# HG changeset patch # User Pat Downey # Date 1283340664 -3600 # Node ID 8e6fa171934010095659e2b81477a57c6312b351 # Parent 6385c4c930490dfb454e8ece8606193b6b5c0fd1 Revert incorrect RCL_3 drop: Revision: 201032 Kit: 201035 diff -r 6385c4c93049 -r 8e6fa1719340 brdo.layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brdo.layers.sysdef.xml Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,23 @@ + + ]> + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/BWINS/npBrowserAudioVideoPlugin.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/BWINS/npBrowserAudioVideoPlugin.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + ?InitializeFuncs@@YAFPAU_NPPluginFuncs@@@Z @ 2 NONAME ; short InitializeFuncs(struct _NPPluginFuncs *) + ?NPP_Shutdown@@YAXXZ @ 3 NONAME ; void NPP_Shutdown(void) + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/EABI/npBrowserAudioVideoPlugin.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/EABI/npBrowserAudioVideoPlugin.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,22 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + _Z12NPP_Shutdownv @ 2 NONAME + _Z15InitializeFuncsP14_NPPluginFuncs @ 3 NONAME + _ZTI11CBavpPlugin @ 4 NONAME ; ## + _ZTI15CBavpController @ 5 NONAME ; ## + _ZTI16CBavpHwKeyEvents @ 6 NONAME ; ## + _ZTI18CBavpVolumeHandler @ 7 NONAME ; ## + _ZTI19CBavpPluginEcomMain @ 8 NONAME ; ## + _ZTI20CBavpControllerAudio @ 9 NONAME ; ## + _ZTI20CBavpControllerVideo @ 10 NONAME ; ## + _ZTI9CBavpView @ 11 NONAME ; ## + _ZTV11CBavpPlugin @ 12 NONAME ; ## + _ZTV15CBavpController @ 13 NONAME ; ## + _ZTV16CBavpHwKeyEvents @ 14 NONAME ; ## + _ZTV18CBavpVolumeHandler @ 15 NONAME ; ## + _ZTV19CBavpPluginEcomMain @ 16 NONAME ; ## + _ZTV20CBavpControllerAudio @ 17 NONAME ; ## + _ZTV20CBavpControllerVideo @ 18 NONAME ; ## + _ZTV9CBavpView @ 19 NONAME ; ## + + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/data/10282810.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/data/10282810.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registry file for Ecom style Browser Audio Video Plugin. +* +*/ + + +#include +#include "BrowserAudioVideoPlugin.rls" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Registry info +// The UIDs for the filters implemented in this DLL +// ----------------------------------------------------------------------------- + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10282810; // should match the name of the file. + // 3rd Uid of associated plugin dll (declared in the dll mmp file) + + interfaces= + { + INTERFACE_INFO + { + // Identifies plugin type (used by ECom) + interface_uid = 0x101F8810; + implementations = + { + IMPLEMENTATION_INFO + { + // Specific implementation (must match an implementation entry in the dll) + implementation_uid = 0x10282811; + version_no = 2; + // File name;Plugin's name + display_name = STRING_r_browser_audio_video_plugin; + // Mimetypes and mime extensions + default_data = STRING_r_mime_application; + // Plugin's description + opaque_data = STRING_r_browser_audio_video_plugin_desc; + }, + IMPLEMENTATION_INFO + { + // Specific implementation (must match an implementation entry in the dll) + implementation_uid = 0x10282812; + version_no = 2; + // Filename;Plugin's name + display_name = STRING_r_browser_audio_video_plugin; + // Supported mimetype and extensions + default_data = STRING_r_mime_audio; + // Plugin's description + opaque_data = STRING_r_browser_audio_video_plugin_desc; + }, + IMPLEMENTATION_INFO + { + // Specific implementation (must match an implementation entry in the dll) + implementation_uid = 0x10282813; + version_no = 2; + // Filename;Plugin's name + display_name = STRING_r_browser_audio_video_plugin; + // Supported mimetype and extensions + default_data = STRING_r_mime_video; + // Plugin's description + opaque_data = STRING_r_browser_audio_video_plugin_desc; + }, + IMPLEMENTATION_INFO + { + // Specific implementation (must match an implementation entry in the dll) + implementation_uid = 0x10282814; + version_no = 2; + // Filename;Plugin's name + display_name = STRING_r_browser_audio_video_plugin; + // Supported mimetype and extensions + default_data = STRING_r_mime_wax_wvx_asx; + // Plugin's description + opaque_data = STRING_r_browser_audio_video_plugin_desc; + } + }; + } + }; + } diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/data/BrowserAudioVideoPlugin.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/data/BrowserAudioVideoPlugin.rls Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the strings for resources of the BAVP. +* +*/ + + +rls_string STRING_r_browser_audio_video_plugin "npBrowserAudioVideoPlugin.dll;Audio Video - Real Player Plugin" +rls_string STRING_r_browser_audio_video_plugin_desc "Audio Video Plugin for S60 Browser" + +rls_string STRING_r_mime_application "application/vnd.nokia.ringing-tone;rng,dm,dcf|application/vnd.nokia.ringing-tone;nrt,dm,dcf|application/sdp;sdp|application/vnd.rn-realmedia;rm" +rls_string STRING_r_mime_audio "audio/*;3gp,3g2,amr,au,aac,awb,dcf,dm,mid,midi,mxmf,mp3,m4a,mp4,ra,ram,rpm,rmf,spmid,wav,wma" +rls_string STRING_r_mime_video "video/*;3gp,mpeg,ram,rm,rv,wmv" +rls_string STRING_r_mime_wax_wvx_asx "audio/x-ms-wax;wax|audio/x-ms-wvx;wvx|video/x-ms-asf;asx" diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/data/BrowserAudioVideoPlugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/data/BrowserAudioVideoPlugin.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,312 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the resources for the Browser Media Plugin +* +*/ + + + +// RESOURCE IDENTIFIER +NAME BAVP // 4 letter resource identifier + +// INCLUDES +#include +#include +#include +#include +#include + +#include + +#include "BrowserAudioVideoPlugin.hrh" +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF + { + buf = ""; + } + +// --------------------------------------------------- +// +// r_note_invalid_clip +// Note that the clip that is not supported in BAVP +// +// --------------------------------------------------- +// +RESOURCE TBUF r_note_invalid_clip + { + buf = qtn_mp_note_invalid_clip; + } + +//---------------------------------------------------- +// +// r_akntapoplist_menu_volume_items +// menu items definition for test pattern 1 +//---------------------------------------------------- +RESOURCE ARRAY r_akntapoplist_menu_volume_items + { + items = + { + LBUF { txt = qtn_browsers_sett_volume_muted; }, + LBUF { txt = qtn_browsers_sett_volume_1; }, + LBUF { txt = qtn_browsers_sett_volume_2; }, + LBUF { txt = qtn_browsers_sett_volume_3; }, + LBUF { txt = qtn_browsers_sett_volume_4; } + }; + } + +//---------------------------------------------------- +// +// r_akntapoplist_select_message +// message for selection +//---------------------------------------------------- +RESOURCE TBUF64 r_akntapoplist_select_message + { + buf = qtn_akntapoplist_select_message; + } + +// =================================================== +// Browser Media (Audio Video) Plugin controls +// =================================================== +RESOURCE TBUF r_text_video_plugin_play { buf = qtn_video_plugin_play; } +RESOURCE TBUF r_text_video_plugin_stop { buf = qtn_video_plugin_stop; } +RESOURCE TBUF r_text_video_plugin_pause { buf = qtn_video_plugin_pause; } +RESOURCE TBUF r_text_video_plugin_full_screen { buf = qtn_video_plugin_full_screen; } +RESOURCE TBUF r_text_video_plugin_media_volume { buf = qtn_browsers_sett_media_volume; } +RESOURCE TBUF r_text_video_plugin_volume_mute { buf = qtn_video_plugin_mute; } +RESOURCE TBUF r_text_video_plugin_rewind { buf = qtn_video_plugin_rewind; } +RESOURCE TBUF r_text_video_plugin_fast_forward { buf = qtn_video_plugin_fast_forward; } + +RESOURCE BMPANIM_DATA r_animation_buffering + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_animation_buffering_array; + } + +RESOURCE ARRAY r_animation_buffering_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_buffering11; } + }; + } + +RESOURCE BMPANIM_DATA r_audio_only_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_audio_only_animation_array; + } + +RESOURCE ARRAY r_audio_only_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_video11; } + }; + } + +RESOURCE BMPANIM_DATA r_no_content_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_no_content_animation_array; + } + +RESOURCE ARRAY r_no_content_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_no_buffering_broken11; } + }; + } + +RESOURCE BMPANIM_DATA r_video_stopped_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_video_stopped_animation_array; + } + +RESOURCE ARRAY r_video_stopped_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_stopped11; } + }; + } + +RESOURCE BMPANIM_DATA r_video_paused_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_video_paused_animation_array; + } + +RESOURCE ARRAY r_video_paused_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_video_paused11; } + }; + } + +RESOURCE BMPANIM_DATA r_audio_stopped_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_audio_stopped_animation_array; + } + +RESOURCE ARRAY r_audio_stopped_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_stopped11; } + }; + } + +RESOURCE BMPANIM_DATA r_audio_paused_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_audio_paused_animation_array; + } + +RESOURCE ARRAY r_audio_paused_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_paused11; } + }; + } + +RESOURCE BMPANIM_DATA r_audio_play_animation + { + frameinterval=150; // milli seconds + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = "Z:\\Resource\\Apps\\BrowserAudioVideoPlugin_aif.mif"; + frames = r_audio_play_animation_array; + } + +RESOURCE ARRAY r_audio_play_animation_array + { + items = + { + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing00; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing01; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing02; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing03; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing04; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing05; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing06; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing07; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing08; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing09; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing10; }, + BMPANIM_FRAME { bmpid = EMbmBrowseraudiovideopluginQgn_graf_video_plugin_anim_audio_playing11; } + }; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/group/BLD.INF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/group/BLD.INF Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project build file for BrowserAudioVideoPlugin +* +*/ + + +#include +#include "../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// export localization files +../loc/browseraudiovideoplugin.loc APP_LAYER_LOC_EXPORT_PATH(browseraudiovideoplugin.loc) +../rom/BrowserAudioVideoPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(BrowserAudioVideoPlugin.iby) +../rom/BrowserAudioVideoPluginResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(BrowserAudioVideoPluginResources.iby) + +#ifdef __SERIES60_32__ + +PRJ_MMPFILES +gnumakefile BrowserAudioVideoPluginIcon.mk + +BrowserAudioVideoPluginEcom.mmp // Plugin mmp file + +#else + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE BrowserAudioVideoPlugin_aif.mif +OPTION HEADERFILE BrowserAudioVideoPlugin.mbg +OPTION SOURCEFILE iconlist.txt +END + +PRJ_MMPFILES + +BrowserAudioVideoPluginEcom.mmp // Plugin mmp file + +#endif + +// End of File + + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/group/BrowserAudioVideoPluginEcom.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/group/BrowserAudioVideoPluginEcom.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the .mmp for building Ecom style Browser Audio and +* Video Plugin +* +*/ + + +#include +#include +#include +#include + +TARGET npBrowserAudioVideoPlugin.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x10282810 + +EPOCALLOWDLLDATA +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + + +START RESOURCE ../data/10282810.rss +TARGET npBrowserAudioVideoPlugin.rsc +END + +START RESOURCE ../data/BrowserAudioVideoPlugin.rss +DEPENDS avkon.rsg +HEADER +TARGET BrowserAudioVideoPlugin.rsc +TARGETPATH RESOURCE_FILES_DIR +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +END + +APP_LAYER_SYSTEMINCLUDE +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src + +SOURCE BavpMediaRecognizer.cpp +SOURCE BavpController.cpp +SOURCE BavpControllerAudio.cpp +SOURCE BavpControllerVideo.cpp +SOURCE BavpPlugin.cpp +SOURCE BavpNPObject.cpp +SOURCE BavpApi.cpp +SOURCE BavpView.cpp +SOURCE BavpMain.cpp +SOURCE BavpVolumeHandler.cpp +SOURCE BavpHwKeyEvents.cpp +SOURCE BavpClipInfo.cpp +SOURCE BavpLogger.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY CommonEngine.lib // RSharedData +LIBRARY eikcoctl.lib // EikBorderControl +LIBRARY cone.lib // CoeControl +LIBRARY Avkon.lib +LIBRARY AknIcon.lib +LIBRARY fbscli.lib // Extended icon skinning +LIBRARY CdlEngine.lib // Scalable UI +LIBRARY ws32.lib +LIBRARY bafl.lib +LIBRARY estlib.lib +LIBRARY RemConCoreApi.lib +LIBRARY RemConInterfaceBase.lib +LIBRARY drmhelper.lib +LIBRARY ecom.lib +LIBRARY charconv.lib + +LIBRARY MediaClientAudio.lib +LIBRARY MediaClientVideo.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY apgrfx.lib +LIBRARY apmime.lib + +LIBRARY HWRMLightClient.lib +LIBRARY commdb.lib +LIBRARY apengine.lib +LIBRARY esock.lib +LIBRARY gdi.lib +LIBRARY hal.lib + +LIBRARY ConnectionManager.lib +LIBRARY featmgr.lib + +LIBRARY InetProtUtil.lib + +LIBRARY bmpanim.lib +LIBRARY Centralrepository.lib +LIBRARY CenRepNotifHandler.lib + +#ifdef __S60_32__ +LIBRARY JavaScriptCore.lib +#else +LIBRARY npscript.lib +#endif + +#ifdef BRDO_ASX_FF +LIBRARY asxparser.lib +#endif // BRDO_ASX_FF + +DEBUGLIBRARY flogger.lib + +deffile npBrowserAudioVideoPlugin.def +nostrictdef diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/group/BrowserAudioVideoPluginIcon.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/group/BrowserAudioVideoPluginIcon.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,161 @@ +# +# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Generating Browser Audio and Video plugin animation +# and scalable icons. +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=\epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +HEADERDIR=\epoc32\include +ICONTARGETFILENAME=$(TARGETDIR)\BrowserAudioVideoPlugin_aif.mif +HEADERFILENAME=$(HEADERDIR)\BrowserAudioVideoPlugin.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask depth is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8 qgn_graf_video_plugin_anim_buffering00.svg \ + /c8 qgn_graf_video_plugin_anim_buffering01.svg \ + /c8 qgn_graf_video_plugin_anim_buffering02.svg \ + /c8 qgn_graf_video_plugin_anim_buffering03.svg \ + /c8 qgn_graf_video_plugin_anim_buffering04.svg \ + /c8 qgn_graf_video_plugin_anim_buffering05.svg \ + /c8 qgn_graf_video_plugin_anim_buffering06.svg \ + /c8 qgn_graf_video_plugin_anim_buffering07.svg \ + /c8 qgn_graf_video_plugin_anim_buffering08.svg \ + /c8 qgn_graf_video_plugin_anim_buffering09.svg \ + /c8 qgn_graf_video_plugin_anim_buffering10.svg \ + /c8 qgn_graf_video_plugin_anim_buffering11.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing00.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing01.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing02.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing03.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing04.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing05.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing06.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing07.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing08.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing09.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing10.svg \ + /c8 qgn_graf_video_plugin_anim_audio_playing11.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped00.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped01.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped02.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped03.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped04.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped05.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped06.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped07.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped08.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped09.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped10.svg \ + /c8 qgn_graf_video_plugin_anim_video_stopped11.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused00.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused01.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused02.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused03.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused04.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused05.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused06.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused07.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused08.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused09.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused10.svg \ + /c8 qgn_graf_video_plugin_anim_video_paused11.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped00.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped01.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped02.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped03.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped04.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped05.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped06.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped07.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped08.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped09.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped10.svg \ + /c8 qgn_graf_video_plugin_anim_audio_stopped11.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused00.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused01.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused02.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused03.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused04.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused05.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused06.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused07.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused08.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused09.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused10.svg \ + /c8 qgn_graf_video_plugin_anim_audio_paused11.svg \ + /c8 qgn_graf_video_plugin_anim_no_video00.svg \ + /c8 qgn_graf_video_plugin_anim_no_video01.svg \ + /c8 qgn_graf_video_plugin_anim_no_video02.svg \ + /c8 qgn_graf_video_plugin_anim_no_video03.svg \ + /c8 qgn_graf_video_plugin_anim_no_video04.svg \ + /c8 qgn_graf_video_plugin_anim_no_video05.svg \ + /c8 qgn_graf_video_plugin_anim_no_video06.svg \ + /c8 qgn_graf_video_plugin_anim_no_video07.svg \ + /c8 qgn_graf_video_plugin_anim_no_video08.svg \ + /c8 qgn_graf_video_plugin_anim_no_video09.svg \ + /c8 qgn_graf_video_plugin_anim_no_video10.svg \ + /c8 qgn_graf_video_plugin_anim_no_video11.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken00.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken01.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken02.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken03.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken04.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken05.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken06.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken07.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken08.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken09.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken10.svg \ + /c8 qgn_graf_video_plugin_anim_no_buffering_broken11.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/group/iconlist.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/group/iconlist.txt Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,96 @@ +-c8 qgn_graf_video_plugin_anim_buffering00 +-c8 qgn_graf_video_plugin_anim_buffering01 +-c8 qgn_graf_video_plugin_anim_buffering02 +-c8 qgn_graf_video_plugin_anim_buffering03 +-c8 qgn_graf_video_plugin_anim_buffering04 +-c8 qgn_graf_video_plugin_anim_buffering05 +-c8 qgn_graf_video_plugin_anim_buffering06 +-c8 qgn_graf_video_plugin_anim_buffering07 +-c8 qgn_graf_video_plugin_anim_buffering08 +-c8 qgn_graf_video_plugin_anim_buffering09 +-c8 qgn_graf_video_plugin_anim_buffering10 +-c8 qgn_graf_video_plugin_anim_buffering11 +-c8 qgn_graf_video_plugin_anim_audio_playing00 +-c8 qgn_graf_video_plugin_anim_audio_playing01 +-c8 qgn_graf_video_plugin_anim_audio_playing02 +-c8 qgn_graf_video_plugin_anim_audio_playing03 +-c8 qgn_graf_video_plugin_anim_audio_playing04 +-c8 qgn_graf_video_plugin_anim_audio_playing05 +-c8 qgn_graf_video_plugin_anim_audio_playing06 +-c8 qgn_graf_video_plugin_anim_audio_playing07 +-c8 qgn_graf_video_plugin_anim_audio_playing08 +-c8 qgn_graf_video_plugin_anim_audio_playing09 +-c8 qgn_graf_video_plugin_anim_audio_playing10 +-c8 qgn_graf_video_plugin_anim_audio_playing11 +-c8 qgn_graf_video_plugin_anim_video_stopped00 +-c8 qgn_graf_video_plugin_anim_video_stopped01 +-c8 qgn_graf_video_plugin_anim_video_stopped02 +-c8 qgn_graf_video_plugin_anim_video_stopped03 +-c8 qgn_graf_video_plugin_anim_video_stopped04 +-c8 qgn_graf_video_plugin_anim_video_stopped05 +-c8 qgn_graf_video_plugin_anim_video_stopped06 +-c8 qgn_graf_video_plugin_anim_video_stopped07 +-c8 qgn_graf_video_plugin_anim_video_stopped08 +-c8 qgn_graf_video_plugin_anim_video_stopped09 +-c8 qgn_graf_video_plugin_anim_video_stopped10 +-c8 qgn_graf_video_plugin_anim_video_stopped11 +-c8 qgn_graf_video_plugin_anim_video_paused00 +-c8 qgn_graf_video_plugin_anim_video_paused01 +-c8 qgn_graf_video_plugin_anim_video_paused02 +-c8 qgn_graf_video_plugin_anim_video_paused03 +-c8 qgn_graf_video_plugin_anim_video_paused04 +-c8 qgn_graf_video_plugin_anim_video_paused05 +-c8 qgn_graf_video_plugin_anim_video_paused06 +-c8 qgn_graf_video_plugin_anim_video_paused07 +-c8 qgn_graf_video_plugin_anim_video_paused08 +-c8 qgn_graf_video_plugin_anim_video_paused09 +-c8 qgn_graf_video_plugin_anim_video_paused10 +-c8 qgn_graf_video_plugin_anim_video_paused11 +-c8 qgn_graf_video_plugin_anim_audio_stopped00 +-c8 qgn_graf_video_plugin_anim_audio_stopped01 +-c8 qgn_graf_video_plugin_anim_audio_stopped02 +-c8 qgn_graf_video_plugin_anim_audio_stopped03 +-c8 qgn_graf_video_plugin_anim_audio_stopped04 +-c8 qgn_graf_video_plugin_anim_audio_stopped05 +-c8 qgn_graf_video_plugin_anim_audio_stopped06 +-c8 qgn_graf_video_plugin_anim_audio_stopped07 +-c8 qgn_graf_video_plugin_anim_audio_stopped08 +-c8 qgn_graf_video_plugin_anim_audio_stopped09 +-c8 qgn_graf_video_plugin_anim_audio_stopped10 +-c8 qgn_graf_video_plugin_anim_audio_stopped11 +-c8 qgn_graf_video_plugin_anim_audio_paused00 +-c8 qgn_graf_video_plugin_anim_audio_paused01 +-c8 qgn_graf_video_plugin_anim_audio_paused02 +-c8 qgn_graf_video_plugin_anim_audio_paused03 +-c8 qgn_graf_video_plugin_anim_audio_paused04 +-c8 qgn_graf_video_plugin_anim_audio_paused05 +-c8 qgn_graf_video_plugin_anim_audio_paused06 +-c8 qgn_graf_video_plugin_anim_audio_paused07 +-c8 qgn_graf_video_plugin_anim_audio_paused08 +-c8 qgn_graf_video_plugin_anim_audio_paused09 +-c8 qgn_graf_video_plugin_anim_audio_paused10 +-c8 qgn_graf_video_plugin_anim_audio_paused11 +-c8 qgn_graf_video_plugin_anim_no_video00 +-c8 qgn_graf_video_plugin_anim_no_video01 +-c8 qgn_graf_video_plugin_anim_no_video02 +-c8 qgn_graf_video_plugin_anim_no_video03 +-c8 qgn_graf_video_plugin_anim_no_video04 +-c8 qgn_graf_video_plugin_anim_no_video05 +-c8 qgn_graf_video_plugin_anim_no_video06 +-c8 qgn_graf_video_plugin_anim_no_video07 +-c8 qgn_graf_video_plugin_anim_no_video08 +-c8 qgn_graf_video_plugin_anim_no_video09 +-c8 qgn_graf_video_plugin_anim_no_video10 +-c8 qgn_graf_video_plugin_anim_no_video11 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken00 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken01 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken02 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken03 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken04 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken05 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken06 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken07 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken08 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken09 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken10 +-c8 qgn_graf_video_plugin_anim_no_buffering_broken11 diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpClipInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpClipInfo.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Store the meta information and the state of the clip played +* +*/ + + +#ifndef BAVPCLIPINFO_H +#define BAVPCLIPINFO_H + +// INCLUDES +#include + +#include "BavpMediaRecognizer.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* CBavpClipInfo +* Store the meta information and the state of the clip to be played +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +NONSHARABLE_CLASS( CBavpClipInfo ) : public CBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBavpClipInfo(); + + /** + * Destructor. + */ + ~CBavpClipInfo(); + + public: // New methods + + /** + * ReInit() + * Reinitialize the data members + * @param none + * @returns void + */ + void ReInit(); + + public: // Data + + // Audio or Video file name + HBufC* iFileName; + + // Audio or Video url link + HBufC* iUrl; + + // Media type + TBavpMediaType iMediaType; + + // Resolution for width + TInt iResolutionWidth; + + // Resolution for height + TInt iResolutionHeight; + + // Bitrate + TInt iBitrate; + + // Maximum volume + TInt iMaxVolume; + + // Duration of the clip + TTimeIntervalMicroSeconds iDurationInSeconds; + + // If clip is seekable + TBool iSeekable; + + // If clip is a live stream + TBool iLiveStream; + + // Is audio track + TBool iAudioTrack; + + // Is video track + TBool iVideoTrack; + + // Is display in fullscreen mode + TBool iInFullScreenMode; + + // Current file position + TTimeIntervalMicroSeconds iPosition; + }; + +#endif // BAVPCLIPINFO_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpController.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,612 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base Controller class for handling browser requests to play +* audio or video. +* +*/ + + +#ifndef BAVPCONTROLLER_H +#define BAVPCONTROLLER_H + +// INCLUDES +#include +#include +#include // RProperty class +#include "FeatMgr.h" + +#include "BrowserAudioVideoPlugin.hrh" +#include "BavpVolumeObserver.h" // Volume Observer class +#include "BavpVolumeHandler.h" +#include "BavpHwKeyEvents.h" // Hardware Key Events +#include "BavpClipInfo.h" // Clip info +#include + +// FORWARD DECLARATIONS +class RFs; +class CBavpPlugin; +class MBavpView; + +// CONSTANTS +// Does this build include Side Volume Keys support +#define HAS_HW_VOLUME_KEYS ( FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) ) + +// Used to walk the content's meta data +_LIT(KBavpTrue, "1"); +_LIT(KBavpFalse, "0"); +_LIT(KBavpLiveStream, "LiveStream"); +_LIT(KBavpSeekable, "Seekable"); + +// ROP controller UID, ?? Helix UID ?? +const TUid KRopControllerUid = + { + 0x101F8514 + }; + +// The Audio or Video player state +enum TAudioVideoState + { + EBavpNone, // Player is idle or not created yet + EBavpBuffering, // Loading the content + EBavpPlaying, // Playing the content + EBavpPlayComplete, // Done playing the content (end) + EBavpStopped, // User stopped the content + EBavpPaused, // User paused the content + EBavpBadContent, // Bad content or network error encountered + EBavpFastForwarding, // Fast Forwarding the content + EBavpFastForwardComplete, // Fast Forward reached end of content + EBavpRewinding, // Rewinding the content + EBavpRewindComplete // Rewind reached beginning of content + }; + +// Use these values for fast-forwarding and rewinding +const TInt KSkipToPosition = 2*1000*1000; // 2 seconds +const TInt KUpdateFrequency = 400*1000; // 400 milliseconds +const TInt KInitialDelay = 600*1000; // 600 milliseconds + +// CLASS DECLARATIONS + +/** +* CBavpController. +* Controller class for handling browser requests to play audio or video. +* @lib npBrowserAudioVideoPlugin.lib +* @since 3.2 +*/ +class CBavpController : public CActive, + public MBavpVolumeObserver, + public MBavpHwKeyEventsObserver, + public MCenRepNotifyHandlerCallback + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBavpController( MBavpView* aView, TUint aAccessPtId ); + + /** + * Destructor. + */ + virtual ~CBavpController(); + + public: // New pure virtual methods + + /** + * Handles request to play the audio or video content + * @since 3.2 + * @param none + * @return void + */ + virtual void PlayAudioVideoL() = 0; + + /** + * Handles request to stop playing the content + * @param none + * @return void + */ + virtual void Stop() = 0; + + /** + * Handles request to play content + * @param none + * @return void + */ + virtual void PlayL() = 0; + + /** + * Handles request to pause playing content + * @param none + * @return void + */ + virtual void PauseL() = 0; + + /** + * Handles request to fast forward content + * @param none + * @return void + */ + virtual void FastForwardL() = 0; + + /** + * Handles request to rewind content + * @param none + * @return void + */ + virtual void RewindL() = 0; + + /** + * Set the volume in the player, we send volume value 0-10, this method + * will scale before calling Player::SetVolume() + * @param aVolume the new volume: 0(mute) - 10(max) + * @return void + */ + virtual void SetPlayerVolume( TInt aVolume ) = 0; + + /** + * Get the current volume of the player + * This needs to be scaled to 0-10 (CR value) before returning + * @param none + * @return player volume scaled: 0(mute) - 10(max) + */ + virtual TInt GetPlayerVolume() = 0; + + /** + * To get the current position of the clip + * @since 3.2 + * @param none + * @return TTimeIntervalMicroSeconds + */ + virtual TTimeIntervalMicroSeconds getPositionL() = 0; + + /** + * To set the position of the clip + * @since 3.2 + * @param TTimeIntervalMicroSeconds + * @return void + */ + virtual void setPositionL(TTimeIntervalMicroSeconds) = 0; + + /** + * Handles the incoming call + * @param none + * @return void + */ + virtual void HandleInComingCallL() = 0; + + public: // New virtual methods + + /** + * Handles Notifications from Browser + * @since 3.2 + * @param TBool: Tell bavp plugin if Browser is in or out of focus + * @return void + */ + virtual void HandleBrowserNotification( TBool aBrowserFocus ); + + /** + * Handles the error + * @param TInt aError: error to be handled + * @return void + */ + virtual void HandleError( TInt aError ); + + /** + * Handles the keys offered by the CCoeControl + * @since 3.2 + * @param TInt aKeyEvent: Which key pressed + * @param TInt aEventCode: Key down, key up... + * @return TKeyResponse: Was the key consumed + */ + virtual TKeyResponse HandleKeysL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** + * Handles commands from Option Menu, defined in resource files + * @since 3.2 + * @param TBavpCommandIds aCommand: a Command Id + * @return void + */ + virtual void HandleCommandL( TBavpCommandIds aCommand ); + + /** + * Called by CBavpView to CBavpPlugin whenever Bavp focus changes + * @since 3.2 + * @param aFocus True if plugin has focus + * @return none + */ + virtual void BavpFocusChanged( TBool aFocus ); + + virtual TBool HandleGesture(RT_GestureHelper::TGestureEvent *gesture); + + public: // New methods + + /** + * Sets volume using the value from attribute + * @since 3.2 + * @param aVolume + * @return void + */ + void SetVolumeFromAttribute( TInt aVolume ); + + /** + * Sets loop using the value from attribute + * @since 3.2 + * @param aLoopValue: The number of times to play file + * @param aInfiniteFlag: Set to ETrue if play infinitely, we use a loop + * countValue = 50 for infinite and always set this to EFalse + * @return void + */ + void SetLoopFromAttribute( TInt aLoopValue, TBool aInfiniteFlag ); + + /** + * Refresh the coordinates of the rectangle to be drawn + * @since 3.2 + * @param none + * @return void + */ + virtual void RefreshRectCoordinatesL(); + + /** + * Sets original file name (used for scripting functionality) + * @since 3.2 + * @param originalFilename + * @return void + */ + void SetOriginalFileName( const TDesC* originalFileName ); + + + /** + * Sets the mime type(used for scripting functionality) + * @since 3.2 + * @param mime type + * @return void + */ + void SetMimeType( const TDesC8* mimetype ); + + public: // New inline methods + + /** + * Bavp has focus + * @since 3.2 + * @param void + * @return : TBool 0 or 1 indicating the focus + */ + inline TBool BavpHasFocus() + { + return iBavpHasFocus; + } + + /** + * Returns the video player plugin current state + * @since 3.2 + * @param none + * @return TVideoState + */ + inline TAudioVideoState State() + { + return iCurrentState; + } + + /** + * returns ETrue is the volume is muted + * @param none + * @return TBool + */ + inline TBool IsVolumeMuted() + { + return ( iCurrentVolume == KCRVolumeMute ); + } + + /** + * Returns ETrue is this is a video clip + * @since 3.2 + * @param none + * @return TBool + */ + inline TBool IsClipVideo() + { + return iClipInfo->iVideoTrack; + } + + /** + * Returns ETrue is the clip is seekable. + * @param none + * @return TBool + */ + inline TBool IsClipSeekable() + { + return iClipInfo->iSeekable; + } + + /** + * returns ETrue is the content is local media file. + * Local files can be FF and Rewind + * @param none + * @return TBool + */ + inline TBool IsClipLocalMedia() + { + return ( iClipInfo->iMediaType == ELocalVideoFile || + iClipInfo->iMediaType == ELocalAudioFile ); + } + + /** + * Returns TRUE if the display is on full screen, otherwise FALSE + * @since 3.2 + * @param none + * @return TBool + */ + inline TBool IsClipFullScreen() + { + return iClipInfo->iInFullScreenMode; + } + + /** + * Returns TRUE if the content is being fast-forwarded, + * otherwise FALSE + * @since 3.2 + * @param none + * @return TBool + */ + inline TBool IsClipFastForwarding() + { + return ( iCurrentState == EBavpFastForwarding ); + } + + /** + * Returns TRUE if the content is being rewound, + * otherwise FALSE + * @since 3.2 + * @param none + * @return TBool + */ + inline TBool IsClipRewinding() + { + return ( iCurrentState == EBavpRewinding ); + } + + /** + * Returns ETrue is the clip is onDemand stream. + * @param none + * @return TBool + */ + inline TBool IsClipOnDemand() + { + return ( iClipInfo->iMediaType != ELocalVideoFile && iClipInfo->iSeekable ); + } + + /** + * Returns ETrue is the clip is live stream. + * @param none + * @return TBool + */ + inline TBool IsClipLive() + { + return ( iClipInfo->iLiveStream ); + } + + + /** Returns the original filename of the clip + * @param none + * @return HBufC* + */ + inline const HBufC& ClipName() + { + return *iOriginalFileName; + } + + /** Returns the duration of the clip + * @param none + * @return TTimeIntervalMicroSeconds + */ + inline TTimeIntervalMicroSeconds Duration() + { + return ( iClipInfo->iDurationInSeconds ); + } + + /** Returns the mime type of the clip + * @param none + * @return HBufC* + */ + inline const HBufC8& MimeType() + { + return *iMimeType; + } + + + + protected: // New methods + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void BaseConstructL( TBavpMediaType aMediaType, + const TDesC& aFileName ); + + /** + * Parse the ram file + * @param none + * @return void + */ + void ParseRamFileL(); +#if defined(BRDO_ASX_FF) + /** + * Parse the asx file + * @param none + * @return void + */ + void ParseAsxFileL(); +#endif //BRDO_ASX_FF + /** + * Set the rectangle to prepare the display + * @param TRect + * @return TRect aRect + */ + TRect GetClipRect( TRect aRect ); + + /** + * Create a query dialog for the volume setting list + * @param none + * @return void + */ + void CreateVolumeListDlgL(); + + /** + * Check if an incoming call comes + * @param none + * @return TBool + */ + TBool IsVideoOrAudioCall(); + + /** + * Check if other audio or video controllers are playing + * @param none + * @return TBool + */ + TBool IsAnotherControllerPlaying(); + + /** + * Pause or Stop the other audio or video controllers from playing + * @param none + * @return void + */ + void PauseOtherControllersPlaying(); + + /** + * Handle the error from MMF for multiple media object case + * @param aError error code from MMF + * @return void + */ + void HandleMultiInstanceError(); + + protected: // Methods from CActive + + /** + * Implements cancellation of an outstanding request. + * @param none + * @return void + */ + void DoCancel() { /* Not implemented */ } + + /** + * Handles an active object’s request completion event. + * @param none + * @return void + */ + void RunL(); + + public: // Methods from MBavpVolumeObserver + + /** + * Updates the volume + * From MBavpVolumeObserver + * @since 3.2 + * @param TInt aVolume: volume value + * @return void + */ + void UpdateVolume( TInt aVolume ); + + private: // From MHwKeyEventsObserver + + /** + * Called when volume level should be changed. + * Set volume control visible into navi pane. + * @param aVolumeChange: +1 change volume up + * -1 change volume down + */ + void BavpHwKeyVolumeChange( TInt aVolumeChange ); + + /** + * Called when a media hardware key (play, pause...) was presed. + * @since 3.2 + * @param aCommand: Command ID representing Play, Pause, ... + * @return void + */ + // void BavpHwKeyCommand( TBavpCommandIds aCommand ); + + public: // Data, public + + // Is Bavp Plugin in focus + TBool iBavpHasFocus; + + // Audio Video plugin current state + TAudioVideoState iCurrentState; + + // ClipInfo contains our metadata from the MMF/Helix and content file + CBavpClipInfo* iClipInfo; + + // Array of pointers of CBavpController (this) instances + static RPointerArray iBavpControllerArray; + + protected: // Data + + // The player is initialized and ready to be used + TBool iPlayerInitialized; + + // Bavp plugin previous state - used when handling interrupted + // media, because of a phone call + TAudioVideoState iPreCallState; + + // Last command + TBavpCommandIds iLastCommand; + + // The number of times the audio or video file will play (loop) + TInt iLoopCount; + + // Hold the initial value of loop + TInt iInitLoopCount; + + // The infinite loop flag, we currently set to EFalse and use loop=50 + // if a web site requests infinite looping + TBool iInfiniteLoopFlag; + + // Access pt id + TUint iAccessPtId; + + // Bavp View + MBavpView* iBavpView; + + // Events from Hardware Keys + CBavpHwKeyEvents* iHwKeyEvents; + + // System state + RProperty iIncomingCalls; + + // Volume hander + CBavpVolumeHandler* iBavpVolumeHandler; + + // Current volume level + TInt iCurrentVolume; + + // Audio or Video player max volume + TInt iPlayerMaxVolume; + + // Timer to jump to a new position, used for Fast Forward, Rewind + CPeriodic* iPositionUpdater; + + // original file name. added for scripting functionality + HBufC* iOriginalFileName; + + // mime type. added for scripting functionality + HBufC8* iMimeType; + + //Normal display mode screen rect + TRect iNormalScreenRect; + }; + +#endif // CBAVPCONTROLLER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpControllerAudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpControllerAudio.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Controller class for handling browser requests to play audio. +* +*/ + + +#ifndef BAVPCONTROLLERAUDIO_H +#define BAVPCONTROLLERAUDIO_H + +// INCLUDES +#include // for MMdaAudioPlayerCallback +#include "BavpController.h" + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATIONS +/** +* CBavpControllerAudio. +* Controller class for handling browser requests to play audio. +* @lib npBrowserAudioVideoPlugin.lib +* @since 3.2 +*/ +class CBavpControllerAudio : public CBavpController, + public MMdaAudioPlayerCallback + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBavpControllerAudio* NewL( MBavpView* aView, + TUint aAccessPtId, + TBavpMediaType aMediaType, + const TDesC& aFileName ); + + /** + * Destructor. + */ + ~CBavpControllerAudio(); + + public: // New methods + + /* + * Non Leaving method to handle request to play content. + * @param none + * @return void + */ + void Play(); + + /** + * Non Leaving method to handle request to pause playing content + * @param none + * @return void + */ + void Pause(); + + private: // New methods + + /** + * C++ default constructor. + */ + CBavpControllerAudio( MBavpView* aView, TUint aAccessPtId ); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL( TBavpMediaType aMediaType, const TDesC& aFileName ); + + /** + * Open an URL link + * @since 3.2 + * @param none + * @return void + */ + void OpenAudioUrlL(); + + /** + * Opens the file to be played. + * @param none + * @return void + */ + void OpenAudioFileL(); + + public: // Methods from MBavpController + + /** + * Handles request to play the audio or video content + * @since 3.2 + * @param none + * @return void + */ + void PlayAudioVideoL(); + + /** + * Handles request to stop playing the content + * @param none + * @return void + */ + void Stop(); + + /** + * Handles request to play content + * @param none + * @return void + */ + void PlayL(); + + /** + * Handles request to pause playing content + * @param none + * @return void + */ + void PauseL(); + + /** + * Handles request to fast forward content + * @param none + * @return void + */ + void FastForwardL(); + + /** + * Handles request to rewind content + * @param none + * @return void + */ + void RewindL(); + + /** + * Set the volume in the player, we send volume value 0-10, this method + * will scale before calling player's SetVolume() + * @param aVolume the new volume: 0(mute) - 10(max) + * @return void + */ + void SetPlayerVolume( TInt aVolume ); + + /** + * Get the current volume of the player + * This needs to be scaled to 0-10 (CR value) before returning + * @param none + * @return player volume scaled: 0(mute) - 10(max) + */ + TInt GetPlayerVolume(); + + /** + * To get the current position of the clip + * @since 3.2 + * @param none + * @return TTimeIntervalMicroSeconds + */ + TTimeIntervalMicroSeconds getPositionL(); + + /** + * To set the position of the clip + * @since 3.2 + * @param TTimeIntervalMicroSeconds + * @return void + */ + void setPositionL(TTimeIntervalMicroSeconds); + + /** + * Handles the incoming call + * @param none + * @return void + */ + void HandleInComingCallL() { }//not implemented + + + public: // Methods overridden from base class CBavpController + + /** + * Handles the error + * @param TInt aError: error to be handled + * @return void + */ + void HandleError( TInt aError ); + + public: // Methods from MMdaAudioPlayerCallback + + /** + * From MMdaAudioPlayerCallback. + * @since 3.2 + * @param TInt aError Error code returned from call to Init + * @param const TTimeIntervalMicroSeconds& aDuration, duration time + * @return void + */ + void MapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& aDuration ); + + /** + * From MMdaAudioPlayerCallback. + * @since 3.2 + * @param TInt aError: Error code returned from call to Play + * @return void + */ + void MapcPlayComplete( TInt aError ); + + private: // Data + + // Used to call MMF for audio functionality + CMdaAudioPlayerUtility* iAudioPlayer; + + // File Server + RFs iFs; + }; + +#endif // CBAVPCONTROLLERAUDIO_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpControllerVideo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpControllerVideo.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,431 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Controller class for handling browser requests to play video. +* +*/ + + +#ifndef BAVPCONTROLLERVIDEO_H +#define BAVPCONTROLLERVIDEO_H + +// INCLUDES +#include + +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF +#include +#else +#include +#endif +#include "BavpController.h" + +// FORWARD DECLARATIONS +class MBavpView; +class CBavpViewFullScreen; + + +// CLASS DECLARATIONS +/** +* CBavpController. +* Controller class for handling browser requests to play video. +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class CBavpControllerVideo : public CBavpController, + public MVideoPlayerUtilityObserver, + public MVideoLoadingObserver, + public MBeating + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBavpControllerVideo* NewL( MBavpView* aView, + TUint aAccessPtId, + TBavpMediaType aMediaType, + const TDesC& aFileName ); + + /** + * Destructor. + */ + ~CBavpControllerVideo(); + + private: // New methods + + /** + * C++ default constructor. + */ + CBavpControllerVideo( MBavpView* aView, TUint aAccessPtId ); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL( TBavpMediaType aMediaType, const TDesC& aFileName ); + + /** + * Open a video URL link + * @since 3.2 + * @param none + * @return void + */ + void OpenVideoUrlL(); + + /** + * Opens the video file to be played. + * @param none + * @return void + */ + void OpenVideoFileL(); + + /** + * Handle the leaving methods needed by MvpuoPrepareComplete + * @param none + * @return void + */ + void PrepareCompleteL(); + + /** + * Non leaving version of initialize the video player plugin + * @param none + * @return void + */ + void InitVideoPlayer(); + + /** + * Initialize the video player plugin + * @param none + * @return void + */ + void InitVideoPlayerL(); + + /** + * Closes the player and delete the player instance + * @param none + * @return void + */ + void UnInitVideoPlayer(); + + /** + * Rotate the screen if its height is bigger than width + * @param none + * @return void + */ + void RotateScreen90(); + + /** + * Switch from normal screen to full screen display + * @param none + * @return void + */ + void RevertToFullScreenL(); + + /** + * Switch from full screen to normal screen display + * @param none + * @return void + */ + void RevertToNormalScreenL(); + + /** + * Switch between normal screen display and full screen display + * @since 3.2 + * @param none + * @return void + */ + void ToggleScreen(); + + /** + * Refresh the coordinates of the rectangle to be drawn + * @since 3.2 + * @param none + * @return void + */ + void RefreshRectCoordinatesL(); + + /** + * Switches between normal screen display and full screen display + * @since 3.2 + * @param TAny* aThisData: the controller itself + * @return TInt error code + */ + static TInt WaitForScreenSwitch( TAny* aThisData ); + + /** + * wrapper function for WaitForScreenSwitch, that leaves + * Switches between normal screen display and full screen display + * @since 3.2 + * @param TAny* aThisData: the controller itself + * @return TInt error code + */ + static void WaitForScreenSwitchL( TAny* aThisData ); + + /** + * Fastforward the video file currently being played or paused + * @since S60 v3.2 + * @param TAny* aThisData: the controller itself + * @return TInt error code + */ + static TInt DoFastForwardL( TAny* aThisData ); + + /** + * Rewind the video file currently being played or paused + * @since S60 v3.2 + * @param TAny* aThisData: the controller itself + * @return TInt error code + */ + static TInt DoRewindL( TAny* aThisData ); + + public: // Methods overridden from base class CBavpController + + /** + * Handles the error + * @param TInt aError: error to be handled + * @return void + */ + void HandleError( TInt aError ); + + /** + * Handles the keys offered by the CCoeControl + * @since 3.2 + * @param TInt aKeyEvent: Which key pressed + * @param TInt aEventCode: Key down, key up... + * @return TKeyResponse: Was the key consumed + */ + TKeyResponse HandleKeysL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Handles commands from Option Menu, defined in resource files + * @since 3.2 + * @param TBavpCommandIds aCommand: a Command Id + * @return void + */ + void HandleCommandL( TBavpCommandIds aCommand ); + + TBool HandleGesture(RT_GestureHelper::TGestureEvent *gesture); + + public: // From MBavpController + + /** + * Handles request to play the audio or video content + * @since 3.2 + * @param none + * @return void + */ + void PlayAudioVideoL(); + + /** + * Handles request to stop playing the content + * @param none + * @return void + */ + void Stop(); + + /** + * Handles request to play content + * @param none + * @return void + */ + void PlayL(); + + /** + * Handles request to pause playing content + * @param none + * @return void + */ + void PauseL(); + + /** + * Handles request to fast forward content + * @param none + * @return void + */ + void FastForwardL(); + + /** + * Handles request to rewind content + * @param none + * @return void + */ + void RewindL(); + + /** + * Set the volume in the player, we send volume value 0-10, this method + * will scale before calling player's SetVolume() + * @param aVolume the new volume: 0(mute) - 10(max) + * @return void + */ + void SetPlayerVolume( TInt aVolume ); + + /** + * Get the current volume of the player + * This needs to be scaled to 0-10 (CR value) before returning + * @param none + * @return player volume scaled: 0(mute) - 10(max) + */ + TInt GetPlayerVolume(); + + /** + * To get the current position of the clip + * @since 3.2 + * @param none + * @return TTimeIntervalMicroSeconds + */ + TTimeIntervalMicroSeconds getPositionL(); + + /** + * To set the position of the clip + * @since 3.2 + * @param TTimeIntervalMicroSeconds + * @return void + */ + void setPositionL(TTimeIntervalMicroSeconds); + + /** + * Handles the incoming call + * @param none + * @return void + */ + void HandleInComingCallL(); + + + public: // Methods from MVideoPlayerUtilityObserver + + /** + * Notification to the client that the opening of the video clip has completed, successfully, or otherwise. + * with the system clock + * @since 3.2 + * @param TInt aError: The status of the video sample after opening + * @return void + */ + void MvpuoOpenComplete( TInt aError ); + + /** + * Notification to the client that the opening of the video clip has been prepared + * successfully, or otherwise. This callback is called in response to a call to CVideoPlayerUtility::Prepare(). + * @since 3.2 + * @param TInt aError: The status of the video sample after opening + * @return void + */ + void MvpuoPrepareComplete( TInt aError ); + + /** + * Notification that the frame requested by a call to GetFrameL is ready + * @since 3.2 + * @param TInt aError: The status of the video sample after opening + * @return void + */ + void MvpuoFrameReady( CFbsBitmap& /*aFrame*/, TInt /*aError*/ ) {}; + + /** + * Notification that video playback has completed. This is not called if playback is + * explicitly stopped by calling Stop. + * @since 3.2 + * @param TInt aError: The status of the video sample after opening + * @return void + */ + void MvpuoPlayComplete( TInt aError ); + + /** + * General event notification from controller. These events are specified by the + * supplier of the controller + * @since 3.2 + * @param TMMFEvent &aEvent: multimedia framework event + * @return void + */ + void MvpuoEvent( const TMMFEvent &aEvent ); + + /** + * Notification that video clip loading/rebuffering has completed + * @since 3.2 + * @param TMMFEvent &aEvent: multimedia framework event + * @return void + */ + void MvloLoadingStarted(); + + /** + * Notification that video clip loading/rebuffering has started + * @since 3.2 + * @param TMMFEvent &aEvent: multimedia framework event + * @return void + */ + void MvloLoadingComplete(); + // MBeating + public: + /** + * Handles a regular heartbeat timer event + * @since S60 v3.2 + * @param none + * @return void + */ + void Beat(); + + /** + * Handles a heartbeat timer event where the timer completes out of synchronisation + * with the system clock + * @since S60 v3.2 + * @param none + * @return void + */ + void Synchronize(); + + private: + /** + * Handles the heart beat to retrieve the current playback position + * @param none + * @return void + */ + void HandleScreenSaver(); + + TBool NoScreenSaverMode(); + void SetDefaultAspectRatioL(); +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + /** + * Handles a window rect update timer event where the timer completes the KWindowChangeUpdateTimeout + * with the system clock + * @since S60 v5.2 + * @param none + * @return void + */ + void UpdateWindowSize(); +#endif + private: // Data + + // Used to call MMF for video functionality +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + /** + * MMF Client API has updated with new methods to control video display + *windows and video picture positioning to produce a new version of the API, + *CVideoPlayerUtility2. The new API is the preferred way to play video on graphics + *surfaces, and will support new features such as more flexible window positioning. + */ + CVideoPlayerUtility2* iVideoPlayer; +#else + CVideoPlayerUtility* iVideoPlayer; +#endif + // Active object for display update + CIdle* iDisplayUpdater; + + // The full screen view + CBavpViewFullScreen* iBavpViewFullScreen; + //heart beat progress + CHeartbeat* iBackLightUpdater; + TRect iNormalScreenRect; + RWindow* iActiveWindow; + }; + +#endif // CBAVPCONTROLLERVIDEO_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpHwKeyEvents.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpHwKeyEvents.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class which implements handling Hardware Key events. +* This class implements methods of MRemConCoreApiTargetObserver +* +*/ + + +#ifndef BAVPHWKEYEVENTS_H +#define BAVPHWKEYEVENTS_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CRemConInterfaceSelector; +class CRemConCoreApiTarget; +class MRemConCoreApiTargetObserver; + +// CONSTANTS + +// CLASS DECLARATION +/** +* MBavpHwKeyEventsObserver class for hardware key events +* This class implements methods of MRemConCoreApiTargetObserver +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class MBavpHwKeyEventsObserver + { + public: + /** + * Called when volume level should be changed. + * @since 3.2 + * @param aVolumeChange: +1 change volume up + * -1 change volume down + * @return void + */ + virtual void BavpHwKeyVolumeChange( TInt aVolumeChange ) = 0; + + /** + * Called when a media hardware key (play, pause...) was presed. + * @since 3.2 + * @param aCommand: Command ID representing Play, Pause, ... + * @return void + */ + // Incr15 SCO item that was cancelled. + // virtual void BavpHwKeyCommand( TBavpCommandIds aCommand ) = 0; + }; + +/** +* CBavpHwKeyEvents class to handle Side Volume Key events +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class CBavpHwKeyEvents : public CBase, + public MRemConCoreApiTargetObserver + { + public: // Constructors and destructor + + /** + * Symbian constructor + * @param aObserver observer to implement callback functions + */ + static CBavpHwKeyEvents* NewL( MBavpHwKeyEventsObserver& aObserver ); + + /** + * Destructor. + */ + ~CBavpHwKeyEvents(); + + private: // Constructors and destructor + + /** + * Default constructor. + * @since 3.2 + */ + CBavpHwKeyEvents( MBavpHwKeyEventsObserver& aObserver ); + + /** + * Constructor. + * @since 3.2 + */ + void ConstructL(); + + protected: // From MRemConCoreApiTargetObserver + + /* Handles hardware key events + * @since 3.2 + */ + void MrccatoCommand( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + private: + + /** + * Change volume depending on the level of increase or decrease + * @since 3.2 + */ + void DoChangeVolume( ); + + /** + * VolumeTimerCallback is the callback function called from change volume timer. + * @since 3.2 + */ + static TInt VolumeTimerCallback( TAny* aThis ); + + private: // data + + MBavpHwKeyEventsObserver& iObserver; + + CRemConInterfaceSelector* iInterfaceSelector; + + CRemConCoreApiTarget* iCoreTarget; + + CPeriodic* iVolumeTimer; + + // Indicates size of volume level change + TInt iChange; + }; + +#endif // BAVPHWKEYEVENTS_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpLogger.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logging support for Bavp +* +*/ + + +#ifndef BAVPLOGGER_H +#define BAVPLOGGER_H + + +// Logging methods for Bavp +void Log( TBool aWrite, TPtrC aData ); +void Log( TBool aWrite, TPtrC aData, TInt aInt ); +void Log( TBool aWrite, const TPtrC s, const TPtrC p); +void Log( TBool aWrite, const TPtrC8 s, const TPtrC8 p); + +#endif BAVPLOGGER_H diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpMediaRecognizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpMediaRecognizer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CBavpMediaRecognizer +* +*/ + + +#ifndef BAVPMEDIARECONGNIZER_H +#define BAVPMEDIARECONGNIZER_H + +// INCLUDES +#include +// L960: header file name with non-standard character +#include + +// Media types +enum TBavpMediaType + { + ELocalVideoFile, + ELocalAudioFile, + ELocalRamFile, + ELocalSdpFile, + EUrl, + ELocalAudioPlaylist, +#if defined(BRDO_ASX_FF) + ELocalAsxFile, +#endif //BRDO_ASX_FF + EUnidentified + }; + +/** +* CBavpMediaRecognizer +* Implementation of CBavpMediaRecognizer +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +NONSHARABLE_CLASS(CBavpMediaRecognizer) : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBavpMediaRecognizer* NewL(); + + /** + * Destructor. + */ + ~CBavpMediaRecognizer(); + + public: // New functions + + /** + * Recognizes media type. + * @since 3.2 + * @param aMediaName Media file name or Url + * @param aIncludeUrls Are Urls included or not + * @return TBavpMediaType + */ + TBavpMediaType IdentifyMediaTypeL( const TDesC& aMediaName, + TBool aIncludeUrls = EFalse ); + + /** + * Recognizes media type. + * @since 3.2 + * @param aMediaName Media file name or Url + * @param aFile file handle + * @param aIncludeUrls Are Urls included or not + * @return TBavpMediaType + */ + TBavpMediaType IdentifyMediaTypeL( const TDesC& aMediaName, + RFile& aFile, + TBool aIncludeUrls = EFalse ); + + /** + * Recognizes Media files MimeType. + * @since 3.2 + * @param aLocalFile File name + * @return TBuf, Mime type. + */ + TBuf MimeTypeL( const TDesC& aLocalFile ); + + /** + * Checks if Url is valid or not. + * @since 3.2 + * @param aUrl + * @return ETrue: Valid + * EFalse: Not valid + */ + TBool ValidUrl( const TDesC& aUrl ); + + /** + * Recognizes Media files MimeType. + * @since 3.2 + * @param aFile File handle + * @return TBuf, Mime type. + */ + TBuf MimeTypeL( RFile& aFile ); + + private: // New functions + + /** + * Checks if there is video playback support. + * @param aFileName + * @param aFileRecognitionResult Recognition result + * @return ETrue: Supported + * EFalse: Not supported + */ + TBool FileHasVideoSupport( const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult ); + + /** + * Checks if there is audio playback support. + * @param aFileName + * @param aFileRecognitionResult Recognition result + * @return ETrue: Supported + * EFalse: Not supported + */ + TBool FileHasAudioSupport( const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult ); + + /** + * Creates array to hold all the controller plugins that support video. + * @return void + */ + void CreateVideoFormatsArrayL(); + + /** + * Creates array to hold all the controller plugins that support audio. + * @return void + */ + void CreateAudioFormatsArrayL(); + + /** + * Recognizes local file + * @param aFileName + * @param aFileRecognitionResult Recognition result + * @return void + */ + void RecognizeFileL( const TDesC& aFileName, + TDataRecognitionResult& aResult ); + + /** + * Reads local file to buffer + * @param aFileName + * @param aBuf, buffer + * @return KErrNone or one of the system wide error codes. + */ + TInt ReadFile( const TDesC& aFileName, TDes8& aBuf ); + + /** + * Determines presence of file handle. + * @return ETrue if file handle exists. + */ + TBool FileHandleExists(); + + private: + + /** + * C++ default constructor. + */ + CBavpMediaRecognizer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + // Array to hold all the controller plugins that support video + RMMFControllerImplInfoArray iVideoControllers; + // Array to hold all the controller plugins that support audio + RMMFControllerImplInfoArray iAudioControllers; + // bufsize + TInt iBufSize; + // Mime type recognizer + RApaLsSession iRecognizer; + RFile iFileHandle; + }; + +#endif // BAVPMEDIARECONGNIZER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpNPObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpNPObject.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef BAVPNPOBJECT +#define BAVPNPOBJECT + +#include +#include + +class CBavpPlugin; + +typedef struct +{ + NPObject object; + CBavpPlugin *plugin; + NPObject* stateChangedCallback; + NPP nppInstance; +} BavpNPObject; + +BavpNPObject* BavpNPObject_new(NPP instance); +void BavpNPObject_stateChanged(BavpNPObject* obj, char* state); + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpPlugin.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,370 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser for handling embedded video requests. +* +*/ + + +#ifndef BAVPPLUGIN_H +#define BAVPPLUGIN_H + +// INCLUDES +#include +#include +#include // For base class MPluginNotifier +#include // For displaying note +#include +#include +#include +#include "BavpNPObject.h" +#include + +// FORWARD DECLARATIONS +class CBavpView; +class CBavpController; + +// CLASS DECLARATION + +/****************************************** +This class is specific to ECom Style Plugin. +This is used for passing plugin specific initialization information to and from +browser. +*******************************************/ +IMPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ); + +// CONSTANTS +const TInt KFirstBavpImplementationValue = 0x10282811; +const TInt KSecondBavpImplementationValue = 0x10282812; +const TInt KThirdBavpImplementationValue = 0x10282813; +const TInt KFourthBavpImplementationValue = 0x10282814; + +/** +* CBavpPluginEcomMain +* Used for passing plugin specific initialization information to and from browser. +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class CBavpPluginEcomMain : public CEcomBrowserPluginInterface + { + public: // Methods from base classes + + /** + * Two-phased constructor. + */ + static CBavpPluginEcomMain* NewL( TAny* aInitParam ); + + /** + * Destructor + */ + ~CBavpPluginEcomMain(); + + /** + * Passed from the browser to the plugin and delcares what functions the browser + * makes available + */ + NPNetscapeFuncs* Funcs() { return iNpf; } + + private: + + // Default constructor + CBavpPluginEcomMain( NPNetscapeFuncs* aNpf ); + + // By default Symbian 2nd phase constructor is private. + void ConstructL( NPPluginFuncs* aPluginFuncs ); + + // Netscape Function Pointer + NPNetscapeFuncs* iNpf; + }; + +/** +* CBavpPlugin class +* Interfaces to Browser, used to pass information between browser and plugin +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class CBavpPlugin : public CBase, + public MPluginNotifier + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBavpPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CBavpPlugin(); + + public: // New methods + + /** + * SetWindowL + * @since 3.2 + * @param MPluginAdapter *pluginAdapter: Pointer to Browser adapter class + * @param const TRect& aRect: rectangle representing current UI + * @return void + */ + void SetWindowL( MPluginAdapter *pluginAdapter, NPWindow* aWindow, NPP aInstance ); + + /** + * OpenAndPlayFileL + * @since 3.2 + * @param const TDesC& aFileName: Name and path of file to be played + * @param const HBufC* originalFileName: name of the file to be played. added for scripting. + * @return void + */ + void OpenAndPlayFileL( const TDesC& aFileName, const HBufC* originalFileName ); + + /** + * OpenAndPlayUrlL + * @since 3.2 + * @param const TDesC& aUrl: Name and path of uri to be played + * @return void + */ + void OpenAndPlayUrlL( const TDesC& aUrl ); + + /** + * Controller + * @since 5.0 + * @param void + * @return controller + */ + CBavpController* Controller() { return iBavpController; } + + /** + * SetNPObject + * iNPObject is a scriptable object + * @since 5.0 + * @param BavpNPObject *aObj + * @return void + */ + void SetNPObject( BavpNPObject* aObj ) { iNPObject = aObj; } + + /** + * NPObject + * return the scriptable object + * @since 5.0 + * @param void + * @return BavpNPObject* + */ + BavpNPObject* NPObject() const { return iNPObject; } + + + public: // New methods + + /** + * SetAccessPtId + * Set access pt id + * @since 3.2 + * @param TUint aAccessPtId, sets the access pt id + * @return void + */ + void SetAccessPtId( TUint aAccessPtId ); + + /** + * SetVolumeAndLoop + * Set volume, loop, and infinite values + * @since 3.2 + * @param TInt aVolume, the volume level from web page + * @param TInt aLoop, the loop count from web page + * @param TInt aInfiniteFlag, not used + * @return void + */ + void SetVolumeAndLoop( TInt aVolume, TInt aLoop, TInt aInfiniteFlag ); + + /** + * SetRtspUri + * Set Rtsp uri + * @since 3.2 + * @param TInt aVolume, the volume level from web page + * @param TInt aLoop, the loop count from web page + * @param TInt aInfiniteFlag, not used + * @return void + */ + void SetRtspUriL( const TDesC& aRtspUri ); + + public: // Methods from base classes + + /** + * From MPluginNotifier + * @since 3.2 + * @param TNotificationType aCallType: Represents a type of notification from Browser + * @param void* aParam: Contains value corresponding to notification + * @return TInt: Error Code + */ + TInt NotifyL( TNotificationType aCallType, void* aParam ); + + /** + * Set the mime type + * The mimetype is returned from headers + * @param NPMIMEType type + * @return void + */ + void SetMimeType(NPMIMEType type); + + NPP getNPP() {return iNPP;} + + NPNetscapeFuncs* getNPNFuncs(); + + TBool HandleGesture(void* aEvent); + private: + + /** + * C++ default constructor. + */ + CBavpPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + public: // Data + + // Initialize as false, then set it whenever error occurs + TBool iError; + + private: // Data + + // Interface to Browser + MPluginAdapter* iPluginAdapter; + + // Audio or Video controller + CBavpController* iBavpController; + + // CCoeControl interface + CBavpView* iBavpView; + + BavpNPObject* iNPObject; + + // Resource offset + TInt iResourceOffset; + + // Src file scheme, which is changed by script in run time + HBufC* iFileName; + + // Src RTSP scheme uri, which is used to start BavpController + HBufC* iRtspUrl; + + // Access point id + TUint iAccessPtId; + + // Value of the Volume embedded in the HTML file + TInt iVolume; + + // Value of the Loop embedded in the HTML file + TInt iLoop; + + // Flag indication if the loop is set to infinite + TBool iInfiniteFlag; + + // DRM Helper instance to address the error case from the plugin level + CDRMHelper* iDrmHelper; + + // Mime type. Added for scripting functionality + HBufC8* iMimeType; + NPP iNPP; + //browser plugin state, used for play and resume + TBool iPauseState; + TBool iIsForeGround; + TBool iPauseInBackground; + TBool iPlayFromFile; + }; + +/** +******************************************************************************** + Plugin API methods. Source located in CBavpApi.cpp +********************************************************************************* +*/ + +/** + * Create a plugin. + */ + +NPError BavpNewp( NPMIMEType pluginType, NPP instance, uint16 mode, + CDesCArray* argn, CDesCArray* argv, NPSavedData* saved ); + +/** + * Wrapper the errors + */ +void BavpConstructL( NPP aInstance, CDesCArray* argn, CDesCArray* argv ); + +/** + * Destroy a plugin. + */ +NPError BavpDestroy( NPP instance, NPSavedData** save ); + +/** + * This is the parent window of a plugin. + */ +NPError BavpSetwindow( NPP instance, NPWindow* window ); + +/** + * A new data stream has been created for sending data to the plugin. + */ +NPError BavpNewstream( NPP instance, NPMIMEType type, NPStream* stream, + NPBool seekable, uint16* stype ); + +/** + * A data stream has been terminated. + */ +NPError BavpDestroystream( NPP instance, NPStream* stream, NPReason reason ); + +/** + * A data stream has been fully saved to a file. + */ +void BavpAsfile( NPP instance, NPStream* stream, const TDesC& fname ); + +/** + * Return the maximum number of bytes this plugin can accept from the stream. + */ +int32 BavpWriteready( NPP instance, NPStream* stream ); + +/** + * Receive more data - return number of bytes processed. + */ +int32 BavpWrite( NPP instance, NPStream* stream, + int32 offset, int32 len, void* buffer ); + +/** + * This is the URL being sensed. + */ +void BavpUrlnotify( NPP instance, const TDesC8& url, NPReason reason, + void* notifyData ); + +/** + * Generic hook to retrieve values/attributes from the plugin. + */ +NPError BavpGetvalue( NPP instance, NPPVariable variable, void *ret_value ); + +/** + * Generic hook to set values/attributes within the plugin. + */ +NPError BavpSetvalue( NPP instance, NPNVariable variable, void *ret_value ); + +/** + * Print + */ +void BavpPrint( NPP instance, NPPrint* platformPrint ); + +/** + * Event + */ +int16 BavpEvent( NPP instance, void* event ); + +#endif // BAVPPLUGIN_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,314 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Uses the interface MPluginAdapter to notify browser of construction + and destruction of the plug-in, implements interface MPluginOptionHandler + to add menus and draws animated images while video player loading the data +* +*/ + + +#ifndef BAVPVIEW_H +#define BAVPVIEW_H + +// INCLUDES +#include +#include + +#include "BrowserAudioVideoPlugin.hrh" +#include + +// CLASS DECLARATION +class CBavpPlugin; +class CBavpController; +class CAknBitmapAnimation; + +/** +* MBavpView +* Handles window controls for the Browser Audio Video Plugin +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class MBavpView + { + public: + /** + * Handles the player animation state changes + * @since 3.2 + * @param none + * @return void + */ + virtual void UpdateView() = 0; + + /** + * Returns CCoeControl instance + * @since 3.2 + * @param none + * @return CCoeControl instance itself + */ + virtual CCoeControl& CoeControl() = 0; + + /** + * Returns handle to a standard window + * @since 3.2 + * @param none + * @return void + */ + virtual RWindow& WindowInst() = 0; + + /** + * Check if the window is the top window instance + * @since 3.2 + * @param none + * @return void + */ + virtual TBool IsTopWindowL() = 0; + + /** + * Check controller status + * @since 3.2 + * @param none + * @return void + */ + virtual void ControllerStateChangedL() = 0; + + virtual TRect WindowRect() = 0; + virtual CBavpPlugin* bavPlugin() = 0; + }; + + +/** +* CBavpView +* Implent the interface of MBavpView +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class CBavpView : public CCoeControl, + public MBavpView, + public MOptionMenuHandler + { + public: + + /** + * Two-phased constructor. + */ + static CBavpView* NewL( const CCoeControl* aParent, const TRect& aRect, CBavpPlugin* aBavPlugin ); + + /** + * Destructor. + */ + ~CBavpView(); + + public: // New functions + + /** + * Sets the controller instance on the view + * @since 3.2 + * @param CBavpController aController + * @return void + */ + void SetBavpController( CBavpController* aController ) + { iBavpController = aController; } + + /** + * Sets the control's extent, specifying a TRect + * @since 3.2 + * @param TRect aRect:The rectangle that defines the control's extent + * @return void + */ + void SetRect( NPWindow* aWindow ); + + public: // Methods from MOptionMenuHandler + + /** + * AddPluginOptionMenuItemsL + * Add the Option Menu items to the menuPane, these will be handled by plugin. + * @since 3.2 + * @param aMenuPane handle of the menu that will contain the options + * @param aCommandBase base id that needs to be added to the command ID + * @param aAfter Plugin options should be added after this index + * @return void + */ + void AddPluginOptionMenuItemsL( CEikMenuPane& aMenuPane, TInt aCommandBase, + TInt aAfter ); + + /** + * HandlePluginCommandL + * Handle the user command from the option menu to the plugin. + * @since 3.2 + * @param aCommand the command ID of the option + * @return void + */ + void HandlePluginCommandL( TInt aCommand ); + + public:// Methods from MBavpView + + /** + * Handles the animation start or cancel status + * @since 3.2 + * @param none + * @return void + */ + void UpdateView(); + + /** + * CCoeControl instance + * @since 3.2 + * @param none + * @return CCoeControl instance itself + */ + CCoeControl& CoeControl() { return *this; } + + /** + * Returns RWidnows + * @since 3.2 + * @param none + * @return RWindow: handle to a standard window + */ + RWindow& WindowInst() { return Window(); } + TRect WindowRect() { return iWindowRect; } + + /** + * Check if the window is the top window instance + * @since 3.2 + * @param none + * @return void + */ + TBool IsTopWindowL(); + + /** + * Monitor the controller's status and display mode changes + * @since 3.2 + * @param none + * @return void + */ + void ControllerStateChangedL(); + + public: // Methods from CCoeControl + + /** + * OfferKeyEventL + * Handle Key press event + * @since 3.2 + * @param aKeyEvent : The Keyevent that is going to be passed in + * @param aType : The type of eventcode that is going to be passed in + * @return TKeyResponse + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + void HandlePointerEventL(const TPointerEvent &aPointerEvent); + + protected: // Methods from CCoeControl + + /** + * Responds to size changes to sets the size and position of the contents of this control. + * @param none + * @return void + */ + void SizeChanged(); + + /** + * Called when focus changes + * @param aDrawNow: Flag to redraw now + * @return void + */ + void FocusChanged( TDrawNow /*aDrawNow*/ ); + + /** + * Draw from CCoeControl + * @param aRect: The rect to draw + * @return void + */ + void Draw(const TRect& aRect) const; + + public: + CBavpPlugin* bavPlugin() { return iBavPlugin; } + private: // methods + + /** + * C++ default constructor. + */ + CBavpView(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( const CCoeControl* aParent, + const TRect& aRect, CBavpPlugin* aBavPlugin ); + + /** + * Allows us to insert plugin specific option menu items + */ + void InsertOneMenuItemL( CEikMenuPane& aMenuPane, + TInt aCommand, TInt aResourceId, TInt index ); + + /** + * Stops all animations and run the one specified + */ + void RunAnimation( CAknBitmapAnimation* aAnimation, TBool &aAnimRunning ); + + private: // Data + + // Pointer to controller + CBavpController* iBavpController; + + // The window server session + RWsSession iWsSession; + + // Window id + TInt iWindowId; + + // Rectangle that defines the control's extent + TRect iRect; + TRect iWindowRect; + TRect iClipRect; + + // Flag to add a control from the control stack + TBool iIsOnStack; + + // Flag to check if video buffering animation running + TBool iIsVideoBuffAnimRunning; + CAknBitmapAnimation* iVideoBuffAnimation; + + // Flag to check if bad content animation is running + TBool iIsBadContentAnimRunning; + CAknBitmapAnimation* iBadContentAnimation; + + // Flag to check if video stopped animation is running + TBool iIsVideoStoppedAnimRunning; + CAknBitmapAnimation* iVideoStoppedAnimation; + + // Flag to check if video paused animation is running + TBool iIsVideoPausedAnimRunning; + CAknBitmapAnimation* iVideoPausedAnimation; + + // Flag to check if audio playing animation running + TBool iIsAudioPlayAnimRunning; + CAknBitmapAnimation* iAudioPlayAnimation; + + // Flag to check if audio stopped animation is running + TBool iIsAudioStoppedAnimRunning; + CAknBitmapAnimation* iAudioStoppedAnimation; + + // Flag to check if audio paused animation is running + TBool iIsAudioPausedAnimRunning; + CAknBitmapAnimation* iAudioPausedAnimation; + + // Command Id that webengine passed in for plugin + TInt iCommandBase; + CBavpPlugin* iBavPlugin; + }; + +#endif // CBavpVIEW_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpViewFullScreen.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpViewFullScreen.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: View class for playing media in full screen. +* +*/ + + +#ifndef BAVPVIEWFULLSCREEN_H +#define BAVPVIEWFULLSCREEN_H + +// INCLUDES +#include +#include // RProperty class +#include +#include + +// CLASS DECLARATION +class CBavpControllerVideo; +/** +* CBavpViewFullScreen +* Controller for full screen +*/ +class CBavpViewFullScreen : public CCoeControl + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBavpViewFullScreen* NewL(CBavpControllerVideo* aController); + + /** + * Destructor. + */ + virtual ~CBavpViewFullScreen(); + + public: // From base classes + /** + * Returns RWidnows + * @since S60 v3.2 + * @param none + * @return RWindow: handle to a standard window + */ + RWindow& WindowInst() { return Window(); } + /** + * Draw from CCoeControl + * @since S60 v5.0 + * @param aRect + * @return void + */ + void Draw( const TRect& aRect ) const; + /** + * Handles pointer events + * @since S60 v5.0 + * @param aPointerEvent + * @return void + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + private: + + /** + * C++ default constructor. + */ + CBavpViewFullScreen(CBavpControllerVideo* aController); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + // Rectangle that defines the control's extent + TRect iRect; + CBavpControllerVideo* iNormalController; + }; + +#endif // BAVPVIEWFULLSCREEN_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpVolumeHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpVolumeHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AO that completes on a change in the volume property. +* +*/ + + +#ifndef BAVPVOLUMEHANDLER_H +#define BAVPVOLUMEHANDLER_H + +#include +#include + +// CONSTANTS +const TInt KGeneralProfile = 0; +const TInt KSilentProfile = 1; +const TInt KMeetingProfile = 2; + +// The Central Depository volume values: +// 0(mute), 2, 5, 8, 10(maximum) +// Used to populate the initial volume and the volume dialog +const TInt KCRVolume0 = 0; +const TInt KCRVolume2 = 2; +const TInt KCRVolume5 = 5; +const TInt KCRVolume8 = 8; +const TInt KCRVolume10 = 10; +const TInt KCRVolumeMute = KCRVolume0; +const TInt KCRVolumeMax = KCRVolume10; + +// FORWARD DECLARATIONS +class MBavpVolumeObserver; +class CCenRepNotifyHandler; +class CRepository; + +/** +* CBavpVolumeHandler class for soft volume handling +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ +class CBavpVolumeHandler : public CBase, + public MCenRepNotifyHandlerCallback + { + public: + // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBavpVolumeHandler* NewL( MBavpVolumeObserver* aObserver ); + + /** + * Destructor. + */ + ~CBavpVolumeHandler(); + + /** + * function impl for MCenRepNotifyHandlerCallback interface + * @since 3.1 + * @param TInt aVolume - volume value to be set to + * @return void + */ + void HandleNotifyInt( const TUint32 aKeyId, TInt aNewValue ); + + private: + /** + * C++ default constructor. + */ + CBavpVolumeHandler( MBavpVolumeObserver* aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + MBavpVolumeObserver* iObserver; + + // Central repository for Volume settings + CRepository* iVolumeRepository; + + // Handler to notify volume changes in central repository + CCenRepNotifyHandler* iVolumeCRHandler; + + // Current volume settings + TInt iCurrentVolume; + + // Previous volume settings, save for mute/unmute + TInt iPreviousVolume; + + // Central repository for Profiles + CRepository* iProfileRepository; + + // Handler to notify Profile changes in central repository + CCenRepNotifyHandler* iProfileCRHandler; + + // Current profile settings + TInt iCurrentProfile; + }; + +#endif //BAVPVOLUMEHANDLER_H diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BavpVolumeObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BavpVolumeObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of the interface BavpVolumeObserver used to +* handle volume level change indications from the Browser +* +*/ + + +#ifndef BAVPVOLUMEOBSERVER_H +#define BAVPVOLUMEOBSERVER_H + +/** +* BavpVolumeObserver class for handling the volume change requests +* @lib npBrowserVideoPlugin.lib +* @since 3.2 +*/ + +class MBavpVolumeObserver + { + public: + + /** + * UpdateVolume - Method called as part of the Central + * repository server to set the volume value + * @since 3.2 + * @param TInt aVolume: Volume value to be set to + * @return void + */ + virtual void UpdateVolume( TInt aVolume ) = 0; + }; + +#endif // BAVPVOLUMEOBSERVER_H diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/inc/BrowserAudioVideoPlugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/inc/BrowserAudioVideoPlugin.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains enumerated list of commands used in the component +* +*/ + + +#ifndef BROWSERAUDIOVIDEOPLUGIN_HRH +#define BROWSERAUDIOVIDEOPLUGIN_HRH + +// CONSTANTS +enum TBavpCommandIds +{ + EBavpCmdUnknown = 0, + EBavpCmdPlay, + EBavpCmdStop, + EBavpCmdPause, + EBavpCmdClose, + EBavpCmdChangeVolume, + EBavpCmdMuteVolume, + EBavpCmdPlayFullScreen, + EBavpCmdFastForward, + EBavpCmdRewind +}; + +#endif // BROWSERAUDIOVIDEOPLUGIN_HRH diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/loc/BrowserAudioVideoPlugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/loc/BrowserAudioVideoPlugin.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is a localisation file for BAVP +* +*/ + + +// LOCALISATION STRINGS + +//d:Invalid clip information note. +//d:Shown when media could not be opened. +//w: +//l:popup_note_window +//r:2.8 +// +#define qtn_mp_note_invalid_clip "Invalid Clip. Operation canceled." + +//d:Menu item for Video option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_video "Video" + + +//d:Menu item for Video play option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_play "Play" + +//d:Menu item for Video stop option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_stop "Stop" + +//d:Menu item for Video pause option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_pause "Pause" + +//d:Menu item for Video fullscreen option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_fullscreen "FullScreen" + +//d:Menu item for Video volume change option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_volume_down "Volume Down" + +//d:Menu item for Video volume change option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +#define qtn_video_plugin_volume_up "Volume Up" + +//d:Menu item for Video Fast Forward option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_video_plugin_fast_forward "Fast Forward" + +//d:Menu item for Video Rewind option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_video_plugin_rewind "Rewind" + +//d:Menu item for Video Skip Forward option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_video_plugin_skip_forward "Skip Forward" + +//d:Menu item for Video Skip Backward option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_video_plugin_skip_backward "Skip Backward" + +//d:Menu item for Video volume mute option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_video_plugin_mute "Mute" + +//d:Menu item for Video Full Screen option menu text +//l:list_single_pane_t1_cp2 +//w: +//r:3.2 +// +#define qtn_video_plugin_full_screen "Full Screen" + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/rom/BrowserAudioVideoPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/rom/BrowserAudioVideoPlugin.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The iby file contains all data that must be included in image for +* BrowserAudioVideoPlugin +* +*/ + + +#ifndef BROWSERAUDIOVIDEOPLUGIN_IBY +#define BROWSERAUDIOVIDEOPLUGIN_IBY + +ECOM_PLUGIN(npbrowseraudiovideoplugin.dll, 0x10282810.rsc) +S60_APP_AIF_ICONS(browseraudiovideoplugin) + +#endif // BROWSERAUDIOVIDEOPLUGIN_IBY + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/rom/BrowserAudioVideoPluginResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/rom/BrowserAudioVideoPluginResources.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The resource iby file contains resource that needs to be localized for +* BrowserAudioVideoPlugin +* +*/ + + +#ifndef BROWSERAUDIOVIDEOPLUGINRESOURCES_IBY +#define BROWSERAUDIOVIDEOPLUGINRESOURCES_IBY + +data=ZRESOURCE\BrowserAudioVideoPlugin.rsc RESOURCE_FILES_DIR\BrowserAudioVideoPlugin.rsc + +#endif // BROWSERAUDIOVIDEOPLUGINRESOURCES_IBY + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpApi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpApi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,482 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API functions that were loaded into TLS for the Browser to use. +* +*/ + +// INCLUDE FILES +#include +#include +#include + +#include "BavpLogger.h" +#include "BavpPlugin.h" +#include "BavpVolumeHandler.h" + +#include +#include "BavpNPObject.h" +// CONSTANTS +_LIT(KAccessPtId, "accesspointid"); +_LIT(KLoop,"loop"); +_LIT(KSrc,"src"); +_LIT(KData,"data"); +_LIT(KRtsp,"rtsp"); +_LIT(KInfinite,"infinite"); +_LIT(KVolume, "volume"); +_LIT(KHigh, "high"); +_LIT(KMiddle, "middle"); +_LIT(KLow, "low"); + +const TInt KOneLoopValue = 1; +const TInt KMaxLoopValue = 50; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// BavpNewp +// Create a new instance of a plugin. This is non-leaving method. +// Returns: NPError: Error codes recognized by Browser +// ----------------------------------------------------------------------------- +NPError BavpNewp( NPMIMEType /* pluginType*/, // Not used locally + NPP aInstance, // Stores pointer to Bavp + uint16 /* mode */, // + CDesCArray* argn, // The number of arguments passed + CDesCArray* argv, // The values of arguments in the array + NPSavedData* /*saved*/ ) // + { + + // Fix for TSW error ID: SLON-74588K, as ControlPanel is unsupported so for the time being + // controlPanel plugin window shown as emplty non supported window. + + _LIT(KControls, "controls"); + _LIT(KControlPanel, "controlpanel"); + + for ( TInt i=0; i < argn->Count(); i++ ) + { + if(((*argn)[i].Compare( KControls) == 0)&&((*argv)[i].Compare(KControlPanel ) == 0)) + { + return NPERR_INVALID_PLUGIN_ERROR; + } + } + // Create BrowserAudioVideoPlugin, call this leaving method to wrap leaving methods + TRAPD( err, BavpConstructL( aInstance, argn, argv ) ); + if ( err == KErrNoMemory ) + { + Log( EFalse, _L("FUNCTION BavpNewp ERROR! Out of Memory Error") ); + + return NPERR_OUT_OF_MEMORY_ERROR; + } + + if ( err != KErrNone ) + { + Log( EFalse, _L("FUNCTION BavpNewp ERROR! Module Load Failure") ); + return NPERR_MODULE_LOAD_FAILED_ERROR; + } + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpConstructL +// This is the leaving method to create the plugin. We have leaving setters +// that need to be wrapped. +// Returns: void +// ----------------------------------------------------------------------------- +void BavpConstructL( NPP aInstance, // Stores pointer to Bavp + CDesCArray* argn, // The number of arguments passed + CDesCArray* argv ) // The values of arguments in the array + { + Log( EFalse, _L("Calling FUNCTION BavpConstructL") ); + + CBavpPlugin *pluginInstance( NULL ); + + // Create BrowserVideoPlugin + pluginInstance = CBavpPlugin::NewL(); + + // Bavp functions can now be called + aInstance->pdata = pluginInstance; + + // Retrieve the various attributes from the HTTP file and the + // object/embed/bgsound/soundstart tags on that page + // + // Retrieve the access point attribute + TInt accessPtIndex; + TInt accessPtId( KUseDefaultIap ); + if ( !argn->Find( KAccessPtId, accessPtIndex, ECmpFolded ) ) + { + // If the string is found get the access pt id and convert to TInt + TPtrC16 accessPtValue( (*argv)[accessPtIndex] ); + TLex lex( accessPtValue ); + TInt intVal( 0 ); + if ( lex.Val( intVal ) == KErrNone) + { + accessPtId = intVal; + } + } + pluginInstance->SetAccessPtId( accessPtId ); + + // Retrieve the "loop" attribute value, default value is "1", + // with infiniteFlag off. This handles the loop attribute missing + // and loop="0" cases. + TInt loopIndex( 0 ); + TPtrC16 loopValue; + TBool infiniteFlag( EFalse ); // Always false, use loop="50" instead "infinite" + TInt loop( KOneLoopValue ); // Our default loop value is "1" + + TInt positionLoop = argn->Find( KLoop, loopIndex, ECmpFolded ); + if ( positionLoop == 0 ) + { + // Found a loop attribute value + TPtrC16 pointerLoopCount( (*argv)[loopIndex] ); + loopValue.Set( pointerLoopCount ); + + // Is the loop value equal to string "infinite" + if ( loopValue.Compare( KInfinite ) == 0 ) + { + // We never play true infinite, we loop max 50 times + loop = KMaxLoopValue; + } + else + { + // Ensure that only a valid loop value is used (1 to 50) + HBufC8* convertPointerLoopCount = HBufC8::New( pointerLoopCount.Length() ); + TPtr8 convertToByteLoop = convertPointerLoopCount->Des(); + convertToByteLoop.Copy( pointerLoopCount ); + + loop = atoi( (char*)(convertToByteLoop.Ptr()) ); + if ( loop < KOneLoopValue ) + { + loop = KOneLoopValue; + } + else if ( loop > KMaxLoopValue ) + { + loop = KMaxLoopValue; + } + } + } + + // Retrieve the "volume" attribute value, default is max, so that if the + // "volume" attribute isn't present, the user preferences will not get + // overwritten. There is a check in controller->SetVolumeByAttribute that + // checks current and attribute volume and choses lower volume. + TInt positionVolumeValue( 0 ); + TInt CRVolume( KCRVolumeMax ); + TPtrC16 volumeValue; + TInt positionVol = argn->Find( KVolume, positionVolumeValue, ECmpFolded ); + if ( positionVol == 0 ) + { + TPtrC16 pointerVolumeValue( (*argv)[positionVolumeValue] ); + volumeValue.Set( pointerVolumeValue ); + if ( !(volumeValue.Compare( KHigh )) ) + { + CRVolume = KCRVolume10; + } + else if ( !(volumeValue.Compare( KMiddle )) ) + { + CRVolume = KCRVolume5; + } + else if ( !(volumeValue.Compare( KLow )) ) + { + CRVolume = KCRVolume2; + } + else + { + // Convert volume numeric string (i.e. volume="6") to CR volume + HBufC8* convertPointerVolumeValue = HBufC8::New( pointerVolumeValue.Length() ); + TPtr8 convertToByteVolume = convertPointerVolumeValue->Des(); + convertToByteVolume.Append( pointerVolumeValue ); + CRVolume = atoi( (char*)(convertToByteVolume.Ptr()) ); + if ( CRVolume < KCRVolumeMute ) + { + CRVolume = KCRVolumeMute; + } + else if ( CRVolume > KCRVolumeMax ) + { + CRVolume = KCRVolumeMax; + } + } + } + + // Set the Volume and Loop for plugin + pluginInstance->SetVolumeAndLoop( CRVolume, loop, infiniteFlag ); + + // Retrieve the "src" or "data" attribute value, if it is rtsp scheme lets + // save it, so we can start a controller, since rtsp content is not passed + // by WebKit. It is our (Bavp) responsibilty to load rtsp content. + TInt srcIndex( 0 ); + TInt ret = argn->Find( KSrc, srcIndex, ECmpFolded ); + if ( ret != 0 ) + { + // If the src attribute NOT found, try to find data attribute + ret = argn->Find( KData, srcIndex, ECmpFolded ); + } + + if ( ret == 0 ) + { + // We found either data or src attribute + TPtrC16 srcValue( (*argv)[ srcIndex ] ); + TUriParser uriParser; + uriParser.Parse( srcValue ); + if ( !uriParser.Extract( EUriScheme ).Compare( KRtsp ) ) + { + // We found a RTSP scheme. Lets save it up, so when the BavpView + // is create we can start the BavpController and load rtsp. This + // is because rtsp will not be started by a call to BavpAsFile(). + // NOTE: Files (http) are downloaded first and then BavpAsFile() + // is called, which starts the BavpController. + pluginInstance->SetRtspUriL( uriParser.UriDes() ); + + // We may have to move this to a different place if eg: the url of + // the object is changed later (say from javascript) + CBavpPluginEcomMain* lBavpPluginEcomMain = (CBavpPluginEcomMain*) Dll::Tls(); + NPNetscapeFuncs* funcPtr = lBavpPluginEcomMain->Funcs(); + if ( funcPtr && funcPtr->getvalue ) + { + funcPtr->getvalue( aInstance, NPNNetworkAccess, (void *)&accessPtId); + pluginInstance->SetAccessPtId( accessPtId ); + } + + } + } + } + +// ----------------------------------------------------------------------------- +// BavpDestroy(NPP aInstance, NPSavedData**) +// Called by Browser to destroy the plugin +// Returns: NPError: Error Code +// ----------------------------------------------------------------------------- +NPError BavpDestroy( NPP aInstance, // Link to Browser + NPSavedData** /*save*/ ) // Not used locally + { + Log( EFalse, _L("Calling FUNCTION BavpDestroy") ); + + CBavpPlugin *pluginInstance = STATIC_CAST( CBavpPlugin*, aInstance->pdata ); + delete pluginInstance; + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpSetwindow +// This is the parent window of plugin +// Returns: NPError: Error Code +// ----------------------------------------------------------------------------- +NPError BavpSetwindow( NPP aInstance, // Link to Browser + NPWindow* aWindow ) // Browser's window passed to Bavp + { + Log( EFalse, _L("Calling FUNCTION BavpSetwindow") ); + + CBavpPlugin *pluginInstance = STATIC_CAST( CBavpPlugin*, aInstance->pdata ); + MPluginAdapter *pluginAdapter = STATIC_CAST( MPluginAdapter*, aWindow->window); + + TRAPD( err, pluginInstance->SetWindowL(pluginAdapter, aWindow, aInstance) ); + if ( err == KErrNoMemory ) + { + Log( EFalse, _L("FUNCTION BavpSetWindow ERROR! Out of Memory Error") ); + + // Set the error to plugin if err occurs, it's for the next create plugin check + pluginInstance->iError = ETrue; + return NPERR_OUT_OF_MEMORY_ERROR; + } + + if ( err != KErrNone ) + { + Log( EFalse, _L("FUNCTION BavpSetWindow ERROR: %d"), err ); + + // Set the error to plugin if err occurs, it's for the next create plugin check + pluginInstance->iError = ETrue; + return NPERR_GENERIC_ERROR; + } + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpNewstream +// Indicates start of downloading of an video file from the internet +// Returns: NPError: Error Code +// ----------------------------------------------------------------------------- +NPError BavpNewstream( NPP instance, + NPMIMEType type, + NPStream* /*stream*/, // + NPBool /*seekable*/, // + uint16* stype ) // Will set to NP_ASFILEONLY to notify Browser how to send data + { + Log( EFalse, _L("Calling FUNCTION BavpNewstream") ); + + // Bavp needs to set stype to alert Browser to send data via Bavp_asfile + *stype = NP_ASFILEONLY; + + CBavpPlugin *pluginInstance = STATIC_CAST( CBavpPlugin*, instance->pdata ); + + pluginInstance->SetMimeType( type ); + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpDestroystream NOT USED +// Indicates completion of downloading an video file from the internet +// Returns: NPError: Error Code +// ----------------------------------------------------------------------------- +NPError BavpDestroystream( NPP /*instance*/, // Not used locally + NPStream* /*stream*/, // + NPReason /*aReason*/ ) // + { + Log( EFalse, _L("Calling FUNCTION BavpDestroyStream") ); + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpAsfile +// Called by Browser when data is copied to a file. +// Returns: void +// ----------------------------------------------------------------------------- +void BavpAsfile( NPP aInstance, // Link to Browser + NPStream* stream, + const TDesC& aFileName ) // file name and path + { + Log( EFalse, _L("Calling FUNCTION BavpAsfile") ); + Log( EFalse, _L("Filename:") ); + Log( EFalse, aFileName ); + + CBavpPlugin *pluginInstance = STATIC_CAST( CBavpPlugin*, aInstance->pdata ); + + // Get the error, and set this error to iError in plugin + TRAPD( err, pluginInstance->OpenAndPlayFileL( aFileName, stream->url ) ); + if ( err != KErrNone ) + { + Log( EFalse, _L("FUNCTION BavpAsfile ERROR!") ); + + // If error, set for plugin, it's for the next create plugin check + pluginInstance->iError = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// BavpWriteready NOT SUPPORTED +// ----------------------------------------------------------------------------- +int32 BavpWriteready( NPP /*instance*/, + NPStream* /*stream*/ ) + { + // Not implemented + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpWrite NOT SUPPORTED +// ----------------------------------------------------------------------------- +int32 BavpWrite( NPP /*instance*/, + NPStream* /*stream*/, + int32 /*offset*/, + int32 /*len*/, + void* /*buffer*/ ) + { + // Not implemented + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpPrint NOT SUPPORTED +// ----------------------------------------------------------------------------- +void BavpPrint( NPP /*instance*/, + NPPrint* /*platformPrint*/ ) + { + // Not implemented + } + +// ----------------------------------------------------------------------------- +// BavpEvent NOT SUPPORTED +// ----------------------------------------------------------------------------- +int16 BavpEvent( NPP instance, + void* event ) + { + TInt ret = EFalse; + if (instance) + { + CBavpPlugin *plugin = static_cast(instance->pdata); + NPEvent *ev = static_cast(event); + + if (plugin) + { + if (ev->event == ENppEventPointer) + { + NPEventPointer *evp =static_cast (ev->param); + ret = plugin->HandleGesture(evp->reserved); + } + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// BavpUrlnotify NOT SUPPORTED +// ----------------------------------------------------------------------------- +void BavpUrlnotify( NPP /*instance*/, + const TDesC8& /*url*/, + NPReason /*reason*/, + void* /*notifyData*/ ) + { + // Not implemented + } + +// ----------------------------------------------------------------------------- +// BavpSetvalue NOT SUPPORTED +// ----------------------------------------------------------------------------- +NPError BavpSetvalue( NPP /*instance*/, + NPNVariable /*variable*/, + void* /*ret_value*/ ) + { + // Not implemented + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// BavpGetvalue NOT SUPPORTED +// ----------------------------------------------------------------------------- +NPError BavpGetvalue( NPP aInstance, + NPPVariable aVariable, + void* ret_value ) + { + NPError err( NPERR_NO_ERROR ); + + switch( aVariable ) + { + case NPPVpluginInteractiveBool: + // Interactive=0, Not Interactive=1 + *(TBool *)ret_value = EFalse; + break; + case NPPVpluginScriptableNPObject: + { + // return instance of scripting object to the browser + BavpNPObject *pluginNPObject = BavpNPObject_new( aInstance ); + + CBavpPlugin *bavpplugin = (CBavpPlugin*)aInstance->pdata; + bavpplugin->SetNPObject(pluginNPObject); + + pluginNPObject->plugin = bavpplugin; + pluginNPObject->nppInstance = aInstance; + void** ret = (void**)ret_value; + *ret = (void*)pluginNPObject; + } + break; + default: + break; + } //end switch + + return err; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpClipInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpClipInfo.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Store the meta information and the state of the clip played +* +*/ + + +// INCLUDE FILES +#include "BavpClipInfo.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpClipInfo::CBavpClipInfo +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- + CBavpClipInfo::CBavpClipInfo() + : iMediaType( EUnidentified ), + iSeekable( ETrue ), + iLiveStream( EFalse ), + iVideoTrack( EFalse ), + iInFullScreenMode( EFalse ) + { + } + +// ----------------------------------------------------------------------------- +// CBavpClipInfo::~CBavpClipInfo +// Destructor +// ----------------------------------------------------------------------------- +CBavpClipInfo::~CBavpClipInfo() + { + // iFileName is created by controller, but we have ownership + delete iFileName; + + // iUrl is created by controller, but we have ownership + delete iUrl; + } + +// ----------------------------------------------------------------------------- +// CBavpClipInfo::Reinit +// Reinitialize all the values +// ----------------------------------------------------------------------------- +void CBavpClipInfo::ReInit() + { + iSeekable = ETrue; + iLiveStream = EFalse; + iResolutionHeight = 0; + iResolutionWidth = 0; + iBitrate = 0; + iMaxVolume = 0; + iDurationInSeconds = 0; + iAudioTrack = EFalse; + iVideoTrack = EFalse; + iPosition = 0; + // Don't modify iMediaType, iFilename, and iUrl + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpController.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,889 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base Controller class for handling browser requests to play +* audio or video +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include // Volume list query dialog +#include +#include + +#include +#include + +#include "BavpController.h" +#include "BavpClipInfo.h" +#include "BavpView.h" +#include "BavpLogger.h" + +#if defined(BRDO_ASX_FF) +#include "AsxParser.h" +#endif //BRDO_ASX_FF + +#include "eikon.hrh" + +using namespace RT_GestureHelper; + +// CONSTANTS +const TInt KBavpMaxLinkFileSize = 5120; // 5kB +#ifdef __PLATFORM_VERSION_32__ +const TInt KRectPadding = 2; +#endif + +// Define our static BavpController array +RPointerArray CBavpController::iBavpControllerArray; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpController::CBavpController +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpController::CBavpController( MBavpView* aView, + TUint aAccessPtId ) + : CActive( EPriorityStandard ), + iCurrentState( EBavpNone ), + iPreCallState( EBavpNone ), + iLastCommand( EBavpCmdUnknown ), + iLoopCount( 1 ), + iInitLoopCount( 1 ), + iInfiniteLoopFlag( EFalse ), + iAccessPtId( aAccessPtId ), + iBavpView( aView ), + iOriginalFileName ( NULL ), + iMimeType ( NULL ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CBavpController::~CBavpController() +// Destructor +// ----------------------------------------------------------------------------- +CBavpController::~CBavpController() + { + Log( EFalse, _L("CBavpController::~CBavpController this="), (TInt)this ); + + if ( iClipInfo ) + { + delete iClipInfo; + } + + iIncomingCalls.Close(); + + // Cancel active object and deleting removes from the ActiveScheduler + Cancel(); + + if ( iBavpVolumeHandler ) + { + delete iBavpVolumeHandler; + } + + // No need to check, if not active, Cancel() does nothing + if ( iPositionUpdater ) + { + iPositionUpdater->Cancel(); + delete iPositionUpdater; + } + + if ( iHwKeyEvents ) + { + delete iHwKeyEvents; + } + + if ( iOriginalFileName ) + { + delete iOriginalFileName; + } + + if ( iMimeType ) + { + delete iMimeType; + } + + // Remove this instance from the array + TInt index = iBavpControllerArray.Find( this ); + if ( index != KErrNotFound ) + { + iBavpControllerArray.Remove( index ); + } + if ( iBavpControllerArray.Count() == 0 ) + { + iBavpControllerArray.Close(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpController::HandleBrowserNotification +// Default implementation, override as needed. +// Handles notification from the Browser concerning the Browser's focus state +// (Browser is in-focus, out-focus, foreground, or the background application) +// and if this plugin is in-focus or out-focus. If the Browser is out-focus, +// this plugin (all plugins) are out-focus. This is not used currently, +// because we do not react to the Browser changing focus. We historically would +// stop playing audio when the browser's focus changed (including when option +// menu is popped up, ie menu top of stack). +// ----------------------------------------------------------------------------- +void CBavpController::HandleBrowserNotification( TBool aFocus ) + { + Log( EFalse, _L("CBavpController::HandleBrowserNotification: aBrowserFocus="), + aFocus ); + } + +// ----------------------------------------------------------------------------- +// CBavpController::HandleError +// Default implementation, override as needed. +// This default error handling implementation just displays the broken (bad) +// content animation and sets state to EBavpBadContent. +// ----------------------------------------------------------------------------- +void CBavpController::HandleError( TInt aError ) + { + Log( EFalse, _L("CBavpController::HandleError(): aError="), aError ); + + if ( aError != KErrNone ) + { + // Any error, display we have bad content + iCurrentState = EBavpBadContent; + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpController::HandleKeysL +// Default implementation, override as needed. +// Handles user key presses when the Plugin is Activated. +// ----------------------------------------------------------------------------- +TKeyResponse CBavpController::HandleKeysL( const TKeyEvent& aKeyEvent, + TEventCode /*aType*/ ) + { + Log( EFalse, _L("CBavpController::HandleKeysL()") ); + + TKeyResponse keyResponse = EKeyWasNotConsumed; + + switch ( aKeyEvent.iCode ) + { + // Cancel key (RSK) was pressed + case EKeyDevice1: + // Return the focus to the Browser, remove it from Bavp + iBavpView->CoeControl().SetFocus( EFalse ); + keyResponse = EKeyWasConsumed; + break; + + // Arrow keys was pressed + case EKeyUpArrow: // North + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // Extra KeyEvent supports diagonal event simulator wedge + + case EKeyRightArrow: // East + + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // Extra KeyEvent supports diagonal event simulator wedge + + case EKeyDownArrow: // South + + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // Extra KeyEvent supports diagonal event simulator wedge + + case EKeyLeftArrow: // West + + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // Extra KeyEvent supports diagonal event simulator wedge + + // Do nothing with these keys, there is no navigating inside Bavp. + keyResponse = EKeyWasConsumed; + break; + + default: + // Do nothing, let the rest of the key events pass back not consumed + break; + } // end of switch + + return keyResponse; + } + +// ----------------------------------------------------------------------------- +// CBavpController::HandleCommandL +// Default implementation, override as needed. +// Handles the commands from the Option Menu defined in TBavpCommandIds +// ----------------------------------------------------------------------------- +void CBavpController::HandleCommandL( TBavpCommandIds aCommand ) + { + Log( EFalse, _L("CBavpController::HandleCommandL(): aCommand="), (TInt)aCommand ); + + switch ( aCommand ) + { + case EBavpCmdPlay: + iLastCommand = EBavpCmdPlay; + PlayL(); + break; + + case EBavpCmdStop: + iLastCommand = EBavpCmdStop; + Stop(); + break; + + case EBavpCmdPause: + iLastCommand = EBavpCmdPause; + PauseL(); + break; + + case EBavpCmdFastForward: + iLastCommand = EBavpCmdFastForward; + FastForwardL(); + break; + + case EBavpCmdRewind: + iLastCommand = EBavpCmdRewind; + RewindL(); + break; + + case EBavpCmdChangeVolume: + iLastCommand = EBavpCmdChangeVolume; + CreateVolumeListDlgL(); + break; + + case EBavpCmdMuteVolume: + iLastCommand = EBavpCmdMuteVolume; + iBavpVolumeHandler->HandleNotifyInt( KBrowserMediaVolumeControl, + KCRVolumeMute ); + break; + + default: + iLastCommand = EBavpCmdUnknown; + break; + } + } + +// ----------------------------------------------------------------------------- +// CBavpController::BavpGainedFocus +// Default implementation, override as needed. +// Called by CBavpView to CBavpPlugin whenever Bavp Plugin has focus and soft key +// cancel is hit. When this happens the Browser calls NotifyL with 1. +// ----------------------------------------------------------------------------- +void CBavpController::BavpFocusChanged( TBool aFocus ) + { + iBavpHasFocus = aFocus; + } + +// ----------------------------------------------------------------------------- +// CBavpController::SetVolumeFromAttribute +// Provides CBavpController with the volume attribute from the tags on the +// HTTP page, i.e. HandleNotifyInt( KBrowserMediaVolumeControl, + iCurrentVolume ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpController::SetLoopFromAttribute +// Provides CBavpController with the loop attribute from the tags on the +// HTTP page, i.e. iUrl +// ----------------------------------------------------------------------------- +void CBavpController::ParseRamFileL() + { + Log( EFalse, _L("CBavpController::ParseRamFileL() ") ); + + RFs rFs; + RFile ramFile; + + // Connect to file server: + User::LeaveIfError( rFs.Connect() ); + CleanupClosePushL( rFs ); + + if ( !BaflUtils::FileExists( rFs, *iClipInfo->iFileName ) ) + { + User::Leave( KErrNotFound ); + } + + User::LeaveIfError( ramFile.Open( rFs, *iClipInfo->iFileName, EFileShareAny ) ); + CleanupClosePushL( ramFile ); + + TInt size; + User::LeaveIfError( ramFile. Size( size ) ); + if ( size > KBavpMaxLinkFileSize ) + { + User::Leave( KErrNotFound ); + } + + HBufC8* urlBuf = HBufC8::NewLC( size ); + TPtr8 ptr = urlBuf->Des(); + + // Read file to urlBuf + User::LeaveIfError( ramFile.Read( ptr ) ); + + // Set the iClipInfo->iUrl + if ( iClipInfo->iUrl ) + { + delete iClipInfo->iUrl; + iClipInfo->iUrl = NULL; + } + iClipInfo->iUrl = HBufC::NewL( urlBuf->Length() ); + + TPtr urlDes = iClipInfo->iUrl->Des(); + + // Read to the end of the line that should be a link + TInt lineChange = urlBuf->LocateF( EKeyLineFeed ); + if ( lineChange == KErrNotFound ) + { + // No line change was found --> last line had no line change + // Copy last line to (unicode) aLink + CnvUtfConverter::ConvertToUnicodeFromUtf8( urlDes, *urlBuf ); + } + else + { + // Set the descriptor to the end of the line + if ( (lineChange > 0) && (urlBuf->Des()[lineChange - 1] == EKeyEnter) ) + { + lineChange--; + } + + // Copy line to (unicode) url + CnvUtfConverter::ConvertToUnicodeFromUtf8( urlDes, urlBuf->Left( lineChange ) ); + } + + CleanupStack::PopAndDestroy( 3 ); // ramFile, urlBuf, rFs + } + + +#if defined(BRDO_ASX_FF) +// ----------------------------------------------------------------------------- +// CBavpController::ParseAsxFileL +// Read the asx file and parse the the url, put into iClipInfo->iUrl +// Only retrieve the first URL found +// ----------------------------------------------------------------------------- +void CBavpController::ParseAsxFileL() + { + Log( EFalse, _L("CBavpController::ParseAsxFileL() ") ); + + TUint urls = 0; + TPtrC8 url; + + if ( iClipInfo->iUrl ) + { + delete iClipInfo->iUrl; + iClipInfo->iUrl = NULL; + } + + CAsxParser* asxParser = CAsxParser::NewL(*iClipInfo->iFileName); + + CleanupStack::PushL( asxParser ); + + if ( asxParser ) + { + asxParser->GetUrlCount(urls); + if ( urls > 0 ) + asxParser->GetUrl(1,url); + } + + iClipInfo->iUrl = HBufC::NewL( url.Length() ); + TPtr urlDes = iClipInfo->iUrl->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( urlDes, url); + + CleanupStack::PopAndDestroy(); // asxparser + } +#endif // BRDO_ASX_FF + + +// CBavpController::GetClipRect +// Retrieve the rect position. Ex. not intersect with title pane and status pane +// ----------------------------------------------------------------------------- +TRect CBavpController::GetClipRect( TRect aRect ) + { + TRect clipRect ( aRect ); + Log( EFalse, _L("GetClipRect") ); + +#ifndef __PLATFORM_VERSION_32__ + //For non touch device the Child rect is relative to view port, + //where as for Touch device the child rect is relative to the application view rect (excluding the + //status Pane + return aRect; +#else + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, iNormalScreenRect ); + + // Calculate not to cover the bottom or the top of the rect. + if ( clipRect.iTl.iX < iNormalScreenRect.iTl.iX ) + { + clipRect.iTl.iX = iNormalScreenRect.iTl.iX; + } + + if ( clipRect.iTl.iY < iNormalScreenRect.iTl.iY ) + { + clipRect.iTl.iY = iNormalScreenRect.iTl.iY; + } + + if ( clipRect.iBr.iY > iNormalScreenRect.iBr.iY ) + { + clipRect.iBr.iY = iNormalScreenRect.iBr.iY; + } + + if ( clipRect.iBr.iX > iNormalScreenRect.iBr.iX ) + { + clipRect.iBr.iX = iNormalScreenRect.iBr.iX - KRectPadding; + } + + return clipRect; +#endif + } + +// ----------------------------------------------------------------------------- +// CBavpController::CreateVolumeListDlg +// Create the volume list query dialog +// ----------------------------------------------------------------------------- +void CBavpController::CreateVolumeListDlgL() +{ + CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; + CleanupStack::PushL( list ); + + // Create popup list and PUSH it. + CAknPopupList* popupList = CAknPopupList::NewL( list, + R_AVKON_SOFTKEYS_OK_CANCEL, + AknPopupLayouts::EMenuWindow); + CleanupStack::PushL( popupList ); + + // Initialize listbox. + list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); + list->CreateScrollBarFrameL( ETrue ); + list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto ); + + // Make list items and PUSH it + CDesCArrayFlat* items = + CCoeEnv::Static()->ReadDesCArrayResourceL( R_AKNTAPOPLIST_MENU_VOLUME_ITEMS ); + + // Set list items. + CTextListBoxModel* model = list->Model(); + model->SetItemTextArray( items ); + model->SetOwnershipType( ELbmOwnsItemArray ); + + // Using the current volume set to determine the index of the volume value + // to highlight in the list + TInt volumeIndex( 0 ); + if ( iCurrentVolume == KCRVolume0 ) + { + volumeIndex = 0; + } + else if ( iCurrentVolume == KCRVolume2 ) + { + volumeIndex = 1; + } + else if ( iCurrentVolume == KCRVolume5 ) + { + volumeIndex = 2; + } + else if ( iCurrentVolume == KCRVolume8 ) + { + volumeIndex = 3; + } + else if ( iCurrentVolume == KCRVolume10 ) + { + volumeIndex = 4; + } + + // Highlight the current item in the list box + list->SetCurrentItemIndexAndDraw( volumeIndex ); + + HBufC* title = CCoeEnv::Static()->AllocReadResourceLC( R_TEXT_VIDEO_PLUGIN_MEDIA_VOLUME); + popupList->SetTitleL( *title ); + CleanupStack::PopAndDestroy(); // title + + // Show popup list and then show return value. + TInt popupOk = popupList->ExecuteLD(); + CleanupStack::Pop(); // popuplist + + // Handle the returned value from the volume list dialog + if ( popupOk ) + { + // Check if there is change for the volume select + if ( volumeIndex != list->CurrentItemIndex() ) + { + // Set the current index to volume index + volumeIndex = list->CurrentItemIndex(); + + // To match the list box data to the values defined in + // the Central repository: (mute)0,2,5,8,10(maximum) + if ( volumeIndex == 0 ) + { + iCurrentVolume = KCRVolume0; + } + else if ( volumeIndex == 1 ) + { + iCurrentVolume = KCRVolume2; + } + else if ( volumeIndex == 2 ) + { + iCurrentVolume = KCRVolume5; + } + else if ( volumeIndex == 3 ) + { + iCurrentVolume = KCRVolume8; + } + else if ( volumeIndex == 4 ) + { + iCurrentVolume = KCRVolume10; + } + + Log( EFalse, _L("Return Volume from Player="), iCurrentVolume ); + + // Tell the volume handler about our new volume the user selected + iBavpVolumeHandler->HandleNotifyInt( KBrowserMediaVolumeControl, + iCurrentVolume ); + } + } + + CleanupStack::PopAndDestroy(); // list +} + +// ----------------------------------------------------------------------------- +// CBavpController::IsVideoOrAudioCall +// Check if there is an incoming call +// ----------------------------------------------------------------------------- +TBool CBavpController::IsVideoOrAudioCall() + { + Log( EFalse, _L("CBavpController::IsVideoOrAudioCall() entered") ); + + // Pause if there is video call + TInt callType; + + RProperty::Get( KPSUidCtsyCallInformation, + KCTsyCallType, + callType ); // Ignore errors + + return ( callType == EPSCTsyCallTypeH324Multimedia || + callType == EPSCTsyCallTypeCSVoice ); + } + +// ----------------------------------------------------------------------------- +// CBavpController::BaseConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpController::BaseConstructL( TBavpMediaType aMediaType, + const TDesC& aFileName ) + { + Log( EFalse, _L("CBavpController::BaseConstructL enter") ); + + // Create Clipinfo + iClipInfo = new (ELeave) CBavpClipInfo(); + iClipInfo->iMediaType = aMediaType; + iClipInfo->iFileName = aFileName.AllocL(); + iClipInfo->iUrl = aFileName.AllocL(); + + // Watch for incoming calls + User::LeaveIfError( iIncomingCalls.Attach( KPSUidCtsyCallInformation, + KCTsyCallState ) ); + iIncomingCalls.Subscribe( iStatus ); + + // Set the AO active. so we will watch for incoming calls, see RunL() + SetActive(); + + // Create Volume Handler to get the initial volume from settings CR, and + // watch the CR for volume changes (browser or system) + iBavpVolumeHandler = CBavpVolumeHandler::NewL( this ); + + // Create the timer for jumping (skipping) to new position + iPositionUpdater = CPeriodic::NewL( CActive::EPriorityStandard ); + + //Get normal display screen rect - not including title pane and toolbar pane + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, iNormalScreenRect ); + // If the phone has side volume keys, create an observer for the hardware + // volume key events + if ( HAS_HW_VOLUME_KEYS ) + { + TRAP_IGNORE(iHwKeyEvents = CBavpHwKeyEvents::NewL( *this ) ); + } + + // Add this BavpController instance to the array + iBavpControllerArray.Append( this ); + + Log( EFalse, _L("CBavpController::BaseConstructL exited") ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::RunL +// If incoming call arrives, handle the audio or video player content. +// If incoming call ends, resume the audio or video player +// ----------------------------------------------------------------------------- +void CBavpController::RunL() + { + Log( EFalse, _L("CBavpController::RunL() entered") ); + + // Do we have an incoming audio or video call + if ( IsVideoOrAudioCall() ) + { + // If we are playing content, pause if seekable or stop if streaming + if ( iCurrentState == EBavpPlaying ) + { + // Set precall state, so we will resume playing the content, + // after the call is done + iPreCallState = EBavpPlaying; + + if ( iClipInfo->iSeekable ) + { + // Seekable content, pause, if there is an incoming call + PauseL(); + } + else + { + HandleInComingCallL(); + // Streaming content, stop, if there is an incoming call + Stop(); + } + } + // If we are seeking content, pause it (these states only for seekable) + else if ( iCurrentState == EBavpFastForwarding || + iCurrentState == EBavpRewinding ) + { + // Set precall state, so we will not resume playing the content, + // after the call is done + iPreCallState = EBavpPaused; + + // Stop the position updater + if ( iPositionUpdater->IsActive() ) + { + iPositionUpdater->Cancel(); + } + // Seekable content, pause, if there is an incoming call + PauseL(); + } + } + else + { + // If the prev status was playing and has been paused by a phone call + // or a video call. Try to get the player to the previous state and + // invoke play function. + if ( iPreCallState == EBavpPlaying ) + { + iPreCallState = EBavpNone; + PlayL(); + } + } + + // Listen for the incoming call property changes + iIncomingCalls.Subscribe( iStatus ); + + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CBavpController::UpdateVolume +// From MBavpVolumeObserver +// Provides CBavpController with the media volume from the VolumeHandler +// ----------------------------------------------------------------------------- +void CBavpController::UpdateVolume( TInt aVolume ) + { + iCurrentVolume = aVolume; + + // Notify Player of volume change + SetPlayerVolume( iCurrentVolume ); + } + +// ----------------------------------------------------------------------------- +// CBavpController::BavpHwKeyVolumeChange +// Handles the change in the Volume that is needed as per the Hardware Volume +// key events. Remember, all volume levels in CBavpController are CR based, +// values 0(mute) - 10(max). Use KCRVolumeX values. +// ----------------------------------------------------------------------------- +void CBavpController::BavpHwKeyVolumeChange( TInt aVolumeChange ) + { + TInt newVolume = iCurrentVolume; + newVolume += aVolumeChange; + + Log( EFalse, _L("CBavpController::BavpHwKeyVolumeChange newVolume="), newVolume ); + + // Ensure the volume is within range + if ( newVolume < KCRVolume0 ) + { + newVolume = KCRVolume0; + } + else if ( newVolume > KCRVolumeMax ) + { + newVolume = KCRVolumeMax; + } + + // Piggyback on this call to set the new volume from + iBavpVolumeHandler->HandleNotifyInt( KBrowserMediaVolumeControl, newVolume ); + } + +// ----------------------------------------------------------------------------- +// CBavpController::IsAnotherControllerPlaying +// Returns ETrue, on the first controller it finds in playing state +// ----------------------------------------------------------------------------- +TBool CBavpController::IsAnotherControllerPlaying() + { + if ( iBavpControllerArray.Count() > 1 ) + { + for ( TInt i( 0 ); i < iBavpControllerArray.Count(); i++ ) + { + CBavpController* bavpController = iBavpControllerArray[ i ]; + if ( ( this != bavpController ) && + ( bavpController->iCurrentState == EBavpPlaying ) ) + { + return ETrue; + } + } + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBavpController::PauseOtherControllersPlaying +// This will attempt to pause all of the other controllers (expect this one), if +// the media can't be paused (ie live stream), it will be stopped. +// ----------------------------------------------------------------------------- +void CBavpController::PauseOtherControllersPlaying() + { + if ( iBavpControllerArray.Count() > 1 ) + { + for ( TInt i( 0 ); i < iBavpControllerArray.Count(); i++ ) + { + CBavpController* bavpController = iBavpControllerArray[ i ]; + if ( this != bavpController ) + { + TRAP_IGNORE( bavpController->PauseL() ); + iBavpView->UpdateView(); + } + } + } + } + +// -------------------------------------------------------------------------- +// CBavpControllerVideo::HandleMultiInstanceError +// Handle error codes. +// NOTES: +// MMF errors start at -12000, see /epoc32/include/mmf/common/MMFErrors.h +// MMF also returns -1 (KErrNotFound) and few other system-wide errors +// ----------------------------------------------------------------------------- +void CBavpController::HandleMultiInstanceError() + { + // Handle multiple media object case + if ( iBavpControllerArray.Count() > 1 && IsAnotherControllerPlaying() ) + { + if ( iLastCommand == EBavpCmdUnknown ) + { + // Another controller is playing, and this controller was + // initializing, so our error is because we can only play one + // media object at a time. Stop this media and let + // the first one initialized continue to play. + //TRAP_IGNORE( PauseL() ); + Stop(); + iBavpView->UpdateView(); + } + else if ( iLastCommand == EBavpCmdPlay ) + { + // Another controller is playing, and the user wants to play + // another media object. Pause (or stop) all of the others and + // play this one. + PauseOtherControllersPlaying(); + TRAP_IGNORE( PlayL() ); + } + } + } + +// ----------------------------------------------------------------------------- +// CBavpController::SetOriginalFileName +// Sets the file name. Used for scripting functionality +// ----------------------------------------------------------------------------- +void CBavpController::SetOriginalFileName( const TDesC* originalFile ) +{ + if ( originalFile ) + { + iOriginalFileName = originalFile->Alloc(); + } +} + +// ----------------------------------------------------------------------------- +// CBavpController::SetMimeType +// Sets the mime type. Used for scripting functionality +// ----------------------------------------------------------------------------- +void CBavpController::SetMimeType( const TDesC8* mimetype ) +{ + if ( mimetype ) + { + iMimeType = mimetype->Alloc(); + } +} + +// ----------------------------------------------------------------------------- +// CBavpController::BavpHwKeyCommand +// Handles transport commands (play, pause, ...) from dedicated hardware keys. +// ----------------------------------------------------------------------------- +/* +void CBavpController::BavpHwKeyCommand( TBavpCommandIds aCommand ) + { + // Do some basic checks for the hardware keys + if ( aCommand == EBavpCmdPlay && iCurrentState == EBavpPlaying ) + { + // We recieved a play command while playing, therefore make it pause + aCommand = EBavpCmdPause; + } + + HandleCommandL( aCommand ); + } +*/ + +// ----------------------------------------------------------------------------- +// HandleGesture(TGestureEvent *gesture) +// ----------------------------------------------------------------------------- +TBool CBavpController::HandleGesture(TGestureEvent* /*gesture*/) + { + // should be implemented in derrived class. + return EFalse; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpControllerAudio.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpControllerAudio.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,479 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Controller class for handling browser requests to play video +* +*/ + + +// INCLUDE FILES +#include // For priority/pref values +#include + +#include "BavpLogger.h" +#include "BavpControllerAudio.h" +#include "BavpView.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CBavpControllerAudio* CBavpControllerAudio::NewL( MBavpView* aView, + TUint aAccessPtId, + TBavpMediaType aMediaType, + const TDesC& aFileName ) + { + CBavpControllerAudio* self = new( ELeave ) CBavpControllerAudio( aView, aAccessPtId ); + + Log( EFalse, _L("CBavpControllerAudio::NewL this="), (TInt)self ); + + CleanupStack::PushL( self ); + self->ConstructL( aMediaType, aFileName ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::~CBavpControllerAudio() +// Destructor +// ----------------------------------------------------------------------------- +CBavpControllerAudio::~CBavpControllerAudio() + { + Log( EFalse, _L("CBavpControllerAudio::~CBavpControllerAudio") ); + + // If currently playing, call Stop before you close and delete + if ( iCurrentState == EBavpPlaying && iAudioPlayer != NULL) + { + iAudioPlayer->Stop(); + } + if ( iAudioPlayer ) + { + iAudioPlayer->Close(); + delete iAudioPlayer; + } + + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::CBavpControllerAudio +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpControllerAudio::CBavpControllerAudio( MBavpView* aView, + TUint aAccessPtId ) + : CBavpController( aView, aAccessPtId ) + { + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::ConstructL( TBavpMediaType aMediaType, + const TDesC& aFileName ) + { + // Construct the BavpController base class + BaseConstructL( aMediaType, aFileName ); + + // Create Audio Player Client: + iAudioPlayer = CMdaAudioPlayerUtility::NewL( *this, KAudioPriorityRealOnePlayer, + TMdaPriorityPreference( KAudioPrefRealOneLocalPlayback ) ); + + // Connect to file server: + User::LeaveIfError( iFs.Connect() ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::OpenAudioUrlL +// Open the audio url link +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::OpenAudioUrlL() + { + Log( EFalse, _L("CBavpControllerAudio::OpenUrlL() ") ); + + // Note: Play() is called from MapcInitComplete() + iAudioPlayer->OpenUrlL( *iClipInfo->iUrl, iAccessPtId, KNullDesC8 ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::OpenAudioFileL +// Open the audio file +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::OpenAudioFileL() + { + Log( EFalse, _L("CBavpControllerAudio::OpenFileL() ") ); + + // Note: Play() is called from MapcInitComplete() + iAudioPlayer->OpenFileL( *iClipInfo->iFileName ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::PlayAudioVideoL +// Handles request to open and play an audio or video file +// TDesC& aFilename: Name of audio file, or video file, or URL link +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::PlayAudioVideoL() + { + Log( EFalse, _L("CBavpControllerAudio::OpenAndPlayL() ") ); + + // If currently playing, call Stop before you attempt to open and play + if ( iCurrentState == EBavpPlaying ) + { + Stop(); + } + + OpenAudioFileL(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::Stop +// Stops audio from playing, if playing. +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::Stop() + { + Log( EFalse, _L("CBavpControllerAudio::Stop") ); + + iAudioPlayer->Stop(); + iClipInfo->iPosition = 0; + iAudioPlayer->SetPosition( iClipInfo->iPosition ); + iCurrentState = EBavpStopped; + + iBavpView->UpdateView(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::Play +// Non leaving method to play audio +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::Play() + { + // To keep LeaveScan from complaining everwhere, we use this non leaving + // method + TRAP_IGNORE( PlayL() ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::PlayL +// Plays audio +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::PlayL() + { + Log( EFalse, _L("CBavpControllerAudio::PlayL") ); + + SetPlayerVolume( iCurrentVolume ); + + // Handle multiple media object case + if ( iBavpControllerArray.Count() > 1 && IsAnotherControllerPlaying() ) + { + if ( iLastCommand == EBavpCmdPlay ) + { + // Another controller is playing, and the user wants to play + // this media object. Pause (or stop) all of the others and + // play this one. + PauseOtherControllersPlaying(); + } + } + + iAudioPlayer->SetPosition( iClipInfo->iPosition ); + iAudioPlayer->Play(); + iCurrentState = EBavpPlaying; + + iBavpView->UpdateView(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::Pause +// Non leaving method to pause playing audio +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::Pause() + { + // To keep LeaveScan from complaining everwhere, we use this non leaving + // method + TRAP_IGNORE( PauseL() ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::PauseL +// Pauses video while playing, if playing. +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::PauseL() + { + Log( EFalse, _L("CBavpControllerAudio::PauseL") ); + + if ( IsClipSeekable() && + (iCurrentState == EBavpPlaying || iCurrentState == EBavpPaused)) + { + // Save clip position, in case we want to resume playing + iAudioPlayer->GetPosition(iClipInfo->iPosition); + iAudioPlayer->Pause(); + iCurrentState = EBavpPaused; + } + else + { + // Not seekable content, i.e. Live stream + iAudioPlayer->Stop(); + iClipInfo->iPosition = 0; + iCurrentState = EBavpStopped; + } + + iBavpView->UpdateView(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::FastForwardL +// Fast forwards the audio +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::FastForwardL() + { + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::RewindL +// Rewinds the audio +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::RewindL() + { + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::SetPlayerVolume +// Calculate the player volume from the CR volume (aka BavpController +// volume value) and sets it +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::SetPlayerVolume( TInt aVolume ) + { + TInt playerVolume( 0 ); + if ( iPlayerInitialized ) + { + TInt maxVolume = iAudioPlayer->MaxVolume(); + if (aVolume < 0) + { + playerVolume = 0; + } + else if (aVolume > maxVolume) + { + playerVolume = maxVolume; + } + else + { + // The CR volume is 0-10, convert to Audio player volume 0-100 + playerVolume = ( aVolume * iPlayerMaxVolume ) / KCRVolumeMax; + } + + // Set Video player volume + iAudioPlayer->SetVolume( playerVolume ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::GetPlayerVolume +// Calculate the player volume value and sets the playback volume for the audio +// track of the video clip. +// ----------------------------------------------------------------------------- +TInt CBavpControllerAudio::GetPlayerVolume() + { + TInt playerVolume( 0 ); + TInt CRVolume( 0 ); + + if ( iPlayerInitialized ) + { + // Audio player returns 0-100 + iAudioPlayer->GetVolume( playerVolume ); + + // Convert to CR volume 0-10 + CRVolume = ( playerVolume * KCRVolumeMax ) / iPlayerMaxVolume; + } + + return CRVolume; + } + +// -------------------------------------------------------------------------- +// CBavpControllerAudio::HandleError +// Handle error codes. We can receive errors from the MMF Video Player +// and its MMF callbacks (mvpuoPlayComplete, etc). +// The MMF errors are for handling content issues, such as decoding content +// and network access. +// NOTES: +// MMF errors start at -12000, see /epoc32/include/mmf/common/MMFErrors.h +// MMF also returns -1 (KErrNotFound) and few other system-wide errors +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::HandleError( TInt aError ) + { + Log( EFalse, _L("In CBavpControllerAudioo::HandleError(): err="), aError ); + + switch ( aError ) + { + case KErrMMVideoDevice: + case KErrMMAudioDevice: + // We get this when the controllers can only support + // playing one media at a time. + HandleMultiInstanceError(); + break; + + default: + iCurrentState = EBavpBadContent; + iBavpView->UpdateView(); + break; + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::MapcInitComplete +// Required due to MMdaAudioPlayerCallback derivation. +// Called by client to indicate initialization has completed and device is ready +// to play. +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::MapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& /*aDuration */ ) + { + Log( EFalse, _L("MapcInitComplete aError="), aError ); + + // Check for error + if ( aError != KErrNone ) + { + HandleError( aError ); + return; + } + + // Audio player is initialized, so we can interact with it, volume, + iPlayerInitialized = ETrue; + + iClipInfo->iDurationInSeconds = iAudioPlayer->Duration(); + iClipInfo->iPosition = 0; + iAudioPlayer->SetPosition( iClipInfo->iPosition ); + + // Get the max player volume, so we can scale volume + iClipInfo->iMaxVolume = iAudioPlayer->MaxVolume(); + iPlayerMaxVolume = iClipInfo->iMaxVolume; + + // Handle multiple media object case + if ( iBavpControllerArray.Count() > 1 && IsAnotherControllerPlaying() ) + { + if ( iLastCommand == EBavpCmdUnknown ) + { + // Another controller is playing, and this controller was + // initializing. Because we can only play one media object at a + // time, stop this media and let the first one + // initialized continue to play. + Stop(); + } + else if ( iCurrentState == EBavpPlaying && iLastCommand == EBavpCmdPlay ) + { + // Another controller is playing, and the user wants to play + // another media object. Pause (or stop) all of the others and + // play this one. + PauseOtherControllersPlaying(); + Play(); + } + } + // Handle the single media object case + else + { + Play(); + } + + // Stop the buffering animation and play the audio only animation + iBavpView->UpdateView(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::MapcPlayComplete +// Required due to MMdaAudioPlayerCallback derivation. +// Called by client to indicate audio file has completed or has stopped playing. +// ----------------------------------------------------------------------------- +void CBavpControllerAudio::MapcPlayComplete( TInt aError ) + { + Log( EFalse, _L("MapcPlayComplete aError="), aError ); + + if ( iInfiniteLoopFlag ) + { + // If infinite flag set: play audio again and again... + iClipInfo->iPosition = 0; + Play(); + } + else if ( ( iLoopCount - 1 ) > 0 ) + { + // If loop count: play, decrement loop count, play again... + iClipInfo->iPosition = 0; + Play(); + iLoopCount-- ; + } + else + { + // We're done looping, or just done playing the audio + iCurrentState = EBavpPlayComplete; + iClipInfo->iPosition = 0; + iLoopCount = iInitLoopCount; + + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::getPositionL +// To get the current position of the clip +// ----------------------------------------------------------------------------- + + TTimeIntervalMicroSeconds CBavpControllerAudio::getPositionL() + { + if ( iAudioPlayer ) + { + TTimeIntervalMicroSeconds pos; + iAudioPlayer->GetPosition( pos ); + return pos; + } + return NULL; + } + + // ----------------------------------------------------------------------------- +// CBavpControllerAudio::setPositionL +// To set the position of the clip +// ----------------------------------------------------------------------------- + + void CBavpControllerAudio::setPositionL( TTimeIntervalMicroSeconds val ) + { + if ( iAudioPlayer ) + { + + if ( !IsClipSeekable() && !IsClipLocalMedia() ) + { + return; + } + + TBool didWePause = EFalse; + // If playing, pause it (PauseL stops the PositionUpdater) + if ( iCurrentState == EBavpPlaying ) + { + PauseL(); + didWePause = ETrue; + } + + if ( (val > iClipInfo->iDurationInSeconds ) || (val < 0) ) + { + val = 0; + } + + iAudioPlayer->SetPosition(val); + iClipInfo->iPosition = val; + if ( didWePause ) + { + PlayL(); + } + } + } + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpControllerVideo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpControllerVideo.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1487 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Controller class for handling browser requests to play video +* +*/ + + +// INCLUDE FILES +#include +#include +#include + +#include "BavpPlugin.h" +#include "BavpLogger.h" +#include "BavpControllerVideo.h" +#include "BavpView.h" +#include "BavpViewFullScreen.h" +#include +#include + +using namespace RT_GestureHelper; + +// CONSTANTS +// One second represented in microseconds +const TInt KBavpOneSecond = 1000000; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CBavpControllerVideo* CBavpControllerVideo::NewL( MBavpView* aView, + TUint aAccessPtId, + TBavpMediaType aMediaType, + const TDesC& aFileName ) + { + CBavpControllerVideo* self = new( ELeave ) CBavpControllerVideo( aView, aAccessPtId ); + + Log( EFalse, _L("CBavpControllerVideo::NewL this="), (TInt)self ); + + CleanupStack::PushL( self ); + self->ConstructL( aMediaType, aFileName ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::~CBavpControllerVideo() +// Destructor +// ----------------------------------------------------------------------------- +CBavpControllerVideo::~CBavpControllerVideo() + { + Log( EFalse, _L("CBavpControllerVideo::~CBavpControllerVideo this="), (TInt)this ); + + // If currently playing, call Stop before you close and delete + if ( iCurrentState == EBavpPlaying && iVideoPlayer) + { + iVideoPlayer->Stop(); + } + + // Close the video plugin, and delete it + if ( iVideoPlayer ) + { + iVideoPlayer->Close(); +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); +#endif + delete iVideoPlayer; + } + + // CIdle AO used for display update + if ( iDisplayUpdater ) + { + delete iDisplayUpdater; + } + + if ( iBackLightUpdater ) + { + iBackLightUpdater->Cancel(); + delete iBackLightUpdater; + } + // Used for displaying content in full screen + if ( iBavpViewFullScreen ) + { + delete iBavpViewFullScreen; + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::CBavpControllerVideo +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpControllerVideo::CBavpControllerVideo( MBavpView* aView, TUint aAccessPtId ) + : CBavpController( aView, aAccessPtId ), iActiveWindow(NULL) + { + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::ConstructL( TBavpMediaType aMediaType, + const TDesC& aFileName ) + { + // Construct the BavpController base class + BaseConstructL( aMediaType, aFileName ); + + // Create CIdle (AO) to update the display + iDisplayUpdater = CIdle::NewL( CActive::EPriorityIdle ); + iBackLightUpdater=CHeartbeat::NewL(CActive::EPriorityStandard); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::PrepareCompleteL +// Handle the leaving methods needed by MvpuoPrepareComplete +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::PrepareCompleteL() + { + // Resolution + TSize size; + iVideoPlayer->VideoFrameSizeL(size); + iClipInfo->iResolutionHeight = size.iHeight; + iClipInfo->iResolutionWidth = size.iWidth; + + // Bitrate + iClipInfo->iBitrate = iVideoPlayer->VideoBitRateL() + + iVideoPlayer->AudioBitRateL(); + + TInt iMetaCount = iVideoPlayer->NumberOfMetaDataEntriesL(); + CMMFMetaDataEntry* metaData = NULL; + + for ( TInt i = 0; i < iMetaCount; i++ ) + { + metaData = iVideoPlayer->MetaDataEntryL( i ); + + Log( EFalse, _L("metaData index="), i ); + Log( EFalse, metaData->Name() ); + Log( EFalse, metaData->Value() ); + + // Check if seekable + if ( !metaData->Name().CompareF( KBavpSeekable ) ) + { + if ( !metaData->Value().CompareF( KBavpFalse ) ) + { + iClipInfo->iSeekable = EFalse; + } + } + + // Check if live stream + if ( !metaData->Name().CompareF( KBavpLiveStream ) ) + { + if ( !metaData->Value().CompareF( KBavpTrue ) ) + { + // Live stream is not seekable + iClipInfo->iLiveStream = ETrue; + iClipInfo->iSeekable = EFalse; + } + } + + delete metaData; + } // end of for + + // Set up the max volume + iClipInfo->iMaxVolume = iVideoPlayer->MaxVolume(); + iPlayerMaxVolume = iClipInfo->iMaxVolume; + + // Duration + iClipInfo->iDurationInSeconds = iVideoPlayer->DurationL(); + + // Audio track + iClipInfo->iAudioTrack = iVideoPlayer->AudioEnabledL(); + + // Video track + iClipInfo->iVideoTrack = iVideoPlayer->VideoBitRateL(); + + if ( IsClipSeekable() ) + { + iVideoPlayer->SetPositionL( iClipInfo->iPosition ); + } +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + TRect rect( iBavpView->CoeControl().Rect() ); + CEikonEnv* eikon = CEikonEnv::Static(); + RWsSession& ws = eikon->WsSession(); + CWsScreenDevice* screenDevice = eikon->ScreenDevice(); + // Clip rect manipulation. + // Calculate the rect for display, including title and status pane + TRect clipRect = GetClipRect( rect ); + TRAPD(errAdd, iVideoPlayer->AddDisplayWindowL(CCoeEnv::Static()->WsSession(), + *screenDevice, + iBavpView->WindowInst(), + rect, + clipRect)); + TRAPD(errScale, iVideoPlayer->SetAutoScaleL(iBavpView->WindowInst(), EAutoScaleBestFit)); + if( ( errAdd != KErrNone ) && (iActiveWindow != &iBavpView->WindowInst()) ) + { + iActiveWindow = &iBavpView->WindowInst(); + } + Log( EFalse, _L("CBavpControllerVideo::InitVideoPlayerL() AddDisplayWindowL %d"), errAdd ); + Log( EFalse, _L("CBavpControllerVideo::InitVideoPlayerL() SetAutoScaleL %d"), errScale ); +#endif + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::InitVideoPlayer +// The non-leaving version that calls the leaving version. Closes the current +// player and prepares the MMF to play the video +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::InitVideoPlayer() + { + TRAP_IGNORE( InitVideoPlayerL() ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::InitVideoPlayerL +// Closes the current player and prepares the MMF to play the video +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::InitVideoPlayerL() + { + Log( EFalse, _L("CBavpControllerVideo::InitVideoPlayerL()") ); + + // If videoplayer is already opened, close and delete it + if ( iVideoPlayer ) + { + iVideoPlayer->Close(); +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); +#endif + delete iVideoPlayer; + iVideoPlayer = NULL; + } + + // Get the rect to display + TRect rect( iBavpView->CoeControl().Rect() ); + TPoint pt = iBavpView->WindowInst().AbsPosition(); + rect.Move( pt.iX, pt.iY ); + + CEikonEnv* eikon = CEikonEnv::Static(); + RWsSession& ws = eikon->WsSession(); + CWsScreenDevice* screenDevice = eikon->ScreenDevice(); + + // Clip rect manipulation. + // Calculate the rect for display, including title and status pane + TRect clipRect = GetClipRect( rect ); + + Log( EFalse, _L("InitVideoPlayerL() - calling CVideoPlayerUtility::NewL") ); + + // Initialize the videoplayer +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + iVideoPlayer = CVideoPlayerUtility2::NewL( *this, EMdaPriorityNormal, + EMdaPriorityPreferenceNone); +#else + iVideoPlayer = CVideoPlayerUtility::NewL( *this, EMdaPriorityNormal, + EMdaPriorityPreferenceNone, + ws, *screenDevice, + iBavpView->WindowInst(), rect, + clipRect); +#endif + + // Register for loading notification + iVideoPlayer->RegisterForVideoLoadingNotification( *this ); + + switch ( iClipInfo->iMediaType ) + { + case ELocalVideoFile: + Log( EFalse, _L("InitVideoPlayerL() - calling OpenVideoFile") ); + OpenVideoFileL(); + break; + + case ELocalRamFile: + case EUrl: + case ELocalSdpFile: +#if defined(BRDO_ASX_FILE) + case ELocalAsxFile: +#endif // BRDO_ASX_FILE + Log( EFalse, _L("InitVideoPlayerL() - calling OpenVideoUrlL") ); + OpenVideoUrlL(); + break; + + // Not supported + case ELocalAudioPlaylist: + default: + User::Leave( KErrNotSupported ); + break; + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::UnInitVideoPlayer +// Closes the player and delete the instance +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::UnInitVideoPlayer() + { + Log( EFalse, _L("CBavpControllerVideo::UnInitVideoPlayer()") ); + + if ( iVideoPlayer ) + { + iVideoPlayer->Close(); +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); +#endif + delete iVideoPlayer; + iVideoPlayer = NULL; + } + + iCurrentState = EBavpNone; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::RotateScreen90 +// Rotate the screen if needed +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::RotateScreen90() + { + Log( EFalse, _L("CBavpControllerVideo::RotateScreen90()") ); + + TRect screenRect; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); + + // Rotate only if screen rect height is greater than its width + if ( screenRect.Height() > screenRect.Width() ) + { +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + TRAP_IGNORE( iVideoPlayer->SetRotationL(iBavpView->WindowInst(), EVideoRotationClockwise90 ) ); +#else + TRAP_IGNORE( iVideoPlayer->SetRotationL( EVideoRotationClockwise90 ) ); +#endif + + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::RevertToFullScreenL +// Set full screen display mode +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::RevertToFullScreenL() + { + Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL()")); + CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); + bool fullscreen = true; + + //This method is not supported when using CVideoPlayerUtility2, and will + //always leave with KErrNotSupported. instead of variating for new player + //we are ignoring the Leave + TRAP_IGNORE( iVideoPlayer->StopDirectScreenAccessL() ); + + + iClipInfo->iInFullScreenMode = ETrue; + + npm->Funcs()->setvalue(iBavpView->bavPlugin()->getNPP(), + NPPVpluginFullScreenBool, + static_cast(&fullscreen)); + iBavpView->ControllerStateChangedL(); + + CEikonEnv* eikon = CEikonEnv::Static(); + RWsSession& ws = eikon->WsSession(); + CWsScreenDevice* screenDevice = eikon->ScreenDevice(); + + iNormalScreenRect = iBavpView->CoeControl().Rect(); + TPoint pt = iBavpView->WindowInst().AbsPosition(); + iNormalScreenRect.Move(pt.iX, pt.iY); + TRect screenRect = eikon->EikAppUi()->ApplicationRect(); + + CCoeControl* parentView = iBavpView->CoeControl().Parent(); + parentView->SetRect(screenRect); + iBavpView->CoeControl().SetExtent(TPoint(0,0), screenRect.Size()); + +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + + iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); + TRAPD(errAdd, iVideoPlayer->AddDisplayWindowL(ws,*screenDevice,iBavpView->WindowInst(), screenRect, screenRect)); + TRAPD(errScale, iVideoPlayer->SetAutoScaleL(iBavpView->WindowInst(), EAutoScaleBestFit)); + Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL() errAdd %d"), errAdd); + Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL() errScale %d"), errScale); +#else + iVideoPlayer->SetDisplayWindowL( ws, *screenDevice, + iBavpView->WindowInst(), + screenRect, screenRect ); + + RotateScreen90(); +#endif + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::RevertToNormalScreenL +// Set back to normal display mode +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::RevertToNormalScreenL() + { + Log( EFalse, _L("CBavpControllerVideo::RevertToNormalScreenL()") ); + CEikonEnv* eikon = CEikonEnv::Static(); + RWsSession& ws = eikon->WsSession(); + CWsScreenDevice* screenDevice = eikon->ScreenDevice(); + CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); + bool fullscreen = false; + + //This method is not supported when using CVideoPlayerUtility2, and will + //always leave with KErrNotSupported. instead of variating for new player + //we are ignoring the Leave + TRAP_IGNORE( iVideoPlayer->StopDirectScreenAccessL() ); + + npm->Funcs()->setvalue(iBavpView->bavPlugin()->getNPP(), + NPPVpluginFullScreenBool, + static_cast(&fullscreen)); + + CCoeControl* parentView = iBavpView->CoeControl().Parent(); + parentView->SetRect(iNormalScreenRect); + iBavpView->CoeControl().SetExtent(TPoint(0,0), iNormalScreenRect.Size()); + + iClipInfo->iInFullScreenMode = EFalse; + RefreshRectCoordinatesL(); +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + iVideoPlayer->SetRotationL(iBavpView->WindowInst(), EVideoRotationNone ); +#else + iVideoPlayer->SetRotationL( EVideoRotationNone ); +#endif + + iBavpView->ControllerStateChangedL(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::ToggleScreen +// Start a call back for the display screen switches (Full Screen to +// Normal Screen) +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::ToggleScreen() + { + if ( iDisplayUpdater->IsActive() ) + { + iDisplayUpdater->Cancel(); + } + + iDisplayUpdater->Start( TCallBack( CBavpControllerVideo::WaitForScreenSwitch, + this ) ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::RefreshRectCoordinatesL +// Refresh the coordinates of rect for display +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::RefreshRectCoordinatesL() + { + Log( EFalse, _L("CBavpControllerVideo::RefreshRectCoordinatesL()") ); + + if ( IsClipFullScreen() ) { + return; + } + if ( iVideoPlayer ) + { + +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF + UpdateWindowSize(); +#else + TRect rect( iBavpView->CoeControl().Rect() ); + + TRect wr(iBavpView->WindowRect()); //can have negative coordinates + //if video scrolled out of viewport + CEikonEnv* eikon = CEikonEnv::Static(); + RWsSession& ws = eikon->WsSession(); + CWsScreenDevice* screenDevice = eikon->ScreenDevice(); + + // Windows' absolute position, relative to the current screen + TPoint pt = iBavpView->WindowInst().AbsPosition(); + rect.Move( pt.iX, pt.iY ); + wr.Move( pt.iX, pt.iY ); + + // Reset clipRect + TRect clipRect = rect; + clipRect = GetClipRect( rect ); + + Log( EFalse, _L("\nPosition: == clipRect to DAS: ==\n") ); + Log( EFalse, _L("\nPosition:: clipRect.x = \n"), clipRect.iTl.iX ); + Log( EFalse, _L("\nPosition:: clipRect.y = \n"), clipRect.iTl.iY ); + Log( EFalse, _L("\nPosition:2: clipRect.x = \n"), clipRect.iBr.iX ); + Log( EFalse, _L("\nPosition:2: clipRect.y = \n"), clipRect.iBr.iY ); + + TRAP_IGNORE + ( + iVideoPlayer->SetDisplayWindowL( ws, *screenDevice, + iBavpView->WindowInst(), + wr, clipRect ); + ); + +#endif + if( iCurrentState == EBavpPaused || iCurrentState == EBavpStopped || iCurrentState == EBavpPlayComplete ) + { + iVideoPlayer->RefreshFrameL(); + } + + } //end of iVideoPlayer + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::WaitForScreenSwitch +// Switches between normal screen and full screen +// ----------------------------------------------------------------------------- +TInt CBavpControllerVideo::WaitForScreenSwitch( TAny* aThisData ) + { + TRAP_IGNORE( WaitForScreenSwitchL( aThisData ) ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::WaitForScreenSwitch +// Switches between normal screen and full screen +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::WaitForScreenSwitchL( TAny* aThisData ) + { + Log( EFalse, _L("CBavpControllerVideo::WaitForScreenSwitchL()") ); + + // Use static cast + CBavpControllerVideo* thisData = STATIC_CAST(CBavpControllerVideo*, aThisData); + + // Switch from Normal screen mode to Full Screen mode + if ( !thisData->IsClipFullScreen() ) + { + thisData->RevertToFullScreenL(); + + } + else if ( thisData->IsClipFullScreen() ) + { + // Switch from Full Screen mode to Normal Screen mode + thisData->RevertToNormalScreenL(); + + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::DoFastForwardL +// Fast forwards the video +// ----------------------------------------------------------------------------- +TInt CBavpControllerVideo::DoFastForwardL( TAny* aThisData ) + { + CBavpControllerVideo* thisData = STATIC_CAST( CBavpControllerVideo*, aThisData ); + TTimeIntervalMicroSeconds skipPosition( 0 ); + TTimeIntervalMicroSeconds currentPosition( thisData->iVideoPlayer->PositionL() ); + + Log( EFalse, _L("CBavpControllerVideo::DoFastForwardL() - currentPosition = "), + currentPosition.Int64() ); + + // If we're not at the end of clip, skip forward a few positions + if ( currentPosition < thisData->iClipInfo->iDurationInSeconds ) + { + skipPosition = currentPosition.Int64() + KSkipToPosition; + + // If skip pass end of clip, set to the end of clip + if ( skipPosition > thisData->iClipInfo->iDurationInSeconds ) + { + skipPosition = thisData->iClipInfo->iDurationInSeconds; + } + + Log( EFalse, _L("CBavpControllerVideo::DoFastForwardL() - skipPosition = "), + skipPosition.Int64() ); + + // Set the position + thisData->iVideoPlayer->SetPositionL( skipPosition ); + + // Refresh the frame + thisData->iVideoPlayer->RefreshFrameL(); + thisData->iClipInfo->iPosition = skipPosition; + } + else + { + // Fast Forward reached the end of the clip, cancel the fast forward + thisData->iPositionUpdater->Cancel(); + thisData->iClipInfo->iPosition = thisData->iClipInfo->iDurationInSeconds; + // Set the state to complete since it reached the end of the clip + thisData->iCurrentState = EBavpFastForwardComplete; + Log( EFalse, _L("CBavpControllerVideo::DoFastForwardL() - End of clip") ); + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::DoRewindL +// Rewinds the video +// ----------------------------------------------------------------------------- +TInt CBavpControllerVideo::DoRewindL( TAny* aThisData ) + { + CBavpControllerVideo* thisData = STATIC_CAST( CBavpControllerVideo*, aThisData ); + TTimeIntervalMicroSeconds skipPosition( 0 ); + TTimeIntervalMicroSeconds currentPosition( thisData->iVideoPlayer->PositionL() ); + + Log( EFalse, _L("CBavpControllerVideo::DoFastForwardL() - currentPosition = "), + currentPosition.Int64() ); + + // We're not at the beginning of the clip, rewind a few positions + if ( currentPosition > 0 ) + { + skipPosition = currentPosition.Int64() - KSkipToPosition; + + // If skip pass beginning of clip, set to the beginning of clip + if ( skipPosition < 0 ) + { + skipPosition = 0; + } + + Log( EFalse, _L("CBavpControllerVideo::RewindL() - skipPosition = "), + skipPosition.Int64() ); + + // Set the position + thisData->iVideoPlayer->SetPositionL( skipPosition ); + + // Refresh the frame + thisData->iVideoPlayer->RefreshFrameL(); + thisData->iClipInfo->iPosition = skipPosition; + } + else + { + // Rewind reached the beginning of the clip, cancel the rewind + thisData->iPositionUpdater->Cancel(); + thisData->iClipInfo->iPosition = 0; + // Set the state to complete since it reached beginning of clip + thisData->iCurrentState = EBavpRewindComplete; + Log( EFalse, _L("CBavpControllerVideo::RewindL() - beginning of clip") ); + } + + return ETrue; + } + +// -------------------------------------------------------------------------- +// CBavpControllerVideo::HandleError +// Handle error codes. We can receive errors from the MMF Video Player +// and its MMF callbacks (mvpuoPlayComplete, etc). +// The MMF errors are for handling content issues, such as decoding content +// and network access. +// NOTES: +// MMF errors start at -12000, see /epoc32/include/mmf/common/MMFErrors.h +// MMF also returns -1 (KErrNotFound) and few other system-wide errors +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::HandleError( TInt aError ) + { + Log( EFalse, _L("In CBavpControllerVideo::HandleError(): err="), aError ); + + switch ( aError ) + { + case KErrSessionClosed: // When we stop live streaming + if ( iCurrentState == EBavpBuffering || + iCurrentState == EBavpStopped ) + { + Log( EFalse, _L("HandleError: iCurrentState=Buffering or Stopped and err=KErrSessionClosed") ); + // Controller needs to be re-initialized, whenever + // live streaming is "Stopped" + // iCurrentState = EBavpNone, set by UnInitVideoPlayer + UnInitVideoPlayer(); + // Set state to stopped, because we "stop" live content + iCurrentState = EBavpStopped; + } + else if ( iCurrentState == EBavpPlaying || + iCurrentState == EBavpPaused ) + { + Log( EFalse, _L("HandleError:iCurrentState=Playing or Paused and err=KErrSessionClosed") ); + // If the window is not on top, it might be a video or phone + // call interrupt + TRAP_IGNORE + ( + if ( !iBavpView->IsTopWindowL() ) + { + InitVideoPlayer(); + } + ) // end of TRAP_IGNORE + } + else + { + } + break; + + case KErrDisconnected: + // If the window is not on top, it might be a video or phone + // call interrupt + Log( EFalse, _L("HandleError: err=KErrDisconnected") ); + TRAP_IGNORE + ( + if ( !iBavpView->IsTopWindowL() ) + { + InitVideoPlayer(); + } + ) // end of TRAP_IGNORE + break; + + case KErrMMVideoDevice: + case KErrMMAudioDevice: + HandleMultiInstanceError(); + break; + + // Errors from MMF (i.e. MvpuoPrepareComplete, MvpuoPlayComplete...) + case KErrNotFound: + case KErrNotSupported: + case KErrCorrupt: + case KErrInUse: + case KErrNoMemory: + case KErrAbort: + case KErrArgument: + case KErrCouldNotConnect: + case KErrTimedOut: + case KErrHardwareNotAvailable: + case KErrOverflow: + case KErrMMNotEnoughBandwidth: + case KErrMMNetworkRead: + case KErrMMNetworkWrite: + case KErrMMServerNotSupported: + case KErrMMUDPReceive: + case KErrMMInvalidProtocol: + case KErrMMInvalidURL: + case KErrMMProxyServer: + case KErrMMDecoder: + case KErrMMPartialPlayback: + // Close the player and delete player instance. + // iCurrentState = EBavpNone, set by UnInitVideoPlayer. + UnInitVideoPlayer(); + + // Display we have bad content + Log( EFalse, _L("HandleError: state=BadContent") ); + iCurrentState = EBavpBadContent; + iBavpView->UpdateView(); + break; + + default: + // Do nothing + break; + + } // end of switch + + Log( EFalse, _L("Out CBavpControllerVideo::HandleError()") ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::HandleKeysL +// Handles user key presses when we're Activated (aka Top of CCoeControl stack) +// ----------------------------------------------------------------------------- +TKeyResponse CBavpControllerVideo::HandleKeysL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + TKeyResponse keyResponse( EKeyWasNotConsumed ); + + // If we're in full screen mode, and any key is pressed, toggle to normal + // screen. Consume all key presses (down, key, up) when in full screen mode. + if ( IsClipFullScreen() ) + { + if ( aType == EEventKeyDown ) + { + ToggleScreen(); + } + keyResponse = EKeyWasConsumed; + } + else + { + // Use the default HandleKeysL method + keyResponse = CBavpController::HandleKeysL( aKeyEvent, aType ); + } + + return keyResponse; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::HandleCommandL +// Default implementation, override as needed. +// Handles the commands from the Option Menu defined in TBavpCommandIds +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::HandleCommandL( TBavpCommandIds aCommand ) + { + Log( EFalse, _L("CBavpControllerVideo::HandleCommandL(): aCommand="), (TInt)aCommand ); + + switch ( aCommand ) + { + case EBavpCmdPlayFullScreen: + ToggleScreen(); + break; + + default: + // Use the default HandleCommandL method + CBavpController::HandleCommandL( aCommand ); + break; + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::PlayAudioVideoL +// Handles request to open and play an audio or video content +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::PlayAudioVideoL() + { + Log( EFalse, _L("CBavpControllerVideo::PlayAudioVideoL() ") ); + + if ( iClipInfo->iMediaType == ELocalRamFile ) + { + ParseRamFileL(); + } +#if defined(BRDO_ASX_FILE) + else if ( iClipInfo->iMediaType == ELocalAsxFile ) + { + ParseAsxFileL(); + } +#endif // BRDO_ASX_FILE + // Check for the mediatype and open the file + InitVideoPlayerL(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::Stop +// Stops video from playing, if playing. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::Stop() + { + Log( EFalse, _L("CBavpControllerVideo::Stop") ); + + // If we are fast forwarding or rewind, stop the position updater + iPositionUpdater->Cancel(); + + if ( iVideoPlayer ) + { + // Stop video and set the state to stop + iVideoPlayer->Stop(); + iCurrentState = EBavpStopped; + + iClipInfo->iPosition = 0; + TRAP_IGNORE + ( + iVideoPlayer->SetPositionL( iClipInfo->iPosition ); + iVideoPlayer->RefreshFrameL(); + ); + } + + // The videoPlayer can play audio-only content, so we need to updateDisplay + // to show the audio stop animation + if ( !IsClipVideo() ) + { + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::PlayL +// Plays video +// +// NOTE: The MMF throws an error when interrupted by a telephone call, so +// iCurrentState=EBavpBadContent and PlayL called after call is done. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::PlayL() + { + Log( EFalse, _L("CBavpControllerVideo::PlayL") ); + + if ( !iVideoPlayer || !iPlayerInitialized ) + { + // 1) Live-stream clip that was stopped will close the iVideoPlayer and + // need buffering, because Play() will have to be reinitialized with + // server. + // 2) The initialization of multiple video instances and a single + // playback hardware/software (ie Julie H/W) will cause the second plus + // instances to return an error. HandleError() will display stop animation, + // and if the user selects PlayL(), and the iVideoPlayer needs to be + // reinitialized. + // + // The buffering animation will be stopped, when MvpuoPrepareComplete() + // is called. + iCurrentState = EBavpBuffering; + iBavpView->UpdateView(); + Log( EFalse, _L("PlayL - Calling InitVideoPlayerL()") ); + + // This calls OpenUrlL or OpenFileL, which will call iVideoPlayer->Play + InitVideoPlayerL(); + return; + } + + if ( iCurrentState == EBavpPaused || + iCurrentState == EBavpFastForwarding || + iCurrentState == EBavpRewinding ) + { + // If we are fast forwarding or rewind, pause + if ( iPositionUpdater->IsActive() ) + { + // PauseL stops the PositionUpdater + PauseL(); + } + + // We are resuming play and the clip is seekable, get the last + // position and adjust the last position, if needed + if ( iClipInfo->iPosition >= + iClipInfo->iDurationInSeconds.Int64() - KBavpOneSecond ) + { + // Take back one second if too near end of clip + TTimeIntervalMicroSeconds adjustPosition = + iClipInfo->iPosition.Int64() - KBavpOneSecond; + + // Negative value is not allowed, use beginning of clip + if ( adjustPosition.Int64() < 0 ) + { + adjustPosition = 0; + } + + // Use the adjusted position + iClipInfo->iPosition = adjustPosition; + } + } + else + { + // Handle all other states, EBavpStopped, EBavpPlayComplete, + // EBavpRewindComplete, EBavpFastForwardComplete, EBavpBadContent + iClipInfo->iPosition = 0; + } + + if ( IsClipOnDemand() && iCurrentState == EBavpStopped ) + { + // On-demand that was stopped will need buffering, + // because Play() will have to be reinitialized with server. + // The buffering animation is stopped, for on-demand when + // MvloLoadingComplete() is called + iCurrentState = EBavpBuffering; + Log( EFalse, _L("PlayL - Set EBavpBuffering") ); + } + else + { + // Set state and update view to stop any animations running + iCurrentState = EBavpPlaying; + Log( EFalse, _L("PlayL - Set EBavpPlaying") ); + } + + iBavpView->UpdateView(); + + iVideoPlayer->SetPositionL( iClipInfo->iPosition ); + //Fix for "EABU-7ZW9YT" if the pause is initiated for foreground to background and also for plugin invisible and plugin playpause + if(iCurrentState == EBavpPaused) + iCurrentState = EBavpPlaying; + + iVideoPlayer->Play(); + // ETwelveOClock: Timer tick is on the second - from Symbian + if (!iBackLightUpdater->IsActive()) + { + iBackLightUpdater->Start( ETwelveOClock, this ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::PauseL +// Pauses video while playing. Saves the last position, if seekable content. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::PauseL() + { + Log( EFalse, _L("CBavpControllerVideo::PauseL") ); + + // If the position updater is running, stop it + iPositionUpdater->Cancel(); + + if ( iVideoPlayer ) + { + //disable screensaver + iBackLightUpdater->Cancel(); + if ( IsClipSeekable() ) + { + // Seekable content, save position for possible resume + iVideoPlayer->PauseL(); + iClipInfo->iPosition = iVideoPlayer->PositionL(); + iCurrentState = EBavpPaused; + } + else + { + // Not seekable content, i.e. Live stream + iVideoPlayer->Stop(); + iClipInfo->iPosition = 0; + iVideoPlayer->SetPositionL( iClipInfo->iPosition ); + iCurrentState = EBavpStopped; + } + } + // The videoPlayer can play audio-only content, so we need to updateDisplay + // to show the audio paused animation + if ( !IsClipVideo() ) + { + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::FastForwardL +// Fast forwards the video. This is only called on seekable and local file +// content. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::FastForwardL() + { + // Check that the content can be Fast Forwarded, this is used when media key + // is pressed. We don't allow the user to select FF from Option Menu, if this + // condition is not already meet. + if ( !IsClipSeekable() && !IsClipLocalMedia() ) + { + return; + } + + // If playing, pause it (PauseL stops the PositionUpdater) + if ( iCurrentState == EBavpPlaying ) + { + PauseL(); + } + + iCurrentState = EBavpFastForwarding; + iPositionUpdater->Start( KInitialDelay, KUpdateFrequency, + TCallBack( &DoFastForwardL, this ) ); + if (!iBackLightUpdater->IsActive()) + { + iBackLightUpdater->Start( ETwelveOClock, this ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerAudio::RewindL +// Rewinds the video. This is only called on seekable and local file +// content. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::RewindL() + { + // Check that the content can be Rewound, this is used when media key + // is pressed. We don't allow the user to select FF from Option Menu, if this + // condition is not already meet. + if ( !IsClipSeekable() && !IsClipLocalMedia() ) + { + return; + } + + // If playing, pause it (PauseL stops the PositionUpdater) + if ( iCurrentState == EBavpPlaying ) + { + PauseL(); + } + + iCurrentState = EBavpRewinding; + iPositionUpdater->Start( KInitialDelay, KUpdateFrequency, + TCallBack( &DoRewindL, this ) ); + if (!iBackLightUpdater->IsActive()) + { + iBackLightUpdater->Start( ETwelveOClock, this ); + } + + } +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::OpenVideoUrlL +// Handles request to open the url link +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::OpenVideoUrlL() + { + Log( EFalse, _L("CBavpControllerVideo::OpenUrlL() entered") ); + + // Note: Play() is called from MvpuoPrepareComplete() + iVideoPlayer->OpenUrlL( *iClipInfo->iUrl, iAccessPtId, + KNullDesC8, KRopControllerUid ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::OpenVideoFileL +// Open a video file +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::OpenVideoFileL() + { + Log( EFalse, _L("CBavpControllerVideo::OpenFileL() ") ); + + // Note: Play() is called from MvpuoPrepareComplete() + iVideoPlayer->OpenFileL( *iClipInfo->iFileName ); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::SetPlayerVolume +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::SetPlayerVolume( TInt aVolume ) + { + if ( iVideoPlayer && iPlayerInitialized ) + { + // The CR volume is 0-10, convert to Video player volume 0-100 + TInt playerVolume = ( aVolume * iPlayerMaxVolume ) / KCRVolumeMax; + + // Set Video player volume + TRAP_IGNORE( iVideoPlayer->SetVolumeL( playerVolume) ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::GetPlayerVolume +// ----------------------------------------------------------------------------- +TInt CBavpControllerVideo::GetPlayerVolume() + { + TInt playerVolume( 0 ); + TInt CRVolume( 0 ); + + if ( iVideoPlayer && iPlayerInitialized ) + { + // Video player returns 0-100 + playerVolume = iVideoPlayer->Volume(); + + // Convert to CR volume 0-10 + CRVolume = ( playerVolume * KCRVolumeMax ) / iPlayerMaxVolume; + } + + return CRVolume; + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::MvpuoOpenComplete +// Notification to the client that the opening of the video clip has completed, +// successfully, or otherwise. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::MvpuoOpenComplete( TInt aError ) + { + Log( EFalse, _L("MvpuoOpenComplete err="), aError ); + + if ( aError != KErrNone ) + { + // Got an error from the MMF callback + HandleError( aError ); + } + else + { + // No error opening player, proceed with preparing player + iVideoPlayer->Prepare(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::MvpuoPrepareComplete +// Notification to the client that the opening of the video clip has been prepared +// successfully, or otherwise. +// This callback is called in response to a call to CVideoPlayerUtility::Prepare(). +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::MvpuoPrepareComplete( TInt aError ) + { + Log( EFalse, _L("MvpuoPrepareComplete err="), aError ); + + if ( aError != KErrNone ) + { + HandleError( aError ); + } + else + { + // Proceed with initialization and playing content + + // Video player initialized and ready for interaction, + // volume, option menus, etc... + iPlayerInitialized = ETrue; + + // Cleanup clip info + iClipInfo->ReInit(); + + // Handle all of the leaving methods of preparing the clip and + // controller. Reading meta data, max volume, ... + TRAP_IGNORE( PrepareCompleteL() ); + + // Full screen display mode, rotate if necessary + if ( IsClipFullScreen() ) + { + RotateScreen90(); + } + + // Use the iCurrrentVolume, everytime we "set" the volume in the + // BavpController we check for Profile setting, so we can use it here + SetPlayerVolume( iCurrentVolume ); + + // Start to play this media object + iVideoPlayer->Play(); + + // Stop the buffering animation now, to avoid screen flicker + iCurrentState = EBavpPlaying; + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::MvpuoPlayComplete +// Notification that video playback has completed. This is not called if playback +// is explicitly stopped by calling Stop. +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::MvpuoPlayComplete( TInt aError ) + { + Log( EFalse, _L("MvpuoPlayComplete err="), aError ); + + if ( aError != KErrNone ) + { + // Got an error from the MMF callback + HandleError( aError ); + } + else + { + // No error, proceed with playing complete + iCurrentState = EBavpPlayComplete; + iClipInfo->iPosition = 0; + + // Set the previous call state to complete, this will ensure we + // don't try to replay the content if a call comes in + iPreCallState = EBavpPlayComplete; + + // Revert back to normal screen if it's full screen display + if ( IsClipFullScreen() ) + { + TRAP_IGNORE + ( + RevertToNormalScreenL(); + iBavpView->ControllerStateChangedL(); + ); + } + + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::MvpuoEvent +// General event notification from controller. These events are specified by the +// supplier of the controller. Take the user initiaiated event, like selecting +// "pause" from the menu item, or another MMF event and convert into a +// "video plugin error", so we can process in HandleError(). +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::MvpuoEvent( const TMMFEvent& aEvent ) + { + Log( EFalse, _L("MvpuoEvent aEvent.iErrorCode="), aEvent.iErrorCode ); + + if ( aEvent.iEventType == KMMFEventCategoryVideoPlayerGeneralError ) + { + HandleError( aEvent.iErrorCode ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::MvloLoadingComplete +// Notification that video clip loading/rebuffering has started +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::MvloLoadingStarted() + { + Log( EFalse, _L("MvloLoadingStarted") ); + + if ( iCurrentState != EBavpPlaying ) + { + // Start the buffering animation + iCurrentState = EBavpBuffering; + iBavpView->UpdateView(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::MvloLoadingComplete +// Notification that video clip loading/rebuffering has completed +// and starting to play +// ----------------------------------------------------------------------------- +void CBavpControllerVideo::MvloLoadingComplete() + { + Log( EFalse, _L("MvloLoadingComplete") ); + + if ( !iBackLightUpdater->IsActive() ) + { + iBackLightUpdater->Start( ETwelveOClock, this ); + } + // Stop the buffering animation + iCurrentState = EBavpPlaying; + iBavpView->UpdateView(); + } + + // ----------------------------------------------------------------------------- +// CBavpControllerVideo::getPositionL +// To get the current position of the clip +// ----------------------------------------------------------------------------- + + TTimeIntervalMicroSeconds CBavpControllerVideo::getPositionL() + { + if ( iVideoPlayer ) + { + return iVideoPlayer->PositionL(); + } + return NULL; + } + + // ----------------------------------------------------------------------------- +// CBavpControllerVideo::setPositionL +// To set the position of the clip +// ----------------------------------------------------------------------------- + + void CBavpControllerVideo::setPositionL(TTimeIntervalMicroSeconds val) + { + if ( iVideoPlayer ) + { + if ( !IsClipSeekable() && !IsClipLocalMedia() ) + { + return; + } + + TBool didWePause = EFalse; + // If playing, pause it (PauseL stops the PositionUpdater) + if ( iCurrentState == EBavpPlaying ) + { + PauseL(); + didWePause = ETrue; + } + + if ( (val > iClipInfo->iDurationInSeconds ) || (val < 0) ) + { + val = 0; + } + + iVideoPlayer->SetPositionL(val); + iVideoPlayer->RefreshFrameL(); + iClipInfo->iPosition = val; + if ( didWePause ) + { + PlayL(); + } + } + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::Beat +// Call HandleScreenSaver +// ----------------------------------------------------------------------------- +// +void CBavpControllerVideo::Beat() + { + HandleScreenSaver(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::Synchronize +// Call HandleScreenSaver +// ----------------------------------------------------------------------------- +// +void CBavpControllerVideo::Synchronize() + { + HandleScreenSaver(); + } + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::HandleScreenSaver +// To disable backlight for screensaver if needed +// ----------------------------------------------------------------------------- +// +void CBavpControllerVideo::HandleScreenSaver() +{ + Log( EFalse, _L("CBavpControllerVideo::HandleScreenSaver() entered" )); + + //disable screensaver when it's in playing|forwarding|backwarding mode + if ( NoScreenSaverMode() && iVideoPlayer ) + { + User::ResetInactivityTime(); + } +} + +TBool CBavpControllerVideo::NoScreenSaverMode() +{ + return (iCurrentState == EBavpPlaying || + iCurrentState == EBavpFastForwarding || + iCurrentState == EBavpRewinding); +} + + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::SetDefaultAspectRatioL +// Sets default aspect ratio (code is taken from mmplayer) +// ----------------------------------------------------------------------------- +/* + * This function was added for consistency with mmplayer. + * Not used is 5.0 (S60_50) since we want to preserve correct + * aspect ratio and this function will stretch the video to + * the full screen, which due to S60_50 screen size doesn't match + * to correct ratio. + * If needed it should be called in WaitForScreenSwitchL() after + * screen mode changed. + */ +void CBavpControllerVideo::SetDefaultAspectRatioL() +{ + TSize frameSize; + TRect rect = iBavpView->CoeControl().Rect(); + + if ( iVideoPlayer ) { + + iVideoPlayer->VideoFrameSizeL( frameSize ); + } + + if ( frameSize.iWidth > 0 && frameSize.iHeight > 0) { + + TMMFScalingType scalingType = EMMFNatural; + + TReal32 videoAspectRatio = (TReal)frameSize.iWidth / + (TReal)frameSize.iHeight; + TReal32 dispAspectRatio = (TReal)rect.Width() / (TReal)rect.Height(); + + // Choose the scaling type through the rule: + // videoAspectRatio - iDisplayAspectRatio > 0.1 ==> zoom + // videoAspectRatio - iDisplayAspectRatio < 0.1 ==> stretch + // videoAspectRatio = iDisplayAspectRatio ==> natural + if ( videoAspectRatio - dispAspectRatio > 0.1 ) { + scalingType = EMMFZoom; + } + else if ( videoAspectRatio != dispAspectRatio ) { + scalingType = EMMFStretch; + } + + TMMFMessageDestinationPckg destinationPckg(KUidInterfaceMMFControllerScalingMsg ); + + TPckgBuf scaleTypePckg( scalingType ); + + iVideoPlayer->CustomCommandSync( destinationPckg, + EMMFSetScalingType, + scaleTypePckg, + KNullDesC8 ); + iVideoPlayer->RefreshFrameL(); + + } +} + +void CBavpControllerVideo::HandleInComingCallL() + +{ + if ( IsClipFullScreen() ) + { + RevertToNormalScreenL(); + iBavpView->ControllerStateChangedL(); + } +} + +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::HandleGesture +// ----------------------------------------------------------------------------- +TBool CBavpControllerVideo::HandleGesture(TGestureEvent *gesture) +{ + TBool ret = EFalse; + TGestureCode gtype = gesture->Code(EAxisBoth); + switch(gtype) + { + case EGestureTap: + { + if (IsClipFullScreen()) + { + ToggleScreen(); + ret = ETrue; + } + break; + } + } + return ret; +} +#ifdef BRDO_VIDEOPLAYER2_ENABLED_FF +// ----------------------------------------------------------------------------- +// CBavpControllerVideo::UpdateWindowSize +// Refreshing the window co-ordinates. +// ----------------------------------------------------------------------------- +/* + * MMF Client API has updated with new methods to control video display + * Windows and video picture positioning to produce a new version of the API, + * CVideoPlayerUtility2. The new API is the preferred way to play video on graphics + * surfaces, and will support new features such as more flexible window positioning. + * Updatewindow has made in separate method so that in future, timer can be + * implemented for redusing the call to update window. + */ +void CBavpControllerVideo::UpdateWindowSize() + { + TRect rect( iBavpView->CoeControl().Rect() ); + TRect wr(iBavpView->WindowRect()); //can have negative coordinates + //if video scrolled out of viewport + CEikonEnv* eikon = CEikonEnv::Static(); + RWsSession& ws = eikon->WsSession(); + CWsScreenDevice* screenDevice = eikon->ScreenDevice(); + // Reset clipRect + TRect clipRect = rect; + clipRect = GetClipRect( rect ); + if( ( iActiveWindow != &iBavpView->WindowInst() ) && ( iActiveWindow != NULL ) ) + { + //Remove the active window and add the new window + iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); + TRAPD(errAdd, iVideoPlayer->AddDisplayWindowL(ws,*screenDevice,iBavpView->WindowInst(), wr, clipRect)); + TRAP_IGNORE(iVideoPlayer->SetAutoScaleL(iBavpView->WindowInst(), EAutoScaleBestFit)); + if( errAdd == KErrNone ) + iActiveWindow = &iBavpView->WindowInst(); + } + else + { + //window is already active, only needs the window size changed or position change + TRAPD(err1,iVideoPlayer->SetVideoExtentL(iBavpView->WindowInst(),wr)); + TRAPD(err2,iVideoPlayer->SetWindowClipRectL(iBavpView->WindowInst(),clipRect)); + Log( EFalse, _L("SetVideoExtent err1 = %d"), err1 ); + Log( EFalse, _L("SetVideoExtent err2 = %d"), err2 ); + } + } +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpHwKeyEvents.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpHwKeyEvents.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class which implements handling Hardware Volume Key events. +* This class implements methods of MRemConCoreApiTargetObserver +* +*/ + + +// INCLUDE FILES +#include +#include +#include // KAknStandardKeyboardRepeatRate + +#include "BavpHwKeyEvents.h" +#include "BavpLogger.h" + +// CONSTANTS +const TInt KVolumeFirstChangePeriod = KAknKeyboardRepeatInitialDelay; +const TInt KVolumeChangePeriod = KAknStandardKeyboardRepeatRate; +const TInt KVolumeChangeUp = 1; +const TInt KVolumeChangeDown = -1; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpHwKeyEvents::NewL +// Two-phased constructor. +// ---------------------------------------------------------------------------- +CBavpHwKeyEvents* CBavpHwKeyEvents::NewL( MBavpHwKeyEventsObserver& aObserver ) + { + Log( EFalse, _L("CBavpHwKeyEvents::NewL") ); + + CBavpHwKeyEvents* self = new ( ELeave ) CBavpHwKeyEvents( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CBavpHwKeyEvents::~CBavpHwKeyEvents +// Destructor +// ---------------------------------------------------------------------------- +CBavpHwKeyEvents::~CBavpHwKeyEvents() + { + Log( EFalse, _L("CBavpHwKeyEvents::~CBavpHwKeyEvents") ); + + if ( iVolumeTimer ) + { + iVolumeTimer->Cancel(); + delete iVolumeTimer; + } + + delete iInterfaceSelector; + iCoreTarget = NULL; // For LINT. Owned by iInterfaceSelector + } + +// ---------------------------------------------------------------------------- +// CBavpHwKeyEvents::CBavpHwKeyEvents +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------------------------- +CBavpHwKeyEvents::CBavpHwKeyEvents( MBavpHwKeyEventsObserver& aObserver ) + : iObserver( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CBavpHwKeyEvents::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpHwKeyEvents::ConstructL( ) + { + Log( EFalse, _L("CBavpHwKeyEvents::ConstructL") ); + + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + + // Owned by iInterfaceSelector + iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); + iInterfaceSelector->OpenTargetL(); + + // Volume key pressed and held (repeat) timer. + iVolumeTimer = CPeriodic::NewL( EPriorityNormal ); + } + +// ---------------------------------------------------------------------------- +// CBavpHwKeyEvents::MrccatoCommand +// Handles hardware key events. The volume up/down keys can be clicked once, +// for volume to increase/decrease one increment, or held down and the volume +// will increase/decrease gradually until the limit is reached. The transport +// keys (play, pause,..) will call the HandleCommandL method on the controller. +// ---------------------------------------------------------------------------- +void CBavpHwKeyEvents::MrccatoCommand( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) + { + Log( EFalse, _L("CBavpHwKeyEvents::MrccatoCommand, OpID"), aOperationId ); + + switch ( aOperationId ) + { + case ERemConCoreApiVolumeUp: + { + switch ( aButtonAct ) + { + case ERemConCoreApiButtonPress: + { + // Volume up held down for 0.6 seconds + iChange = KVolumeChangeUp; + iVolumeTimer->Start( KVolumeFirstChangePeriod, + KVolumeChangePeriod, + TCallBack( VolumeTimerCallback, this ) ); + break; + } + case ERemConCoreApiButtonClick: + { + // Volume up clicked once + iChange = KVolumeChangeUp; + DoChangeVolume(); + break; + } + case ERemConCoreApiButtonRelease: + { + // Volume up key released, stop timer + iVolumeTimer->Cancel(); + break; + } + default: + { + // Never hits this + break; + } + } + break; + } + case ERemConCoreApiVolumeDown: + { + switch ( aButtonAct ) + { + case ERemConCoreApiButtonPress: + { + // Volume down key held for 0.6 seconds + iChange = KVolumeChangeDown; + iVolumeTimer->Start( KVolumeFirstChangePeriod, + KVolumeChangePeriod, + TCallBack( VolumeTimerCallback, this ) ); + break; + } + case ERemConCoreApiButtonClick: + { + // Volume down clicked once + iChange = KVolumeChangeDown; + DoChangeVolume(); + break; + } + case ERemConCoreApiButtonRelease: + { + // Volume down key released, stop timer + iVolumeTimer->Cancel(); + break; + } + default: + { + // Never hits this + break; + } + } + break; + } + default: + { + // Don’t do anything here. + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CBavpHwKeyEvents::DoChangeVolume( ) +// Change volume depending on the level of increase or decrease +// ---------------------------------------------------------------------------- +void CBavpHwKeyEvents::DoChangeVolume( ) + { + Log( EFalse, _L("CBavpHwKeyEvents::DoChangeVolume") ); + + iObserver.BavpHwKeyVolumeChange( iChange ); + } + +// ---------------------------------------------------------------------------- +// CBavpHwKeyEvents::ChangeVolume +// Method call to change volume +// ---------------------------------------------------------------------------- +TInt CBavpHwKeyEvents::VolumeTimerCallback( TAny* aObject ) + { + // cast, and call non-static function + static_cast( aObject )->DoChangeVolume( ); + return KErrNone; + } + +// End of File + + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpLogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpLogger.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser for handling embedded video requests. +* +*/ + + +// INCLUDE FILES +#include +#include "BavpLogger.h" + +// Logging methods for debugging. Only used in the UDEB version not UREL. +// +// aWrite: The aWrite boolean is used to allow the Log() methods to be left in the +// code, but not write to a log file. To write to the log file, set aWrite to +// ETrue. You should always set aWrite to EFalse before checking in, +// this will ensure the log file will not be filled with excessive entries. This +// is important, because the Bavp requires on-hardware debugging. +// +// AudioVideo: The name of the directory (folder) where the log file is written. +// The path "C:\Logs\AudioVideo" must be specified to enable the logging. If no +// path is specified, no log file is created and populated. +// +// log: This is the file name that is created and logging entries added. +// +#ifdef _DEBUG +void Log( TBool aWrite, TPtrC aData ) + { + if ( aWrite ) + { + RFileLogger::WriteFormat( _L( "AudioVideo" ), _L( "bavp.log" ), + EFileLoggingModeAppend, _L( "%S" ), + &aData ); + } + } + +void Log( TBool aWrite, TPtrC aData, TInt aInt ) + { + if ( aWrite ) + { + RFileLogger::WriteFormat( _L( "AudioVideo" ), _L( "bavp.log" ), + EFileLoggingModeAppend, _L( "%S, %d" ), + &aData, aInt ); + } + } + +void Log( TBool aWrite, const TPtrC s, const TPtrC p) + { + if ( aWrite ) + { + RFileLogger::WriteFormat( _L( "AudioVideo" ), _L( "bavp.log" ), + EFileLoggingModeAppend, _L("%S, %S"), + &s, &p); + } + } + + void Log( TBool aWrite, const TPtrC8 s, const TPtrC8 p) + { + if ( aWrite ) + { + RFileLogger::WriteFormat( _L( "AudioVideo" ), _L( "bavp.log" ), + EFileLoggingModeAppend, _L8("%S %S"), + &s, &p); + } + } +#else +void Log( TBool /*aWrite*/, TPtrC /*aData*/ ) + { + } + +void Log( TBool /*aWrite*/, TPtrC /*aData*/, TInt /*aInt*/ ) + { + } +void Log( TBool /*aWrite*/, const TPtrC /*s*/, const TPtrC /*p*/) + { + } +void Log( TBool /*aWrite*/, const TPtrC8 /*s*/, const TPtrC8 /*p*/) + { + } +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpMain.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser +* +*/ + + + +// INCLUDE FILES +#include // For _LIT +#include // For NPError +#include // For NPNetscapeFuncs +#include +#include + +#include "BavpLogger.h" +#include "BavpPlugin.h" // For bap_xx methods + +/***************************************************/ +/**********ECOM STYLE BAVP PLUGIN ENTRY POINTS******/ +/***************************************************/ + +// ----------------------------------------------------------------------------- +// CBavpPluginEcomMain::NewL +// ----------------------------------------------------------------------------- +CBavpPluginEcomMain* CBavpPluginEcomMain::NewL( TAny* aInitParam ) + { + Log( EFalse, _L("Calling CBavpPluginEcomMain::NewL ") ); + + TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam ); + CBavpPluginEcomMain* self = new (ELeave) CBavpPluginEcomMain( funcs->iNetscapeFuncs ); + CleanupStack::PushL( self ); + self->ConstructL( funcs->iPluginFuncs ); + CleanupStack::Pop( self ); + + Dll::SetTls ( (void*) self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CBavpPluginEcomMain::ConstructL +// ----------------------------------------------------------------------------- +void CBavpPluginEcomMain::ConstructL( NPPluginFuncs* aPluginFuncs ) + { + Log( EFalse, _L("Calling CBavpPluginEcomMain::ConstructL ") ); + InitializeFuncs( aPluginFuncs ); + } + +// ----------------------------------------------------------------------------- +// CBavpPluginEcomMain::CBavpPluginEcomMain +// ----------------------------------------------------------------------------- +CBavpPluginEcomMain::CBavpPluginEcomMain( NPNetscapeFuncs* aNpf ) + : CEcomBrowserPluginInterface(), + iNpf( aNpf ) + { + } + +// ----------------------------------------------------------------------------- +// CBavpPluginEcomMain::~CBavpPluginEcomMain +// ----------------------------------------------------------------------------- +CBavpPluginEcomMain::~CBavpPluginEcomMain() + { + } + +// ----------------------------------------------------------------------------- +// KImplementationTable +// ----------------------------------------------------------------------------- +const TImplementationProxy KImplementationTable[] = + { + {{KFirstBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL}, + {{KSecondBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL}, + {{KThirdBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL}, + {{KFourthBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL} + }; + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// Returns the filters implemented in this DLL +// Returns: The filters implemented in this DLL +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + return KImplementationTable; + } + +// ----------------------------------------------------------------------------- +// InitializeFuncs +// ----------------------------------------------------------------------------- +EXPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ) + { + aPpf->size = sizeof(NPPluginFuncs); + aPpf->version = 1; + aPpf->newp = NewNPP_NewProc(BavpNewp); + aPpf->destroy = NewNPP_DestroyProc(BavpDestroy); + aPpf->setwindow = NewNPP_SetWindowProc(BavpSetwindow); + aPpf->newstream = NewNPP_NewStreamProc(BavpNewstream); + aPpf->destroystream = NewNPP_DestroyStreamProc(BavpDestroystream); + aPpf->asfile = NewNPP_StreamAsFileProc(BavpAsfile); + aPpf->writeready = NewNPP_WriteReadyProc(BavpWriteready); + aPpf->write = NewNPP_WriteProc(BavpWrite); + aPpf->print = NewNPP_PrintProc(BavpPrint); + aPpf->event = NewNPP_HandleEventProc(BavpEvent); + aPpf->urlnotify = NewNPP_URLNotifyProc(BavpUrlnotify); + aPpf->javaClass = NULL; + aPpf->getvalue = NewNPP_GetValueProc(BavpGetvalue); + aPpf->setvalue = NewNPP_SetValueProc(BavpSetvalue); + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// NPP_Shutdown +// ----------------------------------------------------------------------------- +EXPORT_C void NPP_Shutdown(void) + { + CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); + delete npm; + Dll::SetTls( NULL ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpMediaRecognizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpMediaRecognizer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,518 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CBavpMediaRecognizer +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "BavpMediaRecognizer.h" +#include "BavpLogger.h" + +// CONSTANTS +_LIT8(KDataTypeRAM, "audio/x-pn-realaudio-plugin"); +_LIT8(KDataTypeSDP, "application/sdp"); +_LIT8(KDataTypePlaylist, "audio/mpegurl"); +_LIT8(KDataTypeRNG, "application/vnd.nokia.ringing-tone"); +_LIT8(KDataTypeMp3, "audio/mp3"); +_LIT8(KDataTypeXmp3, "audio/x-mp3"); +_LIT8(KDataTypeAudio3gp, "audio/3gpp"); + +#if defined(BRDO_ASX_FF) +_LIT8(KDataTypeWvx, "video/x-ms-wvx"); +_LIT8(KDataTypeWax, "audio/x-ms-wax"); +_LIT8(KDataTypeAsx, "video/x-ms-asx"); +#endif // BRDO_ASX_FF + +_LIT(KUrlRtsp, "rtsp:"); + +const TInt KDefaultBufferSize = 1000; + +// _LIT(KRamFileExtension,".ram"); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::CBavpMediaRecognizer +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpMediaRecognizer::CBavpMediaRecognizer() + { + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpMediaRecognizer::ConstructL() + { + User::LeaveIfError( iRecognizer.Connect() ); + if ( iRecognizer.GetMaxDataBufSize( iBufSize) || iBufSize <= 0 ) + { + iBufSize = KDefaultBufferSize; + } + CreateVideoFormatsArrayL(); + CreateAudioFormatsArrayL(); + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CBavpMediaRecognizer* CBavpMediaRecognizer::NewL() + { + CBavpMediaRecognizer* self = new( ELeave ) CBavpMediaRecognizer; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::~CBavpMediaRecognizer +// Destructor +// ----------------------------------------------------------------------------- +CBavpMediaRecognizer::~CBavpMediaRecognizer() + { + iVideoControllers.ResetAndDestroy(); + iAudioControllers.ResetAndDestroy(); + iRecognizer.Close(); + iFileHandle.Close(); + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::IdentifyMediaTypeL +// ----------------------------------------------------------------------------- +TBavpMediaType +CBavpMediaRecognizer::IdentifyMediaTypeL( const TDesC& aMediaName, + TBool aIncludeUrls ) + { + TBavpMediaType ret = EUnidentified; + + if ( BaflUtils::FileExists( CEikonEnv::Static()->FsSession(), aMediaName ) ) + { + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( aMediaName, fileRecognitionResult ); + + if ( !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeSDP ) ) + { + ret = ELocalSdpFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalSdpFile") ); + } + + if ( ret == EUnidentified && + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypePlaylist ) ) + { + ret = ELocalAudioPlaylist; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalAudioPlaylist") ); + } + + if ( ret == EUnidentified && + FileHasAudioSupport( aMediaName, fileRecognitionResult ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeRNG ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeMp3 ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeXmp3 ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeAudio3gp ) ) + { + ret = ELocalAudioFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalAudioFile") ); + } + + if ( ret == EUnidentified && + FileHasVideoSupport( aMediaName, fileRecognitionResult ) ) + { + ret = ELocalVideoFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalVideoFile") ); + } + + if ( ret == EUnidentified && + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeRAM ) ) + { + ret = ELocalRamFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalRamFile") ); + } +#if defined(BRDO_ASX_FF) + if ( ret == EUnidentified && + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeWvx ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeWax ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeAsx )) + { + ret = ELocalAsxFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalAsxFile") ); + } +#endif // BRDO_ASX_FF + } + else + { + if ( aIncludeUrls && ValidUrl( aMediaName ) ) + { + ret = EUrl; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - EUrl") ); + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::IdentifyMediaTypeL +// ----------------------------------------------------------------------------- +TBavpMediaType +CBavpMediaRecognizer::IdentifyMediaTypeL( const TDesC& aMediaName, + RFile& aFile, + TBool aIncludeUrls ) + { + if( aFile.SubSessionHandle() ) + { + User::LeaveIfError( iFileHandle.Duplicate( aFile ) ); + } + + TBavpMediaType ret = EUnidentified; + + if ( BaflUtils::FileExists( CEikonEnv::Static()->FsSession(), aMediaName ) || FileHandleExists() ) + { + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( aMediaName, fileRecognitionResult ); + + if ( !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeSDP ) ) + { + ret = ELocalSdpFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalSdpFile") ); + } + + if ( ret == EUnidentified && + !fileRecognitionResult.iDataType.Des8().CompareF( + KDataTypePlaylist ) ) + { + ret = ELocalAudioPlaylist; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalAudioPlaylist") ); + } + + if ( ret == EUnidentified && + FileHasAudioSupport( aMediaName, fileRecognitionResult ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeRNG ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeMp3 ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeXmp3 ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeAudio3gp ) ) + { + ret = ELocalAudioFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalAudioFile") ); + } + + if ( ret == EUnidentified && + FileHasVideoSupport( aMediaName, fileRecognitionResult ) ) + { + ret = ELocalVideoFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalVideoFile") ); + } + + if ( ret == EUnidentified && + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeRAM ) ) + { + ret = ELocalRamFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalRamFile") ); + } +#if defined(BRDO_ASX_FF) + if ( ret == EUnidentified && + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeWvx ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeWax ) || + !fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeAsx ) ) + { + ret = ELocalAsxFile; + Log( EFalse, _L("CBavpMediaRecognizer::IdentifyMediaTypeL - ELocalAsxFile") ); + } +#endif // BRDO_ASX_FF + } + else + { + if (aIncludeUrls && ValidUrl(aMediaName)) + { + ret = EUrl; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::MimeTypeL +// ----------------------------------------------------------------------------- +TBuf +CBavpMediaRecognizer::MimeTypeL( const TDesC& aLocalFile ) + { + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( aLocalFile,fileRecognitionResult ); + + if ( fileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible ) + { + return fileRecognitionResult.iDataType.Des(); + } + + return KNullDesC(); + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::FileHasVideoSupport +// ----------------------------------------------------------------------------- +TBool CBavpMediaRecognizer::FileHasVideoSupport( const TDesC& /*aFileName*/, + TDataRecognitionResult& aFileRecognitionResult) + { + // Try with mime type + // We have a good quess -> go with mime type + if ( aFileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible ) + { + for (TInt i = 0 ; i < iVideoControllers.Count() ; i++) + { + RMMFFormatImplInfoArray formats = + iVideoControllers[i]->PlayFormats(); + for ( TInt j = 0; j < formats.Count() ; j++ ) + { + if ( formats[j]->SupportsMimeType( + aFileRecognitionResult.iDataType.Des8() ) ) + return ETrue; + } + } + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::FileHasAudioSupport +// ----------------------------------------------------------------------------- +TBool CBavpMediaRecognizer::FileHasAudioSupport(const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult ) + { + // try with mime type + // we have a good quess -> gogo with mime type + if (aFileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible) + { + for (TInt i = 0 ; i < iAudioControllers.Count() ; i++) + { + RMMFFormatImplInfoArray formats = + iAudioControllers[i]->PlayFormats(); + for (TInt j = 0; j < formats.Count() ; j++) + { + if ( formats[j]->SupportsMimeType( + aFileRecognitionResult.iDataType.Des8() ) ) + return ETrue; + } + } + } + + // we can't quess -> try with file extension + else + { + TParsePtrC parser(aFileName); + TBuf8 fileExtension; + fileExtension.Copy(parser.Ext()); + for (TInt i = 0 ; i < iVideoControllers.Count() ; i++) + { + RMMFFormatImplInfoArray formats = + iAudioControllers[i]->PlayFormats(); + for (TInt j = 0; j < formats.Count() ; j++) + { + if (formats[j]->SupportsFileExtension(fileExtension)) + return ETrue; + } + } + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::ValidUrl +// ----------------------------------------------------------------------------- +TBool CBavpMediaRecognizer::ValidUrl(const TDesC& aUrl) + { + TBool ret = EFalse; + if (aUrl.Find(KUrlRtsp) == 0) + { + ret = ETrue; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::MimeTypeL +// ----------------------------------------------------------------------------- +TBuf CBavpMediaRecognizer::MimeTypeL(RFile& aFile) + { + if( aFile.SubSessionHandle() ) + { + // Preferred + User::LeaveIfError( iFileHandle.Duplicate( aFile ) ); + } + + // If new handle is not valid, old might still be + if ( !FileHandleExists() ) + { + User::Leave( KErrBadHandle ); + } + + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( KNullDesC(), fileRecognitionResult ); + + if (fileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible) + { + return fileRecognitionResult.iDataType.Des(); + } + return KNullDesC(); + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::CreateVideoFormatsArrayL +// ----------------------------------------------------------------------------- +void CBavpMediaRecognizer::CreateVideoFormatsArrayL() + { + CMMFControllerPluginSelectionParameters* cSelect = + CMMFControllerPluginSelectionParameters::NewLC(); + + CMMFFormatSelectionParameters* fSelect = + CMMFFormatSelectionParameters::NewLC(); + + // Set the play and record format selection parameters to be blank. + // - format support is only retrieved if requested. + cSelect->SetRequiredPlayFormatSupportL(*fSelect); + + // Set the media ids + RArray mediaIds; + CleanupClosePushL(mediaIds); + User::LeaveIfError(mediaIds.Append(KUidMediaTypeVideo)); + + // Get plugins that support at least video + cSelect->SetMediaIdsL( mediaIds, + CMMFPluginSelectionParameters::EAllowOtherMediaIds ); + + // iVideoControllers contains now all plugins that support at least video + cSelect->ListImplementationsL(iVideoControllers); + + // Clean up + CleanupStack::PopAndDestroy( 3 ); // fSelect, cSelect, mediaIds + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::CreateAudioFormatsArrayL +// ----------------------------------------------------------------------------- +void CBavpMediaRecognizer::CreateAudioFormatsArrayL() + { + CMMFControllerPluginSelectionParameters* cSelect = + CMMFControllerPluginSelectionParameters::NewLC(); + + CMMFFormatSelectionParameters* fSelect = + CMMFFormatSelectionParameters::NewLC(); + + // Set the play and record format selection parameters to be blank. + // - format support is only retrieved if requested. + cSelect->SetRequiredPlayFormatSupportL( *fSelect ); + + // Set the media ids + RArray mediaIds; + CleanupClosePushL( mediaIds ); + User::LeaveIfError( mediaIds.Append(KUidMediaTypeAudio) ); + + // Get plugins that supports audio only + cSelect->SetMediaIdsL( mediaIds, + CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds ); + + // iAudioControllers contains now all audio plugins that + // support at least audio. + cSelect->ListImplementationsL( iAudioControllers ); + + // Clean up + CleanupStack::PopAndDestroy( 3 ); // fSelect, cSelect, mediaIds + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::RecognizeFileL +// ----------------------------------------------------------------------------- +void CBavpMediaRecognizer::RecognizeFileL( const TDesC& aFileName, + TDataRecognitionResult& aResult ) + { + aResult.Reset(); + HBufC8* fBuf = HBufC8::NewLC( iBufSize ); // fBuf in CS + TPtr8 fileBuf = fBuf->Des(); + + // Recognize file + if ( FileHandleExists() ) + { + User::LeaveIfError( iRecognizer.RecognizeData( iFileHandle, aResult ) ); + } + else + { + // Read file + User::LeaveIfError( ReadFile( aFileName, fileBuf ) ); + User::LeaveIfError( iRecognizer.RecognizeData( aFileName, fileBuf, aResult ) ); + } + + CleanupStack::PopAndDestroy(); // fBuf + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::ReadFile +// ----------------------------------------------------------------------------- +TInt CBavpMediaRecognizer::ReadFile( const TDesC& aFileName, TDes8& aBuf ) + { + RFile file; + TInt err; + + if ( FileHandleExists() ) + { + err = file.Duplicate( iFileHandle ); + } + else + { + err = file.Open( CEikonEnv::Static()->FsSession(), aFileName, + EFileRead | EFileShareAny ); + if ( err ) + { + err = file.Open( CEikonEnv::Static()->FsSession(), aFileName, + EFileRead | EFileShareReadersOnly ); + } + } + + if ( err ) + { + // If file does not exist + return err; + } + + // Read the beginning of the file + err = file.Read( 0, aBuf, iBufSize ); + file.Close(); + + return err; + } + +// ----------------------------------------------------------------------------- +// CBavpMediaRecognizer::FileHandleExists +// ----------------------------------------------------------------------------- +TBool CBavpMediaRecognizer::FileHandleExists() + { + TInt size(0); + TInt err(0); + + if ( iFileHandle.SubSessionHandle() ) + { + err = iFileHandle.Size( size ); + } + + return ( !err && size ) ? ETrue : EFalse; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpNPObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpNPObject.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,821 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES + +#include "BavpNPObject.h" +#include "BavpLogger.h" + +#include +#include +#include +#include + +#include "BavpPlugin.h" +#include "BavpController.h" +#include "BavpControllerVideo.h" +#include "BavpControllerAudio.h" + + +const int NUM_METHOD_IDENTIFIERS = 5; +const int ID_PLAY = 0; +const int ID_STOP = 1; +const int ID_PAUSE = 2; +const int ID_FASTFORWARD = 3; +const int ID_REWIND = 4; +static NPIdentifier bavpMethodIdentifiers[NUM_METHOD_IDENTIFIERS]; +static const NPUTF8 *bavpIdentifierNames[NUM_METHOD_IDENTIFIERS] = { + "play", + "stop", + "pause", + "fastforward", + "rewind", +}; + +const int NUM_PROPERTY_IDENTIFIERS = 10; +const int ID_VOLUME = 0; +const int ID_POSITION = 1; +const int ID_DURATION = 2; +const int ID_STATE_CHANGED_CALLBACK = 3; +const int ID_STATE = 4; +const int ID_ISVIDEOCLIP = 5; +const int ID_ISSEEKABLE = 6; +const int ID_CLIPNAME = 7; +const int ID_FULLSCREENMODE = 8; +const int ID_MIMETYPE = 9; +static NPIdentifier bavpPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS]; +static const NPUTF8 *bavpPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = { + "volume", + "position", + "duration", + "statechangedcallback", + "state", + "isvideoclip", + "isseekable", + "clipname", + "fullscreenmode", + "mimetype", +}; + +static bool _initializedIdentifiers = false; +static void initializeIdentifiers() +{ + if (!_initializedIdentifiers) { + _initializedIdentifiers = true; + NPN_GetStringIdentifiers (bavpPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, bavpPropertyIdentifiers); + NPN_GetStringIdentifiers (bavpIdentifierNames, NUM_METHOD_IDENTIFIERS, bavpMethodIdentifiers); + } +}; + + +_LIT8(KNone,"None"); +_LIT8(KBuffering,"Buffering"); +_LIT8(KPlaying,"Playing"); +_LIT8(KPlayComplete,"Playcomplete"); +_LIT8(KStopped,"Stopped"); +_LIT8(KPaused,"Paused"); +_LIT8(KBadContent,"Badcontent"); +_LIT8(KFastForwarding,"Fastforwarding"); +_LIT8(KFFComplete,"Fastforward complete"); +_LIT8(KRewinding,"Rewinding"); +_LIT8(KRewindComplete,"Rewinding complete"); +_LIT8(KInvalidState,"Invalid State"); + + +static const TPtrC8 getState(int state) +{ + TPtrC8 ret; + + switch (state) + { + case EBavpNone: + ret.Set(KNone); + break; + + case EBavpBuffering: + ret.Set(KBuffering); + break; + + case EBavpPlaying: + ret.Set(KPlaying); + break; + + case EBavpPlayComplete: + ret.Set(KPlayComplete); + break; + + case EBavpStopped: + ret.Set(KStopped); + break; + + case EBavpPaused: + ret.Set(KPaused); + break; + + case EBavpBadContent: + ret.Set(KBadContent); + break; + + case EBavpFastForwarding: + ret.Set(KFastForwarding); + break; + + case EBavpFastForwardComplete: + ret.Set(KFFComplete); + break; + + case EBavpRewinding: + ret.Set(KRewinding); + break; + + case EBavpRewindComplete: + ret.Set(KRewindComplete); + break; + + default: + ret.Set(KInvalidState); + break; + } + return ret; +} + +static void reportVolumeResults(int vol,CBavpController *ctlr) +{ + Log(ETrue,_L("SetProperty: Volume")); + + TInt setvol = ctlr->GetPlayerVolume(); + Log(ETrue,_L("Requested volume: "), vol); + Log(ETrue,_L("Volume set to: "),setvol); + + + if ( setvol == vol || setvol == KCRVolumeMax || setvol == KCRVolume0 ) + { + Log(ETrue,_L("Result: Passed")); + } + else + { + Log(ETrue,_L("Result: Failed")); + } +} + +static void reportPositionResultsL(int pos, CBavpController *ctlr) +{ + Log(ETrue,_L("SetProperty: Position")); + + if ( !(ctlr->IsClipSeekable()) && !(ctlr->IsClipLocalMedia()) ) + { + Log(ETrue,_L("Cannot set position for non-seekable and non-local media content")); + return; + } + + TTimeIntervalMicroSeconds ms = ctlr->getPositionL(); + TTimeIntervalMicroSeconds durationms = ctlr->Duration(); + + int setpos = (int)ms.Int64(); + int duration = (int)durationms.Int64(); + + Log(ETrue,_L("Requested position: "), pos); + Log(ETrue,_L("Position set to: "),setpos); + + if ( setpos == pos || setpos == duration || setpos == 0) + { + Log(ETrue,_L("Result: Passed")); + } + else + { + Log(ETrue,_L("Result: Failed")); + } +} + +static void reportPlayResultsL(int initState, CBavpController *ctlr) +{ + if ( ctlr->IsClipVideo()) + { + TPtrC8 expectedState = getState(EBavpPlaying); + TPtrC8 expectedState2 = getState(EBavpBuffering); + TPtrC8 actualState = getState(ctlr->State()); + + if ( initState == EBavpStopped || + initState == EBavpPlayComplete || + initState == EBavpRewindComplete || + initState == EBavpFastForwardComplete || + initState == EBavpBadContent) + { + TTimeIntervalMicroSeconds ms = ctlr->getPositionL(); + int actualpos = (int)ms.Int64(); + + Log(ETrue,_L("Expected Position: "), 0); + Log(ETrue,_L("Actual Position: "),actualpos); + + if ( actualpos != 0) + { + Log(ETrue,_L("Result: Position test failed")); + } + else + { + Log(ETrue,_L("Result:Position test passed")); + } + } + + if ( ctlr->IsClipOnDemand() && initState == EBavpStopped ) + { + Log(ETrue,_L8("Expected State: "), expectedState2); + Log(ETrue,_L8("Actual State: "), actualState); + } + else + { + Log(ETrue,_L8("Expected State: "), expectedState); + Log(ETrue,_L8("Actual State: "), actualState); + } + + if ( actualState.Compare(expectedState) != 0 && actualState.Compare(expectedState2) != 0) + { + Log(ETrue,_L("Result: State test failed")); + } + else + { + Log(ETrue,_L("Result: State test passed")); + } + } + else + { + TPtrC8 expectedState = getState(EBavpPlaying); + TPtrC8 actualState = getState(ctlr->State()); + + Log(ETrue,_L8("Expected State: "), expectedState); + Log(ETrue,_L8("Actual State: "), actualState); + + if ( expectedState.Compare(actualState) != 0) + { + Log(ETrue,_L("Result: Failed")); + } + else + { + Log(ETrue,_L("Result: Passed")); + } + } +} + +static void reportStopResultsL(CBavpController *ctlr) +{ + TPtrC8 expectedState = getState(EBavpStopped); + TPtrC8 actualState = getState(ctlr->State()); + TTimeIntervalMicroSeconds ms = ctlr->getPositionL(); + int position = (int)ms.Int64(); + + Log(ETrue,_L8("Expected State: "), expectedState); + Log(ETrue,_L8("Actual State: "), actualState); + Log(ETrue,_L("Current Position: "), position); + + if ( (position != 0) || (expectedState.Compare(actualState) != 0) ) + { + Log(ETrue,_L("Result: Failed")); + } + else + { + Log(ETrue,_L("Result: Passed")); + } +} + +static void reportRewindResults(CBavpController *ctlr) +{ + if ( ctlr->IsClipVideo() ) + { + if ( !(ctlr->IsClipSeekable()) && !(ctlr->IsClipLocalMedia()) ) + { + Log(ETrue,_L("Result: Rewind is not applicable to non-seekable and non-local media content")); + } + else + { + TPtrC8 expectedState = getState(EBavpRewinding); + TPtrC8 expectedState2 = getState(EBavpRewindComplete); + TPtrC8 actualState = getState(ctlr->State()); + + Log(ETrue,_L8("Expected State: "), expectedState); + Log(ETrue,_L8("Actual State: "), actualState); + + if ( (expectedState.Compare(actualState) != 0) && (expectedState2.Compare(actualState) != 0) ) + { + Log(ETrue,_L("Result: Failed")); + } + else + { + Log(ETrue,_L("Result: Passed")); + } + } + } + else + { + Log(ETrue,_L("Result: Rewind is not applicable to Audio")); + } + +} + +static void reportFFResults(CBavpController *ctlr) +{ + if ( ctlr->IsClipVideo() ) + { + if ( !(ctlr->IsClipSeekable()) && !(ctlr->IsClipLocalMedia()) ) + { + Log(ETrue,_L("Result: Fastforward is not applicable to non-seekable and non-local media content")); + } + else + { + TPtrC8 expectedState = getState(EBavpFastForwarding); + TPtrC8 expectedState2 = getState(EBavpFastForwardComplete); + TPtrC8 actualState = getState(ctlr->State()); + + Log(ETrue,_L8("Expected State: "), expectedState); + Log(ETrue,_L8("Actual State: "), actualState); + + if ( (expectedState.Compare(actualState) != 0) && (expectedState2.Compare(actualState) != 0) ) + { + Log(ETrue,_L("Result: Failed")); + } + else + { + Log(ETrue,_L("Result: Passed")); + } + } + } + else + { + Log(ETrue,_L("Result: Fastforward is not applicable to Audio")); + } + +} + +static void reportPauseResultsL(CBavpController *ctlr) +{ + TBool seekablevideo = (ctlr->IsClipSeekable() && ctlr->IsClipVideo()); + TBool seekableaudio = (ctlr->IsClipSeekable() && !ctlr->IsClipVideo() + && (ctlr->State() == EBavpPaused || ctlr->State() == EBavpPlaying)); + + if ( seekablevideo || seekableaudio ) + { + TPtrC8 expectedState = getState(EBavpPaused); + TPtrC8 actualState = getState(ctlr->State()); + + Log(ETrue,_L8("Expected State: "), expectedState); + Log(ETrue,_L8("Actual State: "), actualState); + + if ( (expectedState.Compare(actualState) != 0) ) + { + Log(ETrue,_L("Result: Failed")); + } + else + { + Log(ETrue,_L("Result: Passed")); + } + + } + else + { + reportStopResultsL(ctlr); + } +} + +static void BavpDesToNpvariant(TPtrC& string, NPVariant*& variant) +{ + char* newString = NULL; + if (string.Length()) { + newString = new char[string.Length()]; + } + if (newString) { + TPtr8 newStringPtr((unsigned char*)newString, 0, string.Length()); + newStringPtr.Copy(string); + STRINGN_TO_NPVARIANT(newString, string.Length(), *variant); + } +} + +static void BavpDesToNpvariant(TPtrC8& string, NPVariant*& variant) +{ + char* newString = NULL; + if (string.Length()) { + newString = new char[string.Length()]; + } + if (newString) { + Mem::Copy(newString, string.Ptr(), string.Length()); + STRINGN_TO_NPVARIANT(newString, string.Length(), *variant); + } +} + +NPObject *BavpAllocate () +{ + BavpNPObject *newInstance = (BavpNPObject *)User::AllocZ (sizeof(BavpNPObject)); + + return (NPObject *)newInstance; +} + +void BavpInvalidate () +{ + // Make sure we've released any remainging references to JavaScript + // objects. +} + +void BavpDeallocate (BavpNPObject *obj) +{ + if (obj->stateChangedCallback) + NPN_ReleaseObject((struct NPObject*)obj->stateChangedCallback); + User::Free ((void *)obj); +} + +bool BavpHasMethod(BavpNPObject */*obj*/, NPIdentifier name) +{ + int i; + for (i = 0; i < NUM_METHOD_IDENTIFIERS; i++) { + if (name == bavpMethodIdentifiers[i]){ + return true; + } + } + return false; +} + + +bool BavpInvokeL(BavpNPObject *obj, NPIdentifier name, const NPVariant */* args */, uint32_t /* argCount */, NPVariant *result) +{ + if (!obj->plugin) { + NULL_TO_NPVARIANT(*result); + return true; + } + + CBavpController *ctlr = obj->plugin->Controller(); + + if (!ctlr) + { + NULL_TO_NPVARIANT(*result); + return true; + } + + int initState = ctlr->State(); + Log( ETrue, _L("\n")); + Log( ETrue, _L8("Initial state:"), getState(initState)); + + if (name == bavpMethodIdentifiers[ID_PLAY]) + { + Log( ETrue, _L("Method Invoked: Play")); + if ( ctlr->State() != EBavpPlaying ) + { + ctlr->PlayL(); + } + VOID_TO_NPVARIANT(*result); + reportPlayResultsL(initState,ctlr); + } + else if (name == bavpMethodIdentifiers[ID_STOP]) + { + Log( ETrue, _L("Method Invoked: Stop")); + if ( ctlr->State() != EBavpStopped ) + { + ctlr->Stop(); + } + VOID_TO_NPVARIANT(*result); + reportStopResultsL(ctlr); + } + else if (name == bavpMethodIdentifiers[ID_PAUSE]) + { + Log( ETrue, _L("Method Invoked: Pause")); + if ( ctlr->State() != EBavpPaused ) + { + ctlr->PauseL(); + } + VOID_TO_NPVARIANT(*result); + reportPauseResultsL(ctlr); + } + else if (name == bavpMethodIdentifiers[ID_FASTFORWARD]) + { + Log( ETrue, _L("Method Invoked: FastForward")); + if ( ctlr->State() == EBavpRewinding ) + { + ctlr->PauseL(); + } + + if ( ctlr->State() != EBavpFastForwarding ) + { + ctlr->FastForwardL(); + } + VOID_TO_NPVARIANT(*result); + reportFFResults(ctlr); + } + else if (name == bavpMethodIdentifiers[ID_REWIND]) + { + Log( ETrue, _L("Method Invoked: Rewind")); + if ( ctlr->State() == EBavpFastForwarding ) + { + ctlr->PauseL(); + } + + if ( ctlr->State() != EBavpRewinding ) + { + ctlr->RewindL(); + } + VOID_TO_NPVARIANT(*result); + reportRewindResults(ctlr); + } + else + { + Log( ETrue, _L("Unknown method invoked")); + return false; + } + + return true; +} + +bool BavpHasProperty(BavpNPObject */*obj*/, NPIdentifier name) +{ + int i; + for (i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++) + { + if (name == bavpPropertyIdentifiers[i]){ + return true; + } + } + return false; +} + +bool BavpGetPropertyL (BavpNPObject *obj, NPIdentifier name, NPVariant *variant) +{ + if (!obj->plugin || !(obj->plugin->Controller())){ + NULL_TO_NPVARIANT(*variant); + return false; + } + + + if (name == bavpPropertyIdentifiers[ID_VOLUME]) + { + INT32_TO_NPVARIANT(obj->plugin->Controller()->GetPlayerVolume(), *variant); + } + + else if (name == bavpPropertyIdentifiers[ID_POSITION]) + { + TTimeIntervalMicroSeconds ms = obj->plugin->Controller()->getPositionL(); + int time = (int)ms.Int64(); + INT32_TO_NPVARIANT(time, *variant); + + } + + else if (name == bavpPropertyIdentifiers[ID_DURATION]) + { + TTimeIntervalMicroSeconds ms = obj->plugin->Controller()->Duration(); + int time = (int)ms.Int64(); + INT32_TO_NPVARIANT(time, *variant); + } + + else if (name == bavpPropertyIdentifiers[ID_STATE_CHANGED_CALLBACK]) + { + if (obj->stateChangedCallback) + OBJECT_TO_NPVARIANT(obj->stateChangedCallback, *variant); + else + NULL_TO_NPVARIANT(*variant); + } + else if (name == bavpPropertyIdentifiers[ID_STATE]) + { + TPtrC8 state = getState((TInt)(obj->plugin->Controller()->State())); + BavpDesToNpvariant(state, variant); + } + else if (name == bavpPropertyIdentifiers[ID_ISVIDEOCLIP]) + { + BOOLEAN_TO_NPVARIANT(obj->plugin->Controller()->IsClipVideo(), *variant); + } + else if (name == bavpPropertyIdentifiers[ID_ISSEEKABLE]) + { + BOOLEAN_TO_NPVARIANT(obj->plugin->Controller()->IsClipSeekable(), *variant); + } + else if (name == bavpPropertyIdentifiers[ID_CLIPNAME]) + { + const HBufC& name = obj->plugin->Controller()->ClipName(); + + TInt lastSlashPos = name.LocateReverse( '/' ); + //retrieve the clip name + if( lastSlashPos == KErrNotFound ) { + lastSlashPos = 0; + } + + TInt len = name.Length()-lastSlashPos-1; + TPtrC namePtr( name.Right(len)); + BavpDesToNpvariant(namePtr, variant); + } + else if (name == bavpPropertyIdentifiers[ID_FULLSCREENMODE]) + { + BOOLEAN_TO_NPVARIANT(obj->plugin->Controller()->IsClipFullScreen(), *variant); + } + else if (name == bavpPropertyIdentifiers[ID_MIMETYPE]) + { + const HBufC8& name = obj->plugin->Controller()->MimeType(); + TPtrC8 namePtr(name); + BavpDesToNpvariant(namePtr, variant); + } + else + { + return false; + } + + return true; + +} + + +bool BavpSetPropertyL (BavpNPObject *obj, NPIdentifier name, NPVariant *variant) +{ + if (!obj->plugin) + return false; + + CBavpController *ctlr = obj->plugin->Controller(); + + if (!ctlr) + return false; + + Log(ETrue,_L("\n")); + + if (name == bavpPropertyIdentifiers[ID_VOLUME]) + { + int vol = 0; + + if (NPVARIANT_IS_DOUBLE(*variant)) + vol = (int)NPVARIANT_TO_DOUBLE(*variant); + else if (NPVARIANT_IS_INT32(*variant)) + vol = NPVARIANT_TO_INT32(*variant); + else + { + Log(ETrue,_L("SetProperty: Not a valid value for volume")); + return false; + } + + ctlr->SetPlayerVolume(vol); + reportVolumeResults(vol,ctlr); + } + + else if (name == bavpPropertyIdentifiers[ID_POSITION]) + { + int pos = 0; + + if (NPVARIANT_IS_DOUBLE(*variant)) + pos = (int)NPVARIANT_TO_DOUBLE(*variant); + else if (NPVARIANT_IS_INT32(*variant)) + pos = NPVARIANT_TO_INT32(*variant); + else + { + Log(ETrue,_L("SetProperty: Not a valid value for position")); + return false; + } + + TInt64 ms(pos); + CBavpController *ctlr = obj->plugin->Controller(); + int state = ctlr->State(); + + if ( state != EBavpRewinding && state != EBavpFastForwarding ) + { + ctlr->setPositionL(TTimeIntervalMicroSeconds(ms)); + } + else + { + ctlr->Stop(); + ctlr->setPositionL(TTimeIntervalMicroSeconds(ms)); + } + + reportPositionResultsL(pos,ctlr); + } + + else if (name == bavpPropertyIdentifiers[ID_STATE_CHANGED_CALLBACK]) + { + //int count = 0; + if (NPVARIANT_IS_NULL(*variant)) + { + if (obj->stateChangedCallback) + { + NPN_ReleaseObject((struct NPObject*)obj->stateChangedCallback); + obj->stateChangedCallback = 0; + } + } + else if (NPVARIANT_IS_OBJECT(*variant)) + { + NPObject* callback = NPVARIANT_TO_OBJECT(*variant); + if (obj->stateChangedCallback) + { + NPN_ReleaseObject((struct NPObject*)obj->stateChangedCallback); + obj->stateChangedCallback = 0; + } + NPN_RetainObject((struct NPObject*)callback); + obj->stateChangedCallback = callback; + } + return true; + } + + else if (name == bavpPropertyIdentifiers[ID_FULLSCREENMODE]) + { + int pos = 0; + TBool newmode, needtochange; + CBavpController *ctlr = obj->plugin->Controller(); + + if ( !(ctlr->IsClipVideo()) ) + { + Log(ETrue,_L("Fullscreenmode not applicable for audio")); + return false; + } + + if (NPVARIANT_IS_INT32(*variant)) + { + pos = NPVARIANT_TO_INT32(*variant); + } + else if (NPVARIANT_IS_DOUBLE(*variant)) + { + pos = (int)NPVARIANT_TO_DOUBLE(*variant); + } + else if (NPVARIANT_IS_BOOLEAN(*variant)) + { + pos = NPVARIANT_TO_BOOLEAN(*variant) ? 1 : 0; + } + + else + { + Log(ETrue,_L("SetProperty: Not a valid value for fullscreenmode")); + return false; + } + + Log(ETrue,_L("SetProperty: Fullscreenmode")); + + newmode = (pos == 1); + needtochange = (ctlr->IsClipFullScreen() != newmode); + + if ( ctlr->IsClipFullScreen() ) + { + Log(ETrue,_L("Current mode: Fullscreen")); + } + else + { + Log(ETrue,_L("Current mode: Normalscreen")); + } + + if ( newmode ) + { + Log(ETrue,_L("Requested mode: Fullscreen")); + } + else + { + Log(ETrue,_L("Requested mode: Normalscreen")); + } + + + if ( !needtochange ) + { + Log(ETrue,_L("No need for mode change")); + return false; + } + + ((CBavpControllerVideo *)ctlr)->HandleCommandL(EBavpCmdPlayFullScreen); + } + else + { + return false; + } + + return true; +} + + +static NPClass _BavpNPClass = { + 0, + (NPAllocateFunctionPtr) BavpAllocate, + (NPDeallocateFunctionPtr) BavpDeallocate, + (NPInvalidateFunctionPtr) BavpInvalidate, + (NPHasMethodFunctionPtr) BavpHasMethod, + (NPInvokeFunctionPtr) BavpInvokeL, + (NPInvokeDefaultFunctionPtr) 0, + (NPHasPropertyFunctionPtr) BavpHasProperty, + (NPGetPropertyFunctionPtr) BavpGetPropertyL, + (NPSetPropertyFunctionPtr) BavpSetPropertyL, + (NPRemovePropertyFunctionPtr) 0 +}; +static NPClass *BavpNPClass = &_BavpNPClass; + + +BavpNPObject* BavpNPObject_new(NPP instance) +{ + initializeIdentifiers(); + BavpNPObject *self = (BavpNPObject *)NPN_CreateObject (instance, BavpNPClass); + return self; +} + +void BavpNPObject_stateChanged(BavpNPObject* obj, char* state) +{ + if (!obj || !obj->stateChangedCallback) + return; + NPVariant arg; + NPVariant res; + STRINGZ_TO_NPVARIANT(state, arg); + NPN_InvokeDefault(obj->nppInstance, obj->stateChangedCallback, &arg, 1, &res); +} diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpPlugin.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,477 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser for handling embedded video requests. +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "BavpLogger.h" +#include "BavpPlugin.h" +#include "BavpView.h" +#include "BavpControllerAudio.h" +#include "BavpControllerVideo.h" + +#include +using namespace RT_GestureHelper; + +// CONSTANTS +_LIT( KBrowserAVPluginRscFileZ, "z:BrowserAudioVideoPlugin.rsc" ); +_LIT( KBrowserAVPluginRscFile, "\\resource\\BrowserAudioVideoPlugin.rsc"); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpPlugin::CBavpPlugin +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpPlugin::CBavpPlugin() + : iError( EFalse ), + iMimeType( NULL ), + iPauseState ( EFalse ), + iIsForeGround ( ETrue ), + iPauseInBackground (EFalse), + iPlayFromFile(EFalse) + { + + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpPlugin::ConstructL() + { + TFileName fileName; + TParse parse; + + Dll::FileName (fileName); + parse.Set(KBrowserAVPluginRscFile, &fileName, NULL); + fileName = parse.FullName(); + BaflUtils::NearestLanguageFile(CCoeEnv::Static()->FsSession(), fileName); + if ( !BaflUtils::FileExists( CCoeEnv::Static()->FsSession(), fileName ) ) + { + // Use the Z drive one + parse.Set( KBrowserAVPluginRscFileZ, &KDC_RESOURCE_FILES_DIR, NULL ); + fileName = parse.FullName(); + BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(),fileName ); + } + iResourceOffset = CCoeEnv::Static()->AddResourceFileL( fileName ); + iDrmHelper = CDRMHelper::NewL( *CCoeEnv::Static() ); + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CBavpPlugin* CBavpPlugin::NewL() + { + Log( EFalse, _L("CBavpPlugin::NewL") ); + + CBavpPlugin* self = new (ELeave) CBavpPlugin; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::Destructor +// ----------------------------------------------------------------------------- +CBavpPlugin::~CBavpPlugin() + { + Log( EFalse, _L("CBavpPlugin::~CBavpPlugin") ); + + delete iBavpController; + + delete iFileName; + + delete iBavpView; + + delete iDrmHelper; + + if ( iMimeType ) + { + delete iMimeType; + } + + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); + } + if ( iNPObject ) + { + if (iNPObject->plugin == this) + iNPObject->plugin = 0; + NPN_ReleaseObject((struct NPObject*)(iNPObject)); + } + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::SetWindowL +// Handles the creation of the window for the video file. +// Called by Browser for window creation. +// aPluginAdapter allows callback to Browser. aRect is window size. +// ----------------------------------------------------------------------------- +void CBavpPlugin::SetWindowL( MPluginAdapter *aPluginAdapter, + NPWindow* aWindow, NPP aInstance ) + { + Log( EFalse, _L("CBavpPlugin::SetWindowL") ); + + // Set our PluginAdapter + iPluginAdapter = aPluginAdapter; + iNPP = aInstance; + + // Check if error occurs last time for setWindowL + if ( iError ) + { + // Stop browser calling NotifyL + iPluginAdapter->SetPluginNotifier( NULL ); + + // Error detected on OpenAndPlayFile + return; + } + + if ( !iBavpView ) + { + iBavpView = CBavpView::NewL( (CCoeControl*)iPluginAdapter->GetParentControl(), TRect(0, 0, 0, 0), this); + + // Note: The pluginAdapter returns NULL + iBavpView->SetObserver( aPluginAdapter->GetParentControlObserver() ); + + // Register for Browser Notifications + iPluginAdapter->SetPluginNotifier( (MPluginNotifier *)this ); + + // Add option menu handler + iPluginAdapter->SetOptionMenuHandler( (MOptionMenuHandler *)iBavpView ); + + // Notify Browser that plugin has been constructed + iPluginAdapter->PluginConstructedL( iBavpView ); + } + else + { + // Only setRect() is enough, since it calls SizeChanged() and + // inside it refreshes the rect's coordinate + iBavpView->SetRect( aWindow ); + + // If we have a Rtsp scheme, we need to play it (aka start the + // BavpControllerVideo). We only do this once + if ( iRtspUrl ) + { + OpenAndPlayUrlL( *iRtspUrl ); + delete iRtspUrl; + iRtspUrl = NULL; + } + } + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::OpenAndPlayFileL +// Called by Browser when ready for file to be played +// ----------------------------------------------------------------------------- +void CBavpPlugin::OpenAndPlayFileL( const TDesC& aFilename, const HBufC* originalFileName ) + { + iPlayFromFile = ETrue; + Log( EFalse, _L("CBavpPlugin::OpenAndPlayFileL"), (TInt)this ); + + if ( !iBavpView ) + { + // The view is not set yet. + // Re-invoke the OpenAndPlayFile after the window has been initialized + delete iFileName; + iFileName = NULL; + iFileName = aFilename.AllocL(); + } + else + { + if ( iBavpController ) + { + // Will stop current audio or video player + delete iBavpController; + iBavpController = NULL; + + // Set to null, otherwise, plugin will crash when it switches file + iBavpView->SetBavpController( NULL ); + } + + // Determine if file is audio or video, so we can start up an audio + // or video controller + CBavpMediaRecognizer* mediaRecognizer = CBavpMediaRecognizer::NewL(); + CleanupStack::PushL( mediaRecognizer ); + TBavpMediaType mediaType = mediaRecognizer->IdentifyMediaTypeL( aFilename ); + CleanupStack::PopAndDestroy(); // mediaRecognizer + + // Do we have audio content, let the audio controller handle it + if ( mediaType == ELocalAudioFile || mediaType == ELocalAudioPlaylist ) + { + iBavpController = CBavpControllerAudio::NewL( iBavpView, + iAccessPtId, + mediaType, + aFilename ); + } + else + { + // We got other content, let the video controller handle it. + iBavpController = CBavpControllerVideo::NewL( iBavpView, + iAccessPtId, + mediaType, + aFilename ); + } + + // Set the volume and loop from the attribute values + iBavpController->SetVolumeFromAttribute( iVolume ); + iBavpController->SetLoopFromAttribute( iLoop, iInfiniteFlag ); + + // Set the original file name & mime type + iBavpController->SetOriginalFileName(originalFileName); + iBavpController->SetMimeType(iMimeType); + + iBavpView->SetBavpController( iBavpController ); + + TRAPD( err, iBavpController->PlayAudioVideoL() ); + if ( err ) + { + Log( EFalse, _L("CBavpPlugin::OpenAndPlayFileL ERROR from PlayAudioVideoL") ); + iBavpController->iCurrentState = EBavpBadContent; + iBavpView->UpdateView(); + User::Leave( err ); + } + } + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::OpenAndPlayUrlL +// Called by Browser when ready for url to be played +// ----------------------------------------------------------------------------- +void CBavpPlugin::OpenAndPlayUrlL( const TDesC& aUrl ) + { + iPlayFromFile = EFalse; + Log( EFalse, _L("CBavpPlugin::OpenAndPlayUrlL"), (TInt)this ); + + if ( iBavpController ) + { + // Will stop current audio or video player + delete iBavpController; + iBavpController = NULL; + + // Set to null, otherwise, plugin will crash when it switches file + iBavpView->SetBavpController( NULL ); + } + + iBavpController = CBavpControllerVideo::NewL( iBavpView, + iAccessPtId, + EUrl, + aUrl ); + + // iRtspUrl is used as a flag in SetWindow, which is re-entrant, so delete + // once we got a controller for it + delete iRtspUrl; + iRtspUrl = NULL; + + // Set the volume and loop from the attribute values + iBavpController->SetVolumeFromAttribute( iVolume ); + iBavpController->SetLoopFromAttribute( iLoop, iInfiniteFlag ); + + iBavpView->SetBavpController( iBavpController ); + + iBavpController->PlayAudioVideoL(); + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::SetAccessPtId +// Sets access pt id to be used +// ----------------------------------------------------------------------------- +void CBavpPlugin::SetAccessPtId( TUint aAccessPtId ) + { + iAccessPtId = aAccessPtId; + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::SetVolumeAndLoop +// Called to set the volume and loop value that we get from the webpage source +// to be able to use it later +// ----------------------------------------------------------------------------- +void CBavpPlugin::SetVolumeAndLoop( TInt aVolume, TInt aLoop, TInt aInfiniteFlag ) + { + // Save volume attribute value, pass to controller after it initializes + iVolume = aVolume; + + // Save loop attribute values, pass to controller after it initializes + iLoop = aLoop; + iInfiniteFlag = aInfiniteFlag; + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::SetVolumeAndLoop +// Called to set the volume and loop value that we get from the webpage source +// to be able to use it later +// ----------------------------------------------------------------------------- +void CBavpPlugin::SetRtspUriL( const TDesC& aRtspUri ) + { + iRtspUrl = aRtspUri.AllocL(); + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::NotifyL +// MPluginNotifier callback, Browser calls this to inform Plugin of some event. +// The biggest use is when the Browser goes in-focus or out-focus. Out-foucus +// can happen when other component takes top of CCoeControl stack, such as the +// Option Menu, another application, Screen saver, ... +// ----------------------------------------------------------------------------- +TInt CBavpPlugin::NotifyL( TNotificationType aCallType, void* aParam ) + { + if(iBavpController) + { + //if player is paused due to focus change or Visual history back and manually pressed Play, then we need + //to clear the pause state. + if(EBavpPlaying == iBavpController->State() && iPauseState) + { + iPauseState = EFalse; + } + } + + switch ( aCallType ) + { + case EApplicationFocusChanged: + // The browser has gone in-focus (foreground), or out-focus + // (background), i.e. the browser is not on top of CCoeControl stack, + // so inform this plugin if it is in-focus or out-focus + if ( iBavpController ) + { + // If Browser out-focus, we send this plugin aParam=EFalse. + // If Browser in-focus, we send this plugin aParam=ETrue, if + // the plugin is (was) in-focus or activated. + iBavpController->HandleBrowserNotification( TBool(aParam) ); + if(!aParam) //app background + { + iIsForeGround = EFalse; + //Pause for Live stream will Leave with KErrNotSupported from Helix player + //and intern session will be closed. For Live stream Pause should not be done + if(EBavpPlaying == iBavpController->State() && ( !iBavpController->IsClipLive()) ) + { + iPauseState = ETrue; + iPauseInBackground = ETrue; + iBavpController->PauseL(); + } + } + else //app foreground + { + iIsForeGround = ETrue; + if(EBavpPaused == iBavpController->State() && iPauseInBackground) + { + iPauseState = EFalse; + iPauseInBackground = EFalse; + iBavpController->PlayL(); + } + + } + + } + break; + + case EPluginPause : + if( !aParam ) + { + if(iBavpController && iPauseState && (iBavpController->State() == EBavpPaused) && (iIsForeGround)) + { + iPauseState = EFalse; + iBavpController->PlayL(); + } + } + + break; + case EPluginInvisible : + if( !aParam ) + { + if ( iBavpController && (!iPauseState) ) //plugin background + { + //Pause for Live stream will Leave with KErrNotSupported from Helix player + //and intern session will be closed. For Live stream Pause should not be done + if( (EBavpPlaying == iBavpController->State() ) && ( !iBavpController->IsClipLive()) ) + { + iPauseState = ETrue; + iBavpController->PauseL(); + } + } + } + else if(iBavpController && iPauseState && (iBavpController->State() == EBavpPaused) && (iIsForeGround)) + { + iPauseState = EFalse; + iBavpController->PlayL(); + } + break; + case EAccesPointChanged : + if (iBavpController && !iPlayFromFile) { + bool state = (iBavpController->State() == EBavpPaused || + iBavpController->State() == EBavpPlaying || + iBavpController->State() == EBavpBuffering || + iBavpController->State() == EBavpFastForwarding || + iBavpController->State() == EBavpRewinding ); + iBavpController->Stop(); + if (state) + iBavpController->PlayL(); + } + break; + + default: + // Not implemented + break; + + }; // end of switch + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::SetMimeType +// Sets the mime name. Used for scripting functionality +// ----------------------------------------------------------------------------- +void CBavpPlugin::SetMimeType( NPMIMEType type ) + { + iMimeType = type.Alloc(); + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::HandleGesture +// ----------------------------------------------------------------------------- +TBool CBavpPlugin::HandleGesture(void* aEvent) + { + TBool ret = EFalse; + TGestureEvent *gesture = static_cast(aEvent); + // Fix crash when iBavpController is null for bug EGUY-7TYHDC + if (iBavpController) { + ret = iBavpController->HandleGesture(gesture); + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// CBavpPlugin::getNPNFuncs +// ----------------------------------------------------------------------------- +NPNetscapeFuncs* CBavpPlugin::getNPNFuncs() + { + CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); + return npm ? npm->Funcs() : NULL; + } + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,796 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Uses the interface MPluginAdapter to notify browser of construction + and destruction of the plug-in, implements interface MPluginOptionHandler + to add menus and draws animated images while video player loading the data +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include // For TResourceReader +#include +#include +#include // For text + +#include + +#include "BavpLogger.h" +#include "BavpView.h" +#include "BavpController.h" +#include "BavpPlugin.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBavpView::CBavpView +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpView::CBavpView() + { + } + +// ----------------------------------------------------------------------------- +// CBavpView::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBavpView::ConstructL( const CCoeControl* aParent, + const TRect& aRect, CBavpPlugin* aBavPlugin ) + { + Log( EFalse, _L("CBavpView::ConstructL") ); + iBavPlugin = aBavPlugin; + + CreateWindowL(aParent); +#ifdef BRDO_MULTITOUCH_ENABLED_FF + if (AknLayoutUtils::PenEnabled()) { + DrawableWindow()->SetPointerGrab(ETrue); + EnableDragEvents(); + } + //To enable advance pointer info for multi-touch + Window().EnableAdvancedPointers(); +#endif + ActivateL(); // Draws icon + iRect = aRect; + CCoeControl::SetRect( aRect ); // Calls SizeChanged + + User::LeaveIfError( iWsSession.Connect() ); + iWindowId = iCoeEnv->RootWin().Identifier(); + + // Video buffering animation, used to show that content is buffering + iVideoBuffAnimation = CAknBitmapAnimation::NewL(); + iVideoBuffAnimation->SetContainerWindowL( *this ); + TResourceReader rrBuffering; + iCoeEnv->CreateResourceReaderLC( rrBuffering, R_ANIMATION_BUFFERING ); + iVideoBuffAnimation->ConstructFromResourceL( rrBuffering ); + CleanupStack::PopAndDestroy(); // rrBuffering + iIsVideoBuffAnimRunning = EFalse; + + // Bad content animation, used to show that content is not available + iBadContentAnimation = CAknBitmapAnimation::NewL(); + iBadContentAnimation->SetContainerWindowL( *this ); + TResourceReader rrNoContentAnim; + iCoeEnv->CreateResourceReaderLC( rrNoContentAnim, R_NO_CONTENT_ANIMATION ); + iBadContentAnimation->ConstructFromResourceL( rrNoContentAnim ); + CleanupStack::PopAndDestroy(); // rrNoContentAnim + iIsBadContentAnimRunning = EFalse; + + // Video stopped animation, used to show that video content is stopped + iVideoStoppedAnimation = CAknBitmapAnimation::NewL(); + iVideoStoppedAnimation->SetContainerWindowL( *this ); + TResourceReader rrVideoStoppedAnim; + iCoeEnv->CreateResourceReaderLC( rrVideoStoppedAnim, R_VIDEO_STOPPED_ANIMATION ); + iVideoStoppedAnimation->ConstructFromResourceL( rrVideoStoppedAnim ); + CleanupStack::PopAndDestroy(); // rrVideoStoppedAnim + iIsVideoStoppedAnimRunning = EFalse; + + // Video paused animation, used to show that video content is paused + iVideoPausedAnimation = CAknBitmapAnimation::NewL(); + iVideoPausedAnimation->SetContainerWindowL( *this ); + TResourceReader rrVideoPausedAnim; + iCoeEnv->CreateResourceReaderLC( rrVideoPausedAnim, R_VIDEO_PAUSED_ANIMATION ); + iVideoPausedAnimation->ConstructFromResourceL( rrVideoPausedAnim ); + CleanupStack::PopAndDestroy(); // rrVideoPausedAnim + iIsVideoPausedAnimRunning = EFalse; + + // Audio playing animation, used when no video is present, only audio + iAudioPlayAnimation = CAknBitmapAnimation::NewL(); + iAudioPlayAnimation->SetContainerWindowL( *this ); + TResourceReader rrAudioPlayAnim; + iCoeEnv->CreateResourceReaderLC( rrAudioPlayAnim, R_AUDIO_PLAY_ANIMATION ); + iAudioPlayAnimation->ConstructFromResourceL( rrAudioPlayAnim ); + CleanupStack::PopAndDestroy(); // rrAudioPlayAnim + iIsAudioPlayAnimRunning = EFalse; + + // Audio stopped animation, used to show that audio content is stopped + iAudioStoppedAnimation = CAknBitmapAnimation::NewL(); + iAudioStoppedAnimation->SetContainerWindowL( *this ); + TResourceReader rrAudioStoppedAnim; + iCoeEnv->CreateResourceReaderLC( rrAudioStoppedAnim, R_AUDIO_STOPPED_ANIMATION ); + iAudioStoppedAnimation->ConstructFromResourceL( rrAudioStoppedAnim ); + CleanupStack::PopAndDestroy(); // rrAudioStoppedAnim + iIsAudioStoppedAnimRunning = EFalse; + + // Audio paused animation, used to show that audio content is paused + iAudioPausedAnimation = CAknBitmapAnimation::NewL(); + iAudioPausedAnimation->SetContainerWindowL( *this ); + TResourceReader rrAudioPausedAnim; + iCoeEnv->CreateResourceReaderLC( rrAudioPausedAnim, R_AUDIO_PAUSED_ANIMATION ); + iAudioPausedAnimation->ConstructFromResourceL( rrAudioPausedAnim ); + CleanupStack::PopAndDestroy(); // rrAudioPausedAnim + iIsAudioPausedAnimRunning = EFalse; + + Log( EFalse, _L("CBavpView::ConstructL - Start Buffering animation") ); + RunAnimation(iVideoBuffAnimation, iIsVideoBuffAnimRunning); + } + +// ----------------------------------------------------------------------------- +// CBavpView::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CBavpView* CBavpView::NewL( const CCoeControl* aParent, + const TRect& aRect, CBavpPlugin* aBavPlugin ) + { + Log( EFalse, _L("CBavpView::NewL") ); + + CBavpView* self = new( ELeave ) CBavpView; + CleanupStack::PushL( self ); + self->ConstructL( aParent, aRect, aBavPlugin ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBavpView::Destructor +// ----------------------------------------------------------------------------- +CBavpView::~CBavpView() + { + Log( EFalse, _L("CBavpView::~CBavpView") ); + + // Check if the keyhandling is on the stack, if yes, remove it + if ( iIsOnStack ) + { + // Check if the animation is active + // if it is not start animation + iEikonEnv->EikAppUi()->RemoveFromStack( this ); + } + + // Cancel video buffering animation, if it's still running + if ( iIsVideoBuffAnimRunning ) + { + iVideoBuffAnimation->CancelAnimation(); + } + delete iVideoBuffAnimation; + + // Cancel video stopped animation, if it's still running + if ( iIsVideoStoppedAnimRunning ) + { + iVideoStoppedAnimation->CancelAnimation(); + } + delete iVideoStoppedAnimation; + + // Cancel video paused animation, if it's still running + if ( iIsVideoPausedAnimRunning ) + { + iVideoPausedAnimation->CancelAnimation(); + } + delete iVideoPausedAnimation; + + // Cancel audio only animation, if it's still running + if ( iIsAudioPlayAnimRunning ) + { + iAudioPlayAnimation->CancelAnimation(); + } + delete iAudioPlayAnimation; + + // Cancel audio stopped animation, if it's still running + if ( iIsAudioStoppedAnimRunning ) + { + iAudioStoppedAnimation->CancelAnimation(); + } + delete iAudioStoppedAnimation; + + // Cancel audio paused animation, if it's still running + if ( iIsAudioPausedAnimRunning ) + { + iAudioPausedAnimation->CancelAnimation(); + } + delete iAudioPausedAnimation; + + // Cancel bad content animation, if it's still running + if ( iIsBadContentAnimRunning ) + { + iBadContentAnimation->CancelAnimation(); + } + delete iBadContentAnimation; + + iWsSession.Close(); + } + +// ----------------------------------------------------------------------------- +// CBavpView::SizeChanged +// Responds to size changes to sets the size and position of the contents of +// this control +// ----------------------------------------------------------------------------- +void CBavpView::SizeChanged() + { + Log( EFalse, _L("CBavpView::SizeChanged") ); + + if ( iBavpController ) + { + iRect = Rect(); + iBavpController->RefreshRectCoordinatesL(); + } + } + +// ----------------------------------------------------------------------------- +// CBavpView::AddPluginOptionMenuItemsL +// Add the Option Menu items to the menuPane, these will be handled by plugin. +// ----------------------------------------------------------------------------- +void CBavpView::AddPluginOptionMenuItemsL( CEikMenuPane& aMenuPane, + TInt aCommandBase, + TInt /*aAfter*/ ) + { + Log( EFalse, _L("CBavpView::AddPluginOptionMenuItemsL") ); + + iCommandBase = aCommandBase; + TInt index( 0 ); + + // The menus are only added, if the controller exists and we're in + // normal screen and not bad content + if ( !iBavpController || iBavpController->IsClipFullScreen() || + iBavpController->State() == EBavpBadContent ) + { + return; + } + + // Display the "Mute" menu item, unless we have HW volume keys, and... + if ( !HAS_HW_VOLUME_KEYS && + !iBavpController->IsVolumeMuted() && + !iBavpController->IsClipRewinding() && + !iBavpController->IsClipFastForwarding() ) + { + InsertOneMenuItemL( aMenuPane, EBavpCmdMuteVolume, + R_TEXT_VIDEO_PLUGIN_VOLUME_MUTE, index); + index++; + } + + // Check CurrentState to determine the menu items to add + switch ( iBavpController->State() ) + { + case EBavpStopped: + case EBavpRewindComplete: + case EBavpPlayComplete: + { + // The content is at the beginning, user can play + InsertOneMenuItemL( aMenuPane, EBavpCmdPlay, + R_TEXT_VIDEO_PLUGIN_PLAY, index ); + index ++; + break; + } + case EBavpPlaying: + { + // Check if it can be paused + if ( iBavpController->IsClipSeekable() ) + { + InsertOneMenuItemL( aMenuPane, EBavpCmdPause, + R_TEXT_VIDEO_PLUGIN_PAUSE, index); + index++; + } + + // If playing, user can also stop + InsertOneMenuItemL( aMenuPane, EBavpCmdStop, + R_TEXT_VIDEO_PLUGIN_STOP, index ); + index++; + // Add FF and Rewind, only if content seekable, local media, video + if ( iBavpController->IsClipSeekable() && + iBavpController->IsClipLocalMedia() && + iBavpController->IsClipVideo() ) + { + InsertOneMenuItemL( aMenuPane, EBavpCmdFastForward, + R_TEXT_VIDEO_PLUGIN_FAST_FORWARD, index ); + index++; + InsertOneMenuItemL( aMenuPane, EBavpCmdRewind, + R_TEXT_VIDEO_PLUGIN_REWIND, index ); + index++; + } + // Add full screen, only if video content + if ( iBavpController->IsClipVideo() ) + { + InsertOneMenuItemL( aMenuPane, EBavpCmdPlayFullScreen, + R_TEXT_VIDEO_PLUGIN_FULL_SCREEN, index ); + index++; + } + break; + } + case EBavpPaused: + { + // If paused, user can continue (play) or stop + InsertOneMenuItemL( aMenuPane, EBavpCmdPlay, + R_TEXT_VIDEO_PLUGIN_PLAY, index ); + index++; + + InsertOneMenuItemL( aMenuPane, EBavpCmdStop, + R_TEXT_VIDEO_PLUGIN_STOP, index ); + index++; + // Add FF and Rewind, only if content seekable, local media, video + if ( iBavpController->IsClipSeekable() && + iBavpController->IsClipLocalMedia() && + iBavpController->IsClipVideo() ) + { + InsertOneMenuItemL( aMenuPane, EBavpCmdFastForward, + R_TEXT_VIDEO_PLUGIN_FAST_FORWARD, index ); + index++; + InsertOneMenuItemL( aMenuPane, EBavpCmdRewind, + R_TEXT_VIDEO_PLUGIN_REWIND, index ); + index++; + } + break; + } + case EBavpFastForwarding: + case EBavpRewinding: + { + // User can play, while FF or Rewinding + InsertOneMenuItemL( aMenuPane, EBavpCmdPlay, + R_TEXT_VIDEO_PLUGIN_PLAY, index ); + index++; + // Add pause, we should only be fast-forwarding or rewinding + // seekable content, no need to check + InsertOneMenuItemL( aMenuPane, EBavpCmdPause, + R_TEXT_VIDEO_PLUGIN_PAUSE, index); + index++; + break; + } + case EBavpFastForwardComplete: + { + // Content is at the end, user can replay + InsertOneMenuItemL( aMenuPane, EBavpCmdPlay, + R_TEXT_VIDEO_PLUGIN_PLAY, index ); + index++; + // Add rewind, we should only be fast-forwarding seekable content, + // no need to check + InsertOneMenuItemL( aMenuPane, EBavpCmdRewind, + R_TEXT_VIDEO_PLUGIN_REWIND, index ); + index++; + break; + } + default: + { + break; + } + } // End of switch + + // Display "Media Volume" menu item, unless we have HW volume keys and... + if ( !HAS_HW_VOLUME_KEYS && + !iBavpController->IsClipRewinding() && + !iBavpController->IsClipFastForwarding() ) + { + // User can adjust volume + InsertOneMenuItemL( aMenuPane, EBavpCmdChangeVolume, + R_TEXT_VIDEO_PLUGIN_MEDIA_VOLUME, index ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpView::HandlePluginCommandL +// Handle the user command from the option menu to the plugin. +// ----------------------------------------------------------------------------- +void CBavpView::HandlePluginCommandL( TInt aCommand ) + { + iBavpController->HandleCommandL( (TBavpCommandIds)(aCommand - iCommandBase) ); + } + +// ----------------------------------------------------------------------------- +// CBavpView::OfferKeyEventL +// Control framework calls this function to handle the key event +// ----------------------------------------------------------------------------- +TKeyResponse CBavpView::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + Log( EFalse, _L("CBavpView::OfferKeyEventL") ); + + TKeyResponse keyResponse( EKeyWasNotConsumed ); + + //Check if the controller is already initialized + if (iBavpController) + { + // Let the Audio or Video controller handle the key presses + keyResponse = iBavpController->HandleKeysL( aKeyEvent, aType ); + } + + return keyResponse; + } + +// ----------------------------------------------------------------------------- +// CBavpView::SetRect +// Sets the control's extent, specifying a TRect +// ----------------------------------------------------------------------------- +void CBavpView::SetRect( NPWindow* aWindow ) + { + Log( EFalse, _L("CBavpView::SetRect") ); + iWindowRect = TRect(TPoint(aWindow->x, aWindow->y), TSize(aWindow->width, aWindow->height)); + iClipRect = TRect(aWindow->clipRect.left, aWindow->clipRect.top, aWindow->clipRect.right, aWindow->clipRect.bottom); + TRect r(iClipRect); + r.Intersection(iWindowRect); + TBool flag = iRect != r; + iRect = r; + CCoeControl::SetRect( iRect ); + + // Set the rect only when the animation is playing + if ( iIsVideoBuffAnimRunning && iVideoBuffAnimation && + flag) + { + iVideoBuffAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iVideoBuffAnimation->SetRect( animRect ); + TRAP_IGNORE( iVideoBuffAnimation->StartAnimationL() ); + } + else if ( iIsAudioPlayAnimRunning && iAudioPlayAnimation && + flag) + { + iAudioPlayAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iAudioPlayAnimation->SetRect( animRect ); + TRAP_IGNORE( iAudioPlayAnimation->StartAnimationL() ); + } + else if ( iIsAudioStoppedAnimRunning && iAudioStoppedAnimation && + flag) + { + iAudioStoppedAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iAudioStoppedAnimation->SetRect( animRect ); + TRAP_IGNORE( iAudioStoppedAnimation->StartAnimationL() ); + } + else if ( iIsAudioPausedAnimRunning && iAudioPausedAnimation && + flag) + { + iAudioPausedAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iAudioPausedAnimation->SetRect( animRect ); + TRAP_IGNORE( iAudioPausedAnimation->StartAnimationL() ); + } + else if ( iIsVideoStoppedAnimRunning && iVideoStoppedAnimation && + flag) + { + iVideoStoppedAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iVideoStoppedAnimation->SetRect( animRect ); + TRAP_IGNORE( iVideoStoppedAnimation->StartAnimationL() ); + } + else if ( iIsVideoPausedAnimRunning && iVideoPausedAnimation && + flag) + { + iVideoPausedAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iVideoPausedAnimation->SetRect( animRect ); + TRAP_IGNORE( iVideoPausedAnimation->StartAnimationL() ); + } + else if ( iIsBadContentAnimRunning && iBadContentAnimation && + flag) + { + iBadContentAnimation->CancelAnimation(); + TRect animRect( iWindowRect); + iBadContentAnimation->SetRect( animRect ); + TRAP_IGNORE( iBadContentAnimation->StartAnimationL() ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpView::IsTopWindow +// Return ETrue if the CCoeControl is the top window instance +// ----------------------------------------------------------------------------- +TBool CBavpView::IsTopWindowL() + { + Log( EFalse, _L("CBavpView::IsTopWindowL") ); + + TBool ret( EFalse ); + TInt numWg( iWsSession.NumWindowGroups() ); + CArrayFixFlat* wgList = new (ELeave) CArrayFixFlat( numWg ); + + // Check if our window is front or not + if ( iWsSession.WindowGroupList( 0, wgList ) == KErrNone ) + { + ret = ( iWindowId == wgList->At(0) ); + } + else + { + ret = EFalse; + } + + delete wgList; + return ret; + } + +// ----------------------------------------------------------------------------- +// CBavpView::UpdateView +// Check animation running status, display the animated image if the video +// player is not playing +// ----------------------------------------------------------------------------- +void CBavpView::UpdateView() + { + Log( EFalse, _L("CBavpView::UpdateView") ); + + // Handle the bad content case, ie MMF reports an error that needs to + // be displayed to the user. (loss of network or bad content) + if ( iBavpController->State() == EBavpBadContent && !iIsBadContentAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Bad Content") ); + RunAnimation( iBadContentAnimation, iIsBadContentAnimRunning ); + } + // Handle the beffering content state + else if ( iBavpController->State() == EBavpBuffering && !iIsVideoBuffAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Buffering media") ); + RunAnimation( iVideoBuffAnimation, iIsVideoBuffAnimRunning ); + } + // Handle the video animations states + else if ( iBavpController->IsClipVideo() ) + { + Log( EFalse, _L("CBavpView::UpdateView - We got Video") ); + if ( iBavpController->State() == EBavpPlaying ) + { + Log( EFalse, _L("CBavpView::UpdateView - Video Playing, stop animation") ); + TBool flag( EFalse ); + RunAnimation( NULL, flag ); + } + else if ( iBavpController->State() == EBavpStopped && !iIsVideoStoppedAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Video Stopped") ); + RunAnimation( iVideoStoppedAnimation, iIsVideoStoppedAnimRunning ); + } + else if ( iBavpController->State() == EBavpPaused && !iIsVideoPausedAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Video Paused") ); + RunAnimation( iVideoPausedAnimation, iIsVideoPausedAnimRunning ); + } + } + // Handle the audio animations states + else + { + Log( EFalse, _L("CBavpView::UpdateView - We got Audio") ); + if ( iBavpController->State() == EBavpPlaying && !iIsAudioPlayAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Audio Playing") ); + RunAnimation( iAudioPlayAnimation, iIsAudioPlayAnimRunning ); + } + else if ( iBavpController->State() == EBavpStopped || + iBavpController->State() == EBavpPlayComplete && + !iIsAudioStoppedAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Audio Stopped") ); + RunAnimation( iAudioStoppedAnimation, iIsAudioStoppedAnimRunning ); + } + else if ( iBavpController->State() == EBavpPaused && !iIsAudioPausedAnimRunning ) + { + Log( EFalse, _L("CBavpView::UpdateView - Audio Paused") ); + RunAnimation( iAudioPausedAnimation, iIsAudioPausedAnimRunning ); + } + } + } + +// ----------------------------------------------------------------------------- +// CBavpView::FocusChanged +// This method is called once CCoeControl::SetFocus is called, could be when +// BavpPlugin::NotifyL causes SetFocus to be called +// ----------------------------------------------------------------------------- +void CBavpView::FocusChanged( TDrawNow /*aDrawNow*/ ) + { + iBavpController->BavpFocusChanged( IsFocused() ); + } + +// ----------------------------------------------------------------------------- +// CBavpView::Draw +// This method is called by CCoeControl::Draw +// ----------------------------------------------------------------------------- +void CBavpView::Draw( const TRect& aRect ) const + { + + if (iBavpController && !iBavpController->IsClipFullScreen()) { + if ( Window().DisplayMode() == EColor16MA ) + { + Log( EFalse, _L("BavpView::Draw() - DisplayMode=EColor16MA") ); + CWindowGc& gc = SystemGc(); + gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); +#ifdef _DEBUG + gc.SetBrushColor(TRgb::Color16MA(0x0000ff00)); +#else + gc.SetBrushColor( TRgb::Color16MA(0) ); +#endif + gc.Clear( aRect ); + } + + if (iBavpController->IsClipLocalMedia() && iBavpController->IsClipSeekable()) { + if (iBavpController->State() == EBavpPlayComplete) { + TRAP_IGNORE(iBavpController->setPositionL(iBavpController->Duration())); + } + else if (iBavpController->State() == EBavpPaused) { + TRAP_IGNORE(iBavpController->setPositionL(iBavpController->getPositionL())); + } + } + } + + } + +// ----------------------------------------------------------------------------- +// CBavpView::ControllerStateChangedL +// Check animation running status and the display screen mode +// ----------------------------------------------------------------------------- +void CBavpView::ControllerStateChangedL() + { + Log( EFalse, _L("CBavpView::ControllerStateChangedL") ); + + // If not in full screen mode and if it is on the stack, then remove + // from the stack + if ( !iBavpController->IsClipFullScreen() && iIsOnStack ) + { + iIsOnStack = EFalse; + iEikonEnv->EikAppUi()->RemoveFromStack( this ); + } + else if ( iBavpController->IsClipFullScreen() && !iIsOnStack ) + { + // If full screen mode and not on stack, add to stack + iIsOnStack = ETrue; + iEikonEnv->EikAppUi()->AddToStackL( this ); + } + } + +// ----------------------------------------------------------------------------- +// CBavpView::InsertOneMenuItemL +// Insert one menu item +// ----------------------------------------------------------------------------- +void CBavpView::InsertOneMenuItemL( CEikMenuPane& aMenuPane, TInt aCommand, + TInt aResourceId, TInt index ) + { + Log( EFalse, _L("CBavpView::InsertOneMenuItemL") ); + + CEikMenuPaneItem::SData item; + HBufC* buf = StringLoader::LoadLC( aResourceId ); + item.iText.Copy( *buf ); + CleanupStack::PopAndDestroy(); // buf + buf = NULL; + + item.iCommandId = aCommand + iCommandBase; + item.iFlags = 0; + item.iCascadeId = 0; + aMenuPane.InsertMenuItemL( item, index ); + } + +// ----------------------------------------------------------------------------- +// CBavpView::RunAnimation +// Run the animation specified, and stop all the other animations +// If the animation and run flag are NULL, we stop all animations +// Check if animation is already running, if so don't stop, this causes flicker +// ----------------------------------------------------------------------------- +void CBavpView::RunAnimation( CAknBitmapAnimation* aAnimation, + TBool &aAnimRunning ) + { + Log( EFalse, _L("CBavpView::RunAnimation") ); + // Display the animation specified, after cancelling any + // other animations first. + // + // Stop the video buffering animation + if ( iIsVideoBuffAnimRunning && iVideoBuffAnimation != aAnimation ) + { + Log( EFalse, _L("CBavpView::RunAnimation - cancel VideoBuffAnimation") ); + iVideoBuffAnimation->CancelAnimation(); + iIsVideoBuffAnimRunning = EFalse; + } + else if ( iIsVideoStoppedAnimRunning && iVideoStoppedAnimation != aAnimation ) + { + // Stop the video stopped animation + Log( EFalse, _L("CBavpView::RunAnimation - cancel VideoStoppedAnimation") ); + iVideoStoppedAnimation->CancelAnimation(); + iIsVideoStoppedAnimRunning = EFalse; + } + else if ( iIsVideoPausedAnimRunning && iVideoPausedAnimation != aAnimation ) + { + // Stop the video paused animation + Log( EFalse, _L("CBavpView::RunAnimation - cancel VideoPausedAnimation") ); + iVideoPausedAnimation->CancelAnimation(); + iIsVideoPausedAnimRunning = EFalse; + } + else if ( iIsAudioPlayAnimRunning && iAudioPlayAnimation != aAnimation ) + { + // Stop the audio playing animation + Log( EFalse, _L("CBavpView::RunAnimation - cancel AudioPlayAnimation") ); + iAudioPlayAnimation->CancelAnimation(); + iIsAudioPlayAnimRunning = EFalse; + } + else if ( iIsAudioStoppedAnimRunning && iAudioStoppedAnimation != aAnimation ) + { + // Stop the audio stopped animation + Log( EFalse, _L("CBavpView::RunAnimation - cancel AudioStoppedAnimation") ); + iAudioStoppedAnimation->CancelAnimation(); + iIsAudioStoppedAnimRunning = EFalse; + } + else if ( iIsAudioPausedAnimRunning && iAudioPausedAnimation != aAnimation ) + { + // Stop the audio paused animation + Log( EFalse, _L("CBavpView::RunAnimation - cancel AudioPausedAnimation") ); + iAudioPausedAnimation->CancelAnimation(); + iIsAudioPausedAnimRunning = EFalse; + } + else if ( iIsBadContentAnimRunning && iBadContentAnimation != aAnimation ) + { + // Stop the bad content animation + Log( EFalse, _L("CBavpView::RunAnimation - cancel BadContentAnimation") ); + iBadContentAnimation->CancelAnimation(); + iIsBadContentAnimRunning = EFalse; + } + + // Now, start the animation specified, if it isn't already running. + // If the animation and run flag are NULL, we don't start any animations. + if ( aAnimation && !aAnimRunning ) + { + Log( EFalse, _L("CBavpView::RunAnimation - start new animation") ); + if ( aAnimation->Rect().Size() != iRect.Size() ) + { + TRect animRect( iWindowRect); + aAnimation->SetRect( animRect ); + } + TRAP_IGNORE + ( + aAnimation->StartAnimationL(); + aAnimRunning = ETrue; + ); + } + + } + + +void CBavpView::HandlePointerEventL(const TPointerEvent &aPointerEvent) + { + /* + * Plugin is sending all pointer events to the browser. + * Browser will process them to gesture and return back using + * event() function. (see PluginWin::HandleGesture(), BavpEvent() and + * CBavpPlugin::HandleGesture(). + * Browser expects event position to be in absolute co-ordinates, + * so we convert position of the pointer event here. + */ + TPoint point(aPointerEvent.iPosition + PositionRelativeToScreen()); + NPNetscapeFuncs* funcs = iBavPlugin->getNPNFuncs(); +#ifdef BRDO_MULTITOUCH_ENABLED_FF + if (aPointerEvent.IsAdvancedPointerEvent()) { + TAdvancedPointerEvent tadvp = *(static_cast(&aPointerEvent)); + tadvp.iPosition = point; + if(funcs && funcs->setvalue) { + (funcs->setvalue)(iBavPlugin->getNPP(), + (NPPVariable) NPPVPluginPointerEvent, + (void*) &(tadvp)); + } + + } + else { +#endif + TPointerEvent event(aPointerEvent); + event.iPosition = point; + if(funcs && funcs->setvalue) { + (funcs->setvalue)(iBavPlugin->getNPP(), + (NPPVariable) NPPVPluginPointerEvent, + (void*) &(event)); + } +#ifdef BRDO_MULTITOUCH_ENABLED_FF + } +#endif + + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpViewFullScreen.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpViewFullScreen.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: View class for playing media in full screen +* +*/ + + +// INCLUDE FILES +#include + +#include "BavpViewFullScreen.h" +#include "BavpControllerVideo.h" +#include "BavpLogger.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// CBavpViewFullScreen::CBavpViewFullScreen +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CBavpViewFullScreen::CBavpViewFullScreen(CBavpControllerVideo* aController) + :iNormalController(aController) + { + } + +// ----------------------------------------------------------------------------- +// CBavpViewFullScreen::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpViewFullScreen::ConstructL() + { + CreateWindowL(); + SetExtent( TPoint(), TSize() ); + ActivateL(); + SetPointerCapture( ETrue ); + ClaimPointerGrab( ETrue ); + } + +// ----------------------------------------------------------------------------- +// CBavpViewFullScreen::HandlePointerEventL +// Handles pointer events, simulate a KeyDown event to revert to normal screen +// ----------------------------------------------------------------------------- +void CBavpViewFullScreen::HandlePointerEventL(const TPointerEvent& aPointerEvent) +{ + Log( EFalse, _L("CBavpViewFullScreen::HandlePointerEventL") ); + switch (aPointerEvent.iType) + { + case TPointerEvent::EButton1Down: + { + //simulate a keyup event + TKeyEvent aKeyEvent; + aKeyEvent.iCode = 0; + aKeyEvent.iModifiers = 0; + aKeyEvent.iRepeats = 0; + aKeyEvent.iScanCode = EStdKeyDownArrow; + //convert back to normal screen + iNormalController->HandleKeysL(aKeyEvent, EEventKeyDown); + break; + } + default: + break; + } + + +} +// ----------------------------------------------------------------------------- +// CBavpViewFullScreen::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CBavpViewFullScreen* CBavpViewFullScreen::NewL(CBavpControllerVideo* aController) + { + CBavpViewFullScreen* self = new (ELeave) CBavpViewFullScreen(aController); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CBavpViewFullScreen::~CBavpViewFullScreen +// Destructor +// ----------------------------------------------------------------------------- +CBavpViewFullScreen::~CBavpViewFullScreen() + { + // ignore error + //release pointer control + SetPointerCapture(EFalse); + } + +// ----------------------------------------------------------------------------- +// CBavpViewFullScreen::Draw +// This method is called by CCoeControl::Draw +// ----------------------------------------------------------------------------- +void CBavpViewFullScreen::Draw( const TRect& aRect ) const + { + if ( Window().DisplayMode() == EColor16MA ) + { + CWindowGc& gc = SystemGc(); + gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); + gc.SetBrushColor( TRgb::Color16MA(0) ); + gc.Clear( aRect ); + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browseraudiovideoplugin/src/BavpVolumeHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browseraudiovideoplugin/src/BavpVolumeHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handles the volume, gets the initial volume from central +* repository and monitors changes in volume. +* +*/ + + +#include +#include +#include + +#include "BavpLogger.h" +#include "BavpVolumeHandler.h" +#include "BavpVolumeObserver.h" + + +// ----------------------------------------------------------------------------- +// CBavpVolumeHandler::NewL +// Two-phased constructor. +// ---------------------------------------------------------------------------- +CBavpVolumeHandler* CBavpVolumeHandler::NewL( MBavpVolumeObserver* aObserver ) + { + Log( EFalse, _L("CBavpVolumeHandler::NewL") ); + + CBavpVolumeHandler* self = new (ELeave) CBavpVolumeHandler( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CBavpVolumeHandler::CBavpVolumeHandler +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------------------------- +CBavpVolumeHandler::CBavpVolumeHandler( MBavpVolumeObserver* aObserver ) + : iObserver( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CBavpVolumeHandler::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CBavpVolumeHandler::ConstructL() + { + Log( EFalse, _L("CBavpVolumeHandler::ConstructL") ); + + iCurrentVolume = KCRVolume5; + iCurrentProfile = KGeneralProfile; + + // Get volume settings from central repository + iVolumeRepository = CRepository::NewL( KCRUidBrowser ); + iVolumeRepository->Get( KBrowserMediaVolumeControl, iCurrentVolume ); + + // If media volume key exists, watch it for changes + iVolumeCRHandler = CCenRepNotifyHandler::NewL( *this, *iVolumeRepository, + CCenRepNotifyHandler::EIntKey, + (TUint32)KBrowserMediaVolumeControl); + iVolumeCRHandler->StartListeningL(); + iPreviousVolume = iCurrentVolume; + + // Get the current profile + iProfileRepository = CRepository::NewL( KCRUidProfileEngine ); + iProfileRepository->Get( KProEngActiveProfile, iCurrentProfile ); + + // Watch the Profile changes using a CR Notify Handler + iProfileCRHandler = CCenRepNotifyHandler::NewL( *this, *iProfileRepository, + CCenRepNotifyHandler::EIntKey, + (TUint32)KProEngActiveProfile ); + iProfileCRHandler->StartListeningL(); + + // Now that we have initial volume and profile, lets use them. + // Check if we're in Silent profile or Meeting profile. + if ( iCurrentProfile == KSilentProfile || + iCurrentProfile == KMeetingProfile ) + { + // Mute the volume, we already saved the CR volume + // as iPreviousVolume + iCurrentVolume = KCRVolumeMute; + } + + // Tell observer (BavpController) the initial volume + if ( iObserver ) + { + iObserver->UpdateVolume( iCurrentVolume ); + } + } + +// ---------------------------------------------------------------------------- +// CBavpVolumeHandler::~CBavpVolumeHandler +// Destructor +// ---------------------------------------------------------------------------- +CBavpVolumeHandler::~CBavpVolumeHandler() + { + Log( EFalse, _L("CBavpVolumeHandler::~CBavpVolumeHandler") ); + + // Clean up the media volume CR and CR Handler + if ( iVolumeCRHandler ) + { + iVolumeCRHandler->StopListening(); + delete iVolumeCRHandler; + } + + delete iVolumeRepository; + + // Clean up the Profile CR and CR Handler + if ( iProfileCRHandler ) + { + iProfileCRHandler->StopListening(); + delete iProfileCRHandler; + } + + delete iProfileRepository; + + } + +// ---------------------------------------------------------------------------- +// CBavpVolumeHandler::HandleNotifyInt() +// Handles volume and profile changes in CR +// ---------------------------------------------------------------------------- +void CBavpVolumeHandler::HandleNotifyInt( const TUint32 aKeyId, TInt aNewValue ) + { + if ( aKeyId == KBrowserMediaVolumeControl && aNewValue != iCurrentVolume ) + { + // Media Volume property updated, and it changed + if ( iCurrentProfile == KSilentProfile || + iCurrentProfile == KMeetingProfile ) + { + // We got a new volume, and Profile is "quiet", save and use later + iPreviousVolume = aNewValue; + } + else + { + // We got a new volume and Profile allows us to use it + iCurrentVolume = aNewValue; + } + } + else if ( aKeyId == KProEngActiveProfile && aNewValue != iCurrentProfile ) + { + // Profile property updated, and it changed + iCurrentProfile = aNewValue; + + // If we got a change in profile, mute or unmute + if ( iCurrentProfile == KSilentProfile || + iCurrentProfile == KMeetingProfile ) + { + // Mute the volume + iPreviousVolume = iCurrentVolume; + iCurrentVolume = KCRVolumeMute; + } + else // Unmute the volume + { + iCurrentVolume = iPreviousVolume; + } + } + + // Tell observer the new volume + if ( iObserver ) + { + iObserver->UpdateVolume( iCurrentVolume ); + } + } + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/BWINS/npGpsPlugin.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/BWINS/npGpsPlugin.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + ?InitializeFuncs@@YAFPAU_NPPluginFuncs@@@Z @ 2 NONAME ; short InitializeFuncs(struct _NPPluginFuncs *) + ?NPP_Shutdown@@YAXXZ @ 3 NONAME ; void NPP_Shutdown(void) + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/EABI/npGpsPlugin.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/EABI/npGpsPlugin.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + _Z12NPP_Shutdownv @ 2 NONAME + _Z15InitializeFuncsP14_NPPluginFuncs @ 3 NONAME + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/data/1028286f.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/data/1028286f.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registry file for Ecom style Browser Location Plugin. +* +*/ + + +#include +#include "GpsPlugin.rls" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Registry info +// The UIDs for the filters implemented in this DLL +// ----------------------------------------------------------------------------- + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x1028286f; // should match the name of the file. + // 3rd Uid of associated plugin dll (declared in the dll mmp file) + interfaces= + { + INTERFACE_INFO + { + // Identifies plugin type (used by ECom) + interface_uid = 0x101F8810; + + implementations = + { + IMPLEMENTATION_INFO + { + // Specific implementation (must match an implementation entry in the dll) + implementation_uid = 0x10282870; + version_no = 2; + // File name;Plugin's name + display_name = STRING_r_browser_gps_plugin; + // Mimetypes and mime extensions + default_data = STRING_r_mime_gps; + // Plugin's description + opaque_data = STRING_r_browser_gps_desc; + } + }; + } + }; + } diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/data/GpsPlugin.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/data/GpsPlugin.rls Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the strings for resources +* +*/ + + +rls_string STRING_r_browser_gps_plugin "npGpsPlugin.dll;Browser GPS Plugin" +rls_string STRING_r_browser_gps_desc "GPS Plugin for S60 Browser" +rls_string STRING_r_mime_gps "application/x-gps-widget" diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/group/BLD.INF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/group/BLD.INF Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project build file for BrowserLocationPlugin +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/BrowserGpsPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(BrowserGpsPlugin.iby) + +PRJ_MMPFILES +GpsPluginEcom.mmp // Plugin mmp file + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/group/GpsPluginEcom.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/group/GpsPluginEcom.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the .mmp for building Ecom style Browser Gps Plugin +* +*/ + +#include +#include +#include + +TARGET npGpsPlugin.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x1028286f + +EPOCALLOWDLLDATA +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../data + +START RESOURCE 1028286f.rss +TARGET npGpsPlugin.rsc +END + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +SOURCEPATH ../src + +SOURCE GpsObserver.cpp +SOURCE GpsApi.cpp +SOURCE GpsPluginEcomMain.cpp +SOURCE GpsPlugin.cpp + +LIBRARY euser.lib +LIBRARY ecom.lib + +#ifdef __S60_32__ +LIBRARY JavaScriptCore.lib +#else +LIBRARY npscript.lib +#endif + +LIBRARY lbs.lib +LIBRARY SatInfo.lib +LIBRARY flogger.lib + +DEFFILE npGpsPlugin.def +NOSTRICTDEF diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/inc/GpsObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/inc/GpsObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef GPSOBSERVER_H +#define GPSOBSERVER_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CGpsPlugin; + +// CONSTANTS + +// State enum and member variable + +// CLASS DECLARATIONS +/** +* CGpsObserver. +* Controller class for handling browser widget requests +* @lib npGpsPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CGpsObserver) : public CActive + { + public: + /** + * C++ default constructor. + */ + static CGpsObserver* NewL( CGpsPlugin* aPlugin ); + + /** + * Destructor. + */ + virtual ~CGpsObserver(); + + public: + /** + * Request network status change notification. + * @since 3.2 + * @param name of the callback + * @return void + */ + void RequestNotificationL( const NPString& aEvent ); + + /* + * Gets latitude + * @since 3.2 + * @return latitude + */ + TReal Latitude() const; + + /* + * Gets longitude. + * @since 3.2 + * @return longitude + */ + TReal Longitude() const; + + /* + * Gets altitude + * @since 3.2 + * @return altitude + */ + TReal Altitude() const; + + /* + * Gets horizontal accuracy + * @since 3.2 + * @return horizontal accuracy + */ + TReal HorizontalAccuracy() const; + + /* + * Gets vertical accuracy + * @since 3.2 + * @return vertical accuracy + */ + TReal VerticalAccuracy() const; + + /* + * Gets tick count for the current sample + * @since 3.2 + * @return + */ + TInt TickCount() const; + + protected: // CActive + /** + * Implements cancellation of an outstanding request. + * @param none + * @return void + */ + void DoCancel(); + + /** + * Handles an active object’s request completion event. + * @param none + * @return void + */ + void RunL(); + + /** + * Handles an active object’s error + * @param error + * @return void + */ + TInt RunError(TInt aError); + + protected: + /** + * C++ default constructor. + */ + CGpsObserver(CGpsPlugin* aPlugin); + + /** + * C++ default constructor. + */ + void ConstructL(); + + protected: + CGpsPlugin* iGpsPlugin; + + RPositionServer iServer; + RPositioner iPositioner; + TPositionInfo iPositionInfo; + TPosition iPosition; + + TInt iTickCount; + HBufC8* iEventHandler; + }; + +#endif // GPSOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/inc/GpsPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/inc/GpsPlugin.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef GPSPLUGIN_H +#define GPSPLUGIN_H + +// INCLUDES +#include +#include +#include // For base class MPluginNotifier + +// FORWARD DECLARATIONS +class CGpsObserver; + +// CLASS DECLARATION + +/****************************************** +This class is specific to ECom Style Plugin. This is used for passing +plugin specific initialization information to and from browser. +*******************************************/ +IMPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ); + +// CONSTANTS +const TInt KFirstGpsImplementationValue = 0x10282870; + +/** +* CGpsPluginEcomMain +* Used for passing plugin specific initialization information to and from browser. +* @lib npGpsPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CGpsPluginEcomMain) : public CEcomBrowserPluginInterface + { + public: // Functions from base classes + + /** + * Two-phased constructor. + */ + static CGpsPluginEcomMain* NewL( TAny* aInitParam ); + + /** + * Destructor + */ + virtual ~CGpsPluginEcomMain(); + + /** + * Passed from the browser to the plugin and delcares what + * functions the browser makes available + */ + NPNetscapeFuncs* Funcs() const { return iNpf; } + + private: + + // Default constructor + CGpsPluginEcomMain( NPNetscapeFuncs* aNpf ); + + // By default Symbian 2nd phase constructor is private. + void ConstructL( NPPluginFuncs* aPluginFuncs ); + + // Netscape Function Pointer + NPNetscapeFuncs* iNpf; + }; + +/** +* CGpsPlugin class +* Interfaces to Browser, used to pass information between browser and plugin +* @lib npGpsPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CGpsPlugin) : public CBase + { + public: + static CGpsPlugin* NewL(); + + virtual ~CGpsPlugin(); + + public: + void Deallocate (); + bool HasMethod( NPIdentifier name ); + bool Invoke( NPIdentifier name, + NPVariant *args, + uint32_t argCount, + NPVariant *result ); + bool HasProperty( NPIdentifier name ); + bool GetProperty( NPIdentifier name, NPVariant *variant ); + bool SetPropertyL( NPIdentifier name, NPVariant *variant ); + + public: + void SetInstance( NPP instance ) { iInstanceHandle = instance; } + bool InvokeCallback( TDesC8& name, const NPVariant *args, uint32_t argCount ); + + /** + * SetWindowL + * @since 2.8 + * @param MPluginAdapter *pluginAdapter: Pointer to Browser adapter class + * @param const TRect& aRect: rectangle representing current UI + * @return void + */ + void SetWindowL( MPluginAdapter *pluginAdapter, const TRect& aRect ); + + private: + CGpsPlugin(); + void ConstructL(); + + private: + NPP iInstanceHandle; + NPIdentifier* iGpsPluginIdentifiers; // not owned + + // Interface to Browser + MPluginAdapter* iPluginAdapter; // not owned + + // gpsplugin feature class instance + CGpsObserver* iGpsObserver; // owned + }; + +/** +******************************************************************************** + Plugin API methods. Source located in CGpsApi.cpp +********************************************************************************* +*/ + +/** + * Create a plugin. + */ + +NPError GpsNewp( NPMIMEType pluginType, NPP instance, uint16 mode, + CDesCArray* argn, CDesCArray* argv, NPSavedData* saved ); + +/** + * Wrapper the errors + */ +void GpsConstructL( NPP aInstance, CDesCArray* argn, CDesCArray* argv ); + +/** + * Destroy a plugin. + */ +NPError GpsDestroy( NPP instance, NPSavedData** save ); + +/** + * Generic hook to retrieve values/attributes from the plugin. + */ +NPError GpsGetvalue( NPP instance, NPPVariable variable, void *ret_value ); + +/** + * This is the parent window of a plugin. + */ +NPError GpsSetwindow(NPP instance, NPWindow* window); + +/** +******************************************************************************** + Gps Plugin API methods. Source located in CGpsApi.cpp +********************************************************************************* +*/ +typedef struct + { + NPObject object; + CGpsPlugin *plugin; + } GpsPluginObject; + +/** + * GpsPluginAllocate + */ +NPObject* GpsPluginAllocate( NPP /*npp*/, NPClass* /*aClass*/ ); + +/** + * GpsPluginDeallocate + */ +void GpsPluginDeallocate( GpsPluginObject* obj ); + +/** + * GpsPluginInvalidate + */ +void GpsPluginInvalidate( NPObject* /*obj*/ ); + +/** + * GpsPluginHasMethod + */ +bool GpsPluginHasMethod( GpsPluginObject* obj, + NPIdentifier name ); + +/** + * GpsPluginInvoke + */ +bool GpsPluginInvoke( GpsPluginObject* obj, + NPIdentifier name, + NPVariant* args, + uint32_t argCount, + NPVariant* result ); + +/** + * GpsPluginHasProperty + */ +bool GpsPluginHasProperty( GpsPluginObject* obj, + NPIdentifier name ); + +/** + * GpsPluginGetProperty + */ +bool GpsPluginGetProperty( GpsPluginObject* obj, + NPIdentifier name, + NPVariant* variant ); + +/** + * GpsPluginSetProperty + */ +bool GpsPluginSetProperty( GpsPluginObject* obj, + NPIdentifier name, + NPVariant* variant ); + +/** + * _GpsPluginClass + */ +static NPClass _GpsPluginClass = + { + 0, // structVersion + (NPAllocateFunctionPtr) GpsPluginAllocate, + (NPDeallocateFunctionPtr) GpsPluginDeallocate, + (NPInvalidateFunctionPtr) GpsPluginInvalidate, + (NPHasMethodFunctionPtr) GpsPluginHasMethod, + (NPInvokeFunctionPtr) GpsPluginInvoke, + (NPInvokeDefaultFunctionPtr) 0, + (NPHasPropertyFunctionPtr) GpsPluginHasProperty, + (NPGetPropertyFunctionPtr) GpsPluginGetProperty, + (NPSetPropertyFunctionPtr) GpsPluginSetProperty, + (NPRemovePropertyFunctionPtr) 0, + (NPEnumerationFunctionPtr) 0 + }; + +/** + * static instance of the function pointer table + */ +static NPClass* GpsPluginClass = &_GpsPluginClass; + +#endif // GPSPLUGIN_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/rom/BrowserGpsPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/rom/BrowserGpsPlugin.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The iby file contains all data that must be included in image for +* BrowserGpsPlugin +* +*/ + + +#ifndef BROWSERGPSPLUGIN_IBY +#define BROWSERGPSPLUGIN_IBY + +#ifdef __WEB_WIDGETS + + +#endif //__WEB_WIDGETS + +#endif // BROWSERGPSPLUGIN_IBY + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/src/GpsApi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/src/GpsApi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API functions that were loaded into TLS for the Browser to use. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include "GpsPlugin.h" + +// CONSTANTS + +// ============================= LOCAL FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// GpsNewp +// Create a new instance of a plugin. This is non-leaving method. +// Returns: NPError: Error codes recognized by Browser +// ---------------------------------------------------------------------------- +NPError GpsNewp( NPMIMEType /*pluginType*/, // Not used locally + NPP aInstance, // Stores pointer to Gps + uint16 /*mode*/, // + CDesCArray* argn, // The number of arguments passed + CDesCArray* argv, // The values of arguments in the array + NPSavedData* /*saved*/ ) // + { + // Create GpsPlugin, call this leaving method to wrap leaving methods + TRAPD( err, GpsConstructL( aInstance, argn, argv ) ); + if ( err == KErrNoMemory ) + { + return NPERR_OUT_OF_MEMORY_ERROR; + } + + if ( err != KErrNone ) + { + return NPERR_MODULE_LOAD_FAILED_ERROR; + } + + return NPERR_NO_ERROR; + } + +// ---------------------------------------------------------------------------- +// GpsConstructL +// This is the leaving method to create the plugin. We have leaving setters +// that need to be wrapped. +// Returns: void +// ---------------------------------------------------------------------------- +void GpsConstructL( NPP aInstance, // Stores pointer to Gps + CDesCArray* /*argn*/, // The number of arguments passed + CDesCArray* /*argv*/ ) // The values of arguments in the array + { + aInstance->pdata = CGpsPlugin::NewL(); + } + +// ---------------------------------------------------------------------------- +// GpsDestroy(NPP aInstance, NPSavedData**) +// Called by Browser to destroy the plugin +// Returns: NPError: Error Code +// ---------------------------------------------------------------------------- +NPError GpsDestroy( NPP aInstance, // Link to Browser + NPSavedData** /*save*/ ) // Not used locally + { + CGpsPlugin *pluginInstance = STATIC_CAST( CGpsPlugin*, aInstance->pdata ); + delete pluginInstance; + return NPERR_NO_ERROR; + } + + +// ---------------------------------------------------------------------------- +// GpsGetvalue +// ---------------------------------------------------------------------------- +// +NPError GpsGetvalue( NPP instance, + NPPVariable variable, + void* ret_value) + { + if (variable==NPPVpluginScriptableNPObject) + { + CGpsPlugin *siplugin = (CGpsPlugin*)instance->pdata; + GpsPluginObject *pluginObject + = (GpsPluginObject *)NPN_CreateObject (instance, GpsPluginClass); + pluginObject->plugin = siplugin; + siplugin->SetInstance(instance); + void** ret = (void**)ret_value; + *ret = (void*)pluginObject; + } + return NPERR_NO_ERROR; + } + + +// ============================= LOCAL FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// GpsPluginAllocate +// ---------------------------------------------------------------------------- +// +NPObject* GpsPluginAllocate( NPP /*npp*/, NPClass* /*aClass*/ ) + { + GpsPluginObject* newInstance + = (GpsPluginObject*)User::Alloc( sizeof(GpsPluginObject) ); + return (NPObject*)newInstance; + } + +// ---------------------------------------------------------------------------- +// GpsPluginDeallocate +// ---------------------------------------------------------------------------- +// +void GpsPluginDeallocate( GpsPluginObject* obj ) + { + obj->plugin->Deallocate(); + User::Free( (void*)obj ); + } + +// ---------------------------------------------------------------------------- +// GpsPluginInvalidate +// ---------------------------------------------------------------------------- +// +void GpsPluginInvalidate( NPObject* /*obj*/ ) + { + } + +// ---------------------------------------------------------------------------- +// GpsPluginHasMethod +// ---------------------------------------------------------------------------- +// +bool GpsPluginHasMethod( GpsPluginObject* obj, + NPIdentifier name ) + { + return obj->plugin->HasMethod( name ); + } + +//----------------------------------------------------------------------------- +// GpsPluginInvoke +//----------------------------------------------------------------------------- +// +bool GpsPluginInvoke( GpsPluginObject* obj, + NPIdentifier name, + NPVariant* args, + uint32_t argCount, + NPVariant *result ) + { + return obj->plugin->Invoke( name, args, argCount, result ); + } + +// ---------------------------------------------------------------------------- +// GpsPluginHasProperty +// ---------------------------------------------------------------------------- +// +bool GpsPluginHasProperty( GpsPluginObject* obj, + NPIdentifier name ) + { + return obj->plugin->HasProperty( name ); + } + +// ---------------------------------------------------------------------------- +// GpsPluginGetProperty +// ---------------------------------------------------------------------------- +// +bool GpsPluginGetProperty( GpsPluginObject* obj, + NPIdentifier name, + NPVariant *variant ) + { + return obj->plugin->GetProperty( name, variant ); + } + +// ---------------------------------------------------------------------------- +// GpsPluginSetProperty +// ---------------------------------------------------------------------------- +// +bool GpsPluginSetProperty( GpsPluginObject* obj, + NPIdentifier name, + NPVariant *variant ) + { + TBool r = EFalse; + TRAPD( error, r = obj->plugin->SetPropertyL( name, variant ) ); + return (r || error)? true : false; + } + +// ---------------------------------------------------------------------------- +// BapSetwindow +// This is the parent window of plugin +// Returns: NPError: Error Code +// ---------------------------------------------------------------------------- +// +NPError GpsSetwindow( + NPP /*aInstance*/, // Link to Browser + NPWindow* /*aWindow*/ ) // Browser's window passed to BAP + { + return NPERR_NO_ERROR; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/src/GpsObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/src/GpsObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include +#include "GpsObserver.h" +#include "GpsPlugin.h" + +// for debug #define BROWSER_GPS_PLUGIN_LOG + +#ifdef BROWSER_GPS_PLUGIN_LOG + +#include + +// output goes in c:\Logs\gps (create this dir manually if it doesn't exist) + +_LIT(LOG_DIR, "gps"); +_LIT(LOG_NAME, "gps.log"); + +TBuf16<256> formatBuf; +_LIT16(formatInt,"[%d]"); + +#define LOG_E \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("E")); \ + formatBuf.Format(formatInt, e); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf) +#define LOG_CONNECT \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("RPositionerServer.Connect")) +#define LOG_NUMMODULES \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("NUMMODULES")); \ + formatBuf.Format(formatInt, numberOfModules); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf) +#define LOG_MODULE \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("MODULE")); \ + formatBuf.Format(formatInt, i); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf) +#define LOG_SATMODULE \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("SATELLITE MODULE")); \ + formatBuf.Format(formatInt, i); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf) +#define LOG_OPEN \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("RPositioner.Open")) +#define LOG_OPTIONS \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("RPositioner.SetUpdateOptions")) +#define LOG_REQUESTOR \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("RPositioner.SetRequestor")) +#define LOG_REQUESTFIELD \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("HPositionGenericInfo.SetRequestedField")) +#define LOG_POSITIONUPDATE \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("RPositioner.NotifyPositionUpdate")) +#define LOG_RESPONSE \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("response")) +#define LOG_GETPOSITION \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, _L("HPositionGenericInfo.GetPosition")) +#define LOG_LATLNGALT \ + int lat = iPosition.Latitude(); \ + int lon = iPosition.Longitude(); \ + int alt = iPosition.Altitude(); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf); \ + formatBuf.Format(formatInt, lat); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf); \ + formatBuf.Format(formatInt, lon); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf); \ + formatBuf.Format(formatInt, alt); \ + RFileLogger::Write(LOG_DIR, LOG_NAME, EFileLoggingModeAppend, formatBuf) + + +#else + +#define LOG_E +#define LOG_CONNECT +#define LOG_NUMMODULES +#define LOG_MODULE +#define LOG_SATMODULE +#define LOG_OPEN +#define LOG_OPTIONS +#define LOG_REQUESTOR +#define LOG_REQUESTFIELD +#define LOG_POSITIONUPDATE +#define LOG_RESPONSE +#define LOG_GETPOSITION +#define LOG_LATLNGALT + +#endif + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CGpsObserver::NewL +// Symbian 2-phase constructor. +// ----------------------------------------------------------------------------- +CGpsObserver* CGpsObserver::NewL( CGpsPlugin* aPlugin ) + { + CGpsObserver* self = new (ELeave) CGpsObserver( aPlugin ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::CGpsObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CGpsObserver::CGpsObserver( CGpsPlugin* aPlugin ) + : CActive( EPriorityStandard ), + iGpsPlugin( aPlugin ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::ConstructL +// 2nd-phase constructor. +// ----------------------------------------------------------------------------- +void CGpsObserver::ConstructL() + { + TInt e; // for error codes + + // 1. connect to the position server + e = iServer.Connect(); + LOG_E; + LOG_CONNECT; + User::LeaveIfError( e ); + + // 2. find the satellite module (see the BLID application source + // code CSattelliteEng.cpp) + TUint numberOfModules = 0; + e = iServer.GetNumModules( numberOfModules ); + LOG_E; + LOG_NUMMODULES; + User::LeaveIfError( e ); + + TPositionModuleInfo moduleInfo; + TInt i; + for ( i = 0; i < numberOfModules ; i++ ) + { + LOG_MODULE; + e = iServer.GetModuleInfoByIndex( i, moduleInfo ); + LOG_E; + if ( ( e == KErrNone ) && + ( moduleInfo.Capabilities() + & TPositionModuleInfo::ECapabilitySatellite ) ) /* bit test */ + { + break; + } + } + + if ( i == numberOfModules ) + { + // leave if no GPS + User::Leave( KErrNotFound ); + } + + // 3. open the positioner with the satellite module + LOG_SATMODULE; + TPositionModuleId moduleId = moduleInfo.ModuleId(); + e = iPositioner.Open( iServer, moduleId ); + LOG_E; + User::LeaveIfError( e ); + LOG_OPEN; + + // 4. set the requestor on the positioner (something for security) + iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("BrowserGpsPlugin")/**srvName*/ ); + LOG_REQUESTOR; + + // 5. request position notification + iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); + SetActive(); + LOG_POSITIONUPDATE; + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::~CGpsObserver() +// Destructor +// ----------------------------------------------------------------------------- +CGpsObserver::~CGpsObserver() + { + Cancel(); + iPositioner.Close(); + iServer.Close(); + + delete iEventHandler; + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBatteryObserver::RequestNotification +// ----------------------------------------------------------------------------- +void CGpsObserver::RequestNotificationL( const NPString& aEvent ) + { + // remove and free current handler + HBufC8* handler = iEventHandler; + iEventHandler = NULL; + delete handler; + + //store the event handler function name + TInt length = aEvent.UTF8Length; + handler = HBufC8::NewL( length+1 ); + + TPtr8 tptr = handler->Des(); + tptr.Copy( (const TUint8 *)aEvent.UTF8Characters, length ); + + //Remove any arguments passed in the with the function name + TInt pos = handler->LocateReverse( TChar('(') ); + if ( pos != KErrNotFound ) + { + length = pos; + } + + tptr.SetLength( length ); + tptr.ZeroTerminate(); + + iEventHandler = handler; + + // monitoring is already active + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBatteryObserver::RunL +// ----------------------------------------------------------------------------- +void CGpsObserver::RunL() + { + // if status ok and exists, update values and invoke callback + if ( iStatus == KErrNone ) + { + // update saved values + iPositionInfo.GetPosition( iPosition ); + LOG_GETPOSITION; + LOG_LATLNGALT; + + iTickCount++; + if ( iEventHandler ) + { + iGpsPlugin->InvokeCallback( *iEventHandler, NULL, 0 ); + } + } + + // request next update + iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::RunError +// ----------------------------------------------------------------------------- +TInt CGpsObserver::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::DoCancel +// ----------------------------------------------------------------------------- +void CGpsObserver::DoCancel() + { + iPositioner.CancelRequest( EPositionerNotifyPositionUpdate ); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::Latitude +// ----------------------------------------------------------------------------- +TReal CGpsObserver::Latitude() const + { + return iPosition.Latitude(); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::Longitude +// ----------------------------------------------------------------------------- +TReal CGpsObserver::Longitude() const + { + return iPosition.Longitude(); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::Altitude +// ----------------------------------------------------------------------------- +TReal CGpsObserver::Altitude() const + { + return iPosition.Altitude(); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::HorizontalAccuracy +// ----------------------------------------------------------------------------- +TReal CGpsObserver::HorizontalAccuracy() const + { + return iPosition.HorizontalAccuracy(); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::VerticalAccuracy +// ----------------------------------------------------------------------------- +TReal CGpsObserver::VerticalAccuracy() const + { + return iPosition.VerticalAccuracy(); + } + +// ----------------------------------------------------------------------------- +// CGpsObserver::TIckCount +// ----------------------------------------------------------------------------- +TInt CGpsObserver::TickCount() const + { + return iTickCount; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/src/GpsPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/src/GpsPlugin.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser for handling embedded Gps requests. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include "GpsPlugin.h" +#include "GpsObserver.h" +#include + + +// CONSTANTS + +enum TIdentifiersNames { + EIdLatitude, + EIdLongitude, + EIdAlt, + EIdHorizontalAccuracy, + EIdVerticalAccuracy, + EIdOnGps, + EIdSatelliteStatus, + EIdTickCount, + EIdLast + }; + +const NPUTF8 *GpsPluginIdentifierNames[EIdLast] += { "latitude", // 0 + "longitude", // 1 + "altitude", // 2 + "horizontalaccuracy", // 3 + "verticalaccuracy", // 4 + "ongps", // 5 + "showsatellitestatus", // 6 + "tickcount", // 7 + }; + +const TBool IsMethod[] = { + EFalse, // latitude, + EFalse, // longitude, + EFalse, // altitude + EFalse, // horizontalaccuracy + EFalse, // verticalaccuracy + EFalse, // ongps + ETrue, // showSatelliteStatus + EFalse, // tickcount + }; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// CGpsPlugin::CGpsPlugin +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------------------------- +CGpsPlugin::CGpsPlugin() + { + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::NewL +// Two-phased constructor. +// ---------------------------------------------------------------------------- +CGpsPlugin* CGpsPlugin::NewL() + { + CGpsPlugin* self = new (ELeave) CGpsPlugin; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::ConstructL +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +void CGpsPlugin::ConstructL() + { + iGpsPluginIdentifiers = new (ELeave) NPIdentifier[EIdLast]; + NPN_GetStringIdentifiers( GpsPluginIdentifierNames, EIdLast, + iGpsPluginIdentifiers ); + + iGpsObserver = CGpsObserver::NewL( this ); + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::Destructor +// ---------------------------------------------------------------------------- +CGpsPlugin::~CGpsPlugin() + { + delete [] iGpsPluginIdentifiers; + delete iGpsObserver; + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::Deallocate +// ---------------------------------------------------------------------------- +void CGpsPlugin::Deallocate () + { + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::InvokeCallback +// ---------------------------------------------------------------------------- +bool CGpsPlugin::InvokeCallback( TDesC8& name, + const NPVariant *args, uint32_t argCount ) + { + CGpsPluginEcomMain* lGpsPPluginEcomMain = (CGpsPluginEcomMain*) Dll::Tls(); + NPNetscapeFuncs* lNetscapeFuncs = lGpsPPluginEcomMain->Funcs(); + if (lNetscapeFuncs && iInstanceHandle) + { + void* value = 0; + NPError npErr + = lNetscapeFuncs->getvalue( iInstanceHandle, NPNVWindowNPObject, + (void*)&value ); + if (npErr == NPERR_NO_ERROR) + { + NPVariant resultVariant; + VOID_TO_NPVARIANT( resultVariant ); + NPIdentifier ident + = NPN_GetStringIdentifier( (const NPUTF8 *)(name.Ptr()) ); + return NPN_Invoke( iInstanceHandle, (NPObject*)value, + ident, args, argCount, &resultVariant ); + } + } + return false; + } + +// ---------------------------------------------------------------------------- +// CWidgetManagerPlugin::HasMethod +// ---------------------------------------------------------------------------- + +bool CGpsPlugin::HasMethod( NPIdentifier name ) + { + for ( TInt i= 0; i < EIdLast; i++ ) + { + if ( name == iGpsPluginIdentifiers[i] ) + { + return IsMethod[i]; + } + } + return false; + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::HasProperty +// ---------------------------------------------------------------------------- +bool CGpsPlugin::HasProperty( NPIdentifier name ) + { + for ( TInt i= 0; i < EIdLast; i++ ) + { + if ( name == iGpsPluginIdentifiers[i] ) + { + return !IsMethod[i]; + } + } + return false; + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::GetProperty +// ---------------------------------------------------------------------------- +bool CGpsPlugin::GetProperty( NPIdentifier name, NPVariant *variant ) + { + // default variant value maps to javascript undefined + VOID_TO_NPVARIANT( *variant ); + if ( name == iGpsPluginIdentifiers[EIdLatitude] ) + { + DOUBLE_TO_NPVARIANT( iGpsObserver->Latitude(), *variant ); + } + else if ( name == iGpsPluginIdentifiers[EIdLongitude] ) + { + DOUBLE_TO_NPVARIANT( iGpsObserver->Longitude(), *variant ); + } + else if ( name == iGpsPluginIdentifiers[EIdAlt] ) + { + DOUBLE_TO_NPVARIANT( iGpsObserver->Altitude(), *variant ); + } + else if ( name == iGpsPluginIdentifiers[EIdHorizontalAccuracy] ) + { + DOUBLE_TO_NPVARIANT( iGpsObserver->HorizontalAccuracy(), *variant ); + } + else if ( name == iGpsPluginIdentifiers[EIdVerticalAccuracy] ) + { + DOUBLE_TO_NPVARIANT( iGpsObserver->VerticalAccuracy(), *variant ); + } + else if ( name == iGpsPluginIdentifiers[EIdTickCount] ) + { + INT32_TO_NPVARIANT( iGpsObserver->TickCount(), *variant ); + } + else + { + return EFalse; + } + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::Invoke +// ---------------------------------------------------------------------------- +bool CGpsPlugin::Invoke( NPIdentifier name, + NPVariant* /*args*/, + uint32_t /*argCount*/, + NPVariant *result ) + { + VOID_TO_NPVARIANT( *result ); + if ( name == iGpsPluginIdentifiers[EIdSatelliteStatus] ) + { + TRAP_IGNORE( + CSatelliteInfoUI* satelliteUI = CSatelliteInfoUI::NewL(); + (void) satelliteUI->ExecuteLD( _L("BrowserGpsPlugin") ) ); + } + return true; + } + +// ---------------------------------------------------------------------------- +// CGpsPlugin::SetPropertyL +// ---------------------------------------------------------------------------- +bool CGpsPlugin::SetPropertyL( NPIdentifier name, NPVariant *variant ) + { + if ( name == iGpsPluginIdentifiers[EIdOnGps] ) + { + NPString str = NPVARIANT_TO_STRING( *variant ); + iGpsObserver->RequestNotificationL(str); + } + else + { + return EFalse; + } + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CBAPPlugin::SetWindowL +// Called by Browser for window creation. +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +void CGpsPlugin::SetWindowL( + MPluginAdapter* /*aPluginAdapter*/, // Allows callback to Browser + const TRect& /*aRect*/) // Window information + { + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsergpsplugin/src/GpsPluginEcomMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsergpsplugin/src/GpsPluginEcomMain.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser +* +*/ + + + +// INCLUDE FILES +#include "GpsPlugin.h" +#include +#include + + +/*********************************************************/ +/******** ECOM STYLE GPS PLUGIN ENTRY POINTS ********/ +/*********************************************************/ + +// ----------------------------------------------------------------------------- +// CGpsPluginEcomMain::NewL +// ----------------------------------------------------------------------------- +CGpsPluginEcomMain* CGpsPluginEcomMain::NewL( TAny* aInitParam ) + { + TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam ); + CGpsPluginEcomMain* self = new (ELeave) CGpsPluginEcomMain( funcs->iNetscapeFuncs ); + CleanupStack::PushL( self ); + self->ConstructL( funcs->iPluginFuncs ); + CleanupStack::Pop( self ); + Dll::SetTls ( (void*)self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGpsPluginEcomMain::ConstructL +// ----------------------------------------------------------------------------- +void CGpsPluginEcomMain::ConstructL( NPPluginFuncs* aPluginFuncs ) + { + InitializeFuncs( aPluginFuncs ); + } + +// ----------------------------------------------------------------------------- +// CGpsPluginEcomMain::CGpsPluginEcomMain +// ----------------------------------------------------------------------------- +CGpsPluginEcomMain::CGpsPluginEcomMain( NPNetscapeFuncs* aNpf ) + : CEcomBrowserPluginInterface(), + iNpf( aNpf ) + { + } + +// ----------------------------------------------------------------------------- +// CGpsPluginEcomMain::~CGpsPluginEcomMain +// ----------------------------------------------------------------------------- +CGpsPluginEcomMain::~CGpsPluginEcomMain() + { + } + +// ----------------------------------------------------------------------------- +// KImplementationTable +// ----------------------------------------------------------------------------- +const TImplementationProxy KImplementationTable[] = + { + {{KFirstGpsImplementationValue}, (TProxyNewLPtr)CGpsPluginEcomMain::NewL} + }; + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// Returns the filters implemented in this DLL +// Returns: The filters implemented in this DLL +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + return KImplementationTable; + } + +// ----------------------------------------------------------------------------- +// InitializeFuncs +// ----------------------------------------------------------------------------- +EXPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ) + { + aPpf->size = sizeof(NPPluginFuncs); + aPpf->version = 1; + aPpf->newp = NewNPP_NewProc(GpsNewp); + aPpf->destroy = NewNPP_DestroyProc(GpsDestroy); + aPpf->setwindow = NewNPP_SetWindowProc(GpsSetwindow); + aPpf->newstream = 0; + aPpf->destroystream = 0; + aPpf->asfile = 0; + aPpf->writeready = 0; + aPpf->write = 0; + aPpf->print = 0; + aPpf->event = 0; + aPpf->urlnotify = 0; + aPpf->javaClass = 0; + aPpf->getvalue = NewNPP_GetValueProc(GpsGetvalue); + aPpf->setvalue = 0; + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// NPP_Shutdown +// ----------------------------------------------------------------------------- +EXPORT_C void NPP_Shutdown(void) + { + CGpsPluginEcomMain* npm = (CGpsPluginEcomMain*)Dll::Tls(); + delete npm; + Dll::SetTls( NULL ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/BWINS/npSystemInfoPlugin.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/BWINS/npSystemInfoPlugin.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + ?InitializeFuncs@@YAFPAU_NPPluginFuncs@@@Z @ 2 NONAME ; short InitializeFuncs(struct _NPPluginFuncs *) + ?NPP_Shutdown@@YAXXZ @ 3 NONAME ; void NPP_Shutdown(void) + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/EABI/npSystemInfoPlugin.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/EABI/npSystemInfoPlugin.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + _Z12NPP_Shutdownv @ 2 NONAME + _Z15InitializeFuncsP14_NPPluginFuncs @ 3 NONAME + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/data/10282853.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/data/10282853.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registry file for Ecom style Browser System Information Plugin. +* +*/ + +#include +#include "SystemInfoPlugin.rls" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Registry info +// The UIDs for the filters implemented in this DLL +// ----------------------------------------------------------------------------- + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10282853; // should match the name of the file. + // 3rd Uid of associated plugin dll (declared in the dll mmp file) + interfaces= + { + INTERFACE_INFO + { + // Identifies plugin type (used by ECom) + interface_uid = 0x101F8810; + + implementations = + { + IMPLEMENTATION_INFO + { + // Specific implementation (must match an implementation entry in the dll) + implementation_uid = 0x10282854; + version_no = 2; + // File name;Plugin's name + display_name = STRING_r_browser_system_info_plugin; + // Mimetypes and mime extensions + default_data = STRING_r_mime_system_info; + // Plugin's description + opaque_data = STRING_r_browser_system_info_desc; + } + }; + } + }; + } diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/data/SystemInfoPlugin.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/data/SystemInfoPlugin.rls Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the strings for resources +* +*/ + + +rls_string STRING_r_browser_system_info_plugin "npSystemInfoPlugin.dll;Browser System Info Plugin" +rls_string STRING_r_browser_system_info_desc "System Information Plugin for S60 Browser" +rls_string STRING_r_mime_system_info "application/x-systeminfo-widget" + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/group/BLD.INF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/group/BLD.INF Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project build file for BrowserSystemPlugin +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/BrowserSystemInfoPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(BrowserSystemInfoPlugin.iby) + +PRJ_MMPFILES +SystemInfoPluginEcom.mmp // Plugin mmp file + +// End of File + + diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/group/SystemInfoPluginEcom.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/group/SystemInfoPluginEcom.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the .mmp for building Ecom style Browser System Info Plugin +* +*/ + + +#include +#include +#include + +TARGET npSystemInfoPlugin.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x10282853 + +EPOCALLOWDLLDATA +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../data + +START RESOURCE 10282853.rss +TARGET npSystemInfoPlugin.rsc +END + +APP_LAYER_SYSTEMINCLUDE +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +USERINCLUDE ../inc +SOURCEPATH ../src + +SOURCE SystemInfoApi.cpp +SOURCE SystemInfoMain.cpp +SOURCE SystemInfoPlugin.cpp +SOURCE SystemInfoObserver.cpp +SOURCE NetworkObserver.cpp +SOURCE PowerObserver.cpp +SOURCE SystemInfoMisc.cpp +SOURCE SystemInfoBeep.cpp + +LIBRARY estlib.lib // libc +LIBRARY euser.lib +LIBRARY ecom.lib + +#ifdef __S60_32__ +LIBRARY JavaScriptCore.lib +#else +LIBRARY npscript.lib +#endif + +LIBRARY cone.lib // CoeControl +LIBRARY efsrv.lib +LIBRARY charconv.lib +LIBRARY HWRMVibraClient.lib +LIBRARY HWRMLightClient.lib +LIBRARY ProfileEng.lib +LIBRARY MediaClientAudio.lib // CMdaAudioToneUtility +LIBRARY etel3rdparty.lib +LIBRARY hal.lib +LIBRARY WidgetRegistryClient.lib // for language code + +DEFFILE npSystemInfoPlugin.def +NOSTRICTDEF diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/inc/NetworkObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/inc/NetworkObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef NETWORKOBSERVER_H +#define NETWORKOBSERVER_H + +// INCLUDES +#include +#include +#include +#include "SystemInfoObserver.h" + +// FORWARD DECLARATIONS +class CSystemInfoPlugin; + +// CONSTANTS + +// State enum and member variable + +// CLASS DECLARATIONS +/** +* CNetworkObserver. +* Interface to information about the radio network connection. +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CNetworkObserver) : public CBase, public MSystemInfoObserverClient + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CNetworkObserver* NewL( CSystemInfoPlugin* aPlugin ); + + /** + * Destructor. + */ + virtual ~CNetworkObserver(); + +public: + enum TIdNetworkItem + { + EIdSignalStrength, + EIdRegistrationStatus, + EIdNetworkInfo + }; + + /** + * Request network values change notification. + * @since 3.2 + * @param name of the callback, transfer ownership + * @return void + */ + void RequestNotificationL( TIdNetworkItem aId, HBufC8* aFunctionName ); + +public: + + /** + * Called to get current network signal bars. + * @since 3.2 + * @param void + * @return signal bars + */ + TInt SignalBars() const; + + /** + * Called to get current network registration status. + * @since 3.2 + * @param void + * @return network registration status + */ + TInt RegistrationStatus() const; + + /** + * Called to get current network name + * @since 3.2 + * @param void + * @return network name + */ + const TDesC& NetworkName() const; + +public: + // from MSystemInfoObserverClient + virtual void SubscribeL( TInt aId, TRequestStatus& aStatus ); + virtual void UpdateL( TInt aId ); + virtual void Cancel( TInt aId ); + virtual void Close( TInt aId ); + +private: + /** + * C++ default constructor. + */ + CNetworkObserver( CSystemInfoPlugin* aPlugin ); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL(); + +protected: + CSystemInfoPlugin* iSystemInfoPlugin; // not owned + CTelephony* iTelephony; // owned + CTelephony* iTelephony2; // owned + CTelephony* iTelephony3; // owned + + // signal + CTelephony::TSignalStrengthV1Pckg iSignalPckg; + CTelephony::TSignalStrengthV1 iSignal; + CSystemInfoObserver* iSignalObserver; // owned + TInt iSignalStarted; + + // registration status + CTelephony::TNetworkRegistrationV1Pckg iRegistrationStatusPckg; + CTelephony::TNetworkRegistrationV1 iRegistrationStatus; + CSystemInfoObserver* iRegistrationStatusObserver; // owned + HBufC8* iRegistrationStatusChangedFunction; // owned + TInt iRegistrationStatusStarted; + + // network info (includes name) + CTelephony::TNetworkInfoV2Pckg iNetworkInfoPckg; + CTelephony::TNetworkInfoV2 iNetworkInfo; + CSystemInfoObserver* iNetworkInfoObserver; // owned + TInt iNetworkInfoStarted; + }; + +#endif // NETWORKOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/inc/PowerObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/inc/PowerObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef POWEROBSERVER_H +#define POWEROBSERVER_H + +// INCLUDES +#include +#include +#include +#include "SystemInfoObserver.h" + +// FORWARD DECLARATIONS +class CSystemInfoPlugin; + +// CONSTANTS + +// State enum and member variable + +// CLASS DECLARATIONS +/** +* CPowerObserver. +* Interface to information about power and battery. +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CPowerObserver) : public CBase, public MSystemInfoObserverClient + { +public: + /** + * Two-phased constructor. + */ + static CPowerObserver* NewL( CSystemInfoPlugin* aPlugin ); + + /** + * Destructor. + */ + virtual ~CPowerObserver(); + +public: + enum TIdPowerItem + { + EIdBatteryInfo, + EIdIndicator // charger connected indicator + }; + + /** + * Request power values change notification. + * @since 3.2 + * @param name of the callback + * @return void + */ + void RequestNotificationL( TIdPowerItem aId, HBufC8* aFunctionName ); + +public: + /** + * Called to get battery charge level. + * @since 3.2 + * @param void + * @return charge level + */ + TInt ChargeLevel() const; + + /** + * Called to get charger connected flag. + * @since 3.2 + * @param void + * @return 1 if charger connected, 0 if not connected + */ + TInt ChargerConnected() const; + +public: + // from MSystemInfoObserverClient + virtual void SubscribeL( TInt aId, TRequestStatus& aStatus ); + virtual void UpdateL( TInt aId ); + virtual void Cancel( TInt aId ); + virtual void Close( TInt aId ); + +private: + /** + * C++ default constructor. + */ + CPowerObserver( CSystemInfoPlugin* aPlugin ); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL(); + +public: + CSystemInfoPlugin* iSystemInfoPlugin; + CTelephony* iTelephony; // owned + CTelephony* iTelephony2; // owned + + // battery + CTelephony::TBatteryInfoV1Pckg iBatteryInfoPckg; + CTelephony::TBatteryInfoV1 iBatteryInfo; + CSystemInfoObserver* iBatteryInfoObserver; // owned + HBufC8* iBatteryInfoChangedFunction; + TInt iBatteryInfoStarted; + + // charger + CTelephony::TIndicatorV1Pckg iIndicatorPckg; + CTelephony::TIndicatorV1 iIndicator; + CSystemInfoObserver* iIndicatorObserver; // owned + HBufC8* iIndicatorChangedFunction; + TInt iIndicatorStarted; + }; + +#endif // POWEROBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/inc/SystemInfoBeep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/inc/SystemInfoBeep.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef SYSTEMINFOBEEP_H +#define SYSTEMINFOBEEP_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* CSystemInfoBeep. +* Interface to information about the radio network connection. +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CSystemInfoBeep) : public CBase, public MMdaAudioToneObserver + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSystemInfoBeep* NewL(); + + /** + * Destructor. + */ + virtual ~CSystemInfoBeep(); + +public: + /** + * Play a pure tone. + * @since 3.2 + * @param frequency of tone in Hertz + * @param duration of tone in microseconds + * @return void + */ + void Play( TInt aFrequency, TTimeIntervalMicroSeconds iDuration); + +private: + /** + * C++ default constructor. + */ + CSystemInfoBeep(); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL(); + +public: + // from MMdaAudioToneObserver + void MatoPrepareComplete(TInt aError); + void MatoPlayComplete(TInt aError); + +private: + typedef enum TBeepState + { + EBeepIdle, + EBeepPreparing, + EBeepPlaying + }; + +private: + + CMdaAudioToneUtility* iToneUtil; // owned + TBeepState iState; + }; + +#endif // SYSTEMINFOBEEP_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/inc/SystemInfoMisc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/inc/SystemInfoMisc.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef SYSTEMINFOMISC_H +#define SYSTEMINFOMISC_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CHWRMLight; +class CHWRMVibra; +class CSystemInfoBeep; + +// CONSTANTS + +// State enum and member variable + +// CLASS DECLARATIONS +/** +* CSystemInfoMisc. +* Interface to various platform services not requiring observers. +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CSystemInfoMisc) : public CBase + { +public: + /** + * Two-phased constructor. + */ + static CSystemInfoMisc* NewL(); + + /** + * Destructor. + */ + virtual ~CSystemInfoMisc(); + +public: + /** + * Called to sound a tone. + * @since 3.2 + * @param void + * @return charge level + */ + void Beep( TInt aFrequency, TTimeIntervalMicroSeconds aDuration ); + + + TInt VibraMinIntensity() const; + + TInt VibraMaxIntensity() const; + + TInt VibraMaxDuration() const; + + TInt VibraSettings() const; // TBD rename VibraProfileEnabled a "boolean" + + void StartVibra( TInt aDuration, TInt aIntensity ); + + void StopVibra(); + + + TInt LightMinIntensity() const; + + TInt LightMaxIntensity() const; + + TInt LightDefaultIntensity() const; + + TInt LightInfiniteDuration() const; + + TInt LightMaxDuration() const; + + TInt LightDefaultCycleTime() const; + + TInt LightTargetPrimaryDisplayAndKeyboard() const; + + TInt LightTargetSystem() const; + + void LightOn( TInt aLightTarget, TInt aDuration, TInt aIntensity, TInt aFadeIn ); + + void LightBlink( TInt aLightTarget, TInt aDuration, + TInt aOnDuration, TInt aOffDuration, TInt aIntensity ); + + void LightOff( TInt aLightTarget, TInt aDuration, TInt aFadeOut ); + + + TInt TotalRam(); + + TInt FreeRam(); + + + void Language( TDes& aLangCode ); + + + void DriveList( TDes8& aDriveList ); + + TReal DriveSize( TChar c ); + + TReal DriveFree( TChar c ); + +private: + /** + * C++ default constructor. + */ + CSystemInfoMisc(); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL(); + + CHWRMLight* iLightControl; + CHWRMVibra* iVibraControl; + CSystemInfoBeep* iBeeper; + RWidgetRegistryClientSession iWidgetRegistryClient; + TBool iWidgetRegistryConnected; // connected to Widget Registry server ? + }; + +#endif // SYSTEMINFOMISC_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/inc/SystemInfoObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/inc/SystemInfoObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef SYSTEMOBSERVER_H +#define SYSTEMOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// State enum and member variable + +// CLASS DECLARATIONS + +/** + * MSystemInfoObserverClient is an interface to whatever data is being + * observed (RProperty, int, string, etc). + * @lib npSystemInfoPlugin.lib + * @since S60 v3.2 + */ +class MSystemInfoObserverClient + { +public: + virtual void SubscribeL( TInt aId, TRequestStatus& aStatus ) = 0; + virtual void UpdateL( TInt aId ) = 0; + virtual void Cancel( TInt aId ) = 0; + virtual void Close( TInt aId ) = 0; +/* + * Outline of use for a publish and subscribe variable + * #include + * #include + * RProperty iProperty; + * iProperty.Attach( KPSUidHWRMPowerState, KHWRMBatteryLevel ); + * SubscribeL => iProperty.Subscribe( status ); + * UpdateL => iProperty.Get( value ); + * Cancel => iProperty.Cancel(); + * Close => iProperty.Close(); + * The ID parameter is there so that a class can contain + * multiple observers and differentiate them in these methods by ID. + * You can also use it for state in a state machine. + */ + }; + +/** +* CSystemInfoObserver. +* Active class for monitoring variables. +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CSystemInfoObserver) : public CActive + { +public: + /** + * Two-phased constructor. + */ + static CSystemInfoObserver* NewL( MSystemInfoObserverClient* aClient, TInt aId ); + + /** + * Destructor. + */ + virtual ~CSystemInfoObserver(); + +private: + /** + * C++ default constructor. + */ + CSystemInfoObserver( MSystemInfoObserverClient* aClient, TInt aId ); + + /** + * By default Symbian 2nd phase constructor is private. + * @param none + * @return void + */ + void ConstructL(); + +public: + /** + * Request observed status change notification + * @since 3.2 + * @param none + * @return void + */ + void RequestNotificationL(); + +protected: // CActive + /** + * Implements cancellation of an outstanding request. + * @param none + * @return void + */ + void DoCancel(); + + /** + * Handles an active object’s request completion event. + * @param none + * @return void + */ + void RunL(); + + /** + * Handles an active object’s error + * @param error + * @return void + */ + TInt RunError(TInt aError); + +private: + MSystemInfoObserverClient* iClient; + TInt iId; + }; + +#endif // SYSTEMOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/inc/SystemInfoPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/inc/SystemInfoPlugin.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef SYSTEMINFOPLUGIN_H +#define SYSTEMINFOPLUGIN_H + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class CPowerObserver; +class CNetworkObserver; +class CSystemInfoMisc; +class MProfileEngine; + +// CLASS DECLARATION + +/****************************************** +This class is specific to ECom Style Plugin. This is used for passing +plugin specific initialization information to and from browser. +*******************************************/ +IMPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ); + +// CONSTANTS +const TInt KFirstSystemInfoImplementationValue = 0x10282854; + +/** +* CSystemInfoPluginEcomMain +* Used for passing plugin specific initialization information to and from browser. +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CSystemInfoPluginEcomMain) : public CEcomBrowserPluginInterface + { + public: // Functions from base classes + + /** + * Two-phased constructor. + */ + static CSystemInfoPluginEcomMain* NewL( TAny* aInitParam ); + + /** + * Destructor + */ + virtual ~CSystemInfoPluginEcomMain(); + + /** + * Passed from the browser to the plugin and delcares what + * functions the browser makes available + */ + NPNetscapeFuncs* Funcs() const { return iNpf; } + + private: + + // Default constructor + CSystemInfoPluginEcomMain( NPNetscapeFuncs* aNpf ); + + // By default Symbian 2nd phase constructor is private. + void ConstructL( NPPluginFuncs* aPluginFuncs ); + + // Netscape Function Pointer + NPNetscapeFuncs* iNpf; + }; + +/** +* CSystemInfoPlugin class +* Interfaces to Browser, used to pass information between browser and plugin +* @lib npSystemInfoPlugin.lib +* @since S60 v3.2 +*/ +NONSHARABLE_CLASS(CSystemInfoPlugin) : public CBase + { + public: + static CSystemInfoPlugin* NewL(); + + virtual ~CSystemInfoPlugin(); + + public: + void Deallocate (); + bool HasMethod( NPIdentifier name ); + bool Invoke( NPIdentifier name, + NPVariant *args, + uint32_t argCount, + NPVariant *result ); + bool HasProperty( NPIdentifier name ); + bool GetProperty( NPIdentifier name, NPVariant *variant ); + bool SetPropertyL( NPIdentifier name, NPVariant *variant ); + + public: + void SetInstance( NPP instance ) { iInstanceHandle = instance; } + bool InvokeCallback ( TDesC8& name, const NPVariant *args, uint32_t argCount ); + + private: + CSystemInfoPlugin(); + void ConstructL(); + + void VariantToInt( NPVariant& v, TInt& i ); + void DesToNpvariant(TPtr8& string, NPVariant*& variant); + + private: + NPP iInstanceHandle; + NPIdentifier* iSystemInfoPluginIdentifiers; + TUid iUid; + MProfileEngine* iProfileEngine; + + // sysinfo feature class instances + CPowerObserver* iPowerObserver; // owned + CNetworkObserver* iNetworkObserver; // owned + CSystemInfoMisc* iSystemInfoMisc; // owned + }; + +/** +******************************************************************************** + Plugin API methods. Source located in CSystemInfoApi.cpp +********************************************************************************* +*/ + +/** + * Create a plugin. + */ + +NPError SystemInfoNewp( NPMIMEType pluginType, NPP instance, uint16 mode, + CDesCArray* argn, CDesCArray* argv, NPSavedData* saved ); + +/** + * Wrapper the errors + */ +void SystemInfoConstructL( NPP aInstance, CDesCArray* argn, CDesCArray* argv ); + +/** + * Destroy a plugin. + */ +NPError SystemInfoDestroy( NPP instance, NPSavedData** save ); + +/** + * Generic hook to retrieve values/attributes from the plugin. + */ +NPError SystemInfoGetvalue( NPP instance, NPPVariable variable, void *ret_value ); + + +/** +******************************************************************************** + System Info Plugin API methods. Source located in CSystemInfoApi.cpp +********************************************************************************* +*/ +typedef struct + { + NPObject object; + CSystemInfoPlugin *plugin; + } SystemInfoPluginObject; + +/** + * systemInfoPluginAllocate + */ +NPObject* systemInfoPluginAllocate( NPP /*npp*/, NPClass* /*aClass*/ ); + +/** + * systemInfoPluginDeallocate + */ +void systemInfoPluginDeallocate( SystemInfoPluginObject* obj ); + +/** + * systemInfoPluginInvalidate + */ +void systemInfoPluginInvalidate( NPObject* /*obj*/ ); + +/** + * systemInfoPluginHasMethod + */ +bool systemInfoPluginHasMethod( SystemInfoPluginObject* obj, + NPIdentifier name ); + +/** + * systemInfoPluginInvokeFunction + */ +bool systemInfoPluginInvokeFunction( SystemInfoPluginObject* obj, + NPIdentifier name, + NPVariant* args, + uint32_t argCount, + NPVariant* result ); + +/** + * systemInfoPluginHasProperty + */ +bool systemInfoPluginHasProperty( SystemInfoPluginObject* obj, + NPIdentifier name ); + +/** + * systemInfoPluginGetProperty + */ +bool systemInfoPluginGetProperty ( SystemInfoPluginObject* obj, + NPIdentifier name, + NPVariant* variant); + +/** + * systemInfoPluginSetProperty + */ +bool systemInfoPluginSetProperty( SystemInfoPluginObject* obj, + NPIdentifier name, + NPVariant* variant); + +/** + * _systemInfoPluginClass + */ +static NPClass _systemInfoPluginClass = + { + 0, // structVersion + (NPAllocateFunctionPtr) systemInfoPluginAllocate, + (NPDeallocateFunctionPtr) systemInfoPluginDeallocate, + (NPInvalidateFunctionPtr) systemInfoPluginInvalidate, + (NPHasMethodFunctionPtr) systemInfoPluginHasMethod, + (NPInvokeFunctionPtr) systemInfoPluginInvokeFunction, + (NPInvokeDefaultFunctionPtr) 0, + (NPHasPropertyFunctionPtr) systemInfoPluginHasProperty, + (NPGetPropertyFunctionPtr) systemInfoPluginGetProperty, + (NPSetPropertyFunctionPtr) systemInfoPluginSetProperty, + (NPRemovePropertyFunctionPtr) 0, + (NPEnumerationFunctionPtr) 0 + }; + +/** + * static instance of the function pointer table + */ +static NPClass* systemInfoPluginClass = &_systemInfoPluginClass; + +#endif // SYSTEMINFOPLUGIN_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/rom/BrowserSystemInfoPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/rom/BrowserSystemInfoPlugin.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The iby file contains all data that must be included in image for +* BrowserSystemInfoPlugin +* +*/ + + +#ifndef BROWSERSYSTEMINFOPLUGIN_IBY +#define BROWSERSYSTEMINFOPLUGIN_IBY + +#ifdef __WEB_WIDGETS + +ECOM_PLUGIN(npSystemInfoPlugin.dll, npSystemInfoPlugin.rsc) + +#endif //__WEB_WIDGETS + +#endif // BROWSERSYSTEMINFOPLUGIN_IBY + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/NetworkObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/NetworkObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,273 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include "NetworkObserver.h" +#include "SystemInfoPlugin.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CNetworkObserver::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CNetworkObserver* CNetworkObserver::NewL( CSystemInfoPlugin* aPlugin ) + { + CNetworkObserver* self = new (ELeave) CNetworkObserver( aPlugin ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::CNetworkObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CNetworkObserver::CNetworkObserver( CSystemInfoPlugin* aPlugin ) + : iSystemInfoPlugin( aPlugin ), + iSignalPckg( iSignal ), + iRegistrationStatusPckg( iRegistrationStatus ), + iNetworkInfoPckg( iNetworkInfo ) + { + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CNetworkObserver::ConstructL() + { + iSignalObserver = CSystemInfoObserver::NewL( this, EIdSignalStrength ); + iRegistrationStatusObserver = CSystemInfoObserver::NewL( this, EIdRegistrationStatus ); + iNetworkInfoObserver = CSystemInfoObserver::NewL( this, EIdNetworkInfo ); + + iTelephony = CTelephony::NewL(); + iTelephony2 = CTelephony::NewL(); + iTelephony3 = CTelephony::NewL(); + + // bootstrap monitoring + + // signal + iSignal.iSignalStrength = INT_MIN; // default indicates unknown + iSignal.iBar = CHAR_MIN; // default indicates unknown + iSignalObserver->RequestNotificationL(); + + // registration status + iRegistrationStatus.iRegStatus = CTelephony::ERegistrationUnknown; // default + iRegistrationStatusObserver->RequestNotificationL(); + + // network info + iNetworkInfo.iDisplayTag.Copy(_L("")); // default indicates unknown + iNetworkInfoObserver->RequestNotificationL(); + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::~CNetworkObserver() +// Destructor +// ----------------------------------------------------------------------------- +CNetworkObserver::~CNetworkObserver() + { + delete iSignalObserver; + delete iRegistrationStatusObserver; + delete iRegistrationStatusChangedFunction; + delete iNetworkInfoObserver; + delete iTelephony; + delete iTelephony2; + delete iTelephony3; + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::SignalBars +// ----------------------------------------------------------------------------- +TInt CNetworkObserver::SignalBars() const + { + if ( !iSignalStarted ) + { + return INT_MIN; // value indicates unknown + } + return iSignal.iBar; + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::RegistrationStatus +// ----------------------------------------------------------------------------- +TInt CNetworkObserver::RegistrationStatus() const + { + TInt s = iRegistrationStatus.iRegStatus; + // explicitly map enum values in case CTelephony API changes. + switch ( s ) + { + case CTelephony::ERegistrationUnknown: + s = 0; + break; + case CTelephony::ENotRegisteredNoService: + s = 1; + break; + case CTelephony::ENotRegisteredEmergencyOnly: + s = 2; + break; + case CTelephony::ENotRegisteredSearching: + s = 3; + break; + case CTelephony::ERegisteredBusy: + s = 4; + break; + case CTelephony::ERegisteredOnHomeNetwork: + s = 5; + break; + case CTelephony::ERegistrationDenied: + s = 6; + break; + case CTelephony::ERegisteredRoaming: + s = 7; + break; + default: + s = 0; + break; + }; + + return s; + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::NetworkName +// ----------------------------------------------------------------------------- +const TDesC& CNetworkObserver::NetworkName() const + { + return iNetworkInfo.iDisplayTag; + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::RequestNotificationL +// ----------------------------------------------------------------------------- +void CNetworkObserver::RequestNotificationL( TIdNetworkItem aId, HBufC8* aFunctionName ) + { + if ( aId == EIdRegistrationStatus ) + { + delete iRegistrationStatusChangedFunction; + iRegistrationStatusChangedFunction = aFunctionName; + // already monitoring, don't request notification again + } + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::SubscribeL +// ----------------------------------------------------------------------------- +void CNetworkObserver::SubscribeL( TInt aId, TRequestStatus& aStatus ) + { + if ( aId == EIdSignalStrength ) + { + if ( iSignalStarted ) + { + iTelephony->NotifyChange( aStatus, + CTelephony::ESignalStrengthChange, + iSignalPckg ); + } + else + { + iTelephony->GetSignalStrength( aStatus, iSignalPckg ); + } + } + else if ( aId == EIdRegistrationStatus ) + { + if ( iRegistrationStatusStarted ) + { + iTelephony2->NotifyChange( aStatus, + CTelephony::ENetworkRegistrationStatusChange, + iRegistrationStatusPckg ); + } + else + { + iTelephony2->GetNetworkRegistrationStatus( aStatus, iRegistrationStatusPckg ); + } + } + else if ( aId == EIdNetworkInfo ) + { + if ( iNetworkInfoStarted ) + { + iTelephony3->NotifyChange( aStatus, + CTelephony::ECurrentNetworkInfoChange, + iNetworkInfoPckg ); + } + else + { + iTelephony3->GetCurrentNetworkInfo( aStatus, iNetworkInfoPckg ); + } + } + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::UpdateL +// ----------------------------------------------------------------------------- +void CNetworkObserver::UpdateL( TInt aId ) + { + if ( aId == EIdSignalStrength ) + { + iSignalStarted = 1; + } + else if ( aId == EIdRegistrationStatus ) + { + iRegistrationStatusStarted = 1; + if ( iRegistrationStatusChangedFunction ) + { + iSystemInfoPlugin->InvokeCallback( *iRegistrationStatusChangedFunction, NULL, 0 ); + } + } + else if ( aId == EIdNetworkInfo ) + { + iNetworkInfoStarted = 1; + // FUTURE add callback to script API + } + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::Cancel +// ----------------------------------------------------------------------------- +void CNetworkObserver::Cancel( TInt aId ) + { + if ( aId == EIdSignalStrength ) + { + (void) iTelephony->CancelAsync( ( iSignalStarted ? + CTelephony::ESignalStrengthChangeCancel + : CTelephony::EGetSignalStrengthCancel ) ); + } + else if ( aId == EIdRegistrationStatus ) + { + (void) iTelephony2->CancelAsync( ( iRegistrationStatusStarted ? + CTelephony::ENetworkRegistrationStatusChangeCancel + : CTelephony::EGetNetworkRegistrationStatusCancel ) ); + } + else if ( aId == EIdNetworkInfo ) + { + (void) iTelephony3->CancelAsync( ( iNetworkInfoStarted ? + CTelephony::ECurrentNetworkInfoChangeCancel + : CTelephony::EGetCurrentNetworkInfoCancel ) ); + } + } + +// ----------------------------------------------------------------------------- +// CNetworkObserver::Close +// ----------------------------------------------------------------------------- +void CNetworkObserver::Close( TInt /*aId*/ ) + { + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/PowerObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/PowerObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include "PowerObserver.h" +#include "SystemInfoPlugin.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPowerObserver::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CPowerObserver* CPowerObserver::NewL( CSystemInfoPlugin* aPlugin ) + { + CPowerObserver* self = new (ELeave) CPowerObserver( aPlugin ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::CPowerObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CPowerObserver::CPowerObserver( CSystemInfoPlugin* aPlugin ) + : iSystemInfoPlugin( aPlugin ), + iBatteryInfoPckg( iBatteryInfo ), + iIndicatorPckg( iIndicator ) + { + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CPowerObserver::ConstructL() + { + iBatteryInfoObserver = CSystemInfoObserver::NewL( this, EIdBatteryInfo ); + iIndicatorObserver = CSystemInfoObserver::NewL( this, EIdIndicator ); + + iTelephony = CTelephony::NewL(); + iTelephony2 = CTelephony::NewL(); + + // bootstrap monitoring + + // battery + iBatteryInfo.iChargeLevel = 0; // default indicates unknown + iBatteryInfoObserver->RequestNotificationL(); + + // charger + iIndicator.iIndicator = 0; + iIndicatorObserver->RequestNotificationL(); + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::~CPowerObserver() +// Destructor +// ----------------------------------------------------------------------------- +CPowerObserver::~CPowerObserver() + { + delete iIndicatorObserver; + delete iBatteryInfoObserver; + delete iBatteryInfoChangedFunction; + delete iIndicatorChangedFunction; + delete iTelephony2; + delete iTelephony; + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::ChargeLevel +// ----------------------------------------------------------------------------- +TInt CPowerObserver::ChargeLevel() const + { + if ( !iBatteryInfoStarted ) + { + // value indicates unknown + return INT_MIN; + } + return STATIC_CAST( TInt, iBatteryInfo.iChargeLevel ); + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::ChargerConnected +// ----------------------------------------------------------------------------- +TInt CPowerObserver::ChargerConnected() const + { + if ( !iIndicatorStarted ) + { + // value indicates unknown + return INT_MIN; + } + return ( CTelephony::KIndChargerConnected & iIndicator.iIndicator ) ? 1 : 0; + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::RequestNotificationL +// ----------------------------------------------------------------------------- +void CPowerObserver::RequestNotificationL( TIdPowerItem aId, HBufC8* aFunctionName ) + { + if ( aId == EIdBatteryInfo ) + { + delete iBatteryInfoChangedFunction; + iBatteryInfoChangedFunction = aFunctionName; + // already monitoring, don't request notification again + } + else if ( aId == EIdIndicator ) + { + delete iIndicatorChangedFunction; + iIndicatorChangedFunction = aFunctionName; + // already monitoring, don't request notification again + } + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::SubscribeL +// ----------------------------------------------------------------------------- +void CPowerObserver::SubscribeL( TInt aId, TRequestStatus& aStatus ) + { + if ( aId == EIdBatteryInfo ) + { + if ( iBatteryInfoStarted ) + { + iTelephony->NotifyChange( aStatus, + CTelephony::EBatteryInfoChange, + iBatteryInfoPckg ); + } + else + { + iTelephony->GetBatteryInfo( aStatus, iBatteryInfoPckg ); + } + } + else if ( aId == EIdIndicator ) + { + if ( iIndicatorStarted ) + { + iTelephony->NotifyChange( aStatus, + CTelephony::EIndicatorChange, + iIndicatorPckg ); + } + else + { + iTelephony->GetIndicator( aStatus, iIndicatorPckg ); + } + } + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::UpdateL +// ----------------------------------------------------------------------------- +void CPowerObserver::UpdateL( TInt aId ) + { + if ( aId == EIdBatteryInfo ) + { + iBatteryInfoStarted = 1; + if ( iBatteryInfoChangedFunction ) + { + iSystemInfoPlugin->InvokeCallback( *iBatteryInfoChangedFunction, NULL, 0 ); + } + } + else if ( aId == EIdIndicator ) + { + iIndicatorStarted = 1; + if ( iIndicatorChangedFunction ) + { + iSystemInfoPlugin->InvokeCallback( *iIndicatorChangedFunction, NULL, 0 ); + } + } + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::Cancel +// ----------------------------------------------------------------------------- +void CPowerObserver::Cancel( TInt aId ) + { + if ( aId == EIdBatteryInfo ) + { + (void) iTelephony->CancelAsync( ( iBatteryInfoStarted ? + CTelephony::EBatteryInfoChangeCancel + : CTelephony::EGetBatteryInfoCancel ) ); + } + else if ( aId == EIdIndicator ) + { + (void) iTelephony->CancelAsync( ( iIndicatorStarted ? + CTelephony::EIndicatorChangeCancel + : CTelephony::EGetIndicatorCancel ) ); + } + } + +// ----------------------------------------------------------------------------- +// CPowerObserver::Close +// ----------------------------------------------------------------------------- +void CPowerObserver::Close( TInt /*aId*/ ) + { + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/SystemInfoApi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/SystemInfoApi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: API functions that were loaded into TLS for the Browser to use. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include "SystemInfoPlugin.h" + +// CONSTANTS + +// ============================= LOCAL FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// SystemInfoNewp +// Create a new instance of a plugin. This is non-leaving method. +// Returns: NPError: Error codes recognized by Browser +// ---------------------------------------------------------------------------- +NPError SystemInfoNewp( NPMIMEType /*pluginType*/, // Not used locally + NPP aInstance, // Stores pointer to SystemInfo + uint16 /*mode*/, // + CDesCArray* argn, // The number of arguments passed + CDesCArray* argv, // The values of arguments in the array + NPSavedData* /*saved*/ ) // + { + // Create SystemInfoPlugin, call this leaving method to wrap leaving methods + TRAPD( err, SystemInfoConstructL( aInstance, argn, argv ) ); + if ( err == KErrNoMemory ) + { + return NPERR_OUT_OF_MEMORY_ERROR; + } + + if ( err != KErrNone ) + { + return NPERR_MODULE_LOAD_FAILED_ERROR; + } + + return NPERR_NO_ERROR; + } + +// ---------------------------------------------------------------------------- +// SystemInfoConstructL +// This is the leaving method to create the plugin. We have leaving setters +// that need to be wrapped. +// Returns: void +// ---------------------------------------------------------------------------- +void SystemInfoConstructL( NPP aInstance, // Stores pointer to SystemInfo + CDesCArray* /*argn*/, // The number of arguments passed + CDesCArray* /*argv*/ ) // The values of arguments in the array + { + aInstance->pdata = CSystemInfoPlugin::NewL(); + } + +// ---------------------------------------------------------------------------- +// SystemInfoDestroy(NPP aInstance, NPSavedData**) +// Called by Browser to destroy the plugin +// Returns: NPError: Error Code +// ---------------------------------------------------------------------------- +NPError SystemInfoDestroy( NPP aInstance, // Link to Browser + NPSavedData** /*save*/ ) // Not used locally + { + CSystemInfoPlugin *pluginInstance = STATIC_CAST( CSystemInfoPlugin*, aInstance->pdata ); + delete pluginInstance; + + return NPERR_NO_ERROR; + } + + +// ---------------------------------------------------------------------------- +// SystemInfoGetvalue +// ---------------------------------------------------------------------------- +// +NPError SystemInfoGetvalue( + NPP instance, + NPPVariable variable, + void* ret_value) + { + if (variable==NPPVpluginScriptableNPObject) + { + CSystemInfoPlugin *siplugin = (CSystemInfoPlugin*)instance->pdata; + SystemInfoPluginObject *pluginObject = (SystemInfoPluginObject *)NPN_CreateObject (instance, systemInfoPluginClass); + pluginObject->plugin = siplugin; + siplugin->SetInstance(instance); + void** ret = (void**)ret_value; + *ret = (void*)pluginObject; + } + return NPERR_NO_ERROR; + } + + +// ============================ LOCAL FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// systemInfoPluginAllocate +// ---------------------------------------------------------------------------- +// +NPObject* systemInfoPluginAllocate( NPP /*npp*/, NPClass* /*aClass*/ ) + { + SystemInfoPluginObject *newInstance = + (SystemInfoPluginObject*)User::Alloc( sizeof(SystemInfoPluginObject) ); + return (NPObject*)newInstance; + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginDeallocate +// ---------------------------------------------------------------------------- +// +void systemInfoPluginDeallocate( SystemInfoPluginObject* obj) + { + obj->plugin->Deallocate(); + User::Free( (void*)obj ); + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginInvalidate +// ---------------------------------------------------------------------------- +// +void systemInfoPluginInvalidate( NPObject* /*obj*/ ) + { + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginHasMethod +// ---------------------------------------------------------------------------- +// +bool systemInfoPluginHasMethod( SystemInfoPluginObject* obj, + NPIdentifier name ) + { + return obj->plugin->HasMethod( name ); + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginInvokeFunction +// ---------------------------------------------------------------------------- +// +bool systemInfoPluginInvokeFunction( SystemInfoPluginObject* obj, + NPIdentifier name, + NPVariant* args, + uint32_t argCount, + NPVariant* result) + { + return obj->plugin->Invoke( name, args, argCount, result ); + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginHasProperty +// ---------------------------------------------------------------------------- +// +bool systemInfoPluginHasProperty( SystemInfoPluginObject* obj, + NPIdentifier name ) + { + return obj->plugin->HasProperty( name ); + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginGetProperty +// ---------------------------------------------------------------------------- +// +bool systemInfoPluginGetProperty( SystemInfoPluginObject* obj, + NPIdentifier name, + NPVariant *variant ) + { + return obj->plugin->GetProperty( name, variant ); + } + +// ---------------------------------------------------------------------------- +// systemInfoPluginSetProperty +// ---------------------------------------------------------------------------- +// +bool systemInfoPluginSetProperty( SystemInfoPluginObject* obj, + NPIdentifier name, + NPVariant *variant ) + { + TBool r = EFalse; + TRAPD( error, r = obj->plugin->SetPropertyL( name, variant ) ); + return (error || !r)? false : true; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/SystemInfoBeep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/SystemInfoBeep.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDES +#include "SystemInfoBeep.h" + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CSystemInfoBeep* CSystemInfoBeep::NewL() + { + CSystemInfoBeep* self = new (ELeave) CSystemInfoBeep(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + }; + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::CSystemInfoBeep +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CSystemInfoBeep::CSystemInfoBeep() + : iState( EBeepIdle ) + { + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CSystemInfoBeep::ConstructL() + { + iToneUtil = CMdaAudioToneUtility::NewL( *this ); + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::~CSystemInfoBeep +// Destructor +// ----------------------------------------------------------------------------- +CSystemInfoBeep::~CSystemInfoBeep() + { + delete iToneUtil; + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::Play +// ----------------------------------------------------------------------------- +void CSystemInfoBeep::Play( TInt aFrequency, TTimeIntervalMicroSeconds aDuration ) + { + if ( iState == EBeepPreparing ) + { + iToneUtil->CancelPrepare(); + } + else if ( iState == EBeepPlaying ) + { + iToneUtil->CancelPlay(); + } + iState = EBeepPreparing; + iToneUtil->PrepareToPlayTone( aFrequency, aDuration ); + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::MatoPrepareComplete +// ----------------------------------------------------------------------------- +void CSystemInfoBeep::MatoPrepareComplete( TInt aError ) + { + if ( aError == KErrNone ) + { + iState = EBeepPlaying; + iToneUtil->Play(); + } + else + { + iState = EBeepIdle; + } + } + +// ----------------------------------------------------------------------------- +// CSystemInfoBeep::MatoPlayComplete +// ----------------------------------------------------------------------------- +void CSystemInfoBeep::MatoPlayComplete( TInt /*aError*/ ) + { + iState = EBeepIdle; + } diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/SystemInfoMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/SystemInfoMain.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "SystemInfoPlugin.h" + + +/***************************************************/ +/**********ECOM STYLE SystemInfo PLUGIN ENTRY POINTS******/ +/***************************************************/ + +// ----------------------------------------------------------------------------- +// CSystemInfoPluginEcomMain::NewL +// ----------------------------------------------------------------------------- +CSystemInfoPluginEcomMain* CSystemInfoPluginEcomMain::NewL( TAny* aInitParam ) + { + TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam ); + CSystemInfoPluginEcomMain* self = new (ELeave) CSystemInfoPluginEcomMain( funcs->iNetscapeFuncs ); + CleanupStack::PushL( self ); + self->ConstructL( funcs->iPluginFuncs ); + CleanupStack::Pop( self ); + + Dll::SetTls ( (void*) self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CSystemInfoPluginEcomMain::ConstructL +// ----------------------------------------------------------------------------- +void CSystemInfoPluginEcomMain::ConstructL( NPPluginFuncs* aPluginFuncs ) + { + InitializeFuncs( aPluginFuncs ); + } + +// ----------------------------------------------------------------------------- +// CSystemInfoPluginEcomMain::CSystemInfoPluginEcomMain +// ----------------------------------------------------------------------------- +CSystemInfoPluginEcomMain::CSystemInfoPluginEcomMain( NPNetscapeFuncs* aNpf ) + : CEcomBrowserPluginInterface(), + iNpf( aNpf ) + { + } + +// ----------------------------------------------------------------------------- +// CSystemInfoPluginEcomMain::~CSystemInfoPluginEcomMain +// ----------------------------------------------------------------------------- +CSystemInfoPluginEcomMain::~CSystemInfoPluginEcomMain() + { + } + +// ----------------------------------------------------------------------------- +// KImplementationTable +// ----------------------------------------------------------------------------- +const TImplementationProxy KImplementationTable[] = + { + {{KFirstSystemInfoImplementationValue}, (TProxyNewLPtr)CSystemInfoPluginEcomMain::NewL} + }; + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// Returns the filters implemented in this DLL +// Returns: The filters implemented in this DLL +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + return KImplementationTable; + } + +// ----------------------------------------------------------------------------- +// InitializeFuncs +// ----------------------------------------------------------------------------- +EXPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ) + { + aPpf->size = sizeof(NPPluginFuncs); + aPpf->version = 1; + aPpf->newp = NewNPP_NewProc(SystemInfoNewp); + aPpf->destroy = NewNPP_DestroyProc(SystemInfoDestroy); + aPpf->setwindow = 0; + aPpf->newstream = 0; + aPpf->destroystream = 0; + aPpf->asfile = 0; + aPpf->writeready = 0; + aPpf->write = 0; + aPpf->print = 0; + aPpf->event = 0; + aPpf->urlnotify = 0; + aPpf->javaClass = 0; + aPpf->getvalue = NewNPP_GetValueProc(SystemInfoGetvalue); + aPpf->setvalue = 0; + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// NPP_Shutdown +// ----------------------------------------------------------------------------- +EXPORT_C void NPP_Shutdown(void) + { + CSystemInfoPluginEcomMain* npm = (CSystemInfoPluginEcomMain*)Dll::Tls(); + delete npm; + Dll::SetTls( NULL ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/SystemInfoMisc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/SystemInfoMisc.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,283 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "SystemInfoMisc.h" +#include +#include +#include +#include +#include "SystemInfoBeep.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSystemInfoMisc::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CSystemInfoMisc* CSystemInfoMisc::NewL() + { + CSystemInfoMisc* self = new (ELeave) CSystemInfoMisc(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CSystemInfoMisc::CSystemInfoMisc +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CSystemInfoMisc::CSystemInfoMisc() + { + } + +// ----------------------------------------------------------------------------- +// CSystemInfoMisc::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CSystemInfoMisc::ConstructL() + { + iLightControl = CHWRMLight::NewL(); + iVibraControl = CHWRMVibra::NewL(); + iBeeper = CSystemInfoBeep::NewL(); + // Create the widget registryclient session + User::LeaveIfError( iWidgetRegistryClient.Connect() ); + iWidgetRegistryConnected = ETrue; + } + +// ----------------------------------------------------------------------------- +// CSystemInfoMisc::~CSystemInfoMisc +// Destructor +// ----------------------------------------------------------------------------- +CSystemInfoMisc::~CSystemInfoMisc() + { + delete iLightControl; + delete iVibraControl; + delete iBeeper; + if ( iWidgetRegistryConnected ) + { + iWidgetRegistryClient.Disconnect(); + } + } + +// ----------------------------------------------------------------------------- +// CSystemInfoMisc::Beep +// ----------------------------------------------------------------------------- +void CSystemInfoMisc::Beep(TInt aFrequency, TTimeIntervalMicroSeconds aDuration ) + { + iBeeper->Play( aFrequency, aDuration ); + } + +TInt CSystemInfoMisc::LightMinIntensity() const + { + return KHWRMLightMinIntensity; + } + +TInt CSystemInfoMisc::LightMaxIntensity() const + { + return KHWRMLightMaxIntensity; + } +TInt CSystemInfoMisc::LightDefaultIntensity() const + { + return KHWRMDefaultIntensity; + } +TInt CSystemInfoMisc::LightInfiniteDuration() const + { + return KHWRMInfiniteDuration; + } +TInt CSystemInfoMisc::LightMaxDuration() const + { + return KHWRMLightMaxDuration; + } +TInt CSystemInfoMisc::LightDefaultCycleTime() const + { + return KHWRMDefaultCycleTime; + } +TInt CSystemInfoMisc::LightTargetPrimaryDisplayAndKeyboard() const + { + return CHWRMLight::EPrimaryDisplayAndKeyboard; + } +TInt CSystemInfoMisc::LightTargetSystem() const + { + return CHWRMLight::ESystemTarget; + } + +void CSystemInfoMisc::LightOn( TInt aLightTarget, TInt aDuration, TInt aIntensity, TInt aFadeIn ) + { + TRAP_IGNORE( iLightControl->LightOnL(aLightTarget, aDuration, aIntensity, aFadeIn) ) + } + +void CSystemInfoMisc::LightBlink( TInt aLightTarget, TInt aDuration, + TInt aOnDuration, TInt aOffDuration, TInt aIntensity ) + { + TRAP_IGNORE( iLightControl->LightBlinkL(aLightTarget, aDuration, + aOnDuration, aOffDuration, aIntensity) ) + } + +void CSystemInfoMisc::LightOff( TInt aLightTarget, TInt aDuration, TInt aFadeOut ) + { + TRAP_IGNORE( iLightControl->LightOffL(aLightTarget, aDuration, aFadeOut) ) + } + + +TInt CSystemInfoMisc::VibraMinIntensity() const + { + return KHWRMVibraMinIntensity; + } + +TInt CSystemInfoMisc::VibraMaxIntensity() const + { + return KHWRMVibraMaxIntensity; + } + +TInt CSystemInfoMisc::VibraMaxDuration() const + { + return KHWRMVibraMaxDuration; + } + +TInt CSystemInfoMisc::VibraSettings() const + { + TInt s = iVibraControl->VibraSettings(); + // explicitly map enum values in case Vibra API changes. + switch ( s ) + { + case CHWRMVibra::EVibraModeUnknown: + s = 0; + break; + case CHWRMVibra::EVibraModeON: + s = 1; + break; + case CHWRMVibra::EVibraModeOFF: + s = 2; + break; + } + return s; + } + +void CSystemInfoMisc::StartVibra( TInt aDuration, TInt aIntensity ) + { + TRAP_IGNORE( iVibraControl->StartVibraL( aDuration, aIntensity ) ) + } + +void CSystemInfoMisc::StopVibra() + { + TRAP_IGNORE( iVibraControl->StopVibraL( ) ) + } + + +TInt CSystemInfoMisc::TotalRam() + { + TInt m = 0; + (void) HAL::Get( HALData::EMemoryRAM, m ); + return m; + } + +TInt CSystemInfoMisc::FreeRam() + { + TInt m = 0; + (void) HAL::Get( HALData::EMemoryRAMFree, m ); + return m; + } + +void CSystemInfoMisc::Language( TDes& aLangCode ) + { + if ( iWidgetRegistryConnected ) + { + iWidgetRegistryClient.GetLprojName( aLangCode ); + } + else + { + aLangCode.Copy(_L("")); + } + } + +// ----------------------------------------------------------------------------- +// CSystemInfoPlugin::DriveList +// +// ----------------------------------------------------------------------------- +void CSystemInfoMisc::DriveList( TDes8& aDriveList ) + { + RFs& fs = CCoeEnv::Static()->FsSession(); + TDriveList driveList; + TInt err = fs.DriveList( driveList ); + TInt effectiveDriveCount = 0; + aDriveList.SetLength( 0 ); + + for ( TInt i = 0; i < KMaxDrives && err == KErrNone; i++ ) + { + if ( driveList[i] && i != EDriveD && i != EDriveZ ) + { + TChar c; + if ( fs.DriveToChar( i, c ) == KErrNone ) + { + if ( effectiveDriveCount ) + { + aDriveList.Append( ' ' ); + } + aDriveList.Append( (TUint)c ); + effectiveDriveCount++; + } + } + } + } + +TReal CSystemInfoMisc::DriveSize( TChar c ) + { + RFs& fs = CCoeEnv::Static()->FsSession(); + TInt drive; + TVolumeInfo v; + if ( fs.CharToDrive( c, drive ) == KErrNone ) + { + if ( drive != EDriveD && drive != EDriveZ ) + { + if ( !fs.Volume( v, drive ) ) + { + TInt64 si = v.iSize; + TReal sr = si; + return sr; + } + } + } + return 0; + } + +TReal CSystemInfoMisc::DriveFree( TChar c ) + { + RFs& fs = CCoeEnv::Static()->FsSession(); + TInt drive; + TVolumeInfo v; + if ( fs.CharToDrive( c, drive ) == KErrNone ) + { + if ( drive != EDriveD && drive != EDriveZ ) + { + if ( !fs.Volume( v, drive ) ) + { + TInt64 fi = v.iFree; + TReal fr = fi; + return fr; + } + } + } + return 0; + } + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/SystemInfoObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/SystemInfoObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "SystemInfoObserver.h" + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::CSystemInfoObserver +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CSystemInfoObserver* CSystemInfoObserver::NewL( MSystemInfoObserverClient* aClient, TInt aId ) + { + CSystemInfoObserver* self = new ( ELeave ) CSystemInfoObserver( aClient, aId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::CSystemInfoObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CSystemInfoObserver::CSystemInfoObserver( MSystemInfoObserverClient* aClient, TInt aId ) + : CActive( EPriorityStandard ), + iClient( aClient ), + iId( aId ) + { + } + + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CSystemInfoObserver::ConstructL() + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::~CSystemInfoObserver() +// Destructor +// ----------------------------------------------------------------------------- +CSystemInfoObserver::~CSystemInfoObserver() + { + Cancel(); + if ( iClient ) + { + iClient->Close( iId ); + } + } + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::RequestNotification +// ----------------------------------------------------------------------------- +void CSystemInfoObserver::RequestNotificationL() + { + if ( !IsActive() ) + { + iClient->SubscribeL( iId, iStatus ); + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::RunL +// ----------------------------------------------------------------------------- +void CSystemInfoObserver::RunL() + { + if( iStatus == KErrNone ) + { + iClient->UpdateL( iId ); + iClient->SubscribeL( iId, iStatus ); // FUTURE consider letting client decide if to do this + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::RunError +// ----------------------------------------------------------------------------- +TInt CSystemInfoObserver::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSystemInfoObserver::DoCancel +// ----------------------------------------------------------------------------- +void CSystemInfoObserver::DoCancel() + { + iClient->Cancel( iId ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/browsersysteminfoplugin/src/SystemInfoPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/browsersysteminfoplugin/src/SystemInfoPlugin.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,624 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to Browser for handling embedded system info requests. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include "SystemInfoPlugin.h" +#include "NetworkObserver.h" +#include "PowerObserver.h" +#include "SystemInfoMisc.h" + +// CONSTANTS + +enum TIdentifiersNames + { + EIdChargeLevel, + EIdOnChargeLevel, + EIdChargerConnected, + EIdOnChargerConnected, + EIdSignalBars, + EIdNetworkName, + EIdNetworkRegistrationStatus, + EIdOnNetworkRegistrationStatus, + EIdLightMinIntensity, + EIdLightMaxIntensity, + EIdLightDefaultIntensity, + EIdLightInfiniteDuration, + EIdLightMaxDuration, + EIdLightDefaultCycleTime, + EIdLightTargetPrimaryDisplayAndKeyboard, + EIdLightTargetSystem, + EIdLightOn, + EIdLightBlink, + EIdLightOff, + EIdVibraMinIntensity, + EIdVibraMaxIntensity, + EIdVibraMaxDuration, + EIdVibraSettings, + EIdStartVibra, + EIdStopVibra, + EIdBeep, + EIdTotalRam, + EIdFreeRam, + EIdDriveList, + EIdDriveSize, + EIdDriveFree, + EIdLanguage, + EIdLast + }; + +const NPUTF8 *systemInfoPluginIdentifierNames[EIdLast] = + { + "chargelevel", + "onchargelevel", + "chargerconnected", + "onchargerconnected", + "signalbars", + "networkname", + "networkregistrationstatus", + "onnetworkregistrationstatus", + "lightminintensity", + "lightmaxintensity", + "lightdefaultintensity", + "lightinfiniteduration", + "lightmaxduration", + "lightdefaultcycletime", + "lighttargetprimarydisplayandkeyboard", + "lighttargetsystem", + "lighton", + "lightblink", + "lightoff", + "vibraminintensity", + "vibramaxintensity", + "vibramaxduration", + "vibrasettings", + "startvibra", + "stopvibra", + "beep", + "totalram", + "freeram", + "drivelist", + "drivesize", + "drivefree", + "language" + }; + +const TBool IsMethod[EIdLast] = + { + EFalse, // "chargelevel" + EFalse, // "onchargelevel" + EFalse, // "chargerconnected" + EFalse, // "onchargerconnected" + EFalse, // "signalbars" + EFalse, // "networkname" + EFalse, // "networkregistrationstatus" + EFalse, // "onnetworkregistrationstatus" + EFalse, // "lightminintensity" + EFalse, // "lightmaxintensity" + EFalse, // "lightdefaultintensity" + EFalse, // "lightinfiniteduration" + EFalse, // "lightmaxduration" + EFalse, // "lightdefaultcycletime" + EFalse, // "lighttargetprimarydisplayandkeyboard" + EFalse, // "lighttargetsystem" + ETrue, // "lighton" + ETrue, // "lightblink" + ETrue, // "lightoff" + EFalse, // "vibraminintensity" + EFalse, // "vibramaxintensity" + EFalse, // "vibramaxduration" + EFalse, // "vibrasettings" + ETrue, // "startvibra" + ETrue, // "stopvibra" + ETrue, // "beep" + EFalse, // "totalram" + EFalse, // "freeram" + EFalse, // "drivelist" + ETrue, // "drivesize" + ETrue, // "drivefree" + EFalse // "language" + }; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::CSystemInfoPlugin +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------------------------- +CSystemInfoPlugin::CSystemInfoPlugin() + { + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::ConstructL +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +void CSystemInfoPlugin::ConstructL() + { + iSystemInfoPluginIdentifiers = new (ELeave) NPIdentifier[EIdLast]; + NPN_GetStringIdentifiers( systemInfoPluginIdentifierNames, EIdLast, + iSystemInfoPluginIdentifiers ); + iUid = RProcess().SecureId(); + + // need profile to determine silent mode for beep control + iProfileEngine = CreateProfileEngineL(); + + // sysinfo feature class instances + iPowerObserver = CPowerObserver::NewL( this ); + iNetworkObserver = CNetworkObserver::NewL( this ); + iSystemInfoMisc = CSystemInfoMisc::NewL(); + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::NewL +// Two-phased constructor. +// ---------------------------------------------------------------------------- +CSystemInfoPlugin* CSystemInfoPlugin::NewL() + + { + CSystemInfoPlugin* self = new (ELeave) CSystemInfoPlugin; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::Destructor +// ---------------------------------------------------------------------------- +CSystemInfoPlugin::~CSystemInfoPlugin() + { + delete [] iSystemInfoPluginIdentifiers; + + if (iProfileEngine != NULL) + { + iProfileEngine->Release(); + } + // sysinfo feature class instances + delete iPowerObserver; + delete iNetworkObserver; + delete iSystemInfoMisc; + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::Deallocate +// +// ---------------------------------------------------------------------------- +void CSystemInfoPlugin::Deallocate() + { + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::InvokeCallback +// +// ---------------------------------------------------------------------------- +bool CSystemInfoPlugin::InvokeCallback( TDesC8& name, const NPVariant *args, uint32_t argCount ) + { + CSystemInfoPluginEcomMain* lSystemInfoPPluginEcomMain + = (CSystemInfoPluginEcomMain*) Dll::Tls(); + NPNetscapeFuncs* lNetscapeFuncs = lSystemInfoPPluginEcomMain->Funcs(); + if ( lNetscapeFuncs && iInstanceHandle ) + { + void* value = 0; + NPError npErr = lNetscapeFuncs->getvalue( iInstanceHandle, NPNVWindowNPObject, + (void*)&value ); + if ( npErr == NPERR_NO_ERROR ) + { + NPVariant resultVariant; + VOID_TO_NPVARIANT( resultVariant ); + NPIdentifier ident = NPN_GetStringIdentifier( (const NPUTF8 *)(name.Ptr()) ); + return NPN_Invoke( iInstanceHandle, (NPObject*)value, ident, + args, argCount, &resultVariant ); + } + } + return false; + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::HasMethod +// +// ---------------------------------------------------------------------------- +bool CSystemInfoPlugin::HasMethod( NPIdentifier name ) + { + for (TInt i= 0; i < EIdLast; i++) + { + if ( name == iSystemInfoPluginIdentifiers[i] ) + { + return IsMethod[i]; + } + } + return false; + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::VariantToInt +// +// ---------------------------------------------------------------------------- +void CSystemInfoPlugin::VariantToInt( NPVariant& v, TInt& i ) + { + if ( NPVARIANT_IS_INT32( v ) ) + { + i = NPVARIANT_TO_INT32( v ); + } + else if ( NPVARIANT_IS_DOUBLE( v ) ) + { + double d = NPVARIANT_TO_DOUBLE( v ); + i = d; + } + // leave unchanged if some other type tag on variant + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::Invoke +// +// ---------------------------------------------------------------------------- +bool CSystemInfoPlugin::Invoke( NPIdentifier name, + NPVariant* args, + uint32_t argCount, + NPVariant *result ) + { + bool ret = false; + VOID_TO_NPVARIANT( *result ); + + if ( name == iSystemInfoPluginIdentifiers[EIdBeep] ) + { + // don't beep if profile is silent + MProfile* profile = NULL; + TRAPD( error, + profile = iProfileEngine->ActiveProfileL() ); + if ( KErrNone != error ) + { + return true; + } + if ( EFalse == profile->IsSilent() ) + { + TInt f = 440; // default 440 hertz + TInt d = 500; // default 0.5 seconds (in milliseconds) + if ( argCount > 0 ) VariantToInt( args[0], f ); + if ( argCount > 1 ) VariantToInt( args[1], d ); + // convert duration from milliseconds to microseconds, the + // underlying functionality doesn't really handle microseconds + // even though the interface specs it as microseconds + d = d * 1000; + // Note that d = 0 seems to mean "forever". Also, there + // are max and min frequencies but they are not defined. + // Below min there is silence, above max the equation + // seems to be f = min( max_freq, f) + iSystemInfoMisc->Beep( f, d ); + } + profile->Release(); + ret = true; + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightOn] ) + { + TInt l = iSystemInfoMisc->LightTargetSystem(); + TInt d = iSystemInfoMisc->LightInfiniteDuration(); + TInt i = iSystemInfoMisc->LightDefaultIntensity(); + TInt f = 1; + if ( argCount > 0 ) VariantToInt( args[0], l ); + if ( argCount > 1 ) VariantToInt( args[1], d ); + if ( argCount > 2 ) VariantToInt( args[2], i ); + if ( argCount > 3 ) VariantToInt( args[3], f ); + iSystemInfoMisc->LightOn( l, d, i, f ); + ret = true; + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightBlink] ) + { + TInt l = iSystemInfoMisc->LightTargetSystem(); + TInt d = iSystemInfoMisc->LightInfiniteDuration(); + TInt don = iSystemInfoMisc->LightDefaultCycleTime(); + TInt doff = iSystemInfoMisc->LightDefaultCycleTime(); + TInt i = iSystemInfoMisc->LightDefaultIntensity(); + if ( argCount > 0 ) VariantToInt( args[0], l ); + if ( argCount > 1 ) VariantToInt( args[1], d ); + if ( argCount > 2 ) VariantToInt( args[2], don ); + if ( argCount > 3 ) VariantToInt( args[3], doff ); + if ( argCount > 4 ) VariantToInt( args[4], i ); + iSystemInfoMisc->LightBlink( l, d, don, doff, i ); + ret = true; + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightOff] ) + { + TInt l = iSystemInfoMisc->LightTargetSystem(); + TInt d = iSystemInfoMisc->LightInfiniteDuration(); + TInt f = 1; + if ( argCount > 0 ) VariantToInt( args[0], l ); + if ( argCount > 1 ) VariantToInt( args[1], d ); + if ( argCount > 2 ) VariantToInt( args[2], f ); + iSystemInfoMisc->LightOff( l, d, f ); + ret = true; + } + else if ( name == iSystemInfoPluginIdentifiers[EIdStartVibra] ) + { + TInt d = iSystemInfoMisc->VibraMaxDuration(); + TInt i = iSystemInfoMisc->VibraMaxIntensity(); + if ( argCount > 0 ) VariantToInt( args[0], d ); + if ( argCount > 1 ) VariantToInt( args[1], i ); + iSystemInfoMisc->StartVibra( d, i ); + ret = true; + } + else if ( name == iSystemInfoPluginIdentifiers[EIdStopVibra] ) + { + iSystemInfoMisc->StopVibra(); + ret = true; + } + else if ( name == iSystemInfoPluginIdentifiers[EIdDriveSize] ) + { + TUint c = 0; + if ( argCount > 0 && NPVARIANT_IS_STRING( args[0] ) ) + { + NPString nps = NPVARIANT_TO_STRING( args[0] ); + if ( nps.UTF8Characters ) c = nps.UTF8Characters[0]; + } + if ( c > 0 ) + { + TChar drive( c ); + TReal size = iSystemInfoMisc->DriveSize( drive ); + DOUBLE_TO_NPVARIANT( size, *result ); + ret = true; + } + } + else if ( name == iSystemInfoPluginIdentifiers[EIdDriveFree] ) + { + TUint c = 0; + if ( argCount > 0 && NPVARIANT_IS_STRING( args[0] ) ) + { + NPString nps = NPVARIANT_TO_STRING( args[0] ); + if ( nps.UTF8Characters ) c = nps.UTF8Characters[0]; + } + if ( c > 0 ) + { + TChar drive( c ); + TReal free = iSystemInfoMisc->DriveFree( drive ); + DOUBLE_TO_NPVARIANT( free, *result ); + ret = true; + } + } + + return ret; + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::HasProperty +// +// ---------------------------------------------------------------------------- +bool CSystemInfoPlugin::HasProperty (NPIdentifier name) + { + for ( TInt i= 0; i < EIdLast; i++ ) + { + if ( name == iSystemInfoPluginIdentifiers[i] ) + { + return !IsMethod[i]; + } + } + return false; + } + + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::GetProperty +// +// ---------------------------------------------------------------------------- +bool CSystemInfoPlugin::GetProperty( NPIdentifier name, NPVariant *variant ) + { + // default variant value maps to javascript undefined + VOID_TO_NPVARIANT( *variant ); + + if ( name == iSystemInfoPluginIdentifiers[EIdChargeLevel] ) + { + INT32_TO_NPVARIANT( iPowerObserver->ChargeLevel(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdChargerConnected] ) + { + INT32_TO_NPVARIANT( iPowerObserver->ChargerConnected(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdSignalBars] ) + { + INT32_TO_NPVARIANT( iNetworkObserver->SignalBars(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdNetworkRegistrationStatus] ) + { + INT32_TO_NPVARIANT( iNetworkObserver->RegistrationStatus(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdNetworkName] ) + { + const TDesC& inBuf = iNetworkObserver->NetworkName(); + HBufC8* outBuf = HBufC8::New( inBuf.Length() + 1 ); + if ( outBuf ) + { + TPtr8 ptr( outBuf->Des() ); + TInt ret = CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, inBuf ); + DesToNpvariant(ptr, variant); + delete outBuf; + } + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightMinIntensity] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightMinIntensity(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightMaxIntensity] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightMaxIntensity(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightDefaultIntensity] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightDefaultIntensity(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightInfiniteDuration] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightInfiniteDuration(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightMaxDuration] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightMaxDuration(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightDefaultCycleTime] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightDefaultCycleTime(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightTargetPrimaryDisplayAndKeyboard] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightTargetPrimaryDisplayAndKeyboard(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLightTargetSystem] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->LightTargetSystem(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdVibraMinIntensity] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->VibraMinIntensity(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdVibraMaxIntensity] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->VibraMaxIntensity(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdVibraMaxDuration] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->VibraMaxDuration(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdVibraSettings] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->VibraSettings(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdTotalRam] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->TotalRam(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdFreeRam] ) + { + INT32_TO_NPVARIANT( iSystemInfoMisc->FreeRam(), *variant ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdDriveList] ) + { + HBufC8* drives = HBufC8::New( KMaxDrives*2 ); + if ( drives ) + { + TPtr8 ptr( drives->Des() ); + iSystemInfoMisc->DriveList( ptr ); + DesToNpvariant(ptr, variant); + delete drives; + } + } + else if ( name == iSystemInfoPluginIdentifiers[EIdLanguage] ) + { + TBuf<64> langCode; + iSystemInfoMisc->Language( langCode ); + HBufC8* outBuf = HBufC8::New( langCode.Length() + 1 ); + if ( outBuf ) + { + TPtr8 ptr( outBuf->Des() ); + ptr.SetLength( 0 ); + // Note: the copy below goes from 16-bit to 8-bit by + // dropping the high 8-bits. This will work since all + // codes are made from 7-bit ASCII characters see + // http://www.rfc-editor.org/rfc/rfc4646.txt section 7 + // "Character Set Considerations". Also see + // http://www.w3.org/International/questions/qa-lang-2or3 + ptr.Copy( langCode ); + ptr.ZeroTerminate(); + DesToNpvariant( ptr, variant ); + delete outBuf; + } + } + else + { + return EFalse; + } + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CSystemInfoPlugin::SetProperty +// ---------------------------------------------------------------------------- +bool CSystemInfoPlugin::SetPropertyL( NPIdentifier name, NPVariant *variant ) + { + // all writeable properties are names of callback functions + HBufC8* pFunctionText = NULL; + + // anything but a string will result in nulling out the callback + if ( NPVARIANT_IS_STRING( *variant ) ) + { + // canonicalize function name string: only fname (no args) and zero terminate + NPString str = NPVARIANT_TO_STRING( *variant ); + + if ( (const TUint8 *)str.UTF8Characters ) + { + // allocate a copy + TInt length = str.UTF8Length; + pFunctionText = HBufC8::NewL( length+1 ); + TPtr8 tptr = pFunctionText->Des(); + tptr.Copy( (const TUint8 *)str.UTF8Characters, length ); + + //Remove any arguments passed in the with the function name + TInt pos = pFunctionText->Locate(TChar('(')); + if ( pos != KErrNotFound ) + { + length = pos; + } + tptr.SetLength(length); + tptr.ZeroTerminate(); + } + } + + // NOTE: pFunctionText can be NULL + + if ( name == iSystemInfoPluginIdentifiers[EIdOnChargeLevel] ) + { + iPowerObserver->RequestNotificationL( CPowerObserver::EIdBatteryInfo, + pFunctionText ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdOnChargerConnected] ) + { + iPowerObserver->RequestNotificationL( CPowerObserver::EIdIndicator, + pFunctionText ); + } + else if ( name == iSystemInfoPluginIdentifiers[EIdOnNetworkRegistrationStatus] ) + { + iNetworkObserver->RequestNotificationL( CNetworkObserver::EIdRegistrationStatus, + pFunctionText ); + } + else + { + delete pFunctionText; + return EFalse; + } + return ETrue; + } + +void CSystemInfoPlugin::DesToNpvariant(TPtr8& string, NPVariant*& variant) +{ + char* newString = NULL; + if (string.Length()) { + newString = new char[string.Length()]; + } + if (newString) { + Mem::Copy(newString, string.Ptr(), string.Length()); + STRINGN_TO_NPVARIANT(newString, string.Length(), *variant); + } +} + + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserplugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserplugins/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project build file for BrowserPlugins +* +*/ + +#ifdef __WEB_WIDGETS + #include "../browsersysteminfoplugin/group/bld.inf" + #include "../browsergpsplugin/group/bld.inf" +#endif + +#include "../browseraudiovideoplugin/group/bld.inf" + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Aif/BrowserAIF.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Aif/BrowserAIF.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* aif resources +* +* +*/ + +#include + +RESOURCE AIF_DATA + { + app_uid=0x10008D39; + + + // icons + num_icons=2; + + // capabilities + embeddability= KAppEmbeddable; + hidden=KAppNotHidden; + + // MIME types + datatype_list= + { + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlc"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/wml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/xhtml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.xhtml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/vnd.wap.wml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/html"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlscriptc"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlscript"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wbxml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/x-opml"; + } + }; + } + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Aif/wb48i.bmp Binary file browserui/browser/Aif/wb48i.bmp has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Aif/wb48m.bmp Binary file browserui/browser/Aif/wb48m.bmp has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/AHLEInterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/AHLEInterface.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains the header file of the CAHLEInterface class. + * +*/ + + +// This is a wrapper class for the AHLE client. Its intent is to defer +// the construction until after the browser startup is +// complete. Documentation is not duplicated. Only new functions or +// those modified are described here. See AHLE.h for the detailed +// descriptions. + + +#ifndef AHLEINTERFACE_H +#define AHLEINTERFACE_H + +#include + +_LIT(KAHLEInterfaceDummyFile, "dummy_file"); + +class CAHLEInterface: public CBase, public MAHLEClientAPI + { + public: + + enum TAHLENewType + { + EAHLENewNoArgs, + EAHLENewAllArgs, + EAHLENewDbOnlyArgs, + EAHLENewPrimarySizeOnlyArgs + }; + + virtual ~CAHLEInterface(); + + /** Engine start. */ + IMPORT_C static CAHLEInterface* NewL(); + IMPORT_C static CAHLEInterface* NewL( const TDesC& aDatabase ); + IMPORT_C static CAHLEInterface* NewL( TUint aPrimarySize ); + IMPORT_C static CAHLEInterface* NewL( const TDesC& aDatabase, + TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ); + + + /** Check if the client has been connected to the server */ + IMPORT_C TBool IsConnected(); + + /** Set Observer */ + IMPORT_C void SetObserverL( const MAHLEClientObserver* aObserver ); + + /** Engine reconfiguration. */ + IMPORT_C TInt ReconfigureL( TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ); + + /** Current engine configuration. */ + IMPORT_C void GetConfigurationL( TUint& aPrimarySize, + TUint& aSecondarySize, + TAHLEScore& aAdaptationSpeed ); + + /** Get adaptive list parameters. */ + IMPORT_C TInt GetParameters( TAHLESortOrder& aOrder ) const; + IMPORT_C TInt GetParameters( TAHLESortOrder& aOrder, + TAny* aReserved ) const; + + + /** Set adaptive list parameters. */ + IMPORT_C TInt SetParameters( TAHLESortOrder aOrder ); + IMPORT_C TInt SetParameters( TAHLESortOrder aOrder, + TAny* aReserved ); + + + //////////////////////////////////////////////////////////////// + // ADAPTIVE LIST METHODS + //////////////////////////////////////////////////////////////// + + /** Logging of new access. Synchronous. Used for string data. */ + IMPORT_C TInt NewAccessL( const TDesC& aItem, + const TDesC& aItemName ); + + /** Asynchronous version of NewAccessL(). */ + IMPORT_C void NewAccessL( TRequestStatus& aStatus, + const TDesC& aItem, + const TDesC& aItemName ); + + /** Get adaptive list. Here the user has the option of selecting sites/groups */ + IMPORT_C TInt AdaptiveListL( CDesCArray& aItems, + CDesCArray& aItemNames, + const TInt aSize, + const TDesC& aMatch, + const TAHLEState aState ); + + /** + * Sorts items by their scores. Used e.g. in Favorite + * Links in Page feature within browser application. + */ + IMPORT_C TInt OrderByScoreL( CDesCArray& aItems, CDesCArray& aItemsSorted ); + IMPORT_C TInt OrderByScoreL( CDesCArray& aItems, RArray& aItemsSorted ); + + + /** Remove item(s). */ + IMPORT_C TInt RemoveL( const TDesC& aItem ); + IMPORT_C void RemoveL( const TDesC& aItem, TRequestStatus& aStatus ); + IMPORT_C TInt RemoveL( const CDesCArray& aItems ); + IMPORT_C void RemoveL( const CDesCArray& aItems, TRequestStatus& aStatus ); + + + /** Remove matching items. */ + IMPORT_C TInt RemoveMatchingL( const TDesC& aMatch ); + IMPORT_C void RemoveMatchingL( const TDesC& aMatch, TRequestStatus& aStatus ); + + + /** Rename item. */ + IMPORT_C TInt RenameL( const TDesC& aItem, const TDesC& aNewName ); + + + /** Get item name. */ + IMPORT_C TInt GetNameL( const TDesC& aItem, TDesC& aName ); + + + /** Clear all adaptive list items. */ + IMPORT_C TInt Clear(); + + + /** Flush cached items to persistent storage. */ + IMPORT_C TInt Flush(); + + + private: + + CAHLEInterface(); + + static TInt AHLEInitializationCB(TAny* thisObj); + + + void ConstructL( TAHLENewType aNewType, + const TDesC& aDatabase, + TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ); + + static CAHLEInterface* NewL( TAHLENewType aNewType, + const TDesC& aDatabase, + TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ); + + // This final section contains the modifications from the CAHLE + // class. The only new method facilitates lazy construction. If not + // needed it will still work. + + private: + + /** + * AHLE Engine Initialization + * Performs the deferred loading of the AHLE dll and its + * initialization. Throws an exception on failure. Does nothing if + * already initialized. + */ + void InitializeAHLEL(); + + + //This private data allows the actual construction of the AHLE + //object to be deferred until actually needed. This will defer the + //loading of the server dll. + + private: + + CAHLE* iAHLE; + TUint iPrimarySize; + TUint iSecondarySize; + TAHLEScore iAdaptationSpeed; + TUint iDeferPrimarySize; + TUint iDeferSecondarySize; + TAHLEScore iDeferAdaptationSpeed; + HBufC* iDatabase; + TAHLENewType iNewType; + CIdle* iIdle; + }; + +#endif /* AHLEINTERFACE_H */ diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/ApiProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/ApiProvider.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,413 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* API provider. +* +* +*/ + + +#ifndef MAPIPROVIDER_H +#define MAPIPROVIDER_H + +// INCLUDE FILES +#include "WmlBrowserBuild.h" +#include "BrowserLoadObserver.h" // for LoadUrlType +#ifdef __RSS_FEEDS +#include "FeedsClientUtilities.h" +#endif + +// FORWARD DECLARATIONS + +class MPreferences; +class MCommsModel; +class MConnection; +class MDisplay; +class MBmOTABinSender; + +//class MStartPageHandler; +class CBrCtlInterface; +class CBrowserDialogsProvider; +class CFavouritesItem; +class TFavouritesWapAp; +class RHttpDownloadMgr; +class CDownloadMgrUiDownloadsList; +class CBrowserSpecialLoadObserver; +class CBrowserSoftkeysObserver; +class CBrowserPopupEngine; +class CBrowserWindowManager; + +// CLASS DECLARATION + +/** +* Interface to query several API implementations. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class MApiProvider + { + public: // New functions + + /** + * Returns reference to the implementation of MDisplay. + * @since Series 60 1.2 + * @return An implementation of MDisplay + */ + virtual MDisplay& Display() const = 0; + + /** + * Returns a reference to the implementaion of MConnection, + * through wich some high-level connection specific data can be set + * @since Series 60 1.2 + * @return reference to MConnection object + */ + virtual MConnection& Connection() const = 0; + + /** + * Returns reference to the implementation of MPrefences. + * @since Series 60 1.2 + * @return An implementation of MPrefences + */ + virtual MPreferences& Preferences() const = 0; + + /** + * Returns reference to the implementation of MCommsModel. + * @since Series 60 1.2 + * @return An implementation of MCommsModel + */ + virtual MCommsModel& CommsModel() const = 0; + + /** + * Returns reference to the CBrCtlInterface + * @since Series 60 2.8 + * @return A reference to CBrCtlInterface + */ + virtual CBrCtlInterface& BrCtlInterface() const = 0; + + /** + * Returns reference to CBrowserLoadObserver. + * @since Series 60 2.8 + * @return An implementation of MBrCtlLoadEventObserver + */ + virtual CBrowserLoadObserver& LoadObserver() const = 0; + + virtual CBrowserSpecialLoadObserver& SpecialLoadObserver() const = 0; + + virtual CBrowserSoftkeysObserver& SoftkeysObserver() const = 0; + /** + * Returns reference to CBrowserDialogsProvider. + * @since Series 60 2.8 + * @return An implementation of MBrCtlDialogsProvider + */ + virtual CBrowserDialogsProvider& DialogsProvider() const = 0; + + /** + * Returns reference to the implementation of MBmOTABinSender. + * @since Series 60 1.2 + * @return An implementation of MBmOTABinSender + */ + virtual MBmOTABinSender& BmOTABinSenderL() = 0; + + virtual CBrowserWindowManager& WindowMgr() const = 0; + + virtual CBrowserPopupEngine& PopupEngine() const = 0; + + /** + * Sets uid which should be activated if needed + * If not, it activates view immediately. + * @since Series 60 1.2 + * @param aUid Uid of the view + */ + virtual void SetViewToBeActivatedIfNeededL( TUid aUid, TInt aMessageId = 0 ) = 0; + + /** + * In some cases it's not permitted to cancel fetching process. + * @since Series 60 1.2 + * @return true is user can cancel fetch + */ + virtual TBool IsCancelFetchAllowed() const = 0; + + /** + * Returns Uid of the last used view. + * @since Series 60 1.2 + * @return Uid of the last used view + */ + virtual TUid LastActiveViewId() const = 0; + + /** + * Sets uid of the last used view + * @since Series 60 1.2 + * @param aUid Uid of the latest used view + */ + virtual void SetLastActiveViewId( TUid aUid ) = 0; + + /** + * Tells if WmlBrowser is in the middle of a shutdown process. + * @since Series 60 1.2 + * @return ETrue if the app is being closed, otherwise with EFalse + */ + virtual TBool ExitInProgress() const = 0; + + /** + * Sets a flag in WmlBrowser to indicate shutdown process. + * @since Series 60 1.2 + * @param aValue Determines if exit is in progress or not + */ + virtual void SetExitInProgress( TBool aValue ) = 0; + + /** + * Is there connection procedure ongoing? + * @since Series 60 1.2 + * @return ETrue if connection procedure is ongoing + */ + virtual TBool IsConnecting() const = 0; + + /** + * Updates progress bar in contentview. + * @since Series 60 1.2 + * @param aStatusMsg Progress bar text + */ + virtual void UpdateNaviPaneL( TDesC& aStatusMsg ) = 0; + + /** + * Set view to return to when closing the content view. + * @since Series60 1.2 + * @param aUid View uid + */ + virtual void SetViewToReturnOnClose( TUid const &aUid ) = 0; + + /** + * Close the content view by activating the bookmarks view + * @since Series60 1.2 + */ + virtual void CloseContentViewL() = 0; + + /** + * Is embedded mode ongoing? + * @since Series60 1.2 + * @return ETrue if embedded mode is ongoing + */ + virtual TBool IsEmbeddedModeOn() const = 0; + + virtual TBool IsShutdownRequested() const = 0; + + virtual void ExitBrowser(TBool aUserShutdown) = 0; + + /** + * Is the avkon appshutter running + * @since Series60 2.0 + * @return ETrue if AppShutter is active + */ + virtual TBool IsAppShutterActive() const = 0; + + /** + * Starts prefrences view if no valid ap + * @since Series60 2.0 + * @return ETrue if access point has been set. + */ + virtual TBool StartPreferencesViewL( TUint aListItems ) = 0; + + /** + * Returns ETrue if at least one page has been loaded. + * @return ETrue if at least one page has been loaded.\n + * EFalse if no pages has been loaded. + */ + virtual TBool IsPageLoaded() = 0; + + /** + * + */ + virtual TBool IsForeGround() const = 0; + + /** + * Returns fetching status. + * @return ETrue if there is a fetch going on, EFalse otherwise. + */ + virtual TBool Fetching() const = 0; + + /** + * Returns content display status. + * @return ETrue if content of a new page is displayed, EFalse otherwise. + * (useful for zooming while page is loading) + */ + virtual TBool ContentDisplayed() const = 0; + + /** + * Sets the content display status. + * (useful for zooming while page is loading) + */ + virtual void SetContentDisplayed( TBool aValue ) = 0; + + /** + * Initiate fetching of bookmark. + * @param aBookmarkUid Uid of bookmark to fetch. + */ + virtual void FetchBookmarkL( TInt aBookmarkUid ) = 0; + + /** + * Initiate fetching of bookmark. + * @param aBookmarkItem Bookmark item to fetch. + */ + virtual void FetchBookmarkL( const CFavouritesItem& aBookmarkItem ) = 0; + + /** + * Initiate fetching of URL. + * @param aUrl URL to fetch. + * @param aUserName User name. + * @param aPassword Password. + * @param aAccessPoint AccessPoint. + */ + virtual void FetchL( + const TDesC& aUrl, + const TDesC& aUserName, + const TDesC& aPassword, + const TFavouritesWapAp& aAccessPoint, + CBrowserLoadObserver::TBrowserLoadUrlType aUrlType + ) = 0; + + /** + * Initiate fetching of URL with default AP, empty username and password. + * @param aUrl URL to fetch. + */ + virtual void FetchL( const TDesC& aUrl, CBrowserLoadObserver::TBrowserLoadUrlType aUrlType = CBrowserLoadObserver::ELoadUrlTypeOther ) = 0; + + /** + * Cancel fetching. + */ + virtual void CancelFetch( TBool aIsUserInitiated ) = 0; + + /** + * Sets requested AP. + * @param aAp the AP to use when connectionneeded is called. + */ + virtual void SetRequestedAP( TInt aAp ) = 0; + + virtual void SetExitFromEmbeddedMode( TBool aFlag ) = 0; + + //To check and set iShowProgress flag that indicates that + //real downloading is going on ( we are not loading from cache ) + + virtual TBool IsProgressShown() const = 0; + + virtual void SetProgressShown( TBool aProgressShown ) = 0; + + virtual TBool StartedUp() const = 0; + + virtual TUint32 RequestedAp() const = 0; + + /** + * Logs a record of opened pages to AHLE + */ + virtual void LogAccessToRecentUrlL( CBrCtlInterface& aBrCtlInterface ) = 0; + + /** + * Logs a record of requested pages to Recent Url Store + */ + virtual void LogRequestedPageToRecentUrlL( const TDesC& aUrl ) = 0; + + /** + * Starts animation. + */ + virtual void StartProgressAnimationL() = 0; + + /** + * Stops animation. + */ + virtual void StopProgressAnimationL() = 0; + +#ifdef __RSS_FEEDS + /** + * Returns reference to FeedsClientUtilities. + */ + virtual CFeedsClientUtilities& FeedsClientUtilities() const = 0; +#endif // __RSS_FEEDS + + /** + * Returns Uid of the previous active view from the view history. + * @since Series 60 3.1 + * @return Uid of the previous active view + */ + virtual TUid GetPreviousViewFromViewHistory() = 0; + + /** + * Set the View for in which the last CBA update was made + * @since 5.0 + */ + virtual void SetLastCBAUpdateView( TUid aView ) = 0; + + /** + * Get the view in which the last CBA update was made + * @since 5.0 + * @return TUid of last view for which CBA was updated + */ + virtual TUid GetLastCBAUpdateView() = 0; + + + /** + * Return if Flash plugin is present in the system or not + * @param none + * @return TBool + */ + virtual TBool FlashPresent( ) = 0; + + /** + * Check state of LaunchHomePage command for dimmed state in options menu and shortcut keymap + * @return ETrue is LaunchHomePage command should be dimmed in options menu and shortcut keymap + * EFalse otherwise + * @param none + */ + virtual TBool IsLaunchHomePageDimmedL() = 0; + + /** + * Return if the Browser was originally launched directly into the feeds view + * @param none + * @return TBool + */ + virtual TBool BrowserWasLaunchedIntoFeeds() = 0; + + /** + * Set flag to ETrue if called from another application. + * @since Series 60 1.2 + * @param aValue Is browser called from some another App. + */ + virtual void SetCalledFromAnotherApp( TBool aValue ) = 0; + + /** + * Get flag if called from another application. + * @since Series 60 3.1 + * @return Etrue if browser is called from some another App. + */ + virtual TBool CalledFromAnotherApp() = 0; + /** + * Check from CCoeAppUi if a Dialog or Menu is diplayed on top of the view + * @return ETrue if Dialog or Menu is displayed + * EFalse otherwise + * @param none + */ + virtual TBool IsDisplayingMenuOrDialog() = 0; + + /** + * API to complete the delayed UI initialization. Invoked once after first view is up. + * @return ETrue if successful + * EFalse otherwise + * @param none + */ + virtual TBool CompleteDelayedInit() = 0; + +}; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BmOTABinSender.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BmOTABinSender.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of MBmOTABinSender. +* +* +*/ + + + +#ifndef MBMOTABINSENDER_H +#define MBMOTABINSENDER_H + +// INCLUDES + + // System includes +#include + + // User includes + +// CLASS DECLARATION + +/** +* Interface to Bookmarks OTA Binary Sending. +* @lib Browser.app +* @since Series 60 1.2 +*/ +class MBmOTABinSender + { + public: + + /** + * Reset and destroy bookmark list. + * @since Series 60 1.2 + */ + virtual void ResetAndDestroy() = 0; + + /** + * Add bookmark title and URL to be sent + * this class will destroy passed objects. + * @since Series 60 1.2 + * @param aURL bookmark's URL + * @param aTitle bookmark's title can be Null + */ + virtual void AppendL + ( const TText *aURL, const TText *aTitle = NULL ) = 0; + + /** + * Add bookmark title and URL to be sent + * this class will destroy passed objects + * @since Series 60 1.2 + * @param aURL bookmark's URL + * @param aTitle bookmark's title + */ + virtual void AppendL( const TDesC& aURL, const TDesC& aTitle ) = 0; + + /** + * Sends all the bookmarks added with AddL(). + * @since Series 60 1.2 + */ + virtual void SendAddressL( ) = 0; + + /** + * Sends an OPML file. + * @since Series 60 3.2 + */ + virtual void SendOPMLFileL(const TDesC& aOPMLFile) = 0; + }; + +#endif + + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAnimation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAnimation.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class to put animation to contextPane. +* +* +*/ + + +#ifndef BROWSERANIMATION_H +#define BROWSERANIMATION_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS + +class CAknBitmapAnimation; +class CFbsBitmap; +class CEikImage; + +// CLASS DECLARATION + +/** +* Encapsulates the animation feature of the browser. +*/ +class CBrowserAnimation : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aResourceId BMPANIM_DATA resource + */ + static CBrowserAnimation* NewL( TInt aResourceId ); + + /** + * Destructor. + */ + virtual ~CBrowserAnimation(); + + public: // New functions + + /** + * Starts animation. + */ + void StartL(); + + /** + * Stops animation. + */ + void StopL(); + + TBool IsRunning() { return iIsRunning; }; + + protected: + + /** + * constructor that can leave. + * @param aResourceId BMPANIM_DATA resource + */ + void ConstructL( TInt aResourceId ); + + private: // Data + + CAknBitmapAnimation* iAnimation; // animation object + + TBool iIsRunning; // Animation is running + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAppDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAppDocument.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser document class +* +* +*/ + +#ifndef __BROWSERAPPDOCUMENT_H +#define __BROWSERAPPDOCUMENT_H + +#include +#include "BrowserUtil.h" +#include + +//CONSTANTS +_LIT( KAttachment,"c:\\system\\temp\\Attachment.html"); +_LIT( KMailerStoreUid,"1000484b"); + +class MDownloadedContentHandler; + +// CAknDocument +class CBrowserAppDocument : public CAknDocument +{ +public: + CBrowserAppDocument(CEikApplication& aApp); + virtual ~CBrowserAppDocument(); + + inline void SetFolderToOpen(TInt aFolderId) { iFolderToOpen = aFolderId; } + + /** + * Set the MDownloadedContentHandler implementation. + * @param aObserver The implementation. + * @return None. + */ + inline void SetDownloadedContentHandler(MDownloadedContentHandler *aObserver); + + inline void SetIsContentHandlerRegistered( TBool aIsContentHandlerRegistered ) + { iIsContentHandlerRegistered = aIsContentHandlerRegistered; } + + inline TBool IsContentHandlerRegistered() const + { return iIsContentHandlerRegistered; }; + + TInt GetFolderToOpen() const; + + HBufC* GetUrlToOpen() const; + + MDownloadedContentHandler *GetDownloadedContentHandler() const; + + CFileStore* OpenFileL(TBool aDoOpen, const TDesC& aFileName, RFs& aFs); + + void OpenFileL(CFileStore*& aFileStore, RFile& aFile); + + TBrowserOverriddenSettings* GetOverriddenSettings(); + + inline void SetOverriddenSettings(TBrowserOverriddenSettings* aSettings){ iOverriddenSettings = aSettings; }; + +protected: + CEikAppUi* CreateAppUiL(); + +private: + MDownloadedContentHandler *iDownloadedContentHandler; + TInt iFolderToOpen; + TBool iIsContentHandlerRegistered; + HBufC* iUrlToOpen; + TBrowserOverriddenSettings* iOverriddenSettings; +}; + +#include "BrowserAppDocument.inl" + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAppDocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAppDocument.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for CBrowserAppDocument. +* +*/ + + +#ifndef BROWSER_APP_DOCUMENT_INL +#define BROWSER_APP_DOCUMENT_INL + +// CONSTANTS +_LIT( KBrowserAppDocPanicString, "BrowserAppDoc" ); + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// CBrowserAppDocument::SetDownloadedContentHandler +// Implementation info: +// Only one of the DownloadedContentHandler is allowed to be set the same time! +// The following example will cause Panic: +// browserAppDocument->SetDownloadedContentHandler( this ); +// browserAppDocument->SetFileDownloadedContentHandler( that ); +// It should be used like: +// browserAppDocument->SetDownloadedContentHandler( NULL ); +// browserAppDocument->SetFileDownloadedContentHandler( this ); +// ---------------------------------------------------------------------------- +// +inline void CBrowserAppDocument::SetDownloadedContentHandler + ( MDownloadedContentHandler* aObserver ) + { + if ( aObserver != NULL ) + { + __ASSERT_ALWAYS( iDownloadedContentHandler == NULL, + User::Panic( KBrowserAppDocPanicString, + Util::EFileDownloadedContentHandlerAlreadyInitialized ) ); + } + iDownloadedContentHandler = aObserver; + } + +#endif /* BROWSER_APP_DOCUMENT_INL */ + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAppEntryPoint.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAppEntryPoint.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* BrowserAppEntryPoint +* +* +*/ + + +#ifndef __BROWSERAPPENTRYPOINT_ +#define __BROWSERAPPENTRYPOINT_ + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAppServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAppServer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CBrowserAppServer +* +* +*/ + + +#ifndef BrowserAppServer_H +#define BrowserAppServer_H + +// INCLUDE FILES +#include +#include + +// CLASS DECLARATION +class CBrowserAppServer : public CAknAppServer +{ +public: + /** + * This is a factory function that takes a UID indicating + * the type of service that is to be created. The server + * application should implement this function to create and + * return service implementations for service UIDs that it + * recognises, and base call for all other UIDs. + * @param aServiceType The service object to create + * @return Object for all service implementations + */ + CApaAppServiceBase* CreateServiceL(TUid aServiceType) const; // from CAknAppServer + + /** + * Second-phase constructor + * @param The server name. ( called by the framework ) + */ + void ConstructL(const TDesC& aFixedServerName); +protected: + + /** + * ( not much info about this method... ) + * Check the capabilities of a client. + * @param aMsg Object which encapsulates a client request. + * @param aAction + * @param aMissing + * @return + */ + TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing ); + + /** + * ( not much info about this method... ) + * Check the capabilities of a client. + * @param aMsg Object which encapsulates a client request. + * @param aAction + * @param aMissing + * @return + */ + TCustomResult CustomFailureActionL(const RMessage2& /*aMsg*/, TInt /*aAction*/, const TSecurityInfo& /*aMissing*/); + +private: + /** + * Document capabilities. + */ + TCapability iClientReqs; +}; + +#endif // BrowserAppServer_H +// End Of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAppUi.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1145 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CBrowserAppUi +* +* +*/ + +#ifndef __BROWSERAPPUI_H +#define __BROWSERAPPUI_H + +// INCLUDE FILES +#include +#include +#include // CHG! +#include +#include "ApiProvider.h" +#include "BrowserBuild.h" +#include "WmlBrowserBuild.h" +#include + +#include +#include +#include "WindowInfoProvider.h" +#include +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +#include +#endif +// FORWARD DECLARATIONS +class CBrowserViewBase; +class MCommsModel; +class CBrowserCommsModel; +class CBrowserPreferences; +class CWmlBrowserBmOTABinSender; +class CBrowserContentView; +class CBrowserSoftkeysObserver; +class CBrowserSpecialLoadObserver; +class CBrowserAsyncExit; +class CBrowserLauncherService; + +// Multiple Windows Support +class CBrowserPopupEngine; +class CBrowserWindow; +class CBrowserWindowManager; +class CBrowserBookmarksView; +#ifdef __RSS_FEEDS + class CFeedsClientUtilities; +#endif // __RSS_FEEDS + +// CONSTANTS + +// +// BROWSER UI KNOWN mime types +// + + +_LIT(KOPMLMimeType, "text/x-opml"); +_LIT(KMimeTypeAppXML, "application/xml"); +_LIT(KMimeTypeTextXML, "text/xml"); +//++PK +_LIT(KMimeTypeCapsTextXML, "Text/xml"); +//++PK +_LIT(KMimeTypeRSS, "application/rss+xml"); +_LIT(KMimeTypeAtom, "application/atom+xml"); +_LIT(KMimeTypeRDF, "application/rdf+xml"); + + +class CBrowserPushMtmObserver; +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +class CIAUpdate; +class CIAUpdateParameters; +#endif +// CLASS DECLARATION + +/** +* CBrowserAppUi. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserAppUi : public CAknViewAppUi, + public MApiProvider, + public MConnectionStageObserver, + public MDownloadedContentHandler, + public MWindowInfoProvider + #ifdef BRDO_IAD_UPDATE_ENABLED_FF + ,public MIAUpdateObserver + #endif + { + public: // Constructors and destructor + /** + * Default constructor. + */ + CBrowserAppUi(); + + /** + * Destructor. + */ + ~CBrowserAppUi(); + + public: +#if defined(__S60_50__) + /** + * Handling the system Event. + * @since Series 60 1.2 + * @param aEvent The System event passed. + */ + + void HandleSystemEventL(const TWsEvent& aEvent); +#endif + /** + * Get the active view. + * @since Series 60 1.2 + * @return The current view. + */ + CBrowserViewBase* ActiveView(); + + /** + * Checking if user wants to disconnect. + * @since Series 60 1.2 + * @param aUserInitiated it can be closed by user or the system. + */ + void ExitBrowser( TBool aUserInitiated ); + + /** + * Calls views' method (ALWAYS changes the view's CBA). + * @since Series 60 1.2 + */ + void UpdateCbaL(); + + /** + * Handles commandline parameters. + * @since Series 60 1.2 + * @param aDocumentName Parameter string + * @param aDoFetch Indicates that this function shoud fetch the given + * URL. This parameter is required and used + * by new embedding architecture. + */ + void ParseAndProcessParametersL( const TDesC8& aDocumentName, TBool aDoFetch = ETrue ); + + /** + * Wait a while, contentview initializing itself + * @since Series 60 3.2 + */ + void WaitCVInit(); + /** + * Set flag to ETrue if called from another application. + * @since Series 60 1.2 + * @param aValue Is browser called from some another App. + */ + void SetCalledFromAnotherApp( TBool aValue ); + + /** + * Get flag if called from another application. + * @since Series 60 3.1 + * @return Etrue if browser is called from some another App. + */ + TBool CalledFromAnotherApp(); + + /** + * Override CAknViewAppUi::ProcessCommandL. Calls CAknAppUi::StopDisplayingMenuBar() before iView one. + * @since Series 60 + * @param aCommand GUI command + */ + void ProcessCommandL(TInt aCommand); + + /** + * Get the instance of the browser UI. + * @since Series 60 1.2 + * @return The browser UI. + */ + static CBrowserAppUi* Static(); + + /** + * Contentview. + * @since Series 60 1.2 + */ + CBrowserContentView* ContentView() const; + + /** + * Check Operator Menu or Video Services status + * @since Series 60 2.0 + * @return ETrue if browser is running in Operator Menu or Video Services app + */ + TBool IsEmbeddedInOperatorMenu() const; + + /** + * Check if avkon appshutter is running + * @since Series60 2.0 + * @return ETrue if avkon appshutter is running + */ + TBool IsAppShutterActive() const; + + /** + * Returns value of iSomeItemsNotSecure member + * @since Series60 2.0 + * @return ETrue if some items is unsecure in page + */ + TBool SomeItemsNotSecure() const; + + /** + * Fetch the home page + */ + void FetchHomePageL(); + + /** + * Check if the application is in foreground + * @return ETrue if application is in foreground + */ + inline TBool IsForeGround() const + { return iIsForeground; } + + /** + * Sets a private status to indicate that Browser has to use + * a special exiting method. + */ + inline void SetExitFromEmbeddedMode( TBool aFlag ) + { iExitFromEmbeddedMode = aFlag; } + + /** + * Sets a the uid of the embedding application if the + * Browser is embedded. + */ + inline void SetEmbeddingAppliacationUid( TUid aEmbeddingApplicationUid ) + { iEmbeddingApplicationUid = aEmbeddingApplicationUid; } + + inline void SetBrowserLauncherService( CBrowserLauncherService* aBrowserLauncherService ) + { iBrowserLauncherService = aBrowserLauncherService; } + + inline CBrowserLauncherService* BrowserLauncherService() const + { return iBrowserLauncherService; } + + void CloseWindowL( TInt aWindowId = 0 ); + + inline CBrowserBookmarksView* GetBookmarksView() + { return iBookmarksView; } + + void OpenLinkInNewWindowL( const CFavouritesItem& aBookmarkItem ); + + /** + * Launching HomePage (AP home page, or user-defined home page). + */ + void LaunchHomePageL(); + + /** + * Set home page found flag + * @param aPgNotFoundFlag: indicate if home page is found or not. + */ + void SetPgNotFound(TBool aPgNotFoundFlag) {iPgNotFound = aPgNotFoundFlag;}; + + /** + * Catch any key presses that are Application wide. Called from OfferKeyEventL() in view containers + * @param aKeyEvent: + * @param aType: + */ + TKeyResponse OfferApplicationSpecificKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + /** + * Sets requested AP. + * @param aAp the AP to use when connectionneeded is called. + */ + void SetRequestedAP( TInt aAp ); + + /** + * Gets the currently focused image, and saves it to Gallery. + */ + void SaveFocusedImageToGalleryL(); + + /** + * Check if shutdown was requested. + * @return ETrue if shutdown was requested. + */ + TBool IsShutdownRequested() const; + + /** + * Check if a progress bar is shown. + * @return ETrue if progress bar is shown. + */ + TBool IsProgressShown() const; + + /** + * Sets prograss bar showing status. + * @param ETrue to show, EFalse to hide the progress bar + */ + void SetProgressShown( TBool aProgressShown ); + + /** + * Check if RFile content should be handled + * by BrowserUI rather than sent off to BrCtl + * @return ETrue if it should be handled by BrowserUI + * @param an RFile filehandle, and an allocated buffer to hold + * discovered mime type + */ + TBool CBrowserAppUi::RecognizeUiFileL( RFile& aFileHandle, TBuf& aDataTypeDes ); + + /** + * Confirm with the user that a file should be handled by + * BrowserUI according to it's mime type with appropriate + * dialogs, etc. The name is used for the dialogs + * @return ETrue if yes, EFalse otherwise + * @param a filename to be shown in dialog, and a mime type + * to switch on so we can show different dialogs in different situations + */ + TBool ConfirmUiHandlingL( TFileName& aFilename, TBuf& aDataTypeDes ); + + /** + * Given a file handle (RFile) and a file path, + * copy the contents of the RFile to the file path given + * @return void + * @param a filehandle RFile, and a path to copy the contents to + */ + void CopyUiRFileToFileL( RFile& aFile, const TDesC& aFilepath ); + + /** + * Handle a file that BrowserUi can process (as opposed to + * BrCtl) + * This will also setup views accordingly (the setup may be different from the HandleUiDownload case) + * @return void + * @param the full path of the filename to be handled and the mime type + * so that handling can be different for different mime types + */ + void HandleUiFileL( TFileName& aFilepath, TBuf& aDataTypeDes ); + + /** + * Handle a file that BrowserUi can process that is downloaded from the content view + * This will also setup views accordingly (the setup may be different from the HandleUiFile case) + * @return void + * @param the full path of the filename to be handled and the mime type + * so that handling can be different for different mime types + */ + void HandleUiDownloadL( TFileName& aFilepath, TBuf& aDataTypeDes ); + + /** + * Launch the browser so that it starts directly into the feeds view + * @return void + * @param none + */ + void LaunchIntoFeedsL(); + + public: // From CEikAppUi + /** + * Handles user commands. + * @param aCommand Command to be handled. + */ + void HandleCommandL( TInt aCommand ); + void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination); + + public: // Functions from MApiProvider + + /** + * Returns reference to the implementation of MDisplay. + * @return An implementation of MDisplay. + */ + MDisplay& Display() const; + + /** + * Returns a reference to the implementaion of MConnection, + * through wich some high-level connection specific data can be set. + * @return reference to MConnection object. + */ + MConnection& Connection( ) const; + + /** + * Returns reference to the implementation of MPrefences. + * @return An implementation of MPrefences. + */ + MPreferences& Preferences() const; + + /** + * Returns reference to the implementation of MCommsModel. + * @return An implementation of MCommsModel. + */ + MCommsModel& CommsModel() const; + + /** + * Returns reference to the CBrCtlInterface + * @return A reference to CBrCtlInterface + */ + CBrCtlInterface& BrCtlInterface() const; + + /** + * Returns reference to CBrowserLoadObserver. + * @return An implementation of MBrCtlLoadEventObserver + */ + CBrowserLoadObserver& LoadObserver() const; + + /** + * Returns reference to CBrowserLoadObserver. + * @return An implementation of MBrCtlLoadEventObserver + */ + CBrowserSpecialLoadObserver& SpecialLoadObserver() const; + + CBrowserSoftkeysObserver& SoftkeysObserver() const; + + /** + * Returns reference to CBrowserDialogsProvider. + * @return An implementation of MBrCtlDialogsProvider + */ + CBrowserDialogsProvider& DialogsProvider() const; + + CBrowserPopupEngine& PopupEngine() const; + + /** + * Returns reference to the implementation of MBmOTABinSender. + * @return An implementation of MBmOTABinSender. + */ + MBmOTABinSender& BmOTABinSenderL(); + + + /** + * Returns reference to the implementation of MStartPageHandler. + * @return An implementation of MStartPageHandler. + */ + CBrowserWindowManager& WindowMgr() const; + + /** + * + */ + inline TBool StartedUp() const { return iStartedUp; }; + + /** + * + */ + void ConnNeededStatusL( TInt aErr ); + + /** + * Checks the last used AP. + * @return the Id of the last used AP. + */ + inline TUint32 RequestedAp() const { return iRequestedAp; } + + /** + * In some cases it's not permitted to cancel fetching process. + * @return ETrue if cancelling fetch is allowed, otherwise EFalse. + */ + TBool IsCancelFetchAllowed() const; + + /** + * Sets uid which should be activated if needed. + * If not, it activates view immediately. + * @param aUid Uid of the view. + * @param aMessageId Id of the message. + */ + void SetViewToBeActivatedIfNeededL( TUid aUid, TInt aMessageId = 0 ); + + /** + * Returns the Uid of the last visited Uid. + * @return Uid of the last used view. + */ + TUid LastActiveViewId() const; + + /** + * Sets uid of the last used view. + * @param aUid Uid of the latest used view. + */ + void SetLastActiveViewId( TUid aUid ); + + + /** + * Gets uid of the current view. + * @param none + * @return TUid of the current view + */ + TUid GetCurrentViewId() const + { + return iCurrentView; + } + + /** + * Set the View for in which the last CBA update was made + * @since 5.0 + */ + void SetLastCBAUpdateView( TUid aView ) { iLastCBAUpdateView = aView; } + + /** + * Get the view in which the last CBA update was made + * @since 5.0 + * @return TUid of last view for which CBA was updated + */ + TUid GetLastCBAUpdateView() { return iLastCBAUpdateView; } + + /** + * Tells if Browser is in the middle of a shutdown process. + * @return ETrue if the app is being closed, otherwise with EFalse. + */ + TBool ExitInProgress() const; + + /** + * Sets a flag in Browser to indicate shutdown process. + * @param aValue ETrue if exit process will be started, otherwise EFalse. + */ + void SetExitInProgress( TBool aValue ); + + /** + * Is Browser connection procedure ongoing or not. + * @return ETrue if connection procedure is ongoing, otherwise EFalse. + */ + TBool IsConnecting() const; + + /** + * Updates progress bar in contentview. + * @param aStatusMsg Progress bar text. + */ + void UpdateNaviPaneL( TDesC& aStatusMsg ); + + /** + * Set view to return to when closing the content view. + * @since Series60 1.2 + * @param aUid View uid + */ + void SetViewToReturnOnClose( TUid const &aUid ); + + /** + * Close the content view by activating the bookmarks view + * @since Series60 1.2 + */ + void CloseContentViewL(); + + /** + * Tells if Browser is in the embedded mode + * @return ETrue if the Browser is in the embedded mode, + * otherwise with EFalse. + */ + TBool IsEmbeddedModeOn() const; + + /** + * Starts prefrences view if no valid ap + * @since Series60 2.0 + * @return ETrue if access point has been set otherwise EFalse. + */ + TBool StartPreferencesViewL( TUint aListItems ); + + /** + * Gives back a pointer to the Recent Url Store + * @return iRecentUrlStore + */ + CRecentUrlStore* RecentUrlStore(); + + /** + * Returns ETrue if at least one page has been loaded. + * @return ETrue if at least one page has been loaded.\n + * EFalse if no pages has been loaded. + */ + TBool IsPageLoaded(); + + /** + * Returns fetching status. + * @return ETrue if there is a fetch going on.\n + * EFalse otherwise. + */ + TBool Fetching() const; + + /** + * Checks if the content of a new page is displayed. + * @return ETrue if the content is displayed. + * EFalse otherwise. + * (useful for zooming while page is loading) + */ + TBool ContentDisplayed() const; + + /** + * Sets the content displayed status + * (useful for zooming while page is loading) + */ + void SetContentDisplayed( TBool aValue ); + + /** + * Initiate fetching of bookmark. + * @param aBookmarkUid Uid of bookmark to fetch. + */ + void FetchBookmarkL( TInt aBookmarkUid ); + + /** + * Initiate fetching of bookmark. + * @param aBookmarkItem Bookmark item to fetch. + */ + void FetchBookmarkL( const CFavouritesItem& aBookmarkItem ); + + /** + * Initiate fetching of URL. + * @param aUrl URL to fetch. + * @param aUserName User name. + * @param aPassword Password. + * @param aAccessPoint AccessPoint. + */ + void FetchL + ( + const TDesC& aUrl, + const TDesC& aUserName, + const TDesC& aPassword, + const TFavouritesWapAp& aAccessPoint, + CBrowserLoadObserver::TBrowserLoadUrlType aUrlType + = CBrowserLoadObserver::ELoadUrlTypeOther + ); + + /** + * Initiate fetching of URL with default AP, empty username and password. + * @param aUrl URL to fetch. + */ + void FetchL( const TDesC& aUrl, CBrowserLoadObserver::TBrowserLoadUrlType aUrlType + = CBrowserLoadObserver::ELoadUrlTypeOther ); + + /** + * Cancel fetching. + */ + void CancelFetch( TBool aIsUserInitiated = EFalse ); + + /** + * Starts animation. + */ + void StartProgressAnimationL(); + + /** + * Stops animation. + */ + void StopProgressAnimationL(); + + /* + * Return True if browser was launched especially into feeds view + */ + TBool BrowserWasLaunchedIntoFeeds() { return(iOverriddenLaunchContextId == EBrowserContextIdFeeds); } + + /* + * record the overridden launch context id + */ + void SetOverriddenLaunchContextId(TUint aId) { iOverriddenLaunchContextId = aId; } + + +#ifdef __RSS_FEEDS + /** + * Returns reference to FeedsClientUtilities. + */ + CFeedsClientUtilities& FeedsClientUtilities() const; +#endif // __RSS_FEEDS + + + /** + * Returns the Uid of the previous active view from the view history. + * @return Uid of the previous active view. + */ + TUid GetPreviousViewFromViewHistory(); + + /** + * Return if Flash plugin is present in the system or not + * @param none + * @return TBool + */ + TBool FlashPresent( ); + + + /** + * Check state of LaunchHomePage command for dimmed state in options menu and shortcut keymap + * @return ETrue is LaunchHomePage command should be dimmed in options menu and shortcut keymap + * EFalse otherwise + * @param none + */ + TBool IsLaunchHomePageDimmedL(); + /** + * Check from CCoeAppUi if a Dialog or Menu is diplayed on top of the view + * @return ETrue if Dialog or Menu is displayed + * EFalse otherwise + * @param none + */ + TBool IsDisplayingMenuOrDialog(); + + /** + * Function to complete the delayed intialization of Browser + * @return ETrue if initialization was successful + * EFalse otherwise + * @param none + */ + TBool CompleteDelayedInit(); + + + public: // from MWindowInfoProvider + + HBufC* CreateWindowInfoLC( const CBrowserWindow& aWindow ) ; + void SwitchWindowL(); + + /** + * Initializes the browser, if it is in embedded mode. + * In embedded mode the browser is initialized later, not when it + * is constructed. First the browser must wait for the embedding + * application to send the startup parameters, and only after that + * can be initialized. This method is required and used by new + * embedding architecture. + */ + void InitBrowserL(); + + /* This method is used for normal startup and when the first view is Bookmarks. + * In order to show the Bookmarks view, initialize only bookmarks and delay the + * remaining initialization. + */ + void InitBookmarksL(); + + /* This method is used for normal startup and when the first view is Bookmarks. + * This method includes intialization stuff which are not necessary for Bookmarks + * view. This is done using async CIdle approach. + */ + void DelayedInitL(); + + /** + * From CAknViewAppUi, CEikAppUi + * Handles changes in keyboard focus when an + * application switches to foreground + * @param aForeground Is foreground event? + */ + void HandleForegroundEventL( TBool aForeground ); + + public: // From MDownloadedContentHandler + + virtual TBool HandleContentL( const TDesC& aFileName, + const CAiwGenericParamList& aParamList, + TBool& aContinue ); + + virtual TAny* DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ); + + void SetContentHandlingResult( TBool aClientWantsToContinue, TBool aWasContentHandled ); + + /** + * Loads the defined search page into content view. + */ + void LoadSearchPageL(); + + // This member is public, so BrowserLauncher.dll can close the browser. + CBrowserAsyncExit *iBrowserAsyncExit; + public: + void StopConnectionObserving(); + +#ifdef BRDO_OCC_ENABLED_FF + //Retry flags + void SetRetryFlag(TBool flag); + TBool GetRetryFlag(); +#endif + + private: + + /** + *Callback for late constructing of the SendUi in idle + *Needed to provide better response time for the user + *@return Returns 0 + */ + static TInt DelayedSendUiConstructL(TAny* aCBrowserAppUi); + + + /** + * Calls ProcessCommandParametersL with the given parameters. + * @param aParams startup parameter (will be casted). + * @return Returns 0 (called only once). + */ + //static TInt DelayedProcessParametersL( TAny* aParams ); + + /** + * Callback function for CIdle. Calls DoStopDelay. + * @param aCBrowserAppUi + * @return Returns 0 (called only once). + */ + static TInt StopDelay( TAny* aCBrowserAppUi); + + /** + * Stops CActiveSchedulerWait loop started + * by ParseAndProcessParametersL(). + */ + void DoStopDelay(); + + /** + *Construct SendUI now + */ + void DoConstructSendUiL(); + + /* + * Changes the connection + * @param + * @return None. + */ + void ChangeConnectionL(); + + /* + * send disconnect event to multiple windows + */ + void SendDisconnectEventL(); + + /** + * Check if Flash plugin is present in the system or not + * @param none + * @return TBool + */ + TBool CheckFlashPresent( ); + + + /** + * Checks if a HomePage will be launched + * @param none + * @return TBool - ETrue if no homepage will be launched otherwise return EFalse + */ + TBool NoHomePageToBeLaunchedL(); + + /** + * Show the name of browser and version of the browser + * @param none + */ + void ShowNameAndVersionL(); + + /** + * There's a homepage to be launched so start in content view + * [Convenience function that gets used in 2 places] + * @param none + */ + void StartFetchHomePageL(); + TBool IsSameWinApp(TUid aMessageUid); +#ifdef BRDO_OCC_ENABLED_FF + //For Call back for reconnectivity + static TInt RetryConnectivity(TAny* aCBrowserAppUi); + TInt RetryInternetConnection(); + void CheckOccConnectionStage(); +#endif + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF + /** + * Check updates + */ + void CheckUpdatesL(); + + /** + * Clean IAD update parameters + */ + void CleanUpdateParams(); + + /** + * This callback function is called when the update checking operation has completed. + * + * @param aErrorCode The error code of the observed update operation. + * KErrNone for successful completion, + * otherwise a system wide error code. + * @param aAvailableUpdates Number of the updates that were found available. + */ + void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ); + + /** + * This callback function is called when an update operation has completed. + * + * @param aErrorCode The error code of the completed update operation. + * KErrNone for successful completion, + * otherwise a system wide error code. + * @param aResult Details about the completed update operation. + * Ownership is transferred. + */ + void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails ); + + /** + * This callback function is called when an update query operation has completed. + * + * @param aErrorCode The error code of the observed query operation. + * KErrNone for successful completion, + * otherwise a system wide error code. + * @param aUpdateNow ETrue informs that an update operation should be started. + * EFalse informs that there is no need to start an update + * operation. + */ + void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ){return;} + + /** + * This function is checking the existence of the file containing last update time + * @param None + * @return TBool. + */ + TBool CheckUpdateFileAvailable(); + + /** + * This function is deleting of the file(if exist) containing last update time + * @param None + * @return None. + */ + void DeleteUpdateFile(); + + /** + * This function is will write the current time in file + * @param None + * @return None. + */ + void WriteUpdateFile(); + + /** + * This function will read the content of the file if it exists + * @param None + * @return TBool. + */ + TInt64 ReadUpdateFile(); + + /** + * Callback function to complete the IAD udated check on CIdle::RunL + * @param None + * @return TBool. + */ + static TInt CompleteIADUpdateCallback( TAny* aBrowserAppUi ); +#endif + protected: + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + /** + * Sends Browser to the background. The task whose window group + * is at the next ordinal position is brought up to the foreground. + */ + void SendBrowserToBackground(); + + /** + * + */ + void DelayedConstructL(); + + /** + * Clear the cache. + */ + void ClearTheCacheL(TBool afterQuery = EFalse, TBool aShowDoneNote = ETrue); + + + /** + * Delete cookies. + */ + void DeleteCookiesL(); + + + /** + * Delete Form and Password Data + * @param aShowPromptAndComplete - show confirmation prompt and completion info note if True + */ + void ClearFormAndPasswdDataL(TBool aShowPromptAndComplete); + + + /** + * Clear History of all open windows + */ + void CBrowserAppUi::ClearHistoryL(); + + + /** + * Prompt before clearing history + */ + void CBrowserAppUi::ClearHistoryWithPromptL(); + + + /** + * Clear All Privacy Data + */ + void CBrowserAppUi::ClearAllPrivacyL(); + + /** + * Disconnect. + */ + void DisconnectL(); + + /** + * Updates the soft keys. Previously a callback in ViewShellObserver + */ + void UpdateSoftKeys(); + /** + * Logs a record of opened pages to Recent Url Store + */ + void LogAccessToRecentUrlL( CBrCtlInterface& aBrCtlInterface ); + + /** + * Logs a record of requested pages to Recent Url Store + */ + void LogRequestedPageToRecentUrlL( const TDesC& aUrl ); + + /** + * Load previous page from history (back button) + * @since Series60 1.2 + */ + void HistoryLoadPrevious(); + + /** + * Load next page from history (forward button) + * @since Series60 1.2 + */ + void HistoryLoadNext(); + + /** + * Creating a full url containing username, password, + * server domain and document path. + * @return buffer pointing to the url + */ + HBufC* CreateFullUrlLC( const TDesC& aUrl, + const TDesC& aUsername, + const TDesC& aPassword ); + + + protected: // from MConnectionStageObserver + /** + * Connection stage achieved. + */ + void ConnectionStageAchievedL(); + + protected: // From CAknViewAppUi, CEikAppUi + + /** + * Processes shell commands. + * @param aCommand Command to process. + * @return //TODO + */ + TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& /*aDocumentName*/,const TDesC8& /*aTail*/ ); + + + /** + * Handle the external message. + * @param aClientHandleOfTargetWindowGroup Handle. + * @param aMessageUid Message id. + * @param aMessageParameters Message parameters. + * @return Response to the message. + */ + MCoeMessageObserver::TMessageResponse HandleMessageL( TUint32 aClientHandleOfTargetWindowGroup, + TUid aMessageUid, + const TDesC8& aMessageParameters ); + + /** + * Handles screen resolution changes + */ + void HandleResourceChangeL( TInt aType ); + + /** + * Handles application specific events like OOM from window server. + * @param aEventType The type of event. + * @param aWsEvent window server event. + * @return Key response. + */ + void HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent); + + private: + + TUint32 iRequestedAp; + TBool iCalledFromAnotherApp; + + TBool iIsForeground; + TUid iViewToBeActivatedIfNeeded; + TUid iViewToReturnOnClose; + + TUid iLastViewId; + TBool iSecureSiteVisited; + + + CWmlBrowserBmOTABinSender* iSender; + + CConnectionStageNotifierWCB* iConnStageNotifier; + + CIdle* iIdle; // at construction phase + CActiveSchedulerWait iWait; + + TBool iExitInProgress; + + RSocketServ iSockServSess; + + TBool iShutdownRequested; + TBool iHTTPSecurityIndicatorSupressed; + CRecentUrlStore* iRecentUrlStore; + TInt iParametrizedLaunchInProgress; //ETrue when launch with parameters is in idling + + TBool iExitFromEmbeddedMode; + + // Flag to indicate that real downloading is + // going on ( we are not loading from cache ) + + TBool iShowProgress; + TBool iLongZeroPressed; + TBool iStartedUp; + TBool iFeatureManager; + TBool iUserExit; + TBool iPgNotFound; + TBool iSuppressAlwaysAsk; + TBool iFlashPresent; + TBool iSpecialSchemeinAddress; + + RFavouritesSession iFavouritesSess; + + // The Uid of the embedding application. + TUid iEmbeddingApplicationUid; + + TUid iPreviousView; + TUid iCurrentView; + + // Uid for tracking what view the last CBA update was made under, + // used to avoid extraneous updates + TUid iLastCBAUpdateView; + + // Observing changes in PushMtm + CBrowserPushMtmObserver* iPushMtmObserver; // owned + + // Record browser launch's overridden context id + TUint iOverriddenLaunchContextId; + + TBool iBrowserAlreadyRunning; + +#ifdef BRDO_OCC_ENABLED_FF + CPeriodic *iRetryConnectivity; + TBool reConnectivityFlag; +#endif + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF + CIAUpdate* iUpdate; + CIAUpdateParameters* iParameters; + RFs iFs; + CIdle* iDelayedUpdate; +#endif + TBool iSameWinApp; + TInt iWindowIdFromFromExternApp; + protected: + + CBrowserCommsModel* iCommsModel; + CBrowserPreferences* iPreferences; + + MConnection* iConnection; + + CBrowserDialogsProvider* iDialogsProvider; + mutable CBrowserPopupEngine* iPopupEngine; + CBrowserLauncherService* iBrowserLauncherService; // Not owned + CActiveSchedulerWait iLauncherServiceWait; + TBool iClientWantsToContinue; + TBool iWasContentHandled; + RArray* iZoomLevelArray; + TUint iCurrentZoomLevelIndex; + TUint iCurrentZoomLevel; + + CBrowserWindowManager* iWindowManager; + CIdle* iLateSendUi; + CBrowserBookmarksView* iBookmarksView; // not owned +#ifdef __RSS_FEEDS + CFeedsClientUtilities* iFeedsClientUtilities; +#endif // __RSS_FEEDS + }; +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAppViewBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAppViewBase.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserAppViewBase. +* +* +*/ + + +#ifndef BROWSER_APP_VIEW_BASE_H +#define BROWSER_APP_VIEW_BASE_H + +// INCLUDE FILES +#include + +// FORWARD DECLARATION + +class MApiProvider; + +// CLASS DECLARATION + +/** +* Class to encapsulate a softkey pair made up of an Command ID and Resource qtn +*/ +class TSKPair + { +public: + /** + * Constructor. + * @param NONE. command and qtn are set to default. + */ + TSKPair(); + + /** + * Constructor. + * @param Command and Resource IDs + */ + TSKPair(TInt aId,TInt aRsc); + + /** + * check to see if command/qtn are not currently set to the default assignment + */ + TBool IsAssigned(); + + /** + * define an == operator to check pair equality + * @param TSK pair + */ + TBool operator==(TSKPair aSKPair); + + /** + * define an = operator for assignment + * @param TSK pair + */ + void operator=(TSKPair aSKPair); + + /** + * a function to set the pair directly + * @param Command and Resource Ids + */ + void setPair(TInt aId, TInt aRsc); + + /** + * retrieve the command ID + */ + TInt id() { return iCmdId; } + + /** + * retrieve the qtn resource ID + */ + TInt qtn() { return iQtnRsc; } +private: + + /** + * private variables to hold command and resource ids + */ + TInt iCmdId; + TInt iQtnRsc; + }; + +/** +* Base class all of the browser's views. Allows CBA setting and holds pointer +* to API provider. +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserViewBase : public CAknView + { + public: // construction + + /** + * Constructor. + * @param aApiProvider The API provider + */ + CBrowserViewBase( MApiProvider& aApiProvider ); + + public: // new methods + + /** + * Get the API provider. + * @since Series 60 1.2 + * @return The API provider + */ + MApiProvider& ApiProvider(); + + /** + * Update the view's CBA, according to its current state. + * This will call the view's CommandSetResourceIdL to get the + * command set's resource id and then change the command set to that. + * Note, there is no Push/Pop of CBA-s! The CBA which changes is always + * that of the view; that is, if there is another CBA Push()-ed on top + * of it (e.g. dialogs etc.), that will be unchanged. + * @since Series 60 1.2 + */ + void UpdateCbaL(); + + /** + * Switch cba visibility, checking landscape state + * @param aVisible Visibility + */ + void MakeCbaVisible(TBool aVisible); + + /** + * Update goto pane, if it is present in the view. + * @since Series 60 1.2 + */ + virtual void UpdateGotoPaneL(); + + /** + * Clear CBA. + * @since Series 60 1.2 + */ + void ClearCbaL(); + + /** + * Return command set id, to be displayed. + * Derived classes should implement this method. + * @since Series 60 1.2 + * @return + * - 0 if the command set should not be changed\n + * - Otherwise, the desired command set's resource id + */ + virtual TInt CommandSetResourceIdL() = 0; + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + virtual void CommandSetResourceDynL(TSKPair &lsk, TSKPair &rsk, TSKPair &msk) = 0; + + /** + * Handles client rect changes + */ + virtual void HandleClientRectChange() = 0; + + /** + * Gets the id of the previous active view. + */ + inline TUid GetPreviousViewID() + { return iPreviousViewID; } + + /** + * Sets the id of the previous active view. + * @param aUid UID of previous view + */ + inline void SetPreviousViewID(TUid aUid) + { iPreviousViewID = aUid; } + + /** + * gets the current view's id + */ + virtual TUid Id() const = 0; + + virtual void LaunchSearchApplicationL( const TDesC& aSearchString ); + //private: + protected: + + MApiProvider& iApiProvider; // API provider + + // Id of the view which was active before this view. + TUid iPreviousViewID; + + + private: + // For each child view class, track + // the last command set, dynamic lsk,rsk,msk settings + // to update CBA as little as possible + TInt iLastCommandSet; + TSKPair iLastLSK; + TSKPair iLastRSK; + TSKPair iLastMSK; + }; + +#endif// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserApplication.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser application class +* +* +*/ + + +#ifndef __BROWSER_APPLICATION_H +#define __BROWSER_APPLICATION_H + +#include + +const TUid KUidBrowserApplication = { 0x10008D39 }; + +class CBrowserApplication : public CAknApplication +{ +protected: + TUid AppDllUid() const; + CApaDocument* CreateDocumentL(); + void NewAppServerL(CApaAppServer*& aAppServer); +}; + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserAsyncExit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserAsyncExit.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CBrowserAsyncExit class can exit the Browser in async mode. It calls the CBrowserAppUi`s +* ExitBrowserL() method, when the object completes the request. +* The class helps avoiding to send event.iCode EKeyApplication1; event +* to the embedded browser to exit. +* +* +*/ + +#ifndef __BROWSERASYNCEXIT_H +#define __BROWSERASYNCEXIT_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MApiProvider; + +// CLASS DEFINITION +class CBrowserAsyncExit : public CActive + { + public: // constructors + + /** + * Create a CBrowserAsyncExit object, Leaves on failure. + * @param aApiProvider Api provider. Not owned. + * @return A pointer to the created instance of CBrowserAsyncExit. + */ + static CBrowserAsyncExit* NewL( MApiProvider* aApiProvider ); + + /** + * Create a CBrowserAsyncExit object. Leaves on failure. + * @param aApiProvider Api provider. Not owned. + * @return A pointer to the created instance of CBrowserAsyncExit + */ + static CBrowserAsyncExit* NewLC( MApiProvider* aApiProvider ); + + private: // default c++, and 2nd phase constructor + + /** + * Constructs this object + * @param aApiProvider Api provider. Not owned. + */ + CBrowserAsyncExit( MApiProvider* aApiProvider ); + + /** + * Performs second phase construction of this object + */ + void ConstructL(); + + public: + + /** + * Destroy the object and release all memory objects + */ + ~CBrowserAsyncExit(); + + /** + * Complete an asynchronous request. + */ + void Start(); + + protected: // from CActive + + /** + * Cancel any outstanding requests + */ + void DoCancel(); + + /** + * Handles object`s request completion event. + */ + void RunL(); + + private: + + /** + * To access CBrowserAppUi`s BrowserExitL() method. + */ + MApiProvider* iApiProvider; // not owned + }; + +#endif // __BROWSERASYNCEXIT_H + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserBmOTABinSender.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserBmOTABinSender.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This class implements the behavior of an anchor element. +* +*/ + +#ifndef WMLBROWSERBMOTABINSENDER_H +#define WMLBROWSERBMOTABINSENDER_H + +// INCLUDES + + // System includes +#include +#include + + // User includes +//#include "WmlBrowserBuild.h" + + + +#include "BmOTABinSender.h" + +// FORWARD DECLARATION +class CSendUi; +class CMessageData; + +// CLASS DECLARATION + +/** +* The class for implementing the CBookmarkOTAItem. +* Item is binary encoded in WBXML format. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBookmarkOTAItem : public CBase + { + friend class CWmlBrowserBmOTABinSender; + + public: + + /** + * Two-phased constructor. Leaves on failure. + * @param aURL is URL of the bookmark or current card's URL address + * @param aTitle is title of the bookmark or title of the current card's URL address + * @return new Bookmark OTA item + */ + static CBookmarkOTAItem* NewL( const TDesC& aURL, + const TDesC& aTitle ); + + /** + * Destructor. + */ + virtual ~CBookmarkOTAItem(); + + protected: + + /** + * Constructor. + */ + CBookmarkOTAItem(); + + /** + * Second phase constructor. Leaves on failure. + * Encode input params to binary WBXML format. + * @since Series 60 1.2 + * @param aURL is URL of the bookmark or current card's URL address + * @param aTitle is title of the bookmark or title of the current card's URL address + */ + void ConstructL( const TDesC& aURL, const TDesC& aTitle ); + + protected: // data + + /** + * Binary encoded bookmark in WBXML format + */ + HBufC *iBookmark; + }; + +/** +* The class for implementing the CWmlBrowserBmOTABinSender. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CWmlBrowserBmOTABinSender : public CBase, public MBmOTABinSender + { + public : // public construction + + /** + * Two-phased constructor. Leaves on failure. + */ + static CWmlBrowserBmOTABinSender* NewL(); + + /** + * Destructor. + */ + virtual ~CWmlBrowserBmOTABinSender(); + + public: // from MBmOTABinSender + + /** + * Reset and destroy bookmark list. + * @since Series 60 1.2 + */ + void ResetAndDestroy(); + + /** + * Add bookmark title and URL to be sent + * this class will destroy passed objects. + * @since Series 60 1.2 + * @param aURL bookmark's URL + * @param aTitle bookmark's title can be Null + */ + void AppendL( const TText *aURL, const TText *aTitle = NULL ); + + /** + * Add bookmark title and URL to be sent + * this class will destroy passed objects. + * @since Series 60 1.2 + * @param aURL bookmark's URL + * @param aTitle bookmark's title + */ + void AppendL( const TDesC& aURL, const TDesC& aTitle ); + + /** + * Sends all the bookmarks added with AddL(). + * @since Series 60 1.2 + */ + void SendAddressL( ); + + /** + * Sends an OPML file. + * @since Series 60 3.2 + */ + virtual void SendOPMLFileL(const TDesC& aOPMLFile); + + protected: // construction + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor. + */ + CWmlBrowserBmOTABinSender(); + + private: // new methods + + /** + * Creates a new attachment file for BT and IR´. + * @since Series 60 1.2 + * @param fs Already connected file session + * @param aBody body of the message + * @return system error code or KErrNone + */ + TInt WriteMessageBodyIntoFileL( RFs &fs, TDesC& aBody ); + + private: // data + + /// List of bookmarks to be sent. Owned. + CArrayPtrFlat iBookmarks; + + /// Pointer to SendUi. Owned. + CSendUi* iSendUi; + }; + + +#endif // WMLBROWSERBMOTABINSENDER_H +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserBuild.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserBuild.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines whether WIM is part of Browser or not +* +* +*/ + + +// INCLUDES +#if !defined(__BROWSERBUILD_H__) +#define __BROWSERBUILD_H__ + +// Comment out to disable Expanded view support +//#define _EXPANDED_VIEW //lint !e760 expression macro ok + + + + + +// Use this flag to send bookmark as plaing ascii text +// instead of binary OTA. +//#define _BOOKMARK_SENT_ASCII +// Use this flag to enable Bluetooth and IR +//#define _BOOKMARK_SEND_BT_IR_ENABLED +//#endif + +#endif // __BROWSERBUILD_H__ + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserCommandLineParser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserCommandLineParser.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* parsing command lines could be used in view activation +* +* +*/ + + + +#ifndef BROWSER_COMMAND_LINE_PARSER_H +#define BROWSER_COMMAND_LINE_PARSER_H + +// INCLUDES +#include + +// CLASS DECLARATION + +/** +* CBrowserCommandLineParser8 class +* Purpose: parsing command lines could be used in view activation. +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserCommandLineParser8 : public CBase + { + public: //Constructors and destructor + + /** + * Two-phased constructor. + * @param aParamString String of parameters + */ + static CBrowserCommandLineParser8* NewL( const TDesC8& aParamString ); + + /** + * Two-phased constructor. Cleanup stack used. + * @param aParamString String of parameters + */ + static CBrowserCommandLineParser8* NewLC( const TDesC8& aParamString ); + + /** + * C++ Default constructor. + */ + CBrowserCommandLineParser8(); + + /** + * Destructor. + */ + ~CBrowserCommandLineParser8(); + + public: // New functions + + /** + * Count the parameters. + * @since Series 60 1.2 + * @return Count of parameters + */ + TUint Count() const; + + /** + * Set parameters to member variable. + * @since Series 60 1.2 + * @param aParamString String of parameters + */ + void SetL( const TDesC8& aParamString ); + + /** + * Get pointer to a certain parameter in parameter array. + * @since Series 60 1.2 + * @param aIndex Index from where to get the parameter + */ + TPtrC8 Param( TUint aIndex ); + + /** + * Check whether the parameter is integer or not. + * @since Series 60 1.2 + * @param aIndex Index from where to get the parameter + * @return ETrue if the parameter is integer + */ + TBool IntegerParam( TUint aIndex ); + + /** + * Extract a signed integer from parameter array. + * @since Series 60 1.2 + * @param aIndex Index from where the parameter is extracted + * @return Parameter as signed integer + */ + TInt ParamToInteger( TUint aIndex ); + + + private: + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( const TDesC8& aParamString ); + + /** + * Fill array with parameters. + * Strips any white spaces. + * @since Series 60 1.2 + */ + void FillUpParamsL(); + + private: // Data + + HBufC8* iParamString ; //copy created in ConstructL + + CArrayFixFlat* iParams; //array of parameters + }; + +#endif // BROWSER_COMMAND_LINE_PARSER_H// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserCommsModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserCommsModel.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of class CBrowserCommsModel. +* +* +*/ + + +#ifndef BROWSER_COMMS_MODEL_H +#define BROWSER_COMMS_MODEL_H + +// INCLUDES + +#include +#include +#include "CommsModel.h" + +// FORWARD DECLARATION + +// class CApListItem; +class CApListItemList; + +// CLASS DECLARATION + +/** +* Comms model for the Browser. +* Provides CommsDb / AP database handling. Because querying AP-s is slow, but +* there should not be many of them, this class keeps a cached copy of AP-s. +* AP db is observed, and the cached list of AP-s is kept up to date. +* However, if database changes but we cannot get new data (database locked +* etc., the cached list is kept (until we can get the new data successfully)). +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserCommsModel: + public CBase, public MCommsModel, public MActiveApDbObserver + { + public: // construction + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed model + */ + static CBrowserCommsModel* NewL(); + + /** + * Destructor. + */ + virtual ~CBrowserCommsModel(); + + protected: // construction + + /** + * Constructor. + */ + CBrowserCommsModel(); + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + public: // from MCommsModel + + /** + * Get Access Point Engine object. + * @since Series 60 1.2 + * @return Access Point Engine object + */ + CActiveApDb& ApDb() const; + + /** + * Get CommsDb object. + * @since Series 60 1.2 + * @return CommsDb object + */ + CCommsDatabase& CommsDb() const; + + /** + * Get a copy of access points in a list. + * The caller is responsible for destroying the returned list. + * @since Series 60 1.2 + * @return List of access points. + */ + CApListItemList* CopyAccessPointsL(); + + /** + * Get pointer to model's cached access points. + * The owner of the list is the model. List contents may be updated + * if database update occurs. + * @since Series 60 1.2 + * @return List of access points. + */ + const CApListItemList* AccessPointsL(); + + /** + * Refresh the cached access points. + */ + void RefreshAccessPointsL(); + + /** + * Add an observer. Duplicates allowed. + * @since Series 60 1.2 + * @param aObserver The observer to add. + */ + void AddObserverL( MCommsModelObserver& aObserver ); + + /** + * Remove an observer. Does nothing if not added / already removed. + * @since Series 60 1.2 + * @param aObserver The observer to remove. + */ + void RemoveObserver( MCommsModelObserver& aObserver ); + + public: // from MActiveApDbObserver + + /** + * Handle database event (refresh cached AP list on change). + * @since Series 60 1.2 + * @param aEvent Database-related event. + */ + void HandleApDbEventL( MActiveApDbObserver::TEvent aEvent ); + + private: // new methods + + /** + * Get all access points (implementation detail). If database is + * inaccessible, old data remains and update becomes pending. + * @since Series 60 1.2 + */ + void GetAccessPointsL(); + + /** + * Get all access points (implementation detail). + * @since Series 60 1.2 + * @param aList Append access points to this list + */ + void DoGetAccessPointsL( CApListItemList& aList ) const; + + /** + * Successfully got new AP data. Notify observers. + * @since Series 60 1.2 + */ + void NotifyObserversL(); + + private: // data + + /** + * Access Point database. + */ + CActiveApDb* iDb; + + /** + * Cached AP list. Since querying the AP Engine is expensive (slow), + * we maintain a cached list of AP-s for quick access. Hopefully + * there are not too many of them. + */ + CApListItemList* iCachedApList; + + /** + * Array of observer pointers. Array owned, contents not. + */ + CArrayPtrFlat* iObservers; + + /** + * ETrue if database has changed, but could not get new data yet. + */ + TBool iUpdatePending; + + + /** + *Etrue if referesh needs to be done on next access to cached data + *Added as a result of performance tuning + */ + TBool iDelayedRefresh; + }; + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserContentView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserContentView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,714 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser content view +* +* +*/ + + +#ifndef __BROWSERCONTENTVIEW_H +#define __BROWSERCONTENTVIEW_H + +// INCLUDES +#include +#include +#include +#include + +#include "BrowserAppViewBase.h" +#include "BrowserGotoPane.h" +#include +#include +#include +#include "WindowObserver.h" + +// FORWARD DECLARATIONS + +class TVwsViewId; +class CBrowserContentViewContainer; +class CBrowserContentViewZoomModeTimer; +class CBrowserBookmarksModel; +class CAknNavigationControlContainer; +class CFindItemMenu; +class CAknInfoPopupNoteController; +class CAknStylusPopUpMenu; +class CBrowserContentViewToolbar; +class CBrowserShortcutKeyMap; + +// CONSTANTS + +const TInt KStatusMessageMaxLength=40; + +//The Zoom tooltip won't disappear +const TInt KZoomModeShowDisableTime( 5* 1000 * 1000 ); // 5000 seconds - disable the timer + + +// STRUCTS + +struct TWindowsMenuItemsDimCheck + { + TBool dimOpenInNewWin; + TBool dimSwitchWin ; + TBool dimCloseWin ; + TBool dimAllowPopups ; + TBool dimBlockPopups ; + }; + +/** +* Declaration for Browser's content view. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserContentView : public CBrowserViewBase, + public MGotoPaneObserver, + public MBrCtlStateChangeObserver, + public MBrCtlCommandObserver, + public MAknToolbarObserver, + public MWindowObserver + { + public: + + /** + * Two-phased constructor. + * @param aApiProvider Reference to the API provider. + * @param aRect + */ + static CBrowserContentView* NewLC( MApiProvider& aApiProvider, TRect& aRect ); + + /** + * Destructor. + */ + ~CBrowserContentView(); + + /** + * Callback - we should initialize the list of DO elements. + * @since 1.2 + */ + void OptionListInitL(); + + /** + * Callback - we should add an element to the list of DO elements. + * @since 1.2 + */ + void OptionListAddItemL( + const TDesC& aText, + TUint32 aElemID, + TBool aIsPrevType ); + + /** + * Update the title. + * @since 1.2 + */ + void UpdateTitleL( MApiProvider& aApiProvider ); + + CBrowserContentViewContainer* Container() const{ return iContainer; }; + + void ResetPreviousViewFlag() { iWasInFeedsView = EFalse; } + /** + * Get the top left position of the application window. + * This is used to place the toolbar. + * @return The top left point of the application rect on the screen + */ + TPoint OnScreenPosition(); + + /** + * Get a pointer to the instance of the class handling the toolbar state. + * This is used when the Browser is shut down, to save the user settings + * @return A pointer to the class handling the toolbar + */ + CBrowserContentViewToolbar* BrowserContentViewToolbar() { return iBrowserContentViewToolbar; } + + /** + * Find if the platform spports touch + * @return ETrue if the platform supports touch, EFalse otherwise + */ + TBool PenEnabled() { return iPenEnabled; } + + /** + * Find if the Full Screen mode is on + * @return ETrue if the Full Screen mode is on, EFalse otherwise + */ + TBool FullScreenMode() { return iContentFullScreenMode; } + public: // from MEikStatusPaneObserver + + /** + * Handles status pane size change. + */ + void HandleStatusPaneSizeChange(); + + public: // from MBrCtlStateChangeObserver + + /** + * State change event handling for ImageMapView changes. + * @param aState which state we are in + * @param aValue state specific value + * @return void + */ + void StateChanged( TBrCtlDefs::TBrCtlState aState, TInt aValue ); + + public: // from MBrCtlCommandObserver + + /** + * Executes commands requested by the webengine + * @param aCommand which state we are in + * @param aAttributesNames name list + * @param aAttributeValues value list + * @return void + */ + void HandleCommandL(TBrCtlDefs::TBrCtlClientCommands aCommand, const CArrayFix& aAttributesNames, + const CArrayFix& aAttributeValues) ; + /* Handle Goto Pane event. + * @since 1.2 + * @param aGotoPane The Goto Pane in which the event occurred. + * @param aEvent Goto Pane event + */ + void HandleGotoPaneEventL( + CBrowserGotoPane* aGotoPane, + MGotoPaneObserver::TEvent aEvent ); + + /** + * Set Last visited bookmark. + * @since 1.2 + */ + void SetLastVisitedBookmarkL(); + + /** + * Update navi pane. + * @since 1.2 + * @param aStatusMsg Status message + */ + void UpdateNaviPaneL( TDesC& aStatusMsg ); + + /** + * Update navi pane. + * @since 1.2 + * @param aLeftScrollBar Will the left scrollbar be updated + * @param aRightScrollBar Will the right scrollbar be updated + */ + void UpdateNaviPaneL( TBool aLeftScrollBar, TBool aRightScrollBar ); + + /** + * Get the id. + * @since 1.2 + * @return UID + */ + TUid Id() const; + + /** + * Is find item in progress. + * @since 1.2 + * @return ETrue if the find item is in progress, otherwise EFalse + */ + TBool FindItemIsInProgress(); + + /** + * Handles client rect changes + */ + void HandleClientRectChange(); + + /** + * Zoom page in zoom mode + * @since 3.2.3 + */ + void ZoomModeImagesL(); + + /** + * Zoom page in + * @since 3.0 + */ + void ZoomImagesInL( TInt aDuration = KZoomModeShowDisableTime ); + + /** + * Zoom page out + * @since 3.0 + */ + void ZoomImagesOutL( TInt aDuration = KZoomModeShowDisableTime ); + + /** + * Zoom slider is to be visible or not in Content View. + * @param aVisible. ETrue if the slider is to visible, EFalse if not. + * @since 5.0 + */ + void MakeZoomSliderVisibleL( TBool aVisible ); + + /** + * Is ZoomSlider is up? + * @since 5.0 + * @return ETrue if the ZoomSlider is up, otherwise EFalse + */ + TBool ZoomSliderVisible() { return iZoomSliderVisible; } + + /** + * Is History view is up? + * @since 3.0 + * @return ETrue if the History View is up, otherwise EFalse + */ + TBool IsHistoryViewUp(); + + /** + * Is History view at the beginning i.e. first page in history + * @since 5.0 + * @return ETrue if the History is at the beginning, otherwise EFalse + */ + TBool IsHistoryAtBeginning(); + + /** + * Is History view at the end i.e. last page in history + * @since 5.0 + * @return ETrue if the History is at the end, otherwise EFalse + */ + TBool IsHistoryAtEnd(); + + /** + * Is Shortcut Keymap view is up? + * @since 5.0 + * @return ETrue if the Shortcut Keymap is up, otherwise EFalse + */ + TBool KeymapIsUp(); + + /** + * Return true if we're in zoom mode + */ + TBool isZoomMode(); + + /** + * Gets Miniature view ( old name: Thumbnail view ) status. + * @since 3.0 + * @return True if Miniature view is active, othervise False. + */ + inline TBool IsMiniatureViewUp() { return iThumbnailViewIsUp; } + + /** + * check if the plugin player is up + * @since 3.2 + * @return True if Miniature view is active, othervise False. + */ + inline TBool IsPluginPlayerUp() const { return iPluginPlayerIsUp; } + + + /** + * Find specifies keyword on page. Set aFindString to NULL if + * searching in directions. + * @since 3.0 + * @param aFindString The string to find on page. If seaching for direction + * this must be NULL. + * @param aFindDirection Search direction. True: next, otherwise: previous. + */ + void FindKeywordL( HBufC* aFindString, TBool aFindDirection = EFalse ); + + /** + * Handles opening a feed with the url + * @since 3.1 + * @param aUrl - the url of the feed + * @return void + */ + void HandleSubscribeToWithUrlL(TPtrC aUrl); + + /** + * Check status of contentview fullscreen mode + * @since 7.x + * @return True if currently in fullscreen mode, othervise False. + */ + inline TBool FullScreenMode() const { return iContentFullScreenMode; } + + public: // from MAknToolbarObserver + /** + * Should be used to set the properties of some toolbar components + * before it is drawn. + * @param aResourceId The resource ID for particular toolbar + * @param aToolbar The toolbar object pointer + */ + void DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* /*aToolbar*/ ); + + /** + * Handles toolbar events for a certain toolbar item. + * @param aCommand The command ID of some toolbar item. + */ + void OfferToolbarEventL( TInt aCommand ) { HandleCommandL(aCommand);} + + public: // from MWindowObserver + void WindowEventHandlerL( TWindowEvent aEvent, TInt aWindowId ); + + // from CAknView + + /** + * Handles commands. + * @param aCommand Command to be handled + */ + void HandleCommandL( TInt aCommand ); + + // from CAknView + + /** + * From @c MEikMenuObserver. Menu emphasising or de-emphasising function. + * @c CEikMenuBar objects call this on their observer. Updates the value of + * the flags for the (@c aMenuControl) on the control stack. + * @param aMenuControl The control to be emphasised or de-emphasisied. + * @param aEmphasis @c ETrue to emphasize the menu, @c EFalse to refuse the + * focus. + */ + void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); + + TRect ResizeClientRect(); + void SetContentContainerRect(); + + private: + + /** + * Generic Zoom function + * @since 3.0 + * @param aDirection 1 for In, -1 for Out + * @param aLow low boundary for zoom level checking + * @param aHigh high boundary for zoom level checking + * @param aDuration the time to display zoom indicator + */ + void ZoomImagesL( TInt aDirection, TUint aLow, TUint aHigh, TInt aDuration ); + + TInt FindCurrentZoomIndex(TInt aCurrentZoomLevel); + + void SaveCurrentZoomLevel(TBool saveZoom); + + protected: // from CAknView + + /** + * @since 1.2 + * @param aPrevViewId Previous view id + * @param aCustomMessageId + * @param aCustomMessage + */ + void DoActivateL( + const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * @since 1.2 + */ + void DoDeactivate(); + + protected: // from CBrowserViewBase + + /** + * @since 1.2 + */ + TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + + private: + + /** + * @param aApiProvider Reference to API provider + */ + CBrowserContentView( MApiProvider& aApiProvider ); + + /** + * Symbian OS contructor. + * @param aRect + */ + void ConstructL( TRect& aRect ); + + /** + * Send address. + */ + void SendAddressL( ); + + /** + * This method is used to update the Option menu label text + * @param aMenuPane Menu pane to be configured. + * @param aCommandId Identifies the menu item (as defined in .hrh file) to be updated. + * @param aResourceId New label resource ID + */ + void UpdateOptionMenuItemLabelL( + CEikMenuPane* aMenuPane, + const TInt aCommandId, + const TInt aResourceId ); + + /** + * Do search for specified items in current page. + * @param aSearchCase items to be searched for + */ + void DoSearchL( CFindItemEngine::TFindItemSearchCase aSearchCase ); + + /** + * + */ + void SetNavipaneViewL(); + + /** + * Force updating the Goto Pane. Does nothing if Goto Pane is not + * visible. + */ + void UpdateGotoPaneL(); + + /** + * View history pane + */ + void ViewHistoryL(); + + /** + * Dynamically initialize menu panes. + * @param aResourceId ID for the resource to be loaded + * @param aMenuPane Menu pane + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * Handles a selection from the subscribe to sub-menu. + * @since 3.0 + * @param aCommand - A menu command + * @return void + */ + void HandleSubscribeToL(TInt aCommand); + + /** + * Deals with menu items for Multiple Windows Support + * @since 3.1 + * @param aWindowMenuItems - bool for each window submenu item that is set to true if it should be dimmed ; false if not + * @return true is all items were true otherwise false is returned. + */ + TBool CheckForEmptyWindowsMenuL(TWindowsMenuItemsDimCheck* aWindowMenuItems); + + /** + * Deals with dimming menu items for Multiple Windows Support + * @since 3.1 + * @param aMenuPane - A menu pane + * @param aWindowMenuItems - lists each window submenu item and whether it should be dimmed + * @return void + */ + void DimMultipleWindowsMenuItems( CEikMenuPane& aMenuPane, TWindowsMenuItemsDimCheck aWindowMenuItems); + + /** + * Check if the input is activate + * @param none + * @return ETrue if input is + */ + TBool IsEditMode(); + private: + + void ProcessCommandL( TInt aCommand ); + + void GotoUrlInGotoPaneL(); + + /** + * Adds the saved bookmark's id to the bottom of the list. + * @param aUid Uid of the bookmark + */ + void AddBMUidToLastPlaceToCurrentListL( const TInt aUid ); + + /** + * callback handler for fullscreen status pane timer + */ + static TInt CallHideFsStatusPane(TAny* aCBrowserContentView ); + + /** + * Hides the status pane for fullscreen mode and cancels timer + */ + void HideFsStatusPane(); + + /** + * Callback handler for auto fullscreen mode timer + */ + static TInt CallActivateAutoFullScreen(TAny* aCBrowserContentView); + + /** + * Activate Automatic Full screen mode + */ + void ActivateAutoFullScreenMode(); + + /** + * Start auto fullscreen timer + */ + void StartAutoFullScreenTimer(); + + /** + * Suspend auto fullscreen timer + */ + void SuspendAutoFullScreenTimer(); + + /** + * Start auto fullscreen Idle timer + */ + void StartAutoFullScreenIdleTimer(); + + /** + * Suspend auto fullscreen Idle timer + */ + void SuspendAutoFullScreenIdleTimer(); + public: + + // BrowserContentViewContainer can use this method to pop up 'Go to' pane. + void LaunchGotoAddressEditorL(); + + void UpdateFullScreenL(); + + void SetFullScreenOffL(); + + /** + * Launches the Find keyword pane. + * @since 3.0 + */ + void LaunchFindKeywordEditorL(); + + /** + * Initializes iZoomLevelArray, iCurrentZoomLevelIndex, iCurrentZoomLevel, + * iZoomInVisible, iZoomOutVisible members. + * + * Note: these members must be initialized later, after the BrowserContentView was constructed + * in BrowserAppUi, because initializing zooming, requires iBrowserControl, which is created in + * BrowserAppUi::ConstructL(), and creating iBrowserControl requires a created BrowserContentView + * object. So zoom levels must be initialized after BrowserAppUi created the iBrowserControl member. + * @since 3.0 + */ + void SetZoomLevelL(); + + /** + * Shows zoom level text in title pane for aDuration seconds. + * @since 3.0 + * @param aResourceId Resource of the zoom level string + * @param aLevel The zoom level which will be shown formatting + * with the resource string. + */ + void SetZoomLevelTitleTextL( TInt aResourceId , TInt aDuration = KZoomModeShowDisableTime ); + + + /** + * Gets the text zoom levels. + */ + void GetTextZoomLevelsL(); + + /** + * Handle zoom mode command + */ + void SetZoomModeL( TBool aZoomMode ); + + /** + * Handle pointer events when Goto pane is visible + */ + void HandlePointerCommand(TInt aCommand) { TRAP_IGNORE(HandleCommandL(aCommand)); } + + /** + * Add new bookmark to the database. + * @param aAsLastVisited ETrue if the meaning is to update "Last visited" bookmark + * @param aUrl The URL that should be bookmarked + */ + void AddNewBookmarkL( TBool aAsLastVisited, HBufC* aUrl = NULL ); + + void ShowKeymap(); + + void HideKeymap(); + + void RedrawKeymap(); + + /** + * Set whether in content view full screen mode or not. + * @since 5.0 + * @param aEnableFullScreen boolean. True: Enter fullscreen, False: Exit + * @return void + */ + void EnableFullScreenModeL( TBool aEnableFullScreen ); + + void HandlePluginFullScreen(TBool aFullScreen); + + /** + * Show or hide status pane for fullscreen mode + * @since 7.x + * @param aShow boolean. True: show status pane, False: start timer that hides status pane on timeout + * @return void + */ + void ShowFsStatusPane(TBool aShow); + + void setFullScreenFlag(){ iWasContentFullScreenMode = iContentFullScreenMode; } + + void CBrowserContentView::HandleStatusPaneCallBack(); + + private: + + CAknNavigationControlContainer* iNaviPane; + CAknNavigationDecorator* iNaviDecorator; + TBufC iStatusMsg; + CBrowserBookmarksModel* iBookmarksModel; + CBrowserContentViewContainer* iContainer; + + + // Find keyword pane's keyword + HBufC* iEnteredKeyword; + + // Zoom images... + // Array contains the zoom levels. ( 30%, 40%, ... defined in webengine) + RArray* iZoomLevelArray; + + // The index of the zoom level in iZoomLevelArray. + TUint iCurrentZoomLevelIndex; + // Zoom text... + // Array contains the text zoom levels. ( All small,Small,Normal ) + CArrayFixFlat* iTextZoomLevelArray; + // The index of the zoom level in iTextZoomLevelArray. + // This index equals to text sizes in EAllSmall... + TUint iCurrentTextZoomLevelIndex; + CArrayFixFlat* iFontSizeArray; + + TBool iHistoryViewIsUp; + TBool iThumbnailViewIsUp; + TBool iSynchRequestViewIsUp; + TBool iImageMapActive; + CAknInfoPopupNoteController* iToolBarInfoNote; + + TBool iPluginPlayerIsUp; + TBool iSmartTextViewIsUp; + + TBool iFindItemIsInProgress; + //Flag to check if the last view was Feeds engine + TBool iWasInFeedsView; + CAknStylusPopUpMenu* iStylusPopupMenu; // owned + CBrowserContentViewToolbar* iBrowserContentViewToolbar; // owned + TBool iPenEnabled; + CBrowserShortcutKeyMap* iShortcutKeyMap; // owned + + // True if the ZoomSlider is currently visible + TBool iZoomSliderVisible; + // True if in zoom mode, zoom indicator (tooltip or slider) displayed + TBool iZoomMode; + CBrowserContentViewZoomModeTimer *iZoomModeTimer; + + // True if the browser is in Full Screen Mode in ContentView + TBool iContentFullScreenMode; + TBool iHistoryAtBeginning; + TBool iHistoryAtEnd; + TBool iIsPluginFullScreenMode; + + CAknAppUiBase::TAppUiOrientation iOrientation; + TBool iWasContentFullScreenMode; + CPeriodic *iPeriodic; + TUint iCurrentZoomLevel; + TUint iSavedZoomLevel; + TBool iOptionsMenuActive; + CPeriodic *iAutoFSPeriodic; + CPeriodic *iIdlePeriodic; + TBool iFullScreenBeforeEditModeEntry; + HBufC* iTitle; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserContentViewContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserContentViewContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser content view container +* +* +*/ + + +#ifndef __BROWSERCONTENTVIEWCONTAINER_H +#define __BROWSERCONTENTVIEWCONTAINER_H + +// INCLUDES + +#include +#include "Browser.hrh" +#include + +#include + + +// CONSTANTS + +// DATA TYPES + +// FORWARD DECLARATIONS + +class CBrowserGotoPane; +class CBrowserGotoPane; +class MApiProvider; +class CBrowserContentView; + +/** +* Container for Browser content view. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserContentViewContainer : public CCoeControl + { + public: // Constuctors and destructor + + static CBrowserContentViewContainer* NewL( CBrowserContentView* aView, + MApiProvider& aApiProvider ); + + ~CBrowserContentViewContainer(); + + public: // New functions + + /** + * Get pointer to Goto pane. + * @since Series 60 1.2 + * @return Pointer to CBrowserGotoPane + */ + CBrowserGotoPane* GotoPane() { return iGotoPane; } ; + + /** + * Get pointer to Findkeyword pane. + * @since Series 60 3.0 + * @return Pointer to CBrowserGotoPane + */ + CBrowserGotoPane* FindKeywordPane() { return iFindKeywordPane; } ; + + /* + * set the iGotoPane + */ + void SetGotoPane(CBrowserGotoPane* aGotoPane) { iGotoPane = aGotoPane; }; + + /* + * set the iFindKeywordPane + */ + void SetFindKeywordPane(CBrowserGotoPane* aFindKeywordPane) { iFindKeywordPane = aFindKeywordPane; }; + + /** + * Shut down Goto URL editor. + * @since Series 60 1.2 + */ + void ShutDownGotoURLEditorL(); + + /** + * Shut down Findkeyword pane. + * @since Series 60 3.0 + */ + void ShutDownFindKeywordEditorL(); + + + private: + + /** + * C++ default constructor. + */ + CBrowserContentViewContainer( CBrowserContentView* aView, + MApiProvider& aApiProvider ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + + private: // From CCoeControl + + /* + * Handle pointer events + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + /** + * Handle key events. + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + /** + * Responds to focus changed. + */ + void FocusChanged(TDrawNow aDrawNow); + + /** + * Responds to size changes. + */ + void SizeChanged(); + + /** + * Gets the number of controls contained in a compound control. + */ + TInt CountComponentControls() const; + + /** + * Gets the specified component of a compound control. + */ + CCoeControl* ComponentControl(TInt aIndex) const; + + public: // for dynamic layout switch updating from contentview + + void HandleResourceChange( TInt aType ); + + private: // New functions + +#ifdef __SERIES60_HELP + + /** + * Get help context for the control. + * @param aContext The context that is filled in. + * @return None. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + +#endif // __SERIES60_HELP + + + /** + * For Configurable short cut keys: create HashTable to map key to function + */ + void CreateShortCutFuncsHashTable(); + + /** + * For Configurable short cut keys: insert key/value pair + */ + void InsertFuncToHashTable(HBufC* aKeyStr, TInt aFunc); + + /** + * For Configurable short cut keys: convert string to TUint + */ + TUint MyAtoi(TPtrC aData); + + /** + * For Configurable short cut keys: invoke short cut function for key pressed + */ + TKeyResponse InvokeFunction(TUint aCode); + + + private: + CBrowserGotoPane* iFindKeywordPane; + CBrowserContentView* iView; + MApiProvider& iApiProvider; + CBrowserGotoPane* iGotoPane; + + TBool iSelectionKeyPressed; + + // True if the key was pressed long, otherwise key was pressed short. + TBool iIsKeyLongPressed; + // True if the key was pressed, and the key was not consumed by the engine. + TBool iIsShortPressAllowed; + + + // For shout cut functions + // True if the hash table for short cut functions has been created; False otherwise. + TBool iShortCutFuncsReady; + + // maps iCode to shortcut function + typedef RHashMap RShortCutFuncMap; + RShortCutFuncMap iShortCutFuncMap; + + + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserContentViewToolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserContentViewToolbar.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class that handles the toolbar +* +* +*/ + + +#ifndef BROWSERCONTENTVIEWTOOLBAR_H +#define BROWSERCONTENTVIEWTOOLBAR_H + +// INCLUDES +#include +#include "browser.hrh" + +// FORWARD DECLARATIONS +class CBrowserContentView; +class CAknToolbar; + + + +//save and load last state + + +// CLASS DECLARATION + +/** +* Helper class that handles the toolbar +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserContentViewToolbar : public CBase + { + public : // constructor, destructor + + /** + * Two-phased constructor. + */ + static CBrowserContentViewToolbar* NewL(CBrowserContentView* aBrowserContentView); + + /** + * Destructor. + */ + virtual ~CBrowserContentViewToolbar(); + + private : // construction + + /** + * Default C++ constructor. + * @param aBrowserContentView + */ + CBrowserContentViewToolbar(CBrowserContentView* aBrowserContentView); + + /** + * Symbian OS constructor that can leave. + */ + void ConstructL(); + + public: // New functions + + + /** + * Enable/disable the toolbar's buttons + */ + void UpdateButtonsStateL(); + + private: // data + + CBrowserContentView* iBrowserContentView; + }; + +#endif // BROWSERCONTENTVIEWTOOLBAR_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserContentViewZoomModeTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserContentViewZoomModeTimer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header for zoom mode timer +* +*/ + + +#ifndef __BROWSERCONTENTVIEWZOOMMODETIMER_H +#define __BROWSERCONTENTVIEWZOOMMODETIMER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CBrowserContentView; + +/** + * CBrowserContentViewZoomModeTimer. + * @lib Browser.app + * @since Series 60 5.0 + */ +class CBrowserContentViewZoomModeTimer : public CTimer + { + public: //Constructors and destructor + + /** + * Destructor. + */ + ~CBrowserContentViewZoomModeTimer(); + + /** + * Two-phased constructor. + */ + static CBrowserContentViewZoomModeTimer* NewL( CBrowserContentView* aBrowserContentView ); + + /** + * Two-phased constructor. Cleanupstack used. + * @since Series60 5.0 + */ + static CBrowserContentViewZoomModeTimer* NewLC( CBrowserContentView* aBrowserContentView ); + + public: // New methods + + /** + * + * + */ + void Start( TTimeIntervalMicroSeconds32 aPeriod ); + + /** + * + * + */ + void Restart( TTimeIntervalMicroSeconds32 aPeriod ); + + public: // From CActive + + void RunL(); + + private: + + /** + * Default constructor. + */ + CBrowserContentViewZoomModeTimer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( CBrowserContentView* aBrowserContentView ); + + private: //data + + CBrowserContentView* iBrowserContentView; + }; + +#endif //__BROWSERCONTENTVIEWZOOMMODETIMER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDialogs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDialogs.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,230 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class that pops up several dialogs. +* +* +*/ + + +#ifndef BROWSERDIALOGS_H +#define BROWSERDIALOGS_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CAknWaitDialog; + +// CLASS DECLARATION + +/** +* TBrowserDialogs, Implements several dialogs used in Browser. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class TBrowserDialogs + { + public: // New functions + /** + * Functions from NWSS. + */ + + /** + * Input prompt dialog used by Search and Home page features library + * @since Series 60 2.8 + * @param aMsg prompt message + * @param aResp entered text + * @param aMaxLength maximum length allowed in editor + * @param aIsUrlAddress flag for allowing only latin input for url addresses + * @return AVKON error code + */ + static TInt DialogPromptReqL( const TDesC& aMsg, + TDes* aResp, + TBool aIsUrlAddress, + TInt aMaxLength = 0 ); + + /** + * Confirmation query dialog used by WTAI library + * @since Series 60 1.2 + * @param aMsg confirmation message + * @param aYesMessage left softkey text + * @param aNoMessage right softkey text + * @return AVKON error code + */ + static TInt DialogQueryReqL( const TDesC& aMsg, + const TDesC& aYesMessage, + const TDesC& aNoMessage); + + + public: // Confirmation queries. + + + /** + * Display an confirmation query with given dialog resource + * @since Series 60 1.2 + * @param aPrompt resource if of prompt to display. + * @param aResId resource id of command set (aResId = 0 means R_AVKON_SOFTKEYS_YES_NO as per default ) + * @param aAnimation animation overrides default one + * @return selected softkey id. + * If you give your own aResId you have to check the return value! + * In that case return value are commands + * as your specified in resource of that CBA. + */ + static TInt ConfirmQueryDialogL( const TInt aPromptResourceId, + TInt aResId = 0, + TInt aAnimation = 0 ); + + /** + * Display an confirmation query with given dialog resource + * @since Series 60 1.2 + * @param aPrompt Prompt to display. + * @param aResId resource id of dialog + * @param aAnimation animation overrides default one + * @return selected softkey id. + */ + static TInt ConfirmQueryDialogL( const TDesC& aPrompt, + TInt aResId = 0, + TInt aAnimation = 0 ); + + + /** + * Display an confirmation query with buttons Yes and No. + * @since Series 60 1.2 + * @param aPrompt Prompt to display. + * @return ETrue if accepted, EFalse if not. + */ + static TBool ConfirmQueryYesNoL( TDesC& aPrompt ); + + + /** + * Display an confirmation query with buttons Yes and No. + * @since Series 60 1.2 + * @param aPromptResourceId Resource id of the prompt (not the + * dialog!). + * @return ETrue if accepted, EFalse if not. + */ + static TBool ConfirmQueryYesNoL( const TInt aPromptResourceId ); + + + /** + * Display an confirmation query with buttons Yes - No. + * @since Series 60 1.2 + * @param aPromptResourceId Resource id of the prompt (not the + * dialog!). + * @param aString This string will be substituted in place of the first + * %U in the format string. + * @return ETrue if accepted, EFalse if not. + */ + static TBool ConfirmQueryYesNoL + ( const TInt aPromptResourceId, const TDesC& aString ); + + + /** + * Display an confirmation query with buttons Yes and No. + * @since Series 60 1.2 + * @param aPromptResourceId Resource id of the prompt (not the + * dialog!). + * @param aNum This number will be substituted in place of the first + * %N in the format string. + * @return ETrue if accepted, EFalse if not. + */ + static TBool ConfirmQueryYesNoL + ( const TInt aPromptResourceId, const TInt aNum ); + + + public: // Information notes. + + /** + * Display an information note with no buttons. + * @since Series 60 1.2 + * @param aDialogResourceId Resource id of note to display. + * Available notes: R_WMLBROWSER_OK_NOTE (check mark animation); + * R_WMLBROWSER_INFO_NOTE (info mark animation). + * @param aPrompt Prompt to display. + */ + static void InfoNoteL( TInt aDialogResourceId, const TDesC& aPrompt ); + + + /** + * Display an information note with no buttons. + * @since Series 60 1.2 + * @param aDialogResourceId Resource id of note to display. + * Available notes: R_WMLBROWSER_OK_NOTE (check mark animation); + * R_WMLBROWSER_INFO_NOTE (info mark animation). + * @param aPromptResourceId Resource id of the prompt. + */ + static void InfoNoteL + ( TInt aDialogResourceId, const TInt aPromptResourceId ); + + + /** + * Display an information note with no buttons. + * @since Series 60 1.2 + * @param aDialogResourceId Resource id of note to display. + * Available notes: R_WMLBROWSER_OK_NOTE (check mark animation); + * R_WMLBROWSER_INFO_NOTE (info mark animation). + * @param aPromptResourceId Resource id of the prompt. + * @param aString This string will be substituted in place of the first + * %U in the format string. + */ + static void InfoNoteL + ( + TInt aDialogResourceId, + const TInt aPromptResourceId, + const TDesC& aString + ); + + + /** + * Display an information note with no buttons. + * @since Series 60 1.2 + * @param aDialogResourceId Resource id of note to display. + * Available notes: R_WMLBROWSER_OK_NOTE (check mark animation); + * R_WMLBROWSER_INFO_NOTE (info mark animation). + * @param aPromptResourceId Resource id of the prompt. + * @param aNum This number will be substituted in place of the first + * %N in the format string. + */ + static void InfoNoteL + ( + TInt aDialogResourceId, + const TInt aPromptResourceId, + const TInt aNum + ); + + + public: // error note + + /** + * Display an error note with buttons Ok - . + * @since Series 60 1.2 + * @param aPromptResourceId Resource id of the prompt (not the + * dialog!). + */ + static void ErrorNoteL( const TInt aPromptResourceId ); + + /** + * Display an error note with buttons Ok - . + * @since Series 60 1.2 + * @param aPrompt Prompt to display. + */ + static void ErrorNoteL( const TDesC& aPrompt ); + + }; + +#endif + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDialogsProviderBlocker.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDialogsProviderBlocker.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Blocks dialog requests to the BrowserDialogsProvider if a +* window is in the background. When the window comes to the +* foreground, it will be displayed. +* +* +*/ + +#ifndef __BROWSERDIALOGSPROVIDERBLOCKER_H +#define __BROWSERDIALOGSPROVIDERBLOCKER_H + +// INCLUDES +#include "BrowserDialogsProviderProxy.h" +#include + +// FORWARD DECLARATIONS +class CBrowserWindowFocusNotifier; + +// CLASS DEFINITION +class CBrowserDialogsProviderBlocker : public CActive + { + public: // constructors + + /** + * Create a CBrowserDialogsProviderBlocker object. Leaves on failure. + * @param aDlg . Not owned. + * @return A reference to the created instance of + * CBrowserDialogsProviderBlocker + */ + static CBrowserDialogsProviderBlocker* NewLC( + CBrowserWindowFocusNotifier& aWinFocusNotifier ); + + private: // default c++, and 2nd phase constructor + + /** + * Constructs this object + * @param aDlg. Not owned. + */ + CBrowserDialogsProviderBlocker( + CBrowserWindowFocusNotifier& aWinFocusNotifier ); + + /** + * Performs second phase construction of this object + */ + void ConstructL(); + + public: + + /** + * Destroy the object and release all memory objects + */ + ~CBrowserDialogsProviderBlocker(); + + /** + * Start an asynchronous request. + */ + void Start(); + + protected: // from CActive + + /** + * Cancel any outstanding requests + */ + void DoCancel(); + + /** + * Handles object`s request completion event. + */ + void RunL(); + + private: + + /** + * Indicates the completion status of a request made to a + * service provider. + */ + //TRequestStatus iStatus; + + CActiveSchedulerWait iWait; // Asynchronous wait + + CBrowserWindowFocusNotifier& iWinFocusNotifier; // not owned + }; + +#endif // __BROWSERDIALOGSPROVIDERBLOCKER_H + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDialogsProviderProxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDialogsProviderProxy.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,281 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Forwards Dialog requests to the BrowserDialogsProvider +* +*/ + + + +#ifndef BROWSERDIALOGSPROVIDERPROXY_H +#define BROWSERDIALOGSPROVIDERPROXY_H + +// INCLUDES + +// User includes + +// System Includes +#include +#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CBrCtlDialogsProvider; +class CBrowserDialogsProviderBlocker; +class CBrowserWindowFocusNotifier; +class CBrowserWindow; +class MBrowserDialogsProviderObserver; + +// CLASS DECLARATION + +/** +* Provide dialogs needed for browser operation +* +* @since 3.0 +*/ +class CBrowserDialogsProviderProxy : public CBase, + public MBrCtlDialogsProvider + { + // Construction/Destruction + public: + + // Two stage constructor + static CBrowserDialogsProviderProxy* NewL( + CBrowserDialogsProvider& aDialogsProvider, + MBrowserDialogsProviderObserver* aDialogsObserver, + CBrowserWindow& aBrowserWindow ); + + // Destructor + virtual ~CBrowserDialogsProviderProxy(); + + protected: + + // 1st stage Constructor + CBrowserDialogsProviderProxy( + CBrowserDialogsProvider& aDialogsProvider, + MBrowserDialogsProviderObserver* aDialogsObserver, + CBrowserWindow& aBrowserWindow ); + + + // 2nd stage constructor + void ConstructL(); + + public: // From MBrCtlDialogsProvider + + /** + * Notify the user of an error + * @since 3.0 + * @param aErrCode The error that occured + * @return void + */ + virtual void DialogNotifyErrorL( TInt aErrCode ); + + /** + * Notify the user of an http error + * @since 3.0 + * @param aErrCode The error that occured + * @param aUri The uri of the request that failed + * @return void + */ + virtual void DialogNotifyHttpErrorL( TInt aErrCode, + const TDesC& aUri ); + + /** + * File selection dialog + * @since 3.0 + * @param aStartPath The initial displayed directory + * @param aRootPath The top most directory that the user can go up to + * @param aSelectedFileName The selected file name. + * Returned on cleanup stack. Browser control will free the buffer + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogFileSelectLC( const TDesC& aStartPath, + const TDesC& aRootPath, + HBufC*& aSelectedFileName); + + /** + * List selection dialog + * @since 3.0 + * @param aTitle The title, could be empty + * @param aBrowserSelectOptionType The type of the list box + * @param aOptions A list of options to display + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogSelectOptionL( + const TDesC& aTitle, + TBrCtlSelectOptionType aBrowserSelectOptionType, + CArrayFix& aOptions ); + + /** + * User Authentication dialog. + * User name and password are returned on cleanup stack + * @since 3.0 + * @param aUrl The url requiring authentication + * @param aRealm The realm requiring authentication + * @param aDefaultUser/Name The user name that was used before for this + * realm and path, if any + * @param aReturnedUserName The user name entered by the user + * @param aReturnedPasswd The password entered by the user + * @param aBasicAuthentication A flag if basic authentication was used + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogUserAuthenticationLC( + const TDesC& aUrl, + const TDesC& aRealm, + const TDesC& aDefaultUserName, + HBufC*& aReturnedUserName, + HBufC*& aReturnedPasswd, + TBool aBasicAuthentication = EFalse); + + /** + * Display a note to the user. No softkeys + * @since 3.0 + * @param aMessage The message to display + * @return void + */ + virtual void DialogNoteL( const TDesC& aMessage ); + + /** + * Display a note to the user with ok softkey only + * @since 3.0 + * @param aTitle The title, could be empty + * @param aMessage The message to display + * @return void + */ + virtual void DialogAlertL( const TDesC& aTitle, + const TDesC& aMessage ); + + /** + * Display confirmation message to the user + * @since 3.0 + * @param aTitle The title, could be empty + * @param aMessage The message to display + * @param aYesMessage The text to display on left softkey + * @param aNoMessage The text to display on right softkey + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogConfirmL( const TDesC& aTitle, + const TDesC& aMessage, + const TDesC& aYesMessage, + const TDesC& aNoMessage); + + /** + * Display input dialog to the user + * @since 3.0 + * @param aTitle The title, could be empty + * @param aMessage The message to display + * @param aDefaultInput The default input if available + * @param aReturnedInput The input entered by the user + * Returned on the cleanup stack, owned by the calling application + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogPromptLC(const TDesC& aTitle, + const TDesC& aMessage, + const TDesC& aDefaultInput, + HBufC*& aReturnedInput); + + /** + * Display object info and ask confirmation before download + * @since 3.0 + * @param aBrCtlObjectInfo The object info + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogDownloadObjectL( + CBrCtlObjectInfo* aBrCtlObjectInfo ); + + /** + * DIsplay the images that appear in the current page + * @since 3.0 + * @param aPageImages The images that appear in this page + * @return vois + */ + virtual void DialogDisplayPageImagesL( + CArrayFixFlat& aPageImages); + + /** + * Cancel any dialog that is being displayed due to + * e.g. Browser exit or page was destroyed + * @since 3.0 + * @return void + */ + virtual void CancelAll(); + + /** + * Display search on page dialog + * @since 3.0 + * @return void + */ + virtual void DialogFindL() { /* TODO: implement this body!!! */ } ; + + /** + * Mime File selection dialog for specific mime type files + * @since 3.2 + * @param aSelectedFileName The selected file name. + * @param aMimeType The accepted mime type + * Returned on cleanup stack. Browser control will free the buffer + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogMimeFileSelectLC( HBufC*& aSelectedFileName, + const TDesC& aMimeType ); + + + public: // New functions + + /** + * Display a tooltip (info popup note) + * @since 3.0 + * @return void + */ + void ShowTooltipL( const TDesC& aText, TInt aDuration, TInt aDelay ); + + /** + * Display a dialog which tracks upload progress + * @since 3.0 + * @param aTotalSize the total size of a file being uploaded + * @param aChunkSize the size of the current chunk being uploaded + * @param aIsLastChunk boolean value indicating whether the current + * @param aObserver an observer for the upload progress dialog + * chunk is the last one in the entire download + * @return void + */ + void UploadProgressNoteL( + TInt32 aTotalSize, + TInt32 aChunkSize, + TBool aIsLastChunk, + MBrowserDialogsProviderObserver* aObserver ); + + /** + * Callback from Window, indicating that the window is now active + * @since 3.0 + */ + void WindowActivated(); + + // DATA MEMBERS + private: + + CBrowserDialogsProvider& iDialogsProvider; + MBrowserDialogsProviderObserver* iDialogsObserver; + CBrowserWindow& iBrowserWindow; + + // Stores data on blocked dialogs + CBrowserWindowFocusNotifier* iWinFocusNotifier; // owned + + TBool iCancelWaitingDialogs; // ETrue means that waiting dialogs should not be displayed when flushed + + }; + +#endif // BROWSERDIALOGSPROVIDERPROXY_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDisplay.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDisplay.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,242 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Access to display components +* +* +*/ + + +#ifndef BROWSER_DISPLAY_H +#define BROWSER_DISPLAY_H + +// INCLUDE FILES +#include +#include +#include "Display.h" +#include "WlanObserver.h" + +// FORWARD DECLARATIONS + +class MApiProvider; +class CBrowserProgressIndicator; +class CAknNavigationDecorator; +class CAknIndicatorContainer; +class CBrowserWindow; + +// CLASS DECLARATION + +class CBrowserDisplay : public CBase, public MDisplay + { + public : // constructor, destructor + + /** + * Two-phased constructor. + */ + static CBrowserDisplay* NewL( MApiProvider& aApiProvider, + CBrowserWindow& aWindow ); + + /** + * Destructor. + */ + virtual ~CBrowserDisplay(); + + public : // functions from MDisplay + + /** + * Return Status Pane. Can be NULL. + * @return Status Pane. + */ + virtual CEikStatusPane* StatusPane() const; + + /** + * Get Navi Pane; leave on error. + * @return Navi Pane. Never NULL. + */ + virtual CAknNavigationControlContainer* NaviPaneL() const; + + /** + * Set title pane text. + * @param aTitle Title text to be displayed. + */ + virtual void SetTitleL( const TDesC& aTitle ); + + /** + * Set title pane text from resource. + * @param aTitle Resource id of title text to be displayed. + */ + virtual void SetTitleL( TInt aResourceId ); + + /** + * Starts animation. + * @param aBearerType Determines what is to be animated. + */ + virtual void StartProgressAnimationL(/* TApBearerType aBearerType*/ ); + + /** + * Stops animation. + */ + virtual void StopProgressAnimationL(); + + /** + * Shows or hides secure indicator depending on aState. + * @param aState EAknIndicatorStateOff/EAknIndicatorStateOn. + */ + virtual void UpdateSecureIndicatorL( const TInt aState ); + + /** + * Adds transaction id to array. + * @param aId Transaction id + */ + virtual void AddTransActIdL( TUint16 aId ) const; + + /** + * Saves maximum and received data with a transction id. + * @since Series60 1.2 + * @param aId Id of the transaction + * @param aRecvdData Amount of data we have received with current transaction Id + * @param aMaxData Max size of the transaction + */ + virtual void AddProgressDataL( TUint16 aId, TUint32 aRecvdData, TUint32 aMaxData ) const; + + /** + * Marks particular transaction id to complete status + * @since Series60 2.0 + * @param aId Id of the transaction + */ + virtual void TransActIdComplete( TUint16 aId ) const; + + /** + * Sets Secure indicator on/off, UpdateFullScreenIndicatorsL() needs to be called after indicators are set + * @param aState indicator state on/off + */ + void SetFullScreenSecureIndicatorL(const TBool aState); + + /** + * Sets gprs indicator for Full Screen on + */ + virtual void SetGPRSIndicatorOnL(); + + /** + * Starts the Wlan Indicator observer + */ + virtual void StartWlanObserverL(); + + /** + * Updates the Wlan Indicator to current value + */ + virtual void UpdateWlanIndicator( const TInt aWlanValue ); + + /** + * Initialises Full Screen pane indicators + */ + virtual void FSPaneOnL( ); + + /** + * Updates Full Screen progress indicator + */ + virtual void UpdateFSProgressIndicator(const TInt aMaxData, const TInt aReceivedData); + + /** + * Starts Full Screen Wait indicator + */ + virtual void StartFSWaitIndicator(); + + /** + * Updates 'downloaded data amount' message on Full Screen pane + */ + virtual void UpdateFSProgressDataL(const TDesC16& aReceivedDataText); + + /** + * Updates initial download indicator on Full Screen pane + */ + virtual void UpdateFSDownloadInitialIndicator(const TBool aState); + + /** + * Initializes Full Screen Indicators + */ + virtual void InitIndicatorsL(); + + /** + * Clears the Message Info indicator in the navipane + */ + virtual void ClearMessageInfo(); + + /** + * Sets formerly saved page title. SetTitleL's functionality moved here, because page title restoration is + * necessary in Full Screen mode + */ + virtual void RestoreTitleL(); + + /** + * Notify that new data has arrived to the loaders. + * @since Series60_version 2.5 + * @return none + */ + virtual void NotifyProgress(); + + /** + * Updates the Multiple Windows Indicator + * @param aState Indicator On or Off + * @param aWinCount The number of windows open + * @since Series60 3.0 + */ + virtual void UpdateMultipleWindowsIndicatorL( + const TBool aState, const TInt aNumWindows ); + + public: + + inline MApiProvider& ApiProvider() { return iApiProvider; } + + private: //for internal use of full screen indicators + + /** + * Selects Editor's IndicatorContainer to use. + */ + CAknIndicatorContainer* SelectIndicContainerEditing(); + + /** + * Selects own IndicatorContainer to use. Editor's or our own. + */ + CAknIndicatorContainer* SelectIndicContainerOwn(); + + protected : // construction + + /** + * Default C++ constructor. + * @param aApiProvider Browser's API provider + */ + CBrowserDisplay( MApiProvider& aApiProvider, CBrowserWindow& aWindow ); + + /** + * Symbian OS constructor that can leave. + */ + void ConstructL(); + + private : // data members + + CBrowserProgressIndicator* iProgressIndicator; ///< animation for CSD,HSCSD,GPRS connections + + MApiProvider& iApiProvider; ///< reference to API provider + CBrowserWindow* iWindow; ///< owner window, object not owned + CWlanObserver* iWlanObserver; ///< Wlan status observer + + CAknNavigationDecorator* iEditorIndicatorContainer; /// Full Screen Editor indicator container + + HBufC* iTitle; /// Page title, stored because it needs to be restored after downloading in Full Screen mode. + }; + +#endif // WMLBROWSER_DISPLAY_H + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDownloadIndicatorTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDownloadIndicatorTimer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __BROWSERDOWNLOADINDICATORTIMER_H +#define __BROWSERDOWNLOADINDICATORTIMER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MBrowserDownloadIndicatorTimerEvent; + +/** + * CDownloadIndicator. + * @lib Browser.app + * @since Series 60 1.2 + */ + +class CBrowserDownloadIndicatorTimer : public CTimer + { + public: //Constructors and destructor + + /** + * Destructor. + */ + ~CBrowserDownloadIndicatorTimer(); + + public: + + /** + * Two-phased constructor. + * @param aUi CBrowserDownloadIndicatorTimer (i.e. BrowserAppUi ) pointer + */ + static CBrowserDownloadIndicatorTimer* NewL( + MBrowserDownloadIndicatorTimerEvent& aUi ); + + /** + * Two-phased constructor. Cleanupstack used. + * @param aUi CBrowserDownloadIndicatorTimer (i.e. BrowserAppUi ) pointer + * @since Series60 1.2 + */ + static CBrowserDownloadIndicatorTimer* NewLC( + MBrowserDownloadIndicatorTimerEvent& aUi ); + + public: + + /** + * + * + */ + void Start( TTimeIntervalMicroSeconds32 aPeriod ); + + public: // From CActive + + void RunL(); + + private: + + /** + * Default constructor. + */ + CBrowserDownloadIndicatorTimer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( MBrowserDownloadIndicatorTimerEvent& aUi ); + + private: //data + + MBrowserDownloadIndicatorTimerEvent* iProgressIndicator; + }; + +#endif //__BROWSERDOWNLOADINDICATORTIMER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDownloadIndicatorTimerEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDownloadIndicatorTimerEvent.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __BROWSERDOWNLOADINDICATORTIMEREVENT_H +#define __BROWSERDOWNLOADINDICATORTIMEREVENT_H + +// INCLUDES +//#include + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib Browser.app +* @since 1.2 +*/ +class MBrowserDownloadIndicatorTimerEvent + { + public: // New functions + + /** + * Set initial download animation off. + * @since 1.2 + */ + virtual void SetBrowserDownloadIndicatorStateOff() = 0; + + }; +#endif //__BROWSERDOWNLOADINDICATORTIMEREVENT_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserDownloadUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserDownloadUtil.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Download handling utilities. +* +*/ + + +#ifndef BROWSER_DOWNLOAD_UTIL_H +#define BROWSER_DOWNLOAD_UTIL_H + +// INCLUDE FILES + +#include + +// FORWARD DECLARATIONS + +class MApiProvider; + +// CLASS DECLARATION + +/** +* Execute the Downloads List in RunL. +*/ +class CAsyncDownloadsListExecuter : public CActive + { + public: + + CAsyncDownloadsListExecuter( MApiProvider& aApiProvider ); + ~CAsyncDownloadsListExecuter(); + + public: + + void Start(); + + private: + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + + private: // Data + + MApiProvider& iApiProvider; + }; + +#endif // BROWSER_DOWNLOAD_UTIL_H + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserGotoPane.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserGotoPane.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,482 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Browser Goto pane. +* +*/ + + +#ifndef WML_GOTO_PANE_BASE_H +#define WML_GOTO_PANE_BASE_H + +// DEFINES +#ifndef GOTOPANE_POPUPLIST_DISABLE +#define GOTOPANE_POPUPLIST_DISABLE EFalse +#endif + +#ifndef GOTOPANE_POPUPLIST_ENABLE +#define GOTOPANE_POPUPLIST_ENABLE ETrue +#endif + +// INCLUDE FILES +#include +#include +#include + +// FORWARD DECLARATION +class CAknInputFrame; +class CBrowserGotoPane; +class CBrowserAdaptiveListPopup; +class CBrowserContentView; + +// CLASS DECLARATION +/** +* Mixin class for handling Goto Pane events. +* +* @lib Browser.app +* @since Series60 1.2 +*/ +class MGotoPaneObserver + { + + public: // types + + enum TEvent /// Goto Pane events. + { + EEventEnterKeyPressed ///< Enter (OK) key pressed. + }; + + public: // new methods + + /** + * Handle Goto Pane event. Derived classes must implement. + * @since Series60 1.2 + * @param aGotoPane The Goto Pane in which the event occurred + * @param aEvent Goto Pane event + */ + virtual void HandleGotoPaneEventL( CBrowserGotoPane* aGotoPane, TEvent aEvent ) = 0; + }; + + +/** +* Key event handled. Has higher priority than FEP, +* to be able to catch up/down key event and forward +* them to goto pane's editor. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserKeyEventHandled : public CCoeControl, public MEikEdwinObserver + { + public: + + /** + * public constructor + * @param aGotoPane pointer to goto pane that key events are controled + */ + CBrowserKeyEventHandled( CBrowserGotoPane& aGotoPane ); + + /** + * Catches key events before FEP could do it. + * @since Series60 1.2 + * @param aKeyEvent + * @param aType + * @return + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + /** + * Catches EEventTextUpdate event. + * @since Series60 1.2 + * @param aKeyEvent + * @param aType + * @return + */ + virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType); + + /** + * Put control to control stack or remove it from there. + * @since Series60 1.2 + * @param aEnable ETrue puts control to the control stack with higher + * priority than FEP has. EFalse removes control from the stack. + */ + void EnableL( TBool aEnable ); + + /** + * Set iFirstKeyEvent to TRUE. + * @since Series60 1.2 + */ + void Reset(); + + /** + * Get LeftRightEvent. + * @since Series60 1.2 + */ + + TBool IsLeftRightEvent() { return iLeftRightEvent; } + + /** + * SetFirstKey. + * @since Series60 3.2 + */ + void SetFirstKeyEvent(TBool aFirstKeyEvent) {iFirstKeyEvent = aFirstKeyEvent;} + + + protected: + + // key event catching enable flag + TBool iEnabled; + + // only first key event is catched + TBool iFirstKeyEvent; + + // + TBool iLeftRightEvent; + + // goto pane control of which key events are catched + CBrowserGotoPane& iGotoPane; + }; + +/** +* Goto Pane Base for the WML Browser & Bookmarks. +* It looks just like a search field. +* +* @lib Browser.app +* @since Series 60 1.2 +*/ +class CBrowserGotoPane: + public CCoeControl, public MCoeControlObserver, public MCoeFepObserver + { + public: + /** + * Two-phased constructor. Leaves on failure. + * @since Series60 1.2 + * @param aParent Parent control + * @param aIconBitmapId Id of the icon to display + * @param aIconMaskId Id of the icon`s mask + * @param aPopupListStatus True if the pane uses popuplist, + * otherwise false. + * @param aContentView Pointer to content view + * @param aFindKeywordMode Set true if the pane is a find keyword pane. + * @return The constructed Goto Pane control + */ + static CBrowserGotoPane* NewL + ( + const CCoeControl* aParent, + TInt aIconBitmapId = EMbmAvkonQgn_indi_find_goto, + TInt aIconMaskId = EMbmAvkonQgn_indi_find_goto_mask, + TBool aPopupListStatus = GOTOPANE_POPUPLIST_ENABLE, + CBrowserContentView* aContentView = NULL, + TBool aFindKeywordMode = EFalse + ); + + /** + * Destructor. + */ + virtual ~CBrowserGotoPane(); + + /** + * Makes goto pane (un)visible. + * @since Series60 1.2 + * @param ETrue to set visible + */ + virtual void MakeVisibleL( TBool aVisible ); + + /** + * Non-leaving version of MakeVisibleL. + * @since Series60 1.2 + * @param ETrue to set visible + */ + virtual void MakeVisible( TBool aVisible ); + + /** + * See description in calslbs.h. + */ + void HandleFindSizeChanged(); + + /** + * Enable key event handler. + * @since Series60 1.2 + * @param aEnable TRUE to enable + */ + void EnableKeyEventHandlerL( TBool aEnable ); + + /** + * Activate GoTo Pane. + */ + void SetGotoPaneActiveL(); + + /** + * Activate Search Pane. + */ + void SetSearchPaneActiveL(); + + /** + * Check if we are in Goto Mode + * @return ETrue if we are in Goto Mode; EFalse otherwise. + */ + inline TBool GotoPaneActive() const { return iGotoPaneActive; } + + /** + * Check if we are in Search Mode + * @return ETrue if we are in Search Mode; EFalse otherwise. + */ + inline TBool SearchPaneActive() const { return iSearchPaneActive; } + + public: // from MCoeControlObserver + + /** + * Handle control event. + * @since Series60 1.2 + * @param aControl The control + * @param aEventType Event type + */ + void HandleControlEventL + ( CCoeControl* aControl, TCoeEvent aEventType ); + + public: // from CCoeControl + + /** + * Handle key event. + * @since Series60 1.2 + * @param aKeyEvent The key event + * @param aType Key event type + * @return Response (was the key event consumed?) + */ + virtual TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * HandlePointerEventL + * From CCoeControl + * + */ + void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); + + /** + * HandleResourceChange + * From CCoeControl + */ + void HandleResourceChange(TInt aType); + + + public: // from CCoeControl + + /** + * Count component controls. + * @since Series60 1.2 + * @return Number of component controls + */ + virtual TInt CountComponentControls() const; + + /** + * Get a component control by index. + * @since Series60 1.2 + * @param aIndex Index of component control to be returned + * @return Component control or NULL + */ + virtual CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Sets the OrdinalPosition of GotoPane + * @param aPos The OrdinalPosition + */ + void SetOrdinalPosition( TInt aPos ); + + public: // Text manipulation + + /** + * Length of the Search text in the editor. + * @return The text length + */ + TInt SearchTextLength() const; + + /** + * Length of the text in the editor. + * @since Series60 1.2 + * @return The text length + */ + TInt TextLength() const; + + /** + * Get text from the editor. + * @since Series60 1.2 + * @return text from the editor + */ + HBufC* GetTextL() const; + + /** + * Set text. + * @since Series60 1.2 + * @param aTxt Text to set + * appended if needed. + */ + virtual void SetTextL( const TDesC& aTxt ); + + /** + * Set Editor Font Posture to Italic. + */ + void SetTextModeItalicL( ); + + /** + * Set Search text. + * @param aTxt Text to set + * appended if needed. + */ + void SetSearchTextL( const TDesC& aTxt ); + + /** + * Selects all text in the editor. + * See CEikEdwin's SelectAllL(); + * @since Series60 1.2 + */ + void SelectAllL(); + + /** + * Set info text. + * @since Series60 1.2 + * @param aText Text to be displayed as info + */ + void SetInfoTextL( const TDesC& aText ); + + /** + * Perform clipboard functionality. + * @since Series60 1.2 + * @param aClipboardFunc Function to perform + */ + void ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc ); + + /** + * Returns editor control of goto pane. + * @since Series60 1.2 + * @return editor control of goto pane + */ + CEikEdwin* Editor() const; + + void ResetPrevText(); + + public: // observer support + + /** + * Set observer. Pass NULL pointer to unset. Panics if already set. + * @since Series60 1.2 + */ + void SetGPObserver( MGotoPaneObserver* aObserver ); + + /** + * Gives back a pointer to adaptivepopuplist + */ + CBrowserAdaptiveListPopup* PopupList(); + + /** + * Handles the completion of a FEP transaction + */ + void HandleCompletionOfTransactionL(); + + /** + * Handles the start of a FEP transaction + */ + void HandleStartOfTransactionL(); + + protected: // Construct / destruct + /** + * Constructor. + * @param + */ + CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode ); + + /** + * Second-phase constructor. Leaves on failure. + * @param aParent Parent control + */ + void ConstructL( const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, TBool aPopupListStatus ); + + /** + * Constructs Search Pane. + */ + void ConstructSearchPaneL(); + + protected: // from CCoeControl + + /** + * Handle size change, lay out and draw components. + */ + virtual void SizeChanged(); + + /** + * Handle focus change. + * @since Series60 1.2 + * @param aDrawNow Draw now? + */ + virtual void FocusChanged( TDrawNow aDrawNow ); + + private: + + /** + * Set the text and redraw. + * @since Series60 1.2 + */ + void DoSetTextL( const TDesC& aTxt ); + + void ActivateVKB(); + + + protected: // data + + CBrowserContentView* iContentView; //Not owned. + + // If the control is in find keyword pane mode. + TBool iFindKeywordMode; + + // HandleFEPFind + TBool iHandleFEPFind; + + // The previously typed text into iEditor + HBufC* iPrevKeyword; + + // Editor. Owned. + CEikEdwin* iEditor; + + // Input frame. Owned. + CAknInputFrame* iInputFrame; + + // Search Editor. Owned. + CEikEdwin* iSearchEditor; + + // Search Input frame. Owned. + CAknInputFrame* iSearchInputFrame; + + // Observer (may be NULL). Not owned. + MGotoPaneObserver* iGPObserver; + + + CBrowserKeyEventHandled *iGotoKeyHandled; + + /// adaptive popuplist + CBrowserAdaptiveListPopup* iBAdaptiveListPopup; + + // Represents Active Editors + TBool iGotoPaneActive; + TBool iSearchPaneActive; + + // Default text in Search Editor.Owned. + HBufC* iDefaultSearchText; + + // Search Input Frame Icon Id, used for tracking the Search Icon Changes. + TInt iSearchIconId; + + // Stores the Search Icon File Path. + TFileName iSearchIconFilePath; + }; + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserInitialContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserInitialContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserInitialContainer. +* +* +*/ + + +#ifndef BROWSERINITIALCONTAINER_H +#define BROWSERINITIALCONTAINER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CBrowserInitialView; +class CBrowserGotoPane; + +// CLASS DECLARATION + +/** +* CBrowserInitialContainer container control class. +*/ +class CBrowserInitialContainer : public CCoeControl, MCoeControlObserver + { + public: + + /** + * default constructor. + * @param aRect Frame rectangle for container. + */ + void ConstructL(const TRect& aRect); + + /** + * Constructor + */ + CBrowserInitialContainer( CBrowserInitialView *aView ); + + /** + * Destructor. + */ + ~CBrowserInitialContainer(); + + + + public: // Functions from base classes + + public: // New functions + + /** + * Opens the selected listbox item + */ + void OpenSelectedListboxItemL( ); + + /** + * Access the created goto pane. + * @return Handle to web menu`s goto pane. + */ + CBrowserGotoPane* GotoPane() { return iGotoPane; } + + /** + * Shuts down goto pane. + */ + void ShutDownGotoURLEditorL(); + + + private: // Functions from base classes + + /** + * From CoeControl,SizeChanged. + */ + void SizeChanged(); + + /** + * From CoeControl,CountComponentControls. + */ + TInt CountComponentControls() const; + + /** + * From CCoeControl,ComponentControl. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * From CCoeControl,Draw. + */ + void Draw(const TRect& aRect) const; + + /** + * From MCoeControlObserver + * Acts upon changes in the hosted control's state. + * + * @param aControl The control changing its state + * @param aEventType The type of control event + */ + void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); + + + private: // New functions + + /** + * From CCoeControl + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + /** + * Gets the resource id of web menu`s title. + */ + TInt TitleResourceId(); + + CBrowserInitialView* iView; // not owned + + private: //data + CBrowserGotoPane* iGotoPane; // the gotopane + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserInitialView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserInitialView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserInitialView. +* +* +*/ + + +#ifndef BROWSERINITIALVIEW_H +#define BROWSERINITIALVIEW_H + +// INCLUDES +#include +#include "BrowserAppViewBase.h" +#include "BrowserGotoPane.h" + +// FORWARD DECLARATIONS +class CBrowserInitialContainer; +class CBrowserBookmarksView; + +// CLASS DECLARATION + +/** +* CBrowserInitialView view class. +*/ +class CBrowserInitialView : public CBrowserViewBase, + public MGotoPaneObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. Places the instance + * on the cleanup stack. + * @param aApiProvider The API provider. + * @return The constructed view. + */ + static CBrowserInitialView* NewLC( MApiProvider& aApiProvider ); + + /** + * default constructor. + */ + void ConstructL(); + + /** + * Constructor + */ + CBrowserInitialView( MApiProvider& aApiProvider); + + /** + * Destructor. + */ + ~CBrowserInitialView(); + + public: // Functions from base classes + + /** + * From CAknView returns Uid of View + * @return TUid uid of the view + */ + TUid Id() const; + + /** + * From MEikMenuObserver delegate commands from the menu + * @param aCommand a command emitted by the menu + * @return void + */ + void HandleCommandL(TInt aCommand); + + /** + * From CBrowserViewBase reaction if size change + * @return void + */ + void HandleClientRectChange(); + + /** + * Return command set id, to be displayed. + * @since 1.2 + * @return The command set's resource id. + */ + virtual TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + public: // Functions from base classes + + private: + + /** + * From CAknView activate the view + * @param aPrevViewId + * @param aCustomMessageId + * @param aCustomMessage + * @return void + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * Launches the goto address editor. + */ + void LaunchGotoAddressEditorL(); + + /** + * Handles GotoPane events + */ + void HandleGotoPaneEventL( CBrowserGotoPane* aGotoPane, TEvent aEvent ); + + /** + * Updates GotoPane + */ + void UpdateGotoPaneL(); + + /** + * Loads the typed url into content view. + */ + void GotoUrlInGotoPaneL(); + + /** + * Dynamically initialize menu panes. + * @param aResourceId ID for the resource to be loaded + * @param aMenuPane Menu pane + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * From CAknView deactivate the view (free resources) + * @return void + */ + void DoDeactivate(); + + public: + + private: // Data + CBrowserInitialContainer* iContainer; + + // GotoPane`s text + HBufC* iEnteredURL; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserLauncherService.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserLauncherService.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of BrowserLauncherService +* +* +*/ + + +#ifndef BROWSERLAUNCHERSERVICE_H +#define BROWSERLAUNCHERSERVICE_H + +// INCLUDE FILES +#include "LauncherServerBase.h" + +// FORWARD DECLARATIONS +class TBrowserOverriddenSettings; +class CAiwGenericParamList; + +// CLASS DECLARATION +class CBrowserLauncherService: public CLauncherServerBase +{ +public: + + /** + * Destructor. + */ + virtual ~CBrowserLauncherService(); + +private: + /** + * Process incoming messages syncronously. + * @param aEmbeddingApplicationUid Embedding application`s UID + * @param aSettings Overridden user preferences. + * @param aFolderUid Uid of the folder that the Browser should open. + * @param aSeamlessParam + * @param aIsContentHandlerRegistered True if a content handler is registered + * @return The result of processing. ( same as SendRecieve() ) + */ + // from CLauncherServerBase + TInt ProcessMessageSyncL( TUid aEmbeddingApplicationUid, + TBrowserOverriddenSettings aSettings, + TInt aFolderUid, + TPtrC aSeamlessParam, + TBool aIsContentHandlerRegistered ); + + /** + * Process incoming messages asyncronously. + * @param aEmbeddingApplicationUid Embedding application`s UID + * @param aSettings Overridden user preferences. + * @param aFolderUid Uid of the folder that the Browser should open. + * @param aSeamlessParam + * @param aIsContentHandlerRegistered True if a content handler is registered + * @param isOverridenSettings True if the client sended an overidden setting + */ + // from CLauncherServerBase + void ProcessMessageASyncL( TUid aEmbeddingApplicationUid, + TBrowserOverriddenSettings aSettings, + TInt aFolderUid, + TPtrC aSeamlessParam, + TBool aIsContentHandlerRegistered, + TBool isOverridenSettings ); + + /** + * Write iClientBuffer member to client`s address space. + * @return The error code of the process. + */ + TInt ProcessMessageSyncBufferL( ); + + /** + * Process TBool parameters. + */ + void ProcessBoolsL( TBool aClientWantsToContinue, TBool aWasContentHandled ); + + /** + * Closes the Browser. + */ + void DoBrowserExit( ); + +public: + + /** + * Notifies client about finished download. + * @param aReason Result of the downloading + */ + void DownloadFinishedL( TInt aReason, const CAiwGenericParamList& aParamList ); + +public: + /** + * Second phase constructor. + */ + void ConstructL(); +}; + +#endif // CBrowserAppServer_H \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserLoadObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserLoadObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle special load events such as network connection, +* deal with non-http or non-html requests +* +*/ + + + +#ifndef BROWSERLOADOBSERVER_H +#define BROWSERLOADOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MApiProvider; +class CBrowserContentView; +class CBrowserWindow; + +// define this macro to log event time, temporary +// #define I__LOG_EVENT_TIME + +// CLASS DECLARATION + +/** +* This observer registers for load events +*/ +class CBrowserLoadObserver : public CBase, + public MBrCtlLoadEventObserver, + public MBrowserDialogsProviderObserver + { + public: // Constructors and destructors + + /** + * Constructor. + */ + static CBrowserLoadObserver* NewL( MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + CBrowserWindow& aWindow ); + + /** + * Destructor. + */ + virtual ~CBrowserLoadObserver(); + + public: + + enum TBrowserLoadState + { + ELoadStateIdle = 0x01, + // ELoadStateContentStart is not used. + // If you want to set it from BrowserUi, please note + // that it's not guarantued that Kimono will send + // any load event in case the content is already moved to + // Download Manager! + ELoadStateContentStart = 0x02, + ELoadStateResponseInProgress = 0x04, + ELoadStateLoadDone = 0x08, + ELoadStateContentAvailable = 0x10 + }; + + enum TBrowserLoadUrlType + { + ELoadUrlTypeSavedDeck = 0x01, + ELoadUrlTypeStartPage, + ELoadUrlTypeEmbeddedBrowserWithUrl, + ELoadUrlTypeOther // for example GotoPane's url, Bookmark + }; + + enum TBrowserLoadStatus + { + // these flags are the status of loading a page, + // can be OR'd for querying, setting + ELoadStatusFirstChunkArrived = 0x0001 , + ELoadStatusContentDisplayed = 0x0002 , + ELoadStatusMainError = 0x0004 , + ELoadStatusSubError = 0x0008 , + ELoadStatusError = ELoadStatusMainError | ELoadStatusSubError, + // 0x000C , // MainError or SubError + ELoadStatusTitleAvailable = 0x0010, + ELoadStatusFirstChunkDisplayed = 0x0020, + ELoadStatusDone = 0x0040, + ELoadStatusSecurePage = 0x0080, + ELoadStatusSecureItemNonSecurePage = 0x0100, + ELoadStatusAllItemIsSecure = 0x0200, // !SomeItemsNotSecure + ELoadStatusSecurePageVisited = 0x0400 + }; + + public: // Functions from MBrCtlLoadEventObserver + + /** + * A load events notification + * @since 2.8 + * @param aLoadEvent The load event + * @param aSize Size depends on the event + * @param aTransactionId The transaction that had this event + * @return void + */ + virtual void HandleBrowserLoadEventL( + TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, + TUint aSize, + TUint16 aTransactionId ); + + public: // Functions from MBrowserDialogsProviderObserver + + /** + * Callback function for dialog events. + */ + void ReportDialogEventL( TInt aType, TInt aFlags = 0 ); + + public: // new functions + + /** + * Loading must be started with this function by the owner. + * @since 3.0 + * @param aLoadUrlType What is the url's type? + * if url doesn't need to be handled a special way, use ELoadUrlTypeOther + * otherwise implement special handling for all the events. + * @return void + */ + void DoStartLoad( TBrowserLoadUrlType aLoadUrlType ); + + /** + * Loading must be terminated with this function by the owner. + * @since 3.0 + * @param aIsCancelled Is user cancelled the fetching operation? + */ + void DoEndLoad( TBool aIsUserInitiated = EFalse ); + + /** + * Checks loading status against some flags. + * @param aFlags + * @return ETrue only if ALL the aFlags are set + */ + inline TBool LoadStatus( TUint32 aFlag ) const + { return ( ( aFlag ) && (( iStatus & ( aFlag )) == ( aFlag ))); } + + protected: // new functions + + /** + * Default C++ constructor. + */ + CBrowserLoadObserver( MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + CBrowserWindow& aWindow ); + + /** + * 2nd phase constructor. Leaves on failure. + */ + void ConstructL(); + + private: // new functions + + void HandleLoadEventOtherL( + TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, + TUint aSize, + TUint16 aTransactionId ); + + inline void SetStatus( TUint32 aFlag ) { iStatus |= aFlag; } + inline void ClearStatus( TUint32 aFlag ) { iStatus &= ~aFlag; } + inline void ClearStatus( ) { iStatus = 0; } + + void UpdateSecureIndicatorL(); + + private: + void StateChange( TBrowserLoadState aNextState ); + void NewTitleAvailableL(); + TBool InBrowserContentView(); + void ContentArrivedL(); + inline void SetRestoreContentFlag( TBool aFlag ) + { iRestoreContentFlag = aFlag; } + + public: + // Get functions + TBrowserLoadUrlType LoadUrlType() const; + TBrowserLoadState LoadState() const; + inline TBool ContentDisplayed(){return iNewContentDisplayed;} + void SetContentDisplayed( TBool aValue ); + + private: // data members + MApiProvider *iApiProvider; // owner app, not owned + CBrowserContentView *iContentView; // contentView, not owned + CBrowserWindow *iWindow; + TBrowserLoadState iLoadState; + TBrowserLoadUrlType iLoadUrlType; + TUint32 iStatus; + + TBool iRestoreContentFlag; + TBool iBrowserInitLoad; + TBool iNewContentDisplayed; + // Large file upload max content + TUint32 iMaxUploadContent; + +#ifdef I__LOG_EVENT_TIME + TTime iStartDownloadTime; + TInt64 iTotalUpdateTime; + TInt64 iNumberOfUpdates; +#endif + + }; + +#endif // BROWSERLOADOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserPopupEngine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserPopupEngine.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CBrowserPopupEngine +* +* +*/ + + +#ifndef __BROWSERPOPUPENGINE_H +#define __BROWSERPOPUPENGINE_H + +// INCLUDE FILES +#include +#include +#include + +// CLASS DECLARATION + +/** +* CBrowserPopupEngine. +* +* @lib Browser.app +* @since Series 60 3.0 +*/ +class CBrowserPopupEngine : public CBase +{ + public:// Constructors and destructor + /** + * Default constructor. + */ + CBrowserPopupEngine(); + /** + * Destructor. + */ + ~CBrowserPopupEngine(); + static CBrowserPopupEngine* NewLC(); + static CBrowserPopupEngine* NewL(); + public:// New functions + /** + * Adds url to white list + * @param aUrl url to ad to white list + */ + void AddUrlToWhiteListL(const TDesC& aUrl); + /** + * Checks whether the url is on the white list + * @param aUrl url to check + * @return ETrue if the url is on white list + */ + TBool IsUrlOnWhiteListL(const TDesC& aUrl); + + void RemoveUrlFromWhiteListL(const TDesC& aUrl); + + private: + void ConstructL(); + /** + * Checks whether the url is in white cache + * @param aUrl url to check + * @return ETrue if the url is in white cache + */ + TBool IsUrlInWhiteCacheL(const TDesC& aUrl); + /** + * Checks whether the url is in the white file + * @param aUrl url to check + * @return ETrue if the url is in white file + */ + TBool IsUrlInWhiteFileL(const TDesC& aUrl); + /** + * Checks whether the url is in file + * @param aUrl url to check + * @return ETrue if the url is in file + */ + TBool IsUrlInFileL(const RFile* aFile, const TDesC& aUrl); + /** + * Checks whether the url is in the cache + * @param aUrl url to check + * @return ETrue if the url is in cache + */ + TBool IsUrlInCacheL( const CDesCArrayFlat* aCacheArray, const TDesC& aUrl, const TInt aLoadedurlno ); + /** + * Loads urls to cache + * @param aFile file where from the urls will be loaded + * @param aCacheArray where to load the urls + * @param aLoadedUrlNo number of loaded urls + */ + void LoadUrlsToCacheL(const RFile* aFile, CDesCArrayFlat* aCacheArray, TInt* aLoadedUrlNo); + /** + * Adds url to cache + * @param aCacheArray array where to add the url + * @param aUrl url to add to cache + */ + void AddUrlToCacheL( CDesCArrayFlat* aCacheArray, const TDesC& aUrl ); + /** + * Converts TDesc16 to TPtrC8 + * @param aString string to convert + * @return a TPtrC8 + */ + TPtrC8 TDesC16ToTPtrC8(const TDesC16 &aString); + /** + * Converts TDesc8 to TPtrC16 + * @param aString string to convert + * @return a TPtrC16 + */ + TPtrC16 TDesC8ToTPtrC16(const TDesC8 &aString); + /** + * Converts TDesc16 to HBufC8 + * @param aString string to convert + * @return a pointer to HBufC8 + */ + HBufC8 *TDesC16ToHBufC8LC(const TDesC16 &string); + /** + * Converts TDesc8 to HBufC16 + * @param aString string to convert + * @return a pointer to HBufC16 + */ + HBufC16 *TDesC8ToHBufC16LC(const TDesC8 &aString); + /** + * Opens the database + * @param aFile pointer to the file handle + * @param aIsBlack whether the databas is black + * @return + */ + void OpenDatabaseL(RFile* aFile); + /** + * Handles order changes in the database + * @param aFile database file + * @param aUrl the url which cause the hange + * @param aExists whether the url exists in the database allready + * @param aIsBlack whether the database is black + * @param aToAdd whether to add the url to the database + * @return + */ + void HandleUrlOrderChangeL(RFile* aFile, const TDesC& aUrl, const TBool aExists,const TBool aToAdd ); + /** + * Removes Url from the cache + * @param aCacheArray + * @param aUrl + * @param aCacheNo + * @return + */ + void RemoveUrlFromCacheL( CDesCArrayFlat* aCacheArray, const TDesC& aUrl, TInt &aCacheNo ); + /** + * Checks whether the database is valid + * @param aFile pointer to the file which will be checked + * @return ETrue if the file is OK + */ + TBool CheckDbValidity(RFile* aFile); + //member variables + RFs iFs; + RFile iWhiteListFile;//stores the white urls + CDesCArrayFlat* iCachedWhiteUrls;//owned + TInt iWhiteCacheNo;//number of white urls loaded to cache +}; + + + +#endif //__BROWSERPOPUPENGINE_H \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserPreferences.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserPreferences.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1124 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: It manages Browser's preferences. +* +*/ + + +#ifndef BROWSER_PREFERENCES_H +#define BROWSER_PREFERENCES_H + +// INCLUDE FILES +#include +#include +#include +#include "Browser.hrh" +#include "Preferences.h" +#include +#include "BrowserUiPrivateCRKeys.h" +#include +#include +#include + +// CONSTANTS + +// FORWARD DECLARATION + +class MCommsModel; +class MApiProvider; +class CRepository; + +// class CBrCtlInterface; +class TBrowserOverriddenSettings; +class CApDataHandler; +class CVpnApItem; +class CVpnApEngine; +// CLASS DECLARATION + +/** +* Stores Browser settings. +* +* @lib Browser.app +* @since Series60 1.2 +*/ +class CBrowserPreferences : public CBase, + public MPreferences, + public MActiveApDbObserver + { + public: // construction + + /** + * Two-phased constructor. + * @since Series60 1.2 + * @param aCommsModel Comms model + * @return The constructed preferences object + */ + static CBrowserPreferences* NewLC( MCommsModel& aCommsModel, + MApiProvider& aApiProvider, + TBrowserOverriddenSettings* aSettings); + + /** + * Two-phased constructor. + * @since Series60 1.2 + * @param aCommsModel Comms model + * @return The constructed preferences object + */ + static CBrowserPreferences* NewL( MCommsModel& aCommsModel, + MApiProvider& aApiProvider , + TBrowserOverriddenSettings* aSettings ); + + public: // destruction + + /** + * Destructor. + */ + virtual ~CBrowserPreferences(); + + + public: // observation + + /** + * Adds an observer to the list of observers to be notified about changes. + * @since Series60 1.2 + * @param anObserver Observer to be notified about events + */ + void AddObserverL( MPreferencesObserver* anObserver ); + + + /** + * Removes an observer. + * @since Series60 1.2 + * @param anObserver The observer + */ + void RemoveObserver( MPreferencesObserver* anObserver ); + + /** + * Notify all observers about change. + * @since Series60 1.2 (updated in 3.0) + */ + void NotifyObserversL( TPreferencesEvent aEvent, + TBrCtlDefs::TBrCtlSettings aSettingType ); + + public: // From MActiveApDbObserver + + /** + * Derived classes should implement this method, and act accordingly + * to database events. + * @since Series60 1.2 + * @param anEvent Database-related event + */ + void HandleApDbEventL( TEvent anEvent ); + + public: // New functions + + /** + * Stores preferences into shared data db. + * @since Series60 1.2 + */ + void StoreSettingsL() const; + + /** + * Returns a structure containing all of the settings according to the + * central repository values + * @since Series60 3.0 + */ + const TPreferencesValues& AllPreferencesL(); + + /** + * To access an int value key in ini file + * @param aKey the ini file key to read + * @return the value of the given key + * @since Series60 2.0 + */ + TInt GetIntValue( TUint32 aKey) const; + + /** + * To access an string value key in ini file + * @param aKey the ini file key to read + * @return the value of the given key + * @since Series60 2.0 + */ + TInt GetStringValueL ( TUint32 aKey, TInt aMaxBufSize, TDes& aBuf ) const; + + private: // New functions + + /** + * restores preferences from shared data db. If fails, it uses defaults. + * @since Series60 1.2 + */ + void RestoreSettingsL(); + + private: //Utility functions for accessing shared data + + /** + * To set an int value key in ini file + * @param aKey the ini file key to write + * @param aValue new value for the key + * @return ETrue if successful + * @since Series60 2.0 + */ + TBool SetIntValueL ( TUint32 aKey, const TInt& aValue); + + /** + * To access an string value key in ini file + * @param aKey the ini file key to read + * @return the value of the given key + * @since Series60 2.0 + */ + HBufC* GetStringValueL ( TUint32 aKey ) const; + + /** + * To set an int value key in ini file + * @param aKey the ini file key to write + * @param aValue new value for the key + * @return ETrue if successful + * @since Series60 2.0 + */ + TBool SetStringValueL( TUint32 aKey, const TDesC& aValue ); + + private: // New functions + + /** + * Enables access to functions in CBrowserAppUi + **/ + inline MApiProvider& ApiProvider() { return iApiProvider; } + + public: // New functions + + /** + * To set overriden values + * @param aSettings settings to verride + * @return void + * @since Series60 2.0 + */ + void SetOverriddenSettingsL(TBrowserOverriddenSettings* aSettings); + + /** + * To set embedded mode + * @param aEmbeddedMode true if embedded mode is on + * @return void + * @since Series60 2.0 + */ + void SetEmbeddedModeL(TBool aEmbeddedMode); + + /** + * To get embedded mode + * @return TBool + * @since Series60 3.0 + */ + inline TBool EmbeddedMode() const { return iEmbeddedMode; } + + /** + * To access DefaultAccessPoint setting. + * @since Series60 1.2 + * @return UID for default accesspoint + */ + inline TUint DefaultAccessPoint() const; + + + /** + * Get the default snap id + * @since Series60 1.2 + * @return + */ + inline TUint DefaultSnapId() const; + + /** + * To access Accossiated VPN if exist setting. + * @since Series60 1.2 + * @return UID for Accossiated VPN or KWmlNoDefaultAccessPoint + */ + inline TUint AssociatedVpn() const; + + /** + * To access deafult AP details if exist setting. + * @since Series60 1.2 + * @return CApAccessPointItem* or NULL + */ + inline CApAccessPointItem* DefaultAPDetails(); + + /** + * To access vpn item if exists. + * aDefaultAccessPoint + * aVpnItem + * @since Series60 1.2 + * @return TBool - if vpn item is valid + */ + TBool VpnDataL( TUint aDefaultAccessPoint, CVpnApItem& aVpnItem ); + + /** + * To access AutoLoadContent setting. + * @since Series60 1.2 + * @return Value of setting + */ + inline TInt AutoLoadContent() const; + + /** + * To access PageOverview setting. + * @return Value of setting + */ + inline TBool PageOverview() const; + + /** + * To access BackList setting. + * @return Value of setting + */ + inline TBool BackList() const; + + /** + * To access AutoRefresh setting. + * @return Value of setting + */ + inline TBool AutoRefresh() const; + + /** + * Sets the automatic updating access point of Web Feeds + */ + void SetAutomaticUpdatingApL( TUint aAutomaticUpdatingAP ); + + + /** + * Sets the automatic updating while roaming of News & Blogs + */ + void SetAutomaticUpdatingWhileRoamingL( TBool aAutoUpdateRoaming ) ; + + /** + * To access user-defined URL suffix list (.com, org, .net) + */ + inline HBufC* URLSuffixList( ) const; + + /** + * To modify user-defined URL suffix list (.com, .org, .net) + */ + void SetURLSuffixList( HBufC* aValue ); + + /** + * automatic updating access point of Web Feeds + */ + inline TUint AutomaticUpdatingAP() const; + + + /** + * automatic updating while roaming of News & Blogs + */ + inline TBool AutomaticUpdatingWhileRoaming() const; + + /** + * To access TextWrap setting + * @since Series60 1.2 + * @return setting item value + */ + inline TBool TextWrap() const; + + /** + * To access FontSize setting + * @since Series60 1.2 + * @return Font size + */ + inline TInt FontSize() const; + + /** + * To access Encoding setting + * @since Series60 1.2 + * @return Default Encoding + */ + inline TUint32 Encoding() const; + + /** + * To access Adaptive Bookmarks setting + * @since Series60 1.2 + * @return TWmlSettingsAdaptiveBookmarks + */ + inline TWmlSettingsAdaptiveBookmarks AdaptiveBookmarks() const; + + /** + * To access FullScreen setting + * @since Series60 2.1 + * @return TWmlSettingsFullScreen + */ + inline TWmlSettingsFullScreen FullScreen() const; + + /** + * To access Cookies setting + * @since Series60 1.2 + * @return TWmlSettingsCookies + */ + inline TWmlSettingsCookies Cookies() const; + + /** + * To access ECMA setting + * @since Series60 2.x + * @return TWmlSettingsECMA + */ + inline TWmlSettingsECMA Ecma() const; + + /** + * To access SCRIPTLOG setting + * @since Series60 3.2 + * @return TUint32 + */ + inline TUint32 ScriptLog() const; + + /** + * To access HTTP security warnings setting + * @since Series60 1.2S + * @return ETrue if security warnings are enabled + */ + inline TBool HttpSecurityWarnings() const; + + /** + * To access IMEI notification setting + * @since Series60 2.6 + * @return ETrue if notification is enabled + */ + inline TWmlSettingsIMEI IMEINotification() const; + + /** + * Call this to check whether Http + */ + inline TBool HttpSecurityWarningsStatSupressed() const; + + /** + * To access Downloads Open setting + * @since Series60 3.x + * @return TBool + */ + inline TBool DownloadsOpen() const; + + /** + * To access user-defined homepage URL setting + */ + TInt HomePageUrlL( TDes& aUrl, TBool aForceLoadFromSD = EFalse ) const; + + /** + * Get the home page URL from belongs to the access point. + */ + TInt HomePageFromIapL( TDes& aUrl, TUint aIap ) const; + + /** + * To access user-defined search page URL setting + */ + TPtrC SearchPageUrlL(); + + /** + * To determine that is there an overridden default access point defined or not + */ + TBool CustomAccessPointDefined(); + + /** + * Shows/Hides the query on exit dialog + * 0 = Not show the dialog + * 1 = Show the dialog + * + * @since Series60 2.7 + * @return ETrue if query on exit is enabled + */ + inline TBool QueryOnExit() const; + + /** + * Sends/Don not send the referrer header + * 0 = Do not send the referrer header + * 1 = Send the referrer header + * + * @since Series60 2.7 + * @return ETrue if Send referrer header is enabled + */ + inline TBool SendReferrer() const; + + /** + * To access ShowConnectionDialogs setting + * @since Series60 2.0 + * @return value of setting + */ + inline TBool ShowConnectionDialogs() const; + + /** + * To check that an engine local feature is supported or not + * @since Series60 2.1 + * @return Returns ETrue if feature is supported + * @param aBitmask Feature to check + */ + inline TBool EngineLocalFeatureSupported( const TInt aFeature ) const; + + /** + * To check that a ui local feature is supported or not + * @since Series60 2.1 + * @return Returns ETrue if feature is supported + * @param aBitmask Feature to check + */ + inline TBool UiLocalFeatureSupported( const TInt aFeature ) const; + + /** + * To access MediaVolume setting + * @since Series60 2.6 + * @return TInt + */ + inline TInt MediaVolume() const; + + /** + * To access home page's type: AP/user defined. + * @since Series60 2.6 + * @return value of setting + */ + inline TWmlSettingsHomePage HomePageType() const; + + /** + * To access Popup Blocking Enabled setting. + * @since Series60 3.0 + * @return value of setting + */ + inline TBool PopupBlocking() const; + + /** + * To access Form Data Saving setting. + * @since Series60 3.1 + * @return value of setting + */ + inline TWmlSettingsFormData FormDataSaving() const; + + /** + * To access Access Keys setting. + * @since Series60 3.2 + * @return value of setting: 1-Enabled, 0-Disabled + */ + inline TBool AccessKeys() const; + + /** + * To modify DefaultAccessPoint setting + * @since Series60 1.2 + * @param aDefaultAccessPoint Id of default accesspoint + */ + void SetDefaultAccessPointL( TUint aDefaultAccessPoint, TUint aAssocVpn = KWmlNoDefaultAccessPoint ); + + /** + * Set default snapid + * @since Series60 1.2 + * @param + */ + void SetDefaultSnapId (TUint aSnapId); + + /** + * To modify AutoLoadContent setting + * @since Series60 1.2 + * @param aAutoLoadContent Change the setting on/off + */ + void SetAutoLoadContentL( TInt aAutoLoadContent ); + + /** + * To modify PageOverview setting + * @param aPageOverview Change the setting on/off + */ + void SetPageOverviewL( TBool aPageOverview ); + + /** + * To modify BackList setting + * @param aBackList Change the setting on/off + */ + void SetBackListL( TBool aBackList ); + + /** + * To modify AutoRefresh setting + * @param aAutoRefresh Change the setting on/off + */ + void SetAutoRefreshL( TBool aAutoRefresh ); + + /** + * To modify TextWrap setting + * @since Series60 1.2 + * @param aTextWrap Change the setting on/off + */ + void SetTextWrapL( TBool aTextWrap ); + + /** + * To modify FontSize setting + * @since Series60 1.2 + * @param aFontSize Set new font size + */ + void SetFontSizeL( TInt aFontSize ); + + /** + * To modify Encoding setting + * @since Series60 1.2 + * @param aEncoding Set new font size + */ + void SetEncodingL( TUint32 aEncoding ); + + /** + * To modify Adaptive Bookmarks setting + * @since Series60 1.2 + * @param aAdaptiveBookmarks + */ + void SetAdaptiveBookmarksL( TWmlSettingsAdaptiveBookmarks aAdaptiveBookmarks ); + + /** + * To modify FullScreen setting + * @since Series60 2.1 + * @param aFullScreen + */ + void SetFullScreenL( TWmlSettingsFullScreen aFullScreen ); + + /** + * To modify Cookies setting + * @since Series60 1.2 + * @param aCookies + */ + void SetCookiesL( TWmlSettingsCookies aCookies ); + + /** + * To modify ECMA setting + * @since Series60 2.x + * @param aEcma + */ + void SetEcmaL( TWmlSettingsECMA aEcma ); + + /** + * To modify ScriptLog setting + * @since Series60 3.2 + * @param aScriptLog + */ + void SetScriptLogL( TUint32 aScriptLog ); + + /** + * To modify HTTP security warnings setting + * @since Series60 1.2S + * @param aWarningsOn True to enable security warnings, false to disable + */ + void SetHttpSecurityWarningsL( TBool aWarningsOn ); + + /** + * To modify IMEI notification setting + * @since Series60 2.6 + * @param aIMEINotification True to enable IMEI notification + */ + void SetIMEINotificationL( TWmlSettingsIMEI aIMEINotification ); + + /** + * To modify MediaVolume setting + * @since Series60 2.6 + * @param aMediaVolume Change the media volume value + */ + void SetMediaVolumeL( TInt aMediaVolume ); + + /** + * To modify Downloads Open setting + * @since Series60 3.x + * @param aOpen True to enable download open + */ + void SetDownloadsOpenL( TBool aOpen ); + + /** + * To flush all the shared data key settings + * @since Series60 2.6 + */ + void FlushSD(); + + /** + * To modify HomePage's type setting + * @since Series60 2.6 + * @param aHomePageType Change the home page type: AP/user defined. + */ + void SetHomePageTypeL( TWmlSettingsHomePage aHomePageType ); + + /** + * To modify user-defined HomePage. + * @since Series60 2.6 + * @param aHomePageURL Change the home page's url. + */ + void SetHomePageUrlL( const TDesC& aHomePageURL ); + + /** + * To modify user-defined Search Page URL + * @since Series60 2.6 + * @param aSearchPageURL Change the search page's url. + */ + void SetSearchPageUrlL( const TDesC& aSearchPageURL ); + + /** + * To modify user-defined Pop-up blocking enabled setting + * @since Series60 3.0 + * @param aPopupBlocking Change setting on/off + */ + void SetPopupBlockingL( TBool aPopupBlocking ); + + /** + * To modify Form Data Saving setting + * @since Series60 3.1 + * @param aFormDataSaving Change setting off/form data only/ form data plus password + */ + void SetFormDataSavingL( TWmlSettingsFormData aFormDataSaving ); + + /** + * To access to the list of self download content types. + * See CBrCtlInterface::SetSelfDownloadContentTypesL()! + */ + TPtrC SelfDownloadContentTypesL(); + + /** + * To access Default Access Point selection mode settings. + */ + TCmSettingSelectionMode AccessPointSelectionMode(); + + /** + * To modify Default Access Point Settings + */ + void SetAccessPointSelectionModeL( TCmSettingSelectionMode aAccessPointSelectionMode ); + + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncHomePg() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncBkMark() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncFindKeyWord() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncPrePage() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncSwitchWin() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncMiniImage() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncFullScreen() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncGoAddr() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncZoomIn() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncZoomOut() const; + + /** + * To access pre defined short cut keys + */ + inline HBufC* ShortCutFuncZoomMode() const; + + /** + * To access rotate display setting + */ + inline TBool RotateDisplay() const; + + /** + * To get Toolbar On/Off value + */ + inline TInt ShowToolbarOnOff() const; + + /** + * To get Toolbar Button 1 command value + */ + inline TInt ShowToolbarButton1Cmd() const; + + /** + * To set Toolbar On/Off value + */ + void SetToolbarOnOffL(TInt aCommand); + + /** + * To set Toolbar Button 1 command value + */ + void SetToolbarButton1CmdL(TInt aCommand); + + /** + * To get Toolbar Button 2 command value + */ + inline TInt ShowToolbarButton2Cmd() const; + + /** + * To set Toolbar Button 2 command value + */ + void SetToolbarButton2CmdL(TInt aCommand); + + /** + * To get Toolbar Button 3 command value + */ + inline TInt ShowToolbarButton3Cmd() const; + + /** + * To set Toolbar Button 3 command value + */ + void SetToolbarButton3CmdL(TInt aCommand); + + /** + * To get Toolbar Button 4 command value + */ + inline TInt ShowToolbarButton4Cmd() const; + + /** + * To set Toolbar Button 4 command value + */ + void SetToolbarButton4CmdL(TInt aCommand); + + /** + * To get Toolbar Button 5 command value + */ + inline TInt ShowToolbarButton5Cmd() const; + + /** + * To set Toolbar Button 5 command value + */ + void SetToolbarButton5CmdL(TInt aCommand); + + /** + * To get Toolbar Button 6 command value + */ + inline TInt ShowToolbarButton6Cmd() const; + + /** + * To set Toolbar Button 6 command value + */ + void SetToolbarButton6CmdL(TInt aCommand); + + /** + * To get Toolbar Button 7 command value + */ + inline TInt ShowToolbarButton7Cmd() const; + + /** + * To set Toolbar Button 7 command value + */ + void SetToolbarButton7CmdL(TInt aCommand); + + /** + * To get Shortcut Key 1 command value + */ + inline TInt ShortcutKey1Cmd() const; + + /** + * To set Shortcut Key 1 command value + */ + void SetShortcutKey1CmdL(TInt aCommand); + + /** + * To get Shortcut Key 2 command value + */ + inline TInt ShortcutKey2Cmd() const; + + /** + * To set Shortcut Key 2 command value + */ + void SetShortcutKey2CmdL(TInt aCommand); + + /** + * To get Shortcut Key 3 command value + */ + inline TInt ShortcutKey3Cmd() const; + + /** + * To set Shortcut Key 3 command value + */ + void SetShortcutKey3CmdL(TInt aCommand); + + /** + * To get Shortcut Key 4 command value + */ + inline TInt ShortcutKey4Cmd() const; + + /** + * To set Shortcut Key 4 command value + */ + void SetShortcutKey4CmdL(TInt aCommand); + + /** + * To get Shortcut Key 5 command value + */ + inline TInt ShortcutKey5Cmd() const; + + /** + * To set Shortcut Key 5 command value + */ + void SetShortcutKey5CmdL(TInt aCommand); + + /** + * To get Shortcut Key 6 command value + */ + inline TInt ShortcutKey6Cmd() const; + + /** + * To set Shortcut Key 6 command value + */ + void SetShortcutKey6CmdL(TInt aCommand); + + /** + * To get Shortcut Key 7 command value + */ + inline TInt ShortcutKey7Cmd() const; + + /** + * To set Shortcut Key 7 command value + */ + void SetShortcutKey7CmdL(TInt aCommand); + + /** + * To get Shortcut Key 8 command value + */ + inline TInt ShortcutKey8Cmd() const; + + /** + * To set Shortcut Key 8 command value + */ + void SetShortcutKey8CmdL(TInt aCommand); + + /** + * To get Shortcut Key 9 command value + */ + inline TInt ShortcutKey9Cmd() const; + + /** + * To set Shortcut Key 9 command value + */ + void SetShortcutKey9CmdL(TInt aCommand); + + /** + * To get Shortcut Key 0 command value + */ + inline TInt ShortcutKey0Cmd() const; + + /** + * To set Shortcut Key 0 command value + */ + void SetShortcutKey0CmdL(TInt aCommand); + + /** + * To get Shortcut Key Star command value + */ + inline TInt ShortcutKeyStarCmd() const; + + /** + * To set Shortcut Key Star command value + */ + void SetShortcutKeyStarCmdL(TInt aCommand); + + /** + * To get Shortcut Key Hash command value + */ + inline TInt ShortcutKeyHashCmd() const; + + /** + * To set Shortcut Key Hash command value + */ + void SetShortcutKeyHashCmdL(TInt aCommand); + + /** + * To get Shortcut Key for Qwerty command value + */ + inline TInt ShortcutKeysForQwerty() const; + + /** + * To get Zoom Level minimum value + */ + inline TUint32 ZoomLevelMinimum() const; + + /** + * To get Zoom Level maximum value + */ + inline TUint32 ZoomLevelMaximum() const; + + /** + * To get Zoom Level default value + */ + inline TUint32 ZoomLevelDefault() const; + + /** + * To get Maximum number of Recent URLs to be displayed in pop up + */ + inline TInt MaxRecentUrls() const; + + /** + * To get Search Feature Flag. + */ + inline TInt SearchFeature() const; + + /** + * To get Service Feature Flag. + */ + inline TInt ServiceFeature() const; + + /** + * To get cursor show mode + */ + inline TBrCtlDefs::TCursorSettings CursorShowMode() const; + + inline TBrCtlDefs::TEnterKeySettings EnterKeyMode() const; + + private: + + /** + * Constructor. + * @param aCommsModel Comms model. + */ + CBrowserPreferences( MCommsModel& aCommsModel, MApiProvider& aApiProvider ); + + /** + * By default constructor is private. + */ + void ConstructL( TBrowserOverriddenSettings* aSettings ); + TInt GetSearchFeatureStatusL( TUint32 aKey, RApaLsSession& aLs ); + private: + + MApiProvider& iApiProvider; // enables access to CBrowserAppUi + + // Application settings to store in file + TUint iCustomAp; + public: + enum ///< Text font size + { + EAllSmall, + ESmall, + ENormal, + ELarge, + EAllLarge + } TFontSize; + private: + // Observers + CArrayPtrFlat< MPreferencesObserver >* iObservers; + MCommsModel& iCommsModel; + + CRepository* iRepository; + CApDataHandler* iApDH; + CVpnApItem* iVpnItem; + CVpnApEngine* iVpnEngine; + + // OSS needs a separate repository for non shared settings. + + TInt iEngineLocalFeaturesBitmask; //Engine Local Features Bitmask + + TInt iUiLocalFeaturesBitmask; //Ui Local Features Bitmask + + TBrowserOverriddenSettings* iOverridenSettings; + + TBool iEmbeddedMode; //ETrue = the browser is in embedded mode + + TInt iCdmaUiLocalFeaturesBitmask; // CDMA UI Local Features Bitmask + + TBool iOverriden;//Settings were overriden or not + + HBufC* iSelfDownloadContentTypes; ///< List of such content types. Owned. + + // A buffer struct for holding each setting value + TPreferencesValues iAllPreferences; + }; + +#include "BrowserPreferences.inl" + +// Toolbar button command translation matrix +// +// translates cenrep value to browser command and setting string resource id +// for each toolbar button +// +// NOTE: THIS MUST STAY IN SYNC WITH SAME DEFINITION IN toolbar.h in webengine. +// +typedef const TInt TToolbarCommandDecodeEntry[1]; + +#define KToolbarCommandDecodeMatrixCount 23 +#define KToolbarCommandDecodeMatrixStringId 0 // first entry is the Setting String Id + +static const TToolbarCommandDecodeEntry ToolbarCommandDecodeMatrix[] = +{ + // Index # Setting String Id + // = cenrep value + /* 0 */ { R_BROWSER_SETTING_NONE }, + /* 1 */ { R_BROWSER_SETTING_SHOW_HELP }, + /* 2 */ { R_BROWSER_SETTING_SWITCH_WINDOW }, + /* 3 */ { R_BROWSER_SETTING_SAVE_PAGE }, + /* 4 */ { R_BROWSER_SETTING_VIEW_IMAGES }, + /* 5 */ { R_BROWSER_SETTING_VISUAL_HISTORY }, + /* 6 */ { R_BROWSER_SETTING_MANAGE_BOOKMARKS }, + /* 7 */ { R_BROWSER_SETTING_SUBSCRIBE_TO_FEEDS }, + /* 8 */ { R_BROWSER_SETTING_ROTATE_SCREEN }, + /* 9 */ { R_BROWSER_SETTING_SETTINGS }, + /* 10 */ { R_BROWSER_SETTING_ZOOM_OUT }, + /* 11 */ { R_BROWSER_SETTING_ZOOM_IN }, + /* 12 */ { R_BROWSER_SETTING_GO_TO_HOMPAGE }, + /* 13 */ { R_BROWSER_SETTING_PREVIOUS_PAGE }, + /* 14 */ { R_BROWSER_SETTING_MINIATURE_SHOW }, + /* 15 */ { R_BROWSER_SETTING_RELOAD }, + /* 16 */ { R_BROWSER_SETTING_FIND_KEYWORD }, + /* 17 */ { R_BROWSER_SETTING_RECENT_URLS }, // toolbar only - recent urls drop down list + /* 18 */ { R_BROWSER_SETTING_SAVE_AS_BOOKMARK }, + /* 19 */ { R_BROWSER_SETTING_LIST_BOOKMARKS }, // toolbar only - bookmarks drop down list + /* 20 */ { R_BROWSER_SETTING_GO_TO_WEB_ADDRESS }, + /* 21 */ { R_BROWSER_SETTING_SHOW_KEYMAP }, + /* 22 */ { R_BROWSER_SETTING_FULL_SCREEN }, +}; + + +// Shortcut Keys command translation matrix +// +// translates cenrep value to browser command and setting string resource id +// for each shortcut key +// +// +typedef const TInt TShortcutsCommandDecodeEntry[2]; + +#define KShortcutsCommandDecodeMatrixCount 22 +#define KShortcutsCommandDecodeMatrixCmdVal 0 // First entry is the Command Value +#define KShortcutsCommandDecodeMatrixStringId 1 // Second entry is the Setting String Id + +static const TShortcutsCommandDecodeEntry ShortcutsCommandDecodeMatrix[] = +{ + // Index # Command Value Setting String Id + // = cenrep value + /* 0 */ { EWmlNoCmd, R_BROWSER_SETTING_NONE }, + /* 1 */ { EAknCmdHelp, R_BROWSER_SETTING_SHOW_HELP }, + /* 2 */ { EWmlCmdSwitchWindow, R_BROWSER_SETTING_SWITCH_WINDOW }, + /* 3 */ { EWmlCmdSavePage, R_BROWSER_SETTING_SAVE_PAGE }, + /* 4 */ { EWmlCmdShowImages, R_BROWSER_SETTING_VIEW_IMAGES }, + /* 5 */ { EWmlCmdHistory, R_BROWSER_SETTING_VISUAL_HISTORY }, + /* 6 */ { EWmlCmdFavourites, R_BROWSER_SETTING_MANAGE_BOOKMARKS }, + /* 7 */ { EWmlCmdShowSubscribeList, R_BROWSER_SETTING_SUBSCRIBE_TO_FEEDS }, + /* 8 */ { EWmlCmdRotateDisplay, R_BROWSER_SETTING_ROTATE_SCREEN }, + /* 9 */ { EWmlCmdPreferences, R_BROWSER_SETTING_SETTINGS }, + /* 10 */ { EWmlCmdZoomOut, R_BROWSER_SETTING_ZOOM_OUT }, + /* 11 */ { EWmlCmdZoomIn, R_BROWSER_SETTING_ZOOM_IN }, + /* 12 */ { EWmlCmdLaunchHomePage, R_BROWSER_SETTING_GO_TO_HOMPAGE }, + /* 13 */ { EWmlCmdOneStepBack, R_BROWSER_SETTING_PREVIOUS_PAGE }, + /* 14 */ { EWmlCmdShowMiniature, R_BROWSER_SETTING_MINIATURE_SHOW }, + /* 15 */ { EWmlCmdReload, R_BROWSER_SETTING_RELOAD }, + /* 16 */ { EWmlCmdFindKeyword, R_BROWSER_SETTING_FIND_KEYWORD }, + /* 17 */ { EWmlCmdSaveAsBookmark, R_BROWSER_SETTING_SAVE_AS_BOOKMARK }, + /* 18 */ { EWmlCmdGoToAddress, R_BROWSER_SETTING_GO_TO_WEB_ADDRESS }, + /* 19 */ { EWmlCmdShowToolBar, R_BROWSER_SETTING_SHOW_TOOLBAR }, + /* 20 */ { EWmlCmdShowShortcutKeymap, R_BROWSER_SETTING_SHOW_KEYMAP }, + /* 21 */ { EWmlCmdEnterFullScreenBrowsing, R_BROWSER_SETTING_FULL_SCREEN }, +}; + +#endif //BROWSER_PREFERENCES_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserPreferences.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserPreferences.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,695 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CBrowserPreferences. +* +* +*/ + + +#ifndef WML_BROWSER_PREFERENCES_INL +#define WML_BROWSER_PREFERENCES_INL + +#include + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// CBrowserPreferences::DefaultSnapId() +// --------------------------------------------------------- +// + +TUint CBrowserPreferences::DefaultSnapId() const + { + + return iAllPreferences.iDefaultSnapId ; + + } + + +// --------------------------------------------------------- +// CBrowserPreferences::DefaultAccessPoint +// --------------------------------------------------------- +// +TUint CBrowserPreferences::DefaultAccessPoint() const + { + if ( ( iOverridenSettings ) && iCustomAp ) + { + return iCustomAp; + } + else + { + return iAllPreferences.iDefaultAccessPoint ; + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::AssociatedVpn +// --------------------------------------------------------- +// +TUint CBrowserPreferences::AssociatedVpn() const + { + return iAllPreferences.iAssocVpn; + } + +// --------------------------------------------------------- +// CBrowserPreferences::DefaultAPDetails +// --------------------------------------------------------- +// +CApAccessPointItem* CBrowserPreferences::DefaultAPDetails() + { + return iAllPreferences.iDefaultAPDetails; + } + +// --------------------------------------------------------- +// CBrowserPreferences::AutoLoadContent +// --------------------------------------------------------- +// +TInt CBrowserPreferences::AutoLoadContent() const + { + return iAllPreferences.iAutoLoadContent; + } + +// --------------------------------------------------------- +// CBrowserPreferences::PageOverview +// --------------------------------------------------------- +// +TBool CBrowserPreferences::PageOverview() const + { + return iAllPreferences.iPageOverview; + } + +// --------------------------------------------------------- +// CBrowserPreferences::BackList +// --------------------------------------------------------- +// +TBool CBrowserPreferences::BackList() const + { + return iAllPreferences.iBackList; + } + +// --------------------------------------------------------- +// CBrowserPreferences::AutoRefresh +// --------------------------------------------------------- +// +TBool CBrowserPreferences::AutoRefresh() const + { + return iAllPreferences.iAutoRefresh; + } + +// --------------------------------------------------------- +// CBrowserPreferences::TextWrap +// --------------------------------------------------------- +// +TBool CBrowserPreferences::TextWrap() const + { + return iAllPreferences.iTextWrap; + } + +// --------------------------------------------------------- +// CBrowserPreferences::FontSize +// --------------------------------------------------------- +// +TInt CBrowserPreferences::FontSize() const + { + return iAllPreferences.iFontSize; + } + +// --------------------------------------------------------- +// CBrowserPreferences::Encoding +// --------------------------------------------------------- +// +TUint32 CBrowserPreferences::Encoding() const + { + return iAllPreferences.iEncoding; + } + +// --------------------------------------------------------- +// CBrowserPreferences::AdaptiveBookmarks +// --------------------------------------------------------- +// +TWmlSettingsAdaptiveBookmarks CBrowserPreferences::AdaptiveBookmarks() const + { + return iAllPreferences.iAdaptiveBookmarks; + } + +// --------------------------------------------------------- +// CBrowserPreferences::FullScreen() +// --------------------------------------------------------- +// +TWmlSettingsFullScreen CBrowserPreferences::FullScreen() const + { + return iAllPreferences.iFullScreen; + } + +// --------------------------------------------------------- +// CBrowserPreferences::Cookies +// --------------------------------------------------------- +// +TWmlSettingsCookies CBrowserPreferences::Cookies() const + { + return iAllPreferences.iCookies; + } + +// --------------------------------------------------------- +// CBrowserPreferences::Ecma +// --------------------------------------------------------- +// +TWmlSettingsECMA CBrowserPreferences::Ecma() const + { + return iAllPreferences.iEcma; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ScriptLog +// --------------------------------------------------------- +// +TUint32 CBrowserPreferences::ScriptLog() const + { + return iAllPreferences.iScriptLog; + } + +// --------------------------------------------------------- +// CBrowserPreferences::HttpSecurityWarnings +// --------------------------------------------------------- +// +TBool CBrowserPreferences::HttpSecurityWarnings() const + { + return iAllPreferences.iHttpSecurityWarnings; + } + +// --------------------------------------------------------- +// CBrowserPreferences::IMEINotification +// --------------------------------------------------------- +// +TWmlSettingsIMEI CBrowserPreferences::IMEINotification() const + { + return iAllPreferences.iIMEINotification; + } + +// --------------------------------------------------------- +// CBrowserPreferences:::HttpSecurityWarningsStatSupressed +// --------------------------------------------------------- +// +TBool CBrowserPreferences::HttpSecurityWarningsStatSupressed() const + { + return iAllPreferences.iHTTPSecuritySupressed; + } + +// --------------------------------------------------------- +// CBrowserPreferences:::DownloadsOpen +// --------------------------------------------------------- +// +TBool CBrowserPreferences::DownloadsOpen() const + { + return iAllPreferences.iDownloadsOpen; + } + + +// --------------------------------------------------------- +// CBrowserPreferences::QueryOnExit +// --------------------------------------------------------- +// +TBool CBrowserPreferences::QueryOnExit() const + { + return iAllPreferences.iQueryOnExit; + } + +// --------------------------------------------------------- +// CBrowserPreferences::SendReferrer +// --------------------------------------------------------- +// +TBool CBrowserPreferences::SendReferrer() const + { + return iAllPreferences.iSendReferrer; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShowConnectionDialogs() +// --------------------------------------------------------- +// +TBool CBrowserPreferences::ShowConnectionDialogs() const + { + return iAllPreferences.iConnDialogs; + } + +// --------------------------------------------------------- +// CBrowserPreferences::MediaVolume() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::MediaVolume() const + { + return iAllPreferences.iMediaVolume; + } + +// --------------------------------------------------------- +// CBrowserPreferences::HomePageType() +// --------------------------------------------------------- +// +TWmlSettingsHomePage CBrowserPreferences::HomePageType() const + { + return iAllPreferences.iHomePgType; + } + +// --------------------------------------------------------- +// CBrowserPreferences::PopupBlocking() +// --------------------------------------------------------- +// +TBool CBrowserPreferences::PopupBlocking() const + { + return iAllPreferences.iPopupBlocking; + } + +// --------------------------------------------------------- +// CBrowserPreferences::FormDataSaving() +// --------------------------------------------------------- +// +TWmlSettingsFormData CBrowserPreferences::FormDataSaving() const + { + return iAllPreferences.iFormDataSaving; + } + +// --------------------------------------------------------- +// CBrowserPreferences::AccessKeys() +// --------------------------------------------------------- +// +TBool CBrowserPreferences::AccessKeys() const + { + return iAllPreferences.iAccessKeys; + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::AutomaticUpdatingAP +// ---------------------------------------------------------------------------- +// +TUint CBrowserPreferences::AutomaticUpdatingAP() const + { + return iAllPreferences.iAutomaticUpdatingAP; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::AutomaticUpdatingWhileRoaming +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::AutomaticUpdatingWhileRoaming() const + { + return iAllPreferences.iAutomaticUpdatingWhileRoaming; + } +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncHomePg +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncHomePg() const + { + return iAllPreferences.iShortCutFuncHomePg; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncBkMark +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncBkMark() const + { + return iAllPreferences.iShortCutFuncBkMark; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncFindKeyWord +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncFindKeyWord() const + { + return iAllPreferences.iShortCutFuncFindKeyWord; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncPrePage +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncPrePage() const + { + return iAllPreferences.iShortCutFuncPrePage; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncSwitchWin +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncSwitchWin() const + { + return iAllPreferences.iShortCutFuncSwitchWin; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncMiniImage +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncMiniImage() const + { + return iAllPreferences.iShortCutFuncMiniImage; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncFullScreen +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncFullScreen() const + { + return iAllPreferences.iShortCutFuncFullScreen; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncGoAddr +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncGoAddr() const + { + return iAllPreferences.iShortCutFuncGoAddr; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncZoomIn +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncZoomIn() const + { + return iAllPreferences.iShortCutFuncZoomIn; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncZoomOut +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncZoomOut() const + { + return iAllPreferences.iShortCutFuncZoomOut; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ShortCutFuncZoomMode +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::ShortCutFuncZoomMode() const + { + return iAllPreferences.iShortCutFuncZoomMode; + } + +// --------------------------------------------------------- +// CBrowserPreferences::RotateDisplay() +// --------------------------------------------------------- +// +TBool CBrowserPreferences::RotateDisplay() const + { + return iAllPreferences.iRotateDisplay; + } + + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarOnOff() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarOnOff() const + { + return iAllPreferences.iToolbarOnOff; + } + + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton1Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton1Cmd() const + { + return iAllPreferences.iToolbarButton1Cmd; + } + + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton2Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton2Cmd() const + { + return iAllPreferences.iToolbarButton2Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton3Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton3Cmd() const + { + return iAllPreferences.iToolbarButton3Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton4Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton4Cmd() const + { + return iAllPreferences.iToolbarButton4Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton5Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton5Cmd() const + { + return iAllPreferences.iToolbarButton5Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton6Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton6Cmd() const + { + return iAllPreferences.iToolbarButton6Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShowToolbarButton7Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShowToolbarButton7Cmd() const + { + return iAllPreferences.iToolbarButton7Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey1Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey1Cmd() const + { + return iAllPreferences.iShortcutKey1Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey2Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey2Cmd() const + { + return iAllPreferences.iShortcutKey2Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey3Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey3Cmd() const + { + return iAllPreferences.iShortcutKey3Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey4Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey4Cmd() const + { + return iAllPreferences.iShortcutKey4Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey5Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey5Cmd() const + { + return iAllPreferences.iShortcutKey5Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey6Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey6Cmd() const + { + return iAllPreferences.iShortcutKey6Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey7Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey7Cmd() const + { + return iAllPreferences.iShortcutKey7Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey8Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey8Cmd() const + { + return iAllPreferences.iShortcutKey8Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey9Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey9Cmd() const + { + return iAllPreferences.iShortcutKey9Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKey0Cmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKey0Cmd() const + { + return iAllPreferences.iShortcutKey0Cmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKeyStarCmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKeyStarCmd() const + { + return iAllPreferences.iShortcutKeyStarCmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKeyHashCmd() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKeyHashCmd() const + { + return iAllPreferences.iShortcutKeyHashCmd; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ShortcutKeysForQwerty() +// --------------------------------------------------------- +// +TInt CBrowserPreferences::ShortcutKeysForQwerty() const + { + return iAllPreferences.iShortcutKeysForQwerty; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ZoomLevelMinimum() +// --------------------------------------------------------- +// +TUint32 CBrowserPreferences::ZoomLevelMinimum() const + { + return iAllPreferences.iZoomLevelMin; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ZoomLevelMaximum() +// --------------------------------------------------------- +// +TUint32 CBrowserPreferences::ZoomLevelMaximum() const + { + return iAllPreferences.iZoomLevelMax; + } + +// --------------------------------------------------------- +// CBrowserPreferences::ZoomLevelDefault() +// --------------------------------------------------------- +// +TUint32 CBrowserPreferences::ZoomLevelDefault() const + { + return iAllPreferences.iZoomLevelDefault; + } + + +// --------------------------------------------------------- +// CBrowserPreferences::CursorShowMode() +// --------------------------------------------------------- +// +TBrCtlDefs::TCursorSettings CBrowserPreferences::CursorShowMode() const + { + return iAllPreferences.iCursorShowMode; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::URLSuffixList +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::URLSuffixList() const + { + return iAllPreferences.iUrlSuffixList; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::MaxRecentUrls +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::MaxRecentUrls() const + { + return iAllPreferences.iMaxRecentUrlsToShow; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SearchFeature +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::SearchFeature() const + { + return iAllPreferences.iSearch; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ServiceFeature +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::ServiceFeature() const + { + return iAllPreferences.iService; + } + +// --------------------------------------------------------- +// CBrowserPreferences::EnterKeyMode() +// --------------------------------------------------------- +// +TBrCtlDefs::TEnterKeySettings CBrowserPreferences::EnterKeyMode() const + { + return iAllPreferences.iEnterKeyMode; + } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserProgressIndicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserProgressIndicator.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class to put animation and progress indicator to contextPane. +* +* +*/ + + +#ifndef BROWSERPROGRESSINDICATOR_H +#define BROWSERPROGRESSINDICATOR_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +//class CBrowserAnimation; +class MApiProvider; + +// DATA TYPES + +// Progressbar data struct. +struct TProgressData + { + TUint16 iId; // Id of the transaction + TUint32 iRecvdData; // Amount of received data + TUint32 iMaxData; // Max amount of data + TBool iComplete; // True if TransAct Id downloaded otherwise False. + }; + + +// CLASS DECLARATION +/** +* Encapsulates the animation feature of the browser. +* +* @lib Browser.app +* @since Series60 1.2 +*/ +class CBrowserProgressIndicator : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aApiProvider Reference to API provider + * @return Pointer to instance of CBrowserAnimation + */ + static CBrowserProgressIndicator* CBrowserProgressIndicator::NewL( MApiProvider& aApiProvider ); + /** + * Constructor. + * @param aApiProvider Reference to API provider + */ + CBrowserProgressIndicator( MApiProvider& aApiProvider ); + + /** + * Destructor. + */ + virtual ~CBrowserProgressIndicator(); + + public: // New functions + + /** + * Starts animation and progress bar. + * @since Series60 1.2 + * @param aBearerType + */ + void StartL(); + + /** + * Stops animation and progress bar. + * @since Series60 1.2 + */ + void StopL(); + + /** + * Adds transaction id to array. + * @since Series60 1.2 + * @param aId Id of the transaction + */ + void AddTransActIdL( TUint16 aId ); + + /** + * Notify that new data has arrived to the loaders. + * @since Series60_version 2.5 + * @return none + */ + void NotifyProgress(); + + /** + * Saves maximum and received data with a transction id. + * @since Series60 1.2 + * @param aId Id of the transaction + * @param aRecvdData Amount of data we have received with current transaction Id + * @param aMaxData Max size of the transaction + */ + void AddProgressDataL( TUint16 aId, TUint32 aRecvdData, TUint32 aMaxData ); + + /** + * Marks particular transaction id to complete status + * @since Series60 2.0 + * @param aId Id of the transaction + */ + void TransActIdCompleteL( TUint16 aId ); + + /** + * Gives amount of transaction ids. + * @since Series60 1.2 + * @return Amount of transaction ids + */ + TInt TransActIdAmount() const; + + /** + * Gives amount of completed transaction ids. + * @since Series60 1.2 + * @return Amount of transaction ids + */ + TInt TransActIdAmountCompleted() const; + + protected: + /** + * Two-phase constructor. + */ + void ConstructL(); + + private: + /** + * Enquires transaction statuses. Calculates and generates progress + * text and progress bar. + * @since Series60 1.2 + * @return None. + */ + void EnquireStatusL(); + + /** + * Deletes progress data item according to aId . + * @since Series60 1.2 + * @param aId Transaction id + */ + void DeleteProgressDataItem( TUint16 aId ); + + /** + * Resets all saved transaction ids, maximum data and received data. + * @since Series60 1.2 + */ + void ResetValues(); + + /** + * Returns total amount of received data. + * @since Series60 1.2 + * @return Number of received data + */ + TUint32 ReceivedData(); + + /** + * All transaction ids won't give max data info at the same time. + * Calculation is needed to get estimated maxData of page. + * @since Series60 1.2 + * @return Number of maximum data + */ + TUint32 EstimateMaxData(); + + /** + * Returns transaction id of current index from array. + * @since Series60 1.2 + * @param aIndex Index of array + * @return Transaction id + */ + TUint16 TransActId( TInt aIndex ); + + private: // Data + + TBool iIsRunning; // Animation is running + MApiProvider& iApiProvider; // Api provider + + CArrayFixFlat* iProgressData; + TBool iInitialDownloadIndicatorState; // initial download (globe) animation in Full Screen pane + TReal iProgressEstimate; + + /** + * Temporary storage for strings. Each must be reseted at + * the beginning of EnquireStatusL! + */ + TBuf<20> iPercentText; + TBuf<15> iDataText; + TBuf<5> iMBvalue; + + const TDesC* iMyKb; + const TDesC* iMyMb; + + TInt iLastMaxEstimate; + TInt iLastReceivedData; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserPushMtmObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserPushMtmObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of CBrowserPushMtmObserver +* +*/ + + +#ifndef BROWSERPUSHMTMOBSERVER_H +#define BROWSERPUSHMTMOBSERVER_H + +// INCLUDES +#include +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class MApiProvider; + +// CLASS DECLARATION + +/** +* +* @lib +* @since 3.0 +*/ +NONSHARABLE_CLASS(CBrowserPushMtmObserver) : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @since 3.0 + * @param + * @param + * @return CacheHandler object. + */ + static CBrowserPushMtmObserver* NewL( MApiProvider* aApiProvider ); + + /** + * Destructor. + */ + virtual ~CBrowserPushMtmObserver(); + + public: // new functions + void StartObserver(); + HBufC8* ReadMsgFileL(); + + public: // from base class CActive + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + + private: + + /** + * Construct. + * @since 3.0 + * @param + * @param + * @return PushMtmObserver object. + */ + CBrowserPushMtmObserver( MApiProvider* aApiProvider ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + RFs iFsSession; // not owned + MApiProvider* iApiProvider; + }; + +#endif // BROWSERPUSHMTMOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserShortcutKeyMap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserShortcutKeyMap.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements Browser Shortcut Key Map +* +*/ + + +#ifndef BROWSERSHORTCUTKEYMAP_H +#define BROWSERSHORTCUTKEYMAP_H + +// INCLUDES +#include + +// MACROS + +// FORWARD DECLARATIONS +class CBrowserContentViewContainer; +class MApiProvider; + +// CLASS DECLARATION +/** +* Encapsulate Keymap Cell Info +* @since 5.0 +*/ +class TKeymapCellData + { +public: + // C++ constructor and destructor to initialize/delete pointer data members + TKeymapCellData(); + ~TKeymapCellData(); + + // data + HBufC* keyText; + HBufC* lineText; + TInt cmdRscId; + CFbsBitmap* keyBitmapImage; + CFbsBitmap* keyBitmapMask; + + TRect r; // Main rect for cell + TRect rCell; // Cell contents rect (includes margin) + TRect rKey; // key indicator rect + TRect rLine1; // text line 1 rect + TRect rLine2; // text line 2 rect + TRect rIcon; // icon rect + }; + +/** +* Create and manage the keymap sprite +* @since 5.0 +*/ + +class CBrowserShortcutKeyMap: public CBase + { + public: // Constructor and destructor + /** + * Two-phased constructor. + */ + static CBrowserShortcutKeyMap* NewL( CBrowserContentViewContainer* aContentViewContainer, MApiProvider& aApiProvider ); + + /** + * Destructor. + */ + virtual ~CBrowserShortcutKeyMap(); + + private: // Constructors + /** + * C++ default constructor. + */ + CBrowserShortcutKeyMap( CBrowserContentViewContainer* aContentViewContainer, MApiProvider& aApiProvider ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // New functions + + /** + * @since 5.0 + * @param + * @return + * Initialize Keymap properties + */ + void InitKeymap(); + + /** + * @since 5.0 + * @param + * @return + * Initialize Keymap data kept for each cell of the map + */ + void InitCellDataL(); + + /** + * @since 5.0 + * @param + * @return + * Create the bitmap and context that will be used for the sprite + */ + void CreateBitmapAndContextL(); + + /** + * @since 5.0 + * @param + * @return + * Calculate the layout of the sprite rects for a given cell + */ + void CreateCellLayout(const TInt& aCellIndex, const TPoint& aUpperL, const TSize& aSize); + + /** + * @since 5.0 + * @param + * @return + * Draw the sprite rects to the sprite bitmap + */ + void CreateSpriteCellL(const TInt& aCellIndex); + + /** + * @since 5.0 + * @param + * @return + * Construct the Sprite from the bitmap and context + */ + void ConstructSprite(); + + /** + * @since 5.0 + * @param + * @return + * Utility: Get the folder where the canned image is located + */ + HBufC* GetCannedImageDirL(); + + /** + * @since 5.0 + * @param + * @return + * Utility: get the SVG bitmaps, etc, given its filename + */ + void LoadSvg( TInt aImageId, const TDesC& aFileName, CFbsBitmap*& aImage, CFbsBitmap*& aImageMask ); + + /** + * @since 7.x + * @param + * @return + * Utility: create dimmed versions of bitmaps aImage + */ + void CreateDimBitmapL( CFbsBitmap* aImage, + CFbsBitmap* aImageMask, + CFbsBitmap*& aDimImage, + CFbsBitmap*& aDimImageMask); + + + private: // Data + CBrowserContentViewContainer* iContentViewContainer; // not owned + MApiProvider& iApiProvider; // not owned, used to query browser prefs + + TRect iTargetRect; // Main rect of the keymap, sized according to parent container + + const CFont* iKeyFont; // not owned, font used for the key indicator text + const CFont* iLineFont; // not owned, font used for the function description + RPointerArray iCellData; // data structure to hold data for each key cell + + HBufC* iSvgMbmFile; // holds icon svg + + /* sprite data */ + RWsSprite iSprite; + CFbsBitmapDevice* iSpriteBitmapDevice; // owned + CFbsBitGc* iSpriteBitmapContext; // owned + CFbsBitmap* iSpriteBitmap; // owned + CFbsBitmapDevice* iSpriteMaskBitmapDevice; // owned + CFbsBitGc* iSpriteMaskBitmapContext; // owned + CFbsBitmap* iSpriteMaskBitmap; // owned + }; + +#endif // BROWSERSHORTCUTKEYMAP_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserSoftkeysObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserSoftkeysObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle softkeys updates +* +*/ + + + +#ifndef BROWSERSOFTKEYSOBSERVER_H +#define BROWSERSOFTKEYSOBSERVER_H + +// INCLUDES +#include +#include "WmlBrowserBuild.h" + +class CBrowserWindow; + +// CLASS DECLARATION + +/** +* This observer is notified when the browser requests softkeys changes +* +* @lib BrowserEngine.lib +* @since 2.8 +*/ +class CBrowserSoftkeysObserver : public CBase, public MBrCtlSoftkeysObserver + { + public: // Constructors and destructors + + /** + * Constructor. + * @since 2.8 + * @param aView Owner AppUi. + */ + static CBrowserSoftkeysObserver* NewL( + CBrowserWindow& aWindow ); + + /** + * Destructor. + */ + virtual ~CBrowserSoftkeysObserver(); + + public: // From MBrCtlSoftkeysObserver + + /** + * Browser Control requests to update a softkey + * @since 2.8 + * @param aKeySoftkey Update the left softkey or the right softkey + * @param aLabel The label associated with the softkey update + * @param aCommandId The command to use if the softkey is selected by the user + * @param aBrCtlSoftkeyChangeReason The reason for the softkey change + * @return void + */ + virtual void UpdateSoftkeyL( TBrCtlKeySoftkey aKeySoftkey, + const TDesC& aLabel, + TUint32 aCommandId, + TBrCtlSoftkeyChangeReason aReason ); + + protected: // new functions + + /** + * Default C++ constructor. + */ + CBrowserSoftkeysObserver( + CBrowserWindow& aWindow ); + + /** + * 2nd phase constructor. Leaves on failure. + */ + void ConstructL(); + + private: // data members + + CBrowserWindow* iWindow; // not owned + + }; + +#endif // BROWSERSOFTKEYSOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserSpecialLoadObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserSpecialLoadObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle special load events such as network connection, +* deal with non-http or non-html requests +* +*/ + + + +#ifndef BROWSERSPECIALLOADOBSERVER_H +#define BROWSERSPECIALLOADOBSERVER_H + +// INCLUDES +#include +#include +#include +#include +#include + +class MApiProvider; +class CEikDocument; +class CSchemeHandler; +class CDocumentHandler; +class CBrowserContentView; +class CAiwGenericParamList; +class CBrowserWindow; + +enum TPopupPreferences + { + EBlockOnce = 0, + EAllowOnce, + EBlock, + EAllow + }; + +// CLASS DECLARATION + +/** +* This observer handles special load events such as network connection, +* deal with non-http(s) or non-html requests +* +* @lib BrowserEngine.lib +* @since 2.8 +*/ +class CBrowserSpecialLoadObserver : public CBase, + public MBrCtlSpecialLoadObserver, + public MAknServerAppExitObserver + { + public: // Constructors and destructors + + /** + * Constructor. + */ + static CBrowserSpecialLoadObserver* NewL( + MApiProvider& aApiProvider, + CBrowserWindow* aWindow, + CEikDocument* aDocument, + CBrowserContentView* aContentView ); + + /** + * Destructor. + */ + virtual ~CBrowserSpecialLoadObserver(); + + private: + +#ifdef __WINS__ + TInt AskIapIdL( TUint32& aId ); +#endif // __WINS__ + + public: // From MBrCtlSpecialLoadObserver + + /** + * Request to create a network connection. + * @since 2.8 + * @param aConnectionPtr A pointer to the new connection. + * If NULL, the proxy filter will automatically create + * a network connection. + * @param aSockSvrHandle A handle to the socket server. + * @param aNewConn A flag if a new connection was created. + * If the connection is not new, proxy filter optimization + * will not read the proxy again from CommsBd. + * @return void + */ + virtual void NetworkConnectionNeededL( TInt* aConnectionPtr, + TInt* aSockSvrHandle, + TBool* aNewConn, + TApBearerType* aBearerType ); + + /** + * Request the host applicaion to handle non-http request. + * @since 2.8 + * @param aUrl The non-http(s) or file URL + * @param aParamList Parameters to pass to the host application. Contain referer header. It could be NULL + * @return ETrue is handled by the host application. EFlase if not + */ + virtual TBool HandleRequestL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ); + + /** + * Request the host applicaion to handle downloads + * @since 2.8 + * @param aTypeArray array of download parameter types + * @param aDesArray array of values associated with the types in the type array + * @return ETrue is handled by the host application. EFlase if not + */ + virtual TBool HandleDownloadL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ); + + + public: // from MAknServerAppExitObserver + + void HandleServerAppExit( TInt aReason ); + + protected: // Constructors + + /** + * Default C++ constructor. + */ + CBrowserSpecialLoadObserver( MApiProvider& aApiProvider, + CBrowserWindow* aWindow, + CEikDocument* aDocument, + CBrowserContentView* aContentView ); + + /** + * 2nd phase constructor. Leaves on failure. + */ + void ConstructL(); + + public: // New functions + + inline TBool LongZeroStartup() + { return iLongZeroStartup; } + + inline void SetLongZeroStartup( TBool aLongZeroStartup ) + { iLongZeroStartup = aLongZeroStartup; } + inline TBool IsConnectionStarted() + { return iConnectionStarted; } + /** + * Request for the connection to be cancelled + */ + inline void CancelConnection() { iConnectionCancelled = ETrue; } + + + protected: // New functions + +#ifdef __RSS_FEEDS + /** + * Handles the content if it is special Ui content (rss or opml) and returns true, otherwise the method + * returns false. + * @param aTypeArray array of download parameter types + * @param aDesArray array of values associated with the types in the type array + * @return ETrue if it handled rss content, EFalse otherwise + * @since 3.1 + */ + TBool HandleUiContentL(RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) const; +#endif // __RSS_FEEDS + + /** + * Make generic parameter list from BrCtl parameter list. + * @param aTypeArray array of download parameter types + * @param aDesArray array of values associated with the types in the type array + * @return The dynamically allocated list. + * @since 2.8 + */ + CAiwGenericParamList* BrCtlParamList2GenericParamListL( + RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) const; + + /** + * Extract the given BrCtl parameter from the list. + * @param aParamTypeToFind Extract this parameter. + * @param aTypeArray array of download parameter types. + * @param aDesArray array of values associated with the types in the type array. + * @param aParamFound Output: ETrue if the parameter was found. + * @return A TPtrC pointer for the value. + * @since 2.8 + */ + TPtrC ExtractBrCtlParam( + TUint aParamTypeToFind, + RArray* aTypeArray, + CDesCArrayFlat* aDesArray, + TBool& aParamFound ) const; + + /** + * Check if the download's content type is in + * KBrowserSelfDownloadContentTypes. + * @param aTypeArray array of download parameter types. + * @param aDesArray array of values associated with the types in the type array. + * @return ETrue, if it is there. + * @since 3.0 + */ + TBool IsSelfDownloadContentTypeL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) const; + + /** + * Open the download embedded with Document Handler. + * @param aTypeArray array of download parameter types. + * @param aDesArray array of values associated with the types in the type array. + * @return None. + * @since 3.0 + */ + void OpenFileEmbeddedL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ); + + /** + * DoRequest the host applicaion to handle non-http request. + * @since 2.8 + * @param aUrl The non-http(s) or file URL + * @param aParamList Parameters to pass to the host application. Contain referer header. It could be NULL + * @return ETrue is handled by the host application. EFlase if not + */ + virtual TBool DoHandleRequestL( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ); + + private: // data members + + MApiProvider *iApiProvider; // owner app, not owned + CBrowserWindow *iWindow; // owner window, not owned + CEikDocument *iDocument; // document, not owned + CSchemeHandler *iSchemeHandler; // scheme handler + CDocumentHandler *iDocHandler; // Owned. + CBrowserContentView* iContentView; // content view, not owned + TBool iSchemeProcessing; // scheme processing + + /** + * Indicated whether the Browser was started using the long zero + * key press. This is ONLY valid at start up. + **/ + TBool iLongZeroStartup; + + /** + * Flag to indicate whether the Browser has started the network connection + **/ + TBool iConnectionStarted; + TBool iConnectionCancelled; + }; + +#endif // BROWSERSPECIALLOADOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserUIVariant.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserUIVariant.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This file contains all the declarations to variate locally +* whole Messaging subsystem +* +* +*/ + + +#ifndef BROWSERUIVARIANT_HRH +#define BROWSERUIVARIANT_HRH + + +/* +* Comment the meaning of the each setting value here well !! +* What is the SD file and setting used for values, e.g. +*/ + +// BrowserUI related values are in 0x101F861B.ini +//setting "R-BrUi1" + +// +// Feature to allow Multiple Windows to be available +// +#define KBrowserMultipleWindows 0x01 + +// +// Feature which allows a URL to be defined for searching the web +// ON = 1 +// +#define KBrowserUiSearchWeb 0x02 + + +// +// Feature which determines whether the user can modify the Search URL. +// Writable = 1 +// +#define KBrowserUiSearchWebWritable 0x04 + + +// +// Feature to use HomePageSetting in Browser +// +#define KBrowserUiHomePageSetting 0x08 + +// +// Feature to limit functionality of Multiple Windows for midrange phones +// 0 = Full functionality, 1 = Minimal functionality +// +#define KBrowserMinimalMultipleWindows 0x10 + +// +// Feature to enable Page Overview and Graphical History +// After 9.2 TB, This feature is used only to enable page overview +// +#ifdef BRDO_MULTITOUCH_ENABLED_FF + #define KBrowserGraphicalPage 0x00 +#else + #define KBrowserGraphicalPage 0x20 +#endif +// +// Feature to enable Auto Form Fill and Password Management options +// +#define KBrowserAutoFormFill 0x40 + +// +// Feature to enable Graphical History +// (Page Overview must be on for Graphical History to be on) +// +#define KBrowserGraphicalHistory 0x80 + +// +// Local variation flags for CDMA Browser UI shared data key "R-BrUI2" in 0x101F861B.ini. +// +enum TBrUI2LocalVariantFlags + { + // + // Show/hide the Restart feature + // + EBrowserLVRestart = 0x01, + + // + // Disable the connection manager dialogs to use NAI. + // + EBrowserLVNAIConnection = 0x02, + + // + // Show/hide the Query Exit feature + // + EBrowserLVQueryExit = 0x04, + // + // Send/Don't send the Referrer Header + // + EBrowserLVSendReferrerHeader = 0x08, + + // + // Show/hide Dynamic Lable feature + // + EBrowserLVDynamicLabel = 0x10 + }; + +// If, for some good reason, you need compile time variation per +// release use the release flags. This file is the only place to use the +// release flags ! However, think hard why you can not use SD setting !!! +// +#if defined (__SERIES60_20__) +//const TInt KSomeCompileTimeConstantValue = 1; +#elif defined (____SERIES60_21__) +//const TInt KSomeCompileTimeConstantValue = 2; +#endif + +#endif // BROWSERUIVARIANT_HRH + + +//--------------------- in CPP code -------------------------------- + +/** +* How to use: +* TInt featureBitmask = 0; +* if ( sharedDataClient.Assign( KSDUidBrowserLV ) == KErrNone ) +* { +* if ( sharedDataClient.GetInt( +* KBrowserUiLV1, featureBitmask ) != KErrNone ) +* { +* featureBitmask = 0; // if problems reading shared data, assume everything is off +* } +* } +* +* // +* // Get the value once and save it for later use. +* // No need always to access shared data every time when a value is needed +* +* // Use the local feature flags at run-time for different behaviour per release +* if ( featureBitmask & KBrowserOnScreenScrollBar ) +* { +* //on screen scrollbar is supported, cache this fact here +* } +*/ \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserUtil.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Utilities. +* +* +*/ + + +#ifndef BROWSER_UTILS_H +#define BROWSER_UTILS_H + +// INCLUDE FILES + +#include + +// FORWARD DECLARATIONS + +class CFavouritesItem; +class TFavouritesWapAp; +class MApiProvider; +class CAiwGenericParamList; + +// CLASS DECLARATION + +/** +* Static utility and debug support methods. This class cannot be instantiated, +* hence the name. +*/ +class Util + { + public: // types + + /** + * Panic reasons. + */ + enum TPanicReason + { + EInvalidDirection, + EInvalidScrollingUnitType, + EUninitializedData, + EOutOfRange, + ENoChildren, + EBadPosition, + ENullPointer, + EInvalidArgument, + EUnExpected, + ERootLevel, + ENoScriptProxy, + EMissingFont, + /// Attempt to remove a non-existing database observer. + EActiveBookmarkDbObserverNotFound, + /// Event reported from an unexpected listbox control. + EFavouritesBadListbox, + /// The database table is not open as it ought to be. + EFavouritesDbTableIsNotOpen, + /// The database table is not closed as it ought to be. + EFavouritesDbTableIsNotClosed, + /// Unexpected Uid. + EFavouritesBadBookmarkUid, + /// The Ap Model already exists. + EFavouritesApModelAlreadyExists, + /// Bad icon index. + EFavouritesBadIconIndex, + /// Attempt to create filter twice. + EFavouritesFilterAlreadyExists, + /// Item array count and icon index array count do not match. + EFavouritesBadIconIndexArray, + /// Model closed with observers still in. + EFavouritesObserversStillActive, + /// Attempt to remove an observer which is not added / already removed. + EFavouritesObserverNotFound, + /// Attempt to set AP Observer over an existing one. + EApObserverAlreadySet, + /// Attempt to set Goto Pane Observer over an existing one. + EGotoPaneObserverAlreadySet, + /// Some internal limit doe not match the external dependency. + ELimitMismatch, + /// Internal error. + EFavouritesInternal, + /// Undefined AP + EUndefinedAccessPoint, + /// EUnable to set temporary gateway + EUnableToSetTempGw, + /// WIM is off but tried to used + EUnsupportedFeature, + /// Start an incremental operation when another is still running. + EIncrementalOperationAlreadyRunning, + /// Attempt ot update data which is in use (incremental operations) + ECannotUpdateDataInUse, + // Size string is not convertable to integer + EInvalidSizeValue, + /// Descriptor-based downloaded content handler already set. + EDownloadedContentHandlerAlreadyInitialized, + /// File-based downloaded content handler already set. + EFileDownloadedContentHandlerAlreadyInitialized + }; + + public: // methods + + /** + * Panic the current thread. + * @param aReason Panic reason. + */ + static void Panic( TPanicReason aReason ); + + /** + * In debug builds, perform sanity check before application starts and + * panic if some check fails. In release builds, do nothing. + * Whatever "once-only" sanity checking you have, add that to this + * method. + */ + static void SanityCheckL(); + + /** + * Parses the given URL. Fills username and password fields of the + * given item. Fills URL field with the given url excluding the + * username and password parts. + * @param aUrl URL. + * @param aItem Bookmark item. + */ + static void RetreiveUsernameAndPasswordFromUrlL + ( const TDesC& aUrl, CFavouritesItem& aItem ); + + /** + * Returns descriptor to the middle of the url between '//' and '#'. + * @param aUrl Original url. + * @return Stripped url. + */ + static TPtrC StripUrl( const TDesC& aUrl ); + + /** + * Create an URL from a file name (file://blabla) and return + * it in an allocated buffer. Pushed on cleanup stack; owner is the + * caller. + * @param aFileName File name. + * @return The created URL in a buffer. + */ + static HBufC* UrlFromFileNameLC( const TDesC& aFileName ); + + /** + * Check if Disk space goes below critical level if allocating + * more disk space. + * @param aShowErrorNote If ETrue, a warning note is shown. + * @param aBytesToWrite Amount of disk space to be allocated (use an + * estimate if exact amount is not known). + * @return ETrue if allocation would go below critical level. + */ + static TBool FFSSpaceBelowCriticalLevelL + ( TBool aShowErrorNote, TInt aBytesToWrite = 0 ); + + static TBool CheckBookmarkApL( const MApiProvider& aApiProvider, const TFavouritesWapAp& aItem ); + static TBool IsValidAPFromParamL( const MApiProvider& aApiProvider, TUint32 aIAPid ); + static TBool CheckApValidityL( const MApiProvider& aApiProvider, const TUint32 aItem ); + static TUint32 IapIdFromWapIdL( const MApiProvider& aApiProvider, const TUint32 aItem ); + static TUint32 WapIdFromIapIdL( const MApiProvider& aApiProvider, const TUint32 aItem ); + static void EncodeSpaces(HBufC*& aString); + + /** + * Allocate a heap buffer for aUrl and make sure the URL is encoded. + * If aUrl does not contain a scheme, then a default "http://" + * scheme is prepended to aUrl. + * @param aUrl The URL to allocate a buffer for. + * @return The URL in a buffer. + */ + static HBufC* AllocateUrlWithSchemeL( const TDesC& aUrl ); + }; + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindow.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,417 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* API provider. +* +* +*/ + + +#ifndef __MULTIPLE_WINDOWS_WINDOW_H__ +#define __MULTIPLE_WINDOWS_WINDOW_H__ + +// INCLUDES FILES +#include "WmlBrowserBuild.h" +#include +#include "ApiProvider.h" +#include "Preferences.h" +#include +#include "BrowserLoadObserver.h" +#include "BrowserDialogsProviderProxy.h" +#include + +// FORWARD DECLARATIONS +class CBrCtlInterface; +class CBrowserDisplay; +class CBrowserSpecialLoadObserver; +class CBrowserSoftkeysObserver; +class CBrowserWindowManager; + +class MDisplay; +class MConnection; +class CBrowserDialogsProvider; +class MBmOTABinSender; +class CBrowserPopupEngine; + +// CLASS DECLARATION + +/** +* Interface to query several API implementations via Window class. +* +* @lib Browser.app +* @since Series 60 3.0 +*/ +class CBrowserWindow : public CBase, + public MApiProvider, + public MPreferencesObserver, + public MBrCtlWindowObserver + { + public: + static CBrowserWindow* NewLC( + TInt aWindowId, + const TDesC* aTargetName, + CBrowserWindowManager* aWindowMgr ); + static CBrowserWindow* NewL( + TInt aWindowId, + const TDesC* aTargetName, + CBrowserWindowManager* aWindowMgr ); + ~CBrowserWindow(); + + public: // new functions + + /* + * Return the window's id. + */ + inline TInt WindowId() const + { return iWindowId; } + + /* + * Return the window's targetname. + */ + inline const TDesC* TargetName() const + { return iTargetName; } + + /* + * Return the window's active status. + */ + inline TBool IsWindowActive() const + { return iActive; } + + /* + * Activates this window, redraw it, updates title, etc. + */ + void ActivateL( TBool aDraw = ETrue ); + + /* + * Deactivates this window. + */ + void DeactivateL(); + + /* + * Returns a reference to the DialogsProviderProxy + */ + inline CBrowserDialogsProviderProxy& DialogsProviderProxy() const + { return *iDialogsProviderProxy; }; + /** + * To check that Page Overview feature is supported or not + * @since Series60 3.0 + * @return Returns ETrue if feature is supported + */ + TBool IsPageOverviewSupportedL(); + + /* + * Resets Page Overview setting as defined in Preferences. + * @since Series 60 3.0 + */ + void ResetPageOverviewLocalSettingL(); + + /* + * Temporarily changes the Page Overview setting. + * This function does not change the Page Overview setting + * in Preferences. + * @since Series 60 3.0 + */ + void FlipPageOverviewLocalSettingL(); + + /* + * Changes the title pane text until the given interval. + * @since Series 60 3.0 + * @param aTitle The new text of the title pane + * @param aInterval The interval while the new text will be shown on title pane + */ + void ChangeTitlePaneTextUntilL( const TDesC& aTitle, TInt aInterval ); + + /* + * Set if window contains WML page(s). + * @since Series 60 3.1 + * @param aHasWMLContent + */ + void SetHasWMLContent(TBool aHasWMLContent); + + /* + * Set if current window contains WML page(s). + * @since Series 60 3.1 + * @param aCurrWinHasWMLContent + */ + void SetCurrWinHasWMLContent(TBool aCurrWinHasWMLContent); + + /* + * Returns wml content state for current page only or any page in window history based on param + * @since Series 60 3.1 + * @param aCurrWinOnly - If ETrue, Returns ETrue if current window has WML content. + * If EFalse, Returns ETrue if any window in history has WML content. + * @return TBool + */ + TBool HasWMLContent (TBool aCurrWinOnly); + + /* + * Returns true if current window has Feeds content. + * @since Series 60 3.1 + * @return TBool + */ + TBool HasFeedsContent ()const { return iHasFeedsContent; }; + + /* + * Set if current page of window contains WML. + * @since Series 60 3.1 + * @param aWMLMode + */ + void SetWMLMode(TBool aWMLMode); + + /* + * Set if hisory needs to be cleared after loading next page. + * @since Series 60 3.1 + * @param aFirstPage + */ + void SetFirstPage(TBool aFirstPage); + + /* + * Set if current window contains Feeds Full Story. + * Used to go back to feeds view when window is closed + * @since Series 60 3.1 + * @param aHasFeedsContent + */ + void SetHasFeedsContent(TBool aHasFeedsContent); + + /* + * Returns true if current page has WML content. + * @since Series 60 3.1 + * @return TBool + */ + TBool WMLMode ()const { return iWMLMode; }; + + /* + * Returns true if current page has images loaded. + * @since Series 60 5.0 + * @return TBool + */ + TBool HasLoadedImages ()const { return iImagesLoaded; }; + + /* + * Set true if user selects current page to load images. false when page loads + * @since Series 60 5.0 + * @param aImagesLoaded + */ + void SetImagesLoaded (TBool aImagesLoaded) { iImagesLoaded = aImagesLoaded; }; + + + public: // from MApiProvider + + CBrCtlInterface& BrCtlInterface() const ; + MDisplay& Display() const ; + CBrowserLoadObserver& LoadObserver() const ; + CBrowserSoftkeysObserver& SoftkeysObserver() const ; + CBrowserSpecialLoadObserver& SpecialLoadObserver() const ; + inline CBrowserWindowManager& WindowMgr() const + { return *iWindowManager; } + + MConnection& Connection() const; + MPreferences& Preferences() const; + MCommsModel& CommsModel() const; + CBrowserDialogsProvider& DialogsProvider() const; + MBmOTABinSender& BmOTABinSenderL(); + CBrowserPopupEngine& PopupEngine() const; + + void SetViewToBeActivatedIfNeededL( TUid aUid, TInt aMessageId = 0 ); + TBool IsCancelFetchAllowed() const; + TUid LastActiveViewId() const; + void SetLastActiveViewId( TUid aUid ); + TBool ExitInProgress() const; + void SetExitInProgress( TBool aValue ); + TBool IsConnecting() const; + void UpdateNaviPaneL( TDesC& aStatusMsg ); + void SetViewToReturnOnClose( TUid const &aUid ); + void CloseContentViewL(); + TBool IsEmbeddedModeOn() const; + TBool IsShutdownRequested() const; + void ExitBrowser(TBool aUserShutdown); + TBool IsAppShutterActive() const; + TBool StartPreferencesViewL( TUint aListItems ); + TBool IsPageLoaded(); + TBool IsForeGround() const; + TBool Fetching() const; + TBool ContentDisplayed() const; + void SetContentDisplayed( TBool aValue ); + void FetchBookmarkL( TInt aBookmarkUid ); + void FetchBookmarkL( const CFavouritesItem& aBookmarkItem ); + void FetchL( + const TDesC& aUrl, + const TDesC& aUserName, + const TDesC& aPassword, + const TFavouritesWapAp& aAccessPoint, + CBrowserLoadObserver::TBrowserLoadUrlType aUrlType + ); + void FetchL( const TDesC& aUrl, CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ); + void CancelFetch( TBool aIsUserInitiated ); + void SetRequestedAP( TInt aAp ); + void SetExitFromEmbeddedMode( TBool aFlag ); + TBool IsProgressShown() const; + void SetProgressShown( TBool aProgressShown ); + TBool StartedUp() const; + TUint32 RequestedAp() const; + void LogAccessToRecentUrlL( CBrCtlInterface& aBrCtlInterface ); + void LogRequestedPageToRecentUrlL( const TDesC& aUrl ); + void StartProgressAnimationL(); + void StopProgressAnimationL(); + #ifdef __RSS_FEEDS + virtual CFeedsClientUtilities& FeedsClientUtilities() const; + #endif // __RSS_FEEDS + TUid GetPreviousViewFromViewHistory(); + + void SetLastCBAUpdateView( TUid aView ); + TUid GetLastCBAUpdateView(); + + TBool FlashPresent(); + TBool IsLaunchHomePageDimmedL(); + void SetCalledFromAnotherApp( TBool aValue ); + TBool CalledFromAnotherApp(); + TBool BrowserWasLaunchedIntoFeeds(); + TBool IsDisplayingMenuOrDialog(); + TBool CompleteDelayedInit(); + + //------------------------------------------------------------------------- + // Preferences Handling + //------------------------------------------------------------------------- + + public: // from MPreferencesObserver + + /** + * Observer for Preference changes + * @param aEvent the type of preference event which happened + * @param aValues a struct of all settings values + * @since Series60 3.0 + */ + virtual void HandlePreferencesChangeL( + const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ); + + //------------------------------------------------------------------------- + // Window Observing + //------------------------------------------------------------------------- + + public: // from MBrCtlWindowObserver + + /** + * Request the host applicaion to open the URL in a new window + * @since 3.0 + * @param aUrl The Url of the request to be done in the new window + * @param aTargetName The name of the new window + * @param aUserInitiated ETrue if the new window is initiated by a user event (click) + * @param aReserved For future use + * @return Return Value is the new browser control associated with the new window + */ + CBrCtlInterface* OpenWindowL( TDesC& aUrl, TDesC* aTargetName, TBool aUserInitiated, + TAny* aReserved ); + + /** + * Find a window by target name + * @since 3.0 + * @param aTargetName name of the window to find + * @return Return Value is the browser control associated with the window name + */ + CBrCtlInterface* FindWindowL( const TDesC& aTargetName ) const; + + /** + * Handle window events such as close/focus etc + * @since 3.0 + * @param aTargetName name of the window to send the event to + * @param aCommand Command to pass to the window + * @return void + */ + void HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand ); + + //------------------------------------------------------------------------- + + protected: + + /** + * Checks for any changes in Global Prefeernces and notifies + * Browser Control + * @param aSettingType an enum defining a setting + * @since Series60 3.0 + **/ + void UpdateGlobalPreferencesL( TBrCtlDefs::TBrCtlSettings aSettingType ); + + /** + * Checks for any changes in Local Preferences and notifies + * Browser Control + * @param aValues a struct of all settings values + * @since Series60 3.0 + **/ + void UpdateLocalPreferencesL( TPreferencesValues& aValues ); + + /** + * Initialises Local Preferences + * @since Series60 3.0 + **/ + void InitialiseLocalPreferencesL(); + + /** + * Passes a subset of settings to the Browser Control + * @since Series60 3.0 + */ + void UpdateBrCtlSettingsL(); + + //------------------------------------------------------------------------- + + protected: + /** + * Default C++ constructor. + */ + CBrowserWindow( + TInt aWindowId, + const TDesC* aTargetName, + CBrowserWindowManager* aWindowMgr ); + + /* + * 2nd phase constructor. + */ + void ConstructL(); + + //------------------------------------------------------------------------- + + private: + TBool iClosing; + TInt iWindowId; + const TDesC* iTargetName; // owned + TBool iActive; + TBool iHasWMLContent; + TBool iCurrWinHasWMLContent; + TBool iHasFeedsContent; + TBool iWMLMode; + TBool iFirstPage; + TBool iImagesLoaded; + + CBrCtlInterface* iBrCtlInterface; + CBrowserDialogsProviderProxy* iDialogsProviderProxy; + CBrowserDisplay* iDisplay; + CBrowserLoadObserver* iLoadObserver; + CBrowserSoftkeysObserver* iSoftkeysObserver; + CBrowserSpecialLoadObserver* iSpecialLoadObserver; + CBrowserWindowManager* iWindowManager; // not owned + + private: // Local Settings + + TInt iFontSize; + TUint32 iEncoding; + TBool iTextWrap; + TBool iIsPageOverviewOn; + static TBool iIsPageOverviewSupported; + static TBool iIsPageOverviewSupportQueried; + }; + +#endif // __MULTIPLE_WINDOWS_WINDOW_H__ + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindowFocusNotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindowFocusNotifier.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef BROWSERWINDOWFOCUSNOTFIER_H +#define BROWSERWINDOWFOCUSNOTFIER_H + +// INCLUDES +// User includes +// System Includes +#include + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Provide dialogs needed for browser operation +* +* @since 3.0 +*/ +class CBrowserWindowFocusNotifier : public CBase + { + friend class CBrowserDialogsProviderProxy; + + // Construction/Destruction + public: + + // Two stage constructor + static CBrowserWindowFocusNotifier* NewL(); + + // Destructor + virtual ~CBrowserWindowFocusNotifier(); + + protected: + + // 1st stage Constructor + CBrowserWindowFocusNotifier(); + + // 2nd stage constructor + void ConstructL(); + + public: // New functions + + TInt Add( TRequestStatus* aStatus ); + void OnFocusGained(); + + protected: // New functions + + void FlushAOStatusArray(); + + // DATA MEMBERS + private: + + RPointerArray iAOStatusArray; + }; + +#endif // BROWSERWINDOWFOCUSNOTFIER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindowManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindowManager.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Multiple Windows' WindowManager. +* +* +*/ + + +#ifndef __MULTIPLE_WINDOWS_WINDOWMANAGER_H__ +#define __MULTIPLE_WINDOWS_WINDOWMANAGER_H__ + +// INCLUDES FILES +#include "WmlBrowserBuild.h" +#include "Preferences.h" +#include +#include +#include "WindowObserver.h" + +// FORWARD DECLARATIONS +class CBrowserWindow; +class MApiProvider; +class CBrowserContentView; +class MWindowInfoProvider; +class CWindowInfo; +class CBrowserWindowQue; + +// CLASS DECLARATION + +/** +* Interface to query several API implementations via Window class. +* +* @lib Browser.app +* @since Series 60 3.0 +*/ +class CBrowserWindowManager : public CBase, + public MPreferencesObserver + { + public: // constructors / destructor + + static CBrowserWindowManager* NewLC( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + TInt aMaxWindowCount ); + static CBrowserWindowManager* NewL( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + TInt aMaxWindowCount ); + ~CBrowserWindowManager(); + + public: // accessing windows / window data + + TInt WindowCount() const; + + inline TInt MaxWindowCount() const; + + // @returns window object + // possible error codes: KErrNotFound, KErrGeneral + // searching for a window identified by an Id + TInt Window( TInt aWindowId, CBrowserWindow*& aWindow ); + + // @returns window object + // possible error codes: KErrNotFound, KErrGeneral + // searching for a window identified by an Id + CBrowserWindow* FindWindowL( + const TDesC& aTargetName ); + + CBrowserWindow* CurrentWindow() const; + + CBrowserWindowQue* CurrentWindowQue() const; + + inline MApiProvider* ApiProvider() const; + + inline CBrowserContentView* ContentView() const; + + CArrayFixFlat* GetWindowInfoL( + MWindowInfoProvider* aWindowInfo ); + + inline void SetUserExit( TBool aUserExit ); + + void SendCommandToAllWindowsL( TInt aCommand ); + + /** + * Adds an observer which is notified about window events + * @param aObserver The observer which will receive window events. + * @since series 60 3.1 + */ + void AddObserverL( MWindowObserver* aObserver ); + + /** + * Removes an observer which won`t be notified about window events. + * @param aObserver The observer which will not receive + * further window events. + * @since 3.1 + */ + void RemoveObserver( MWindowObserver* aObserver ); + + /** + * Notifies the observer about an event. + * @param aEvent The type of the event. + * @since 3.1 + */ + void NotifyObserversL( TWindowEvent aEvent, TInt aWindowId = 0 ); + + public: // window management + + // possible leave codes: KErrNoMemory + // Window specific settings are read from ApiProvider().Preferences() + // based on the current state + CBrowserWindow* CreateWindowL( + TInt aParentId, + const TDesC* aTargetName ); + + /** + * Deletes a window. + * @param aWindowId the window to be deleted + * @param aUserInitiated: user or script initiated the process + * @return the windowId should be activated or 0 + */ + TInt DeleteWindowL( TInt aWindowId, TBool aForceDelete = EFalse ); + + // possible leave codes: KErrNotFound + TInt SwitchWindowL( TInt aWindowId, TBool aDraw = ETrue ); + + // is there any content in the window? + inline TBool IsContentExist() const; + + // content was shown in the window + inline void SetContentExist( TBool aValue ); + + // Sets the type of content in the view + void SetCurrentWindowViewState(TBrCtlDefs::TBrCtlState aViewState, TInt aValue); + + //Closes all windows except the current one + void CloseAllWindowsExceptCurrent(); + + public: // from MPreferencesObserver + + /** + * Observer for Preference changes + */ + virtual void HandlePreferencesChangeL( + const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ); + + protected: + + CBrowserWindowManager( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + TInt aMaxWindowCount ); + /** + * 2nd phase constructor + */ + void ConstructL(); + + // searching for a window identified by its Id and TargetName + // returns with the Window + TInt Window( + TInt aParentId, + const TDesC* aTargetName, + CBrowserWindow*& aWindow, + CBrowserWindowQue* aStartingItem ) const; + + // searching for a window identified by its Id + // returns with the Queue element of that Window + TInt Window( + TInt aWindowId, + CBrowserWindowQue*& aWindowQue, + CBrowserWindowQue* aStartingItem ) const; + + // really delete a window + TInt DeleteOneWindowL( TInt aWindowId ); + + // removes already deleted (status) windows from the queue + void RemoveDeletedWindowsL(); + + private: + static TInt iWindowIdGenerator; // for generating window's id + MApiProvider* iApiProvider; // not owned + CBrowserContentView* iContentView; // not owned + TInt iMaxWindowCount; + TInt iWindowCount; + TInt iDeletedWindowCount; + CBrowserWindowQue* iWindowQueue; // head of the windows + CBrowserWindowQue* iCurrentWindow; // points to the current window + TBool iUserExit; + TBool iIsContentExist; + CArrayPtrFlat< MWindowObserver >* iObservers; + }; + +#include "BrowserWindowManager.inl" + +#endif // __MULTIPLE_WINDOWS_WINDOWMANAGER_H__ + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindowManager.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindowManager.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CBrowserPreferences. +* +* +*/ + + +#ifndef BROWSER_WINDOWMANAGER_INL +#define BROWSER_WINDOWMANAGER_INL + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::ApiProvider() +// ----------------------------------------------------------------------------- +// +MApiProvider* CBrowserWindowManager::ApiProvider() const + { + return iApiProvider; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::ContentView() +// ----------------------------------------------------------------------------- +// +CBrowserContentView* CBrowserWindowManager::ContentView() const + { + return iContentView; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::SetUserExit() +// ----------------------------------------------------------------------------- +// +void CBrowserWindowManager::SetUserExit( TBool aUserExit ) + { + iUserExit = aUserExit; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::MaxWindowCount() +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowManager::MaxWindowCount() const + { + return iMaxWindowCount; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::IsContentExist() +// ----------------------------------------------------------------------------- +// +// is there any content in the window? +TBool CBrowserWindowManager::IsContentExist() const + { + return iIsContentExist; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::SetContentExist() +// ----------------------------------------------------------------------------- +// +// content was shown in the window +void CBrowserWindowManager::SetContentExist( TBool aValue ) + { + iIsContentExist = aValue; + } + +#endif // BROWSER_WINDOWMANAGER_INL + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindowQueue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindowQueue.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Internal class for storing a window. +* +* +*/ + + +#ifndef __MULTIPLE_WINDOWS_WINDOWQUEUE_H__ +#define __MULTIPLE_WINDOWS_WINDOWQUEUE_H__ + +// INCLUDES FILES +#include "WmlBrowserBuild.h" +#include + +// FORWARD DECLARATIONS +class CBrowserWindow; + +// CLASS DECLARATION + +// multiple linked queue for windows +// iPrev and iNext for stepping through all the queue +// iParent points to the window's parent +class CBrowserWindowQue: public CBase + { + public: // default constructor to have a valid window + CBrowserWindowQue( CBrowserWindow* aWindow ) : + iWindow(aWindow), iParent(NULL), + iPrev(NULL), iNext(NULL), iStatus( 0 ) {} + ~CBrowserWindowQue(); + + public: + // returns the last item in the queue + inline CBrowserWindowQue* LastItem() const ; + // appends an iten at the end of the queue + void AppendL( CBrowserWindowQue* aItem ); + // points to the 'next' window which is not deleted + CBrowserWindowQue* Next() const; + // points to the 'prev' window which is not deleted + CBrowserWindowQue* Prev() const; + + + public: + enum TWindowStatus { // bit mask + EWindowNone = 0, + EWindowDeleted = 1 + }; + + public: // data members + CBrowserWindow* iWindow; + CBrowserWindowQue* iParent; + CBrowserWindowQue* iPrev; + CBrowserWindowQue* iNext; + TInt iStatus; // bitmask + }; + + +#endif // __MULTIPLE_WINDOWS_WINDOWQUEUE_H__ + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindowSelectionContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindowSelectionContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserWindowSelectionContainer. +* +* +*/ + + +#ifndef BROWSERWINDOWSELECTIONCONTAINER_H +#define BROWSERWINDOWSELECTIONCONTAINER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CBrowserWindowSelectionView; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknTabGroup; +class CEikImage; +class CGulIcon; + +// CLASS DECLARATION + +/** +* CBrowserWindowSelectionContainer container control class. +* +*/ +class CBrowserWindowSelectionContainer : public CCoeControl, + MCoeControlObserver, MAknTabObserver + { + public: // Constructors and destructor + + /** + * default constructor. + * @param aRect Frame rectangle for container. + */ + void ConstructL(const TRect& aRect); + + /** + * Constructor + */ + CBrowserWindowSelectionContainer( CBrowserWindowSelectionView *aView ); + + /** + * Destructor. + */ + ~CBrowserWindowSelectionContainer(); + + public: // New functions + + /** + * Gets a pointer to the tab group on navi pane. + * @return Pointer to the tab group. + */ + inline CAknTabGroup* GetTabGroup() { return iTabGroup; } + + /** + * Gets a pointer to the decorator on navi pane. + * @return Pointer to the decorator. + */ + inline CAknNavigationDecorator* GetNaviDecorator() { return iNaviDecorator; } + + /** + * Creates tabs on navipane, from the array of strings. + * @param An array containing the name of the windows. + * @param The tab index, that will be activated after creation. + */ + void ChangeTabL( CArrayFixFlat* aTabTexts, TInt aActivateTab ); + + /** + * The id of the window, which thumbnail to get. + * @param aWindowId Window id. + */ + void GetWindowThumbnailL( TInt aWindowId ); + + public: // Functions from base classes + /** + * HandlePointerEventL + * From CCoeControl + * + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + /** + * TabChangedL + * From MAknTabObserver + * + */ + void TabChangedL(TInt aIndex); + + private: // Functions from base classes + + /** + * From CoeControl,SizeChanged. + */ + void SizeChanged(); + + /** + * From CoeControl,CountComponentControls. + */ + TInt CountComponentControls() const; + + /** + * From CCoeControl,ComponentControl. + */ + CCoeControl* ComponentControl(TInt aIndex) const; + + /** + * From CCoeControl,Draw. + */ + void Draw(const TRect& aRect) const; + + /** + * From CCoeControl Handles key events + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * From MCoeControlObserver + * Acts upon changes in the hosted control's state. + * + * @param aControl The control changing its state + * @param aEventType The type of control event + */ + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + + private: //data + CBrowserWindowSelectionView* iView; // not owned + CAknNavigationDecorator* iNaviDecorator; // not owned + CAknTabGroup* iTabGroup; // not owned + CGulIcon* iThumbnail; + //test + //CFbsBitmap* iThumbnail; + //CEikImage* iTabIcon; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/BrowserWindowSelectionView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/BrowserWindowSelectionView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserWindowSelectionView. +* +* +*/ + + +#ifndef BROWSERWINDOWSELECTIONVIEW_H +#define BROWSERWINDOWSELECTIONVIEW_H + +// INCLUDES +#include +#include "BrowserAppViewBase.h" +#include "WindowInfoProvider.h" +#include "WindowObserver.h" + +// FORWARD DECLARATIONS +class CBrowserWindowSelectionContainer; + +// CLASS DECLARATION + +/** +* CBrowserWindowSelectionView view class. +* +*/ +class CBrowserWindowSelectionView : public CBrowserViewBase, + MWindowInfoProvider, + MWindowObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. Places the instance + * on the cleanup stack. + * @param aApiProvider The API provider. + * @return The constructed view. + */ + static CBrowserWindowSelectionView* NewLC( MApiProvider& aApiProvider ); + + /** + * Constructor + */ + CBrowserWindowSelectionView( MApiProvider& aApiProvider ); + + /** + * default constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CBrowserWindowSelectionView(); + + public: // Functions from base classes + + /** + * From CAknView returns Uid of View + * @return TUid uid of the view + */ + TUid Id() const; + + /** + * Return command set id, to be displayed. + * @since 1.2 + * @return The command set's resource id. + */ + virtual TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + /** + * From MEikMenuObserver delegate commands from the menu + * @param aCommand a command emitted by the menu + * @return void + */ + void HandleCommandL(TInt aCommand); + + /** + * From CAknView reaction if size change + * @return void + */ + void HandleClientRectChange(); + + /** + * Changes the tabs according to available windows, by + * recreating all tabs based on WindowManager. + */ + void UpdateTabsL(); + + /** + * + */ + void UpdateTumbnailL(); + + /** + * Updates the title of the view according to the highlighted tab. + */ + void UpdateTitleL(); + + /** + * From MWindowObserver + */ + void WindowEventHandlerL( TWindowEvent aEvent, TInt aWindowId ); + + /** + * @return Id of the window to activate. + */ + TInt GetWindowIdFromTabIndex( TInt aActiveTabIndex ); + + private: + + /** + * From CAknView activate the view + * @param aPrevViewId + * @param aCustomMessageId + * @param aCustomMessage + * @return void + */ + void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * From CAknView deactivate the view (free resources) + * @return void + */ + void DoDeactivate(); + + /** + * From MWindowInfoProvider + */ + HBufC* CreateWindowInfoLC( const CBrowserWindow& aWindow ); + + /** + * @return Pointer to the window`s title text. + */ + HBufC* GetWindowTitleFromTabIndex( TInt aActiveTabIndex ); + + private: // Data + CBrowserWindowSelectionContainer* iContainer; + CArrayFixFlat* iWindowInfo; // Array of all available windows + CArrayFixFlat* iWindowIds; // Array of window id`s + CArrayFixFlat* iTitles; // Array of window titles + TVwsViewId iLastViewId; + TBool iWindowEventsDisabled; // False if the object not handles events. + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/CommonConstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/CommonConstants.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Common constants +* +* +*/ + + +#ifndef COMMONCONSTANTS_H +#define COMMONCONSTANTS_H + +// INCLUDE FILES +#include + +// CONSTANTS + +const TUid KUidBrowserContentViewId = { 75 }; +const TUid KUidBrowserBookmarksViewId = { 79 }; +const TUid KUidBrowserSettingsViewId = { 78 }; +const TUid KUidBrowserStartupViewId = { 81 }; +const TUid KUidBrowserWindowSelectionViewId = { 83 }; +const TUid KUidBrowserInitialViewId = { 84 }; +const TUid KUidBrowserFeedsFolderViewId = { 85 }; +const TUid KUidBrowserFeedsTopicViewId = { 86 }; +const TUid KUidBrowserFeedsFeedViewId = { 87 }; + +const TUid KUidBrowserNullViewId = { 0 }; ///< null view id used in startup + +const TUid KUidCustomMsgDownloadsList = { 0x01 }; ///< jump to download list +const TUid KUidSettingsGotoToolbarGroup = { 0x02 }; ///< jump to toolbar section of settings view +const TUid KUidSettingsGotoShortcutsGroup = { 0x03 }; ///< jump to shortcuts section of settings view + +// Granualities for dynamic arrays +const TInt KGranularityLow = 10; ///< minimum granularity +const TInt KGranularityMedium = 5; +const TInt KGranularityHigh = 2; ///< maximum gr. + +_LIT( KHttpString, "http://" ); +_LIT( KFileString, "file://" ); +_LIT( KWWWString, "http://www." ); + + +#define KBrsrMalformedUrl -26018 +#define KBrsrUnknownScheme -26026 +#define KBrsrWmlbrowserCardNotInDeck -26144 + +_LIT( KWmlValueHttpScheme, "http" ); + +#define KAvkonMbmPath KAvkonBitmapFile + +_LIT( KBrowserDirAndFile,"z:browser.mbm"); + +_LIT( KWmlValueFile, "file" ); +_LIT( KWmlValueFileSlashSlashSlashStr, "file:///" ); +// _LIT( KWmlDefaultLocation, "c:" ); +// _LIT( KWmlDefaultLocationSlash, "c:/" ); +_LIT( KWmlBackSlash, "\\" ); + +const TInt KWmlEmptyResourceId = 0; + +const TInt KMaxUrlLenghtInOTA = 255; +const TInt KMaxHomePgUrlLength = 1000; +const TInt KMaxSearchPgUrlLength = 1000; +const TInt KAhlePrimaryStorage = 100; //AHLE primary storage, also used + //as adaptive bookmarks max list size + +// Encodings (character set ids) - no header file is provided with character set +const TUint KCharacterSetIdentifierWindows1250 = 0x100059D6; +const TUint KCharacterSetIdentifierWindows1251 = 0x100059D7; +const TUint KCharacterSetIdentifierWindows1253 = 0x100059D8; +const TUint KCharacterSetIdentifierWindows1254 = 0x100059D9; +const TUint KCharacterSetIdentifierWindows1255 = 0x101F8547; +const TUint KCharacterSetIdentifierWindows1256 = 0x101F8548; +const TUint KCharacterSetIdentifierWindows1257 = 0x100059DA; +const TUint KCharacterSetIdentifierWindows1258 = 0x102073B8; +const TUint KCharacterSetIdentifierTis620 = 0x101f8549; +const TUint KCharacterSetIdentifierWindows874 = 0x101F854A; +const TUint KCharacterSetIdentifierKoi8_r = 0x101f8778; // Russian +const TUint KCharacterSetIdentifierKoi8_u = 0x101f8761; // Ukrainian +const TUint KCharacterSetIdentifierIscii_temp = 0x1027508E; + +const TUint KCharacterSetIdentifierEucKr = 0x2000E526; // Korean +const TUint KCharacterSetIdentifierKsc5601_temp = 0x200113CD; // Korean +const TUint KCharacterSetIdentifierAutomatic = 0x00; +const TUint KCharacterSetIdentifierUCS2 = 0xffffffff; // dummy value this id is never checked + +#endif // COMMONCONSTANTS_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/CommsModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/CommsModel.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class MCommsModel. +* +* +*/ + + +#ifndef MCOMMS_MODEL_H +#define MCOMMS_MODEL_H + +// FORWARD DECLARATION + +// class CApListItem; +class CApListItemList; +class CActiveApDb; +class CCommsDatabase; + +// CLASS DECLARATION + +/** +* Observer mixin class for Comms Model changes. +* The main difference between being this observer and MActiveApDbObserver is +* that when an MActiveApDbObserver is notified, the database can be locked +* (so the notification is quite useless). An MCommsModelObserver is notified +* about the change only when the changes are successfully read by +* MCommsModelObserver - that is, in HandleCommsModelChangeL implementation +* you can safely read cached AP-s from CommsModel (and never get KErrLocked). +*/ +class MCommsModelObserver + { + public: // new methods + + /** + * Handle change in comms model (AP-s). Derived classes must provide + * this method. + */ + virtual void HandleCommsModelChangeL() = 0; + + }; + +/** +* Comms model for the WML Browser. +* Provides CommsDb / AP database handling. +*/ +class MCommsModel + { + public: // new methods + + /** + * Get Access Point Engine object. + * @return Access Point Engine object. + */ + virtual CActiveApDb& ApDb() const = 0; + + /** + * Get CommsDb object. + * @return CommsDb object. + */ + virtual CCommsDatabase& CommsDb() const = 0; + + /** + * Get a copy of access points in a list. + * @return List of access points. The caller is responsible for + * destroying the returned list. + * @return List of access points. + */ + virtual CApListItemList* CopyAccessPointsL() = 0; + + /** + * Get the pointer to model's cached access points. + * The owner of the list is the model. List contents may be updated + * if database update occurs. + * @return List of access points. + */ + virtual const CApListItemList* AccessPointsL() = 0; + + /** + * Refresh the cached access points. + */ + virtual void RefreshAccessPointsL() = 0; + + public: // observer support + + /** + * Add an observer. Duplicates allowed. + * @param aObserver The observer to add. + */ + virtual void AddObserverL( MCommsModelObserver& aObserver ) = 0; + + /** + * Remove an observer. Does nothing if not added / already removed. + * @param aObserver The observer to remove. + */ + virtual void RemoveObserver( MCommsModelObserver& aObserver ) = 0; + + }; + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/Display.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/Display.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Interface to Status Pane. +* +* +*/ + + +#ifndef MDISPLAY_H +#define MDISPLAY_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +class CAknNavigationControlContainer; +class CEikStatusPane; + +// CLASS DECLARATION + +/** +* Interface to GUI components. +*/ +class MDisplay + { + public: // Status Pane / NaviPane handling + + /** + * Return Status Pane. Can be NULL. + * @return Status Pane. + */ + virtual CEikStatusPane* StatusPane() const = 0; + + // VAG 01.Feb.2002. + // Please do not add Push/Pop-NaviDecoratorL methods. Ownership of + // the decorator becomes problematic. The safe way is: + // Create a decorator as an own member, push it to Navi Pane, and + // simply delete that decorator in your destructor (deleting it pops + // automatically). This cannot go wrong, and does not contain leaving + // code in destructors. + + /** + * Get Navi Pane; leave on error. + * @return Navi Pane. Never NULL. + */ + virtual CAknNavigationControlContainer* NaviPaneL() const = 0; + + public: // TitlePane handling + + /** + * Set title pane text. + * @param aTitle Title text to be displayed. + */ + virtual void SetTitleL( const TDesC& aTitle ) = 0; + + /** + * Set title pane text from resource. + * @param aTitle Resource id of title text to be displayed. + */ + virtual void SetTitleL( TInt aResourceId ) = 0; + + public: // Animation in contextpane + + /** + * Starts animation and progress indicator. + * @param aBearerType Determines what is to be animated. + */ + virtual void StartProgressAnimationL() = 0; + + /** + * Stops animation and progress indicator. + */ + virtual void StopProgressAnimationL() = 0; + + /** + * Notify that new data has arrived to the loaders. + * @since Series60_version 2.5 + * @return none + */ + virtual void NotifyProgress() = 0; + + public: // Transaction + + /** + * Adds transaction id + * @param aId Transaction id + */ + virtual void AddTransActIdL( TUint16 aId ) const = 0; + + /** + * Saves maximum and received data with a transction id. + * @since Series60 1.2 + * @param aId Id of the transaction + * @param aRecvdData Amount of data we have received with current transaction Id + * @param aMaxData Max size of the transaction + */ + virtual void AddProgressDataL( TUint16 aId, TUint32 aRecvdData, TUint32 aMaxData ) const = 0; + + /** + * Marks particular transaction id to complete status + * @since Series60 2.0 + * @param aId Id of the transaction + */ + virtual void TransActIdComplete( TUint16 aId ) const = 0; + + public: // Secure indicator + + /** + * Shows or hides secure indicator depending on aState. + * @param aState EAknIndicatorStateOff/EAknIndicatorStateOn. + */ + virtual void UpdateSecureIndicatorL( const TInt aState ) = 0; + + /** + * Sets GPRS indicator on for Full Screen Mode + */ + virtual void SetGPRSIndicatorOnL() = 0; + + /** + * Starts the Wlan Indicator observer + */ + virtual void StartWlanObserverL() = 0; + + /** + * Updates the Wlan Indicator to current value + */ + virtual void UpdateWlanIndicator( const TInt aWlanValue ) = 0; + + /** + * Initialises Full Screen pane indicators + */ + + virtual void FSPaneOnL( ) = 0; + + /** + * Updates Full Screen progress indicator + */ + + virtual void UpdateFSProgressIndicator(const TInt aMaxData, const TInt aReceivedData) = 0; + + /** + * Starts Full Screen Wait indicator + */ + + virtual void StartFSWaitIndicator() = 0; + + /** + * Updates 'downloaded data amount' message on Full Screen pane + */ + + virtual void UpdateFSProgressDataL(const TDesC16& aReceivedDataText) = 0; + + /** + * Clears the Message Info indicator in the navipane + */ + virtual void ClearMessageInfo() = 0; + + /** + * Sets formerly saved page title. SetTitleL's functionality moved here, because page title restoration is + * necessary in Full Screen mode + */ + + virtual void RestoreTitleL() = 0; + + /** + * Updates initial download indicator on Full Screen pane + */ + + virtual void UpdateFSDownloadInitialIndicator(const TBool aState) = 0; + + /** + * Initializes Full Screen Indicators + */ + + virtual void InitIndicatorsL() = 0; + + /** + * Updates the Multiple Windows Indicator + * @param aState Indicator On or Off + * @param aWinCount The number of windows open + * @since Series60 3.0 + */ + virtual void UpdateMultipleWindowsIndicatorL( + const TBool aState, const TInt aNumWindows ) = 0; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/Logger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/Logger.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implemented logger functionality of the module +* +*/ + + +#ifndef BROWSER_LOGGER_H +#define BROWSER_LOGGER_H + +#if defined( I__BROWSER_LOG_ENABLED ) || defined ( I__BROWSER_PERF_LOG_ENABLED ) + +// INCLUDES +#include +#include +#include +#include +#include + + +// log files are stored to KDebugLogDirFull folder +_LIT(KDebugLogDependency, "C:\\Logs\\"); +_LIT(KDebugLogDoubleBackSlash, "\\"); + +_LIT( KDebugLogDir, "Browser"); +_LIT( KDebugLogFile, "Browser.log"); +_LIT( KDebugPerfLogFile, "BrowserPerf.log"); +_LIT( KLogMessageAppBanner, "Browser: module (%d.%d.%d) started" ); +_LIT( KPerLogBanner, "*************Performance Logging *****************"); +// _LIT( KDebugLogTimeFormatString,"%H:%T:%S:%*C3" ); +_LIT( KDebugLogExit, "Browser: module exit" ); + +#endif + +#if defined( I__BROWSER_LOG_ENABLED ) + +// MACROS +// indentation is not supported by the hardware at this moment +#if defined( __WINSCW__ ) +#define I__BROWSER_LOG_INDENT +#endif + +/** +* Use this macro in order to initialize logger : +* - create log directory, +* - write version information into the log file +*/ +#define LOG_CREATE { TFileName path( KDebugLogDependency ); \ + path.Append( KDebugLogDir ); \ + path.Append( KDebugLogDoubleBackSlash ); \ + RFs& fs = CEikonEnv::Static()->FsSession(); \ + fs.MkDirAll( path ); \ + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, EFileLoggingModeOverwrite, KLogMessageAppBanner ); \ + } + +/** +* Use this macro for writing information about exiting. +*/ +#define LOG_DELETE { RFileLogger::Write( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, KDebugLogExit ); } + +/** +* Use this function at any points of a function for writing a hex dump +* of the specified data to the log. +* @param p The data the is to be converted to a hex string. +* @param l How many of the characters in p are to be converted. +* Conversion always starts from position 0 within p. +*/ +//#define LOG_WRITE_HEXDUMP( p, l ) { RFileLogger::HexDump( KDebugLogDir, KDebugLogFile, EFileLoggingModeAppend, _S("RLog_Ex"), _S("RL_cont"), p, l ); } + +// ------------------------------------------------- + +class MLoggerProvider + { + public: + virtual TInt* LoggerIndent() = 0; + virtual void LoggerIndentIncrement( TInt aValue ) = 0; + virtual void LoggerIndentDecrement( TInt aValue ) = 0; + }; + +class CBrowserLogger: public CBase + { + public: + CBrowserLogger( const TDesC& aFunc ); + ~CBrowserLogger(); + + /** + * Write formatted log. + * @param aFmt Format string. + */ + static void Write( TRefByValue aFmt, ... ); + + /** + * Write formatted log. + * @param aFmt Format string. + * @param aList Variable argument list. + */ + static void Write( TRefByValue aFmt, VA_LIST& aList ); + + /** + * Write formatted log. + * @param aFmt Format string. + */ + static void Write(TRefByValue aFmt, ... ); + + /** + * Write formatted log. + * @param aFmt Format string. + * @param aList Variable argument list. + */ + static void Write( TRefByValue aFmt, VA_LIST& aList ); + + protected: + TPtrC iFunc; + const MLoggerProvider* iOwner; + // make the indentation available by 'static' keyword +#if defined ( I__BROWSER_LOG_INDENT ) + static +#endif + TInt iIndent; + }; + +// ------------------------------------------------- +// Usage: +// - call LOG_ENTERFN( "function name" ); at entry point of a function +// otherwise BROWSER_LOG call won't work +// - call BROWSER_LOG( ( _L( "log string" ) ) ); OR +// you can add parameters to this call like this: +// - BROWSER_LOG( ( _L( "format string: %d" ), value ) ); +// ------------------------------------------------- +// future development if _L() will be removed: +// #define _BL( a ) TPtrC( _S( a ) ) +// BROWSER_LOG( ( _BL( "format string: %d" ), a ) ) +// ------------------------------------------------- + +#define LOG_ENTERFN( a ) _LIT( _br_temp_log_string18, a ); \ + CBrowserLogger _br_entry_exit( _br_temp_log_string18 ) +#define BROWSER_LOG( _params_ ) \ + _br_entry_exit.Write _params_ +#define LOG_WRITE( _params_ ) \ + BROWSER_LOG( ( _L( _params_ ) ) ) +#define LOG_WRITE_FORMAT( _format_, _params_ ) \ + BROWSER_LOG( ( _L( _format_ ), _params_ ) ) + +#else // I__BROWSER_LOG_ENABLED + +// Empty macros +#define LOG_CREATE +#define LOG_DELETE +#define LOG_ENTERFN( a ) +#define LOG_WRITE( a ) +#define LOG_WRITE_FORMAT( a, b ) +#define LOG_WRITE_TIMESTAMP( a ) +#define LOG_WRITE_HEXDUMP( p, l ) +#define BROWSER_LOG( a ) + +#endif // I__BROWSER_LOG_ENABLED + + +#ifdef I__BROWSER_PERF_LOG_ENABLED + +/** +* Use this macro in order to initialize performance logger: +* - create log directory, +* +*/ +#define PERFLOG_CREATE { TFileName path( KDebugLogDependency ); \ + path.Append( KDebugLogDir ); \ + path.Append( KDebugLogDoubleBackSlash ); \ + RFs& fs = CEikonEnv::Static()->FsSession(); \ + fs.MkDirAll( path ); \ + RFileLogger::WriteFormat( KDebugLogDir, KDebugPerfLogFile, EFileLoggingModeOverwrite, KPerLogBanner);\ + } + +#define PERFLOG_LOCAL_INIT \ + TTime __time1_brbrbr;\ + TTime __time2_brbrbr;\ + TTimeIntervalMicroSeconds diff_brbrbr; + + +#define PERFLOG_STOPWATCH_START \ + __time1_brbrbr.HomeTime(); + +#define PERFLOG_STOPWATCH_STOP \ + __time2_brbrbr.HomeTime();\ + diff_brbrbr = __time2_brbrbr.MicroSecondsFrom( __time1_brbrbr ); + +#define PERFLOG_WRITE( _param_ ){\ + _LIT( __perf_temp_1234_, "%S took %Ld ms" );\ + _LIT(__perf_temp_param, _param_ );\ + RFileLogger::WriteFormat( KDebugLogDir, KDebugPerfLogFile, EFileLoggingModeAppend, __perf_temp_1234_, &__perf_temp_param(), diff_brbrbr .Int64() );\ + } + +#define PERFLOG_STOP_WRITE( _params_ )\ + PERFLOG_STOPWATCH_STOP\ + PERFLOG_WRITE( _params_ ) + +//It may look ugly in code +#define PERF( _a, _b ) \ + {\ + PERFLOG_LOCAL_INIT\ + PERFLOG_STOPWATCH_START\ + _b;\ + PERFLOG_STOP_WRITE( _a )\ + } + + +#else + +#define PERFLOG_CREATE +#define PERFLOG_LOCAL_INIT +#define PERFLOG_STOPWATCH_START +#define PERFLOG_STOPWATCH_STOP +#define PERFLOG_WRITE(a) +#define PERFLOG_STOP_WRITE(a) +#define PERF( _a, _b ) _b +#endif + + + +#endif // BROWSER_LOGGER_H + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/Preferences.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/Preferences.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,872 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Interface for Preferences handling. +* +* +*/ + + +#ifndef MPREFERENCES_H +#define MPREFERENCES_H + +// INCLUDES +#include +#include +#include + +#include "Browser.hrh" +#include + +#include +#include + +#include + +using namespace CMManager; +// FORWARD DECLARATIONS + +// CONSTS + +const TUint KWmlNoDefaultAccessPoint = KMaxTUint; +const TUint KWmlNoDefaultSnapId = KMaxTUint; + +const TInt KShortCutFuncStringLength = 32; + +const TInt KUrlSuffixMaxLength = 256; + +// CLASS DECLARATION +class CVpnApItem; + +//============================================================================= +// Observer for the MPreferences Class +// + +/** +* Helper struct for MPreferencesObserver +*/ +struct TPreferencesValues + { + // Setting Values + TUint iDefaultAccessPoint; + TUint iDefaultSnapId; + CApAccessPointItem* iDefaultAPDetails; //cache all data + // It is stored because of VPN. Default value = KWmlNoDefaultAccessPoint, + // means it is not VPN AP, otherwise iAssocVpn = iDefaultAccessPoint + // iDefaultAPDetails always stores real AP specific settings. + TUint iAssocVpn; + TCmSettingSelectionMode iAccessPointSelectionMode; + TInt iAutoLoadContent; + TInt iFontSize; + TBool iTextWrap; + TWmlSettingsCookies iCookies; + TBool iPageOverview; + TBool iBackList; + TBool iAutoRefresh; + TWmlSettingsECMA iEcma; + TWmlSettingsIMEI iIMEINotification; + TUint32 iEncoding; + TWmlSettingsFullScreen iFullScreen; + TBool iQueryOnExit; + TBool iSendReferrer; + TWmlSettingsAdaptiveBookmarks iAdaptiveBookmarks; + TWmlSettingsHomePage iHomePgType; + TBool iHTTPSecuritySupressed; + TBool iDownloadsOpen; + TBool iConnDialogs; + TBool iHttpSecurityWarnings; + TInt iMediaVolume; + HBufC* iSearchPgURL; + HBufC* iHomePgURL; + TBool iPopupBlocking; + TWmlSettingsFormData iFormDataSaving; + TUint iAutomaticUpdatingAP; + TBool iAutomaticUpdatingWhileRoaming; + TBool iAccessKeys; + HBufC* iShortCutFuncHomePg; + HBufC* iShortCutFuncBkMark; + HBufC* iShortCutFuncFindKeyWord; + HBufC* iShortCutFuncPrePage; + HBufC* iUrlSuffixList; + HBufC* iShortCutFuncSwitchWin; + HBufC* iShortCutFuncMiniImage; + HBufC* iShortCutFuncFullScreen; + HBufC* iShortCutFuncGoAddr; + HBufC* iShortCutFuncZoomIn; + HBufC* iShortCutFuncZoomOut; + HBufC* iShortCutFuncZoomMode; + TBool iRotateDisplay; + TInt iToolbarOnOff; // Turns Toolbar On or Off ( 0 = Off ; 1 = On) + TInt iToolbarButton1Cmd; // see Toolbar Button Command List for cenrep values + TInt iToolbarButton2Cmd; // see Toolbar Button Command List for cenrep values + TInt iToolbarButton3Cmd; // see Toolbar Button Command List for cenrep values + TInt iToolbarButton4Cmd; // see Toolbar Button Command List for cenrep values + TInt iToolbarButton5Cmd; // see Toolbar Button Command List for cenrep values + TInt iToolbarButton6Cmd; // see Toolbar Button Command List for cenrep values + TInt iToolbarButton7Cmd; // see Toolbar Button Command List for cenrep values + TInt iShortcutKeysForQwerty; + TInt iShortcutKey1Cmd; + TInt iShortcutKey2Cmd; + TInt iShortcutKey3Cmd; + TInt iShortcutKey4Cmd; + TInt iShortcutKey5Cmd; + TInt iShortcutKey6Cmd; + TInt iShortcutKey7Cmd; + TInt iShortcutKey8Cmd; + TInt iShortcutKey9Cmd; + TInt iShortcutKey0Cmd; + TInt iShortcutKeyStarCmd; + TInt iShortcutKeyHashCmd; + TUint32 iScriptLog; + // Minimum, Maximum and Default (for new page) Zoom Level settings + TUint32 iZoomLevelMin; + TUint32 iZoomLevelMax; + TUint32 iZoomLevelDefault; + TInt iMaxRecentUrlsToShow; + TBool iSearch; // Search Feature + TBool iService; // Service Feature + TBrCtlDefs::TCursorSettings iCursorShowMode; + TBrCtlDefs::TEnterKeySettings iEnterKeyMode; + }; + +/** +* Helper enum for MPreferencesObserver +*/ +enum TPreferencesEvent + { + EPreferencesActivate, // Preferences opened + EPreferencesDeactivate, // Preferences closed + EPreferencesItemChange // Setting change has occurred + }; + + +/** +* Mixin class for observing changes in preferences. +*/ +class MPreferencesObserver + { + public: + + /** + * Derived classes should implement this method, and act accordingly. + */ + virtual void HandlePreferencesChangeL( + const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ) = 0; + }; + +//============================================================================= + +/** +* Interface for Preferences handling. +*/ +class MPreferences + { + public: // New functions + + /** + * To read all of the preferences in one go + */ + virtual const TPreferencesValues& AllPreferencesL() = 0; + + /** + * To access embedded mode + */ + virtual TBool EmbeddedMode() const = 0; + + /** + * To access DefaultAccessPoint setting + */ + virtual TUint DefaultAccessPoint() const = 0; + + + /** + * To access DefaultSnapId setting + */ + + virtual TUint DefaultSnapId() const = 0; + + /** + * To access deafult AP details if exist setting. + */ + virtual CApAccessPointItem* DefaultAPDetails() = 0; + + /** + * To access Associated VPN Ap if exist + */ + virtual TUint AssociatedVpn() const = 0; + + /** + * Get the vpn item if it is vpn + */ + virtual TBool VpnDataL( TUint aDefaultAccessPoint, CVpnApItem& aVpnItem ) = 0; + + /** + * To access AutoLoadContent setting + */ + virtual TInt AutoLoadContent() const = 0; + + /** + * To access PageOverview setting + */ + virtual TBool PageOverview() const = 0; + + /** + * To access BackList setting + */ + virtual TBool BackList() const = 0; + + /** + * To access AutoRefresh setting + */ + virtual TBool AutoRefresh() const = 0; + + /* + * Sets the automatic updating access point of Web Feeds + */ + virtual void SetAutomaticUpdatingApL( TUint aSetting ) = 0; + /* + * Sets the automatic updating while roaming of News & Blogs + */ + virtual void SetAutomaticUpdatingWhileRoamingL( TBool aAutoUpdateRoaming ) = 0; + + /** + * To modify user-defined URL suffix list (.com, .org, .net) + */ + virtual void SetURLSuffixList( HBufC* aValue ) = 0; + + /** + * To access user-defined URL suffix list (.com, org, .net) + */ + virtual HBufC* URLSuffixList( ) const = 0; + /** + * automatic updating access point of Web Feeds + */ + virtual TUint AutomaticUpdatingAP() const = 0; + /** + * automatic updating while roaming of News & Blogs + */ + virtual TBool AutomaticUpdatingWhileRoaming() const = 0; + + /** + * To access TextWrap setting + @ return setting item value + */ + virtual TBool TextWrap() const = 0; + + /** + * To access FontSize setting + */ + virtual TInt FontSize() const = 0; + + /** + * To access Encoding setting + */ + virtual TUint32 Encoding() const = 0; + + /** + * To access Adaptive Bookmarks setting + */ + virtual enum TWmlSettingsAdaptiveBookmarks AdaptiveBookmarks() const = 0; + + /** + * To access FullScreen setting + */ + virtual enum TWmlSettingsFullScreen FullScreen() const = 0; + + /** + * To access Cookies setting + */ + virtual enum TWmlSettingsCookies Cookies() const = 0; + + /** + * To access ECMA setting + */ + virtual enum TWmlSettingsECMA Ecma() const = 0; + + /** + * To access ScriptLog setting + */ + virtual TUint32 ScriptLog() const = 0; + + /** + * To access HTTP security warning setting + */ + virtual TBool HttpSecurityWarnings() const = 0; + + /** + * To access IMEI notification setting + */ + virtual enum TWmlSettingsIMEI IMEINotification() const = 0; + + /** + *To access HTTP security warning supression - read only pref. + */ + virtual TBool HttpSecurityWarningsStatSupressed() const = 0; + + /** + * To access Downloads Open setting + */ + virtual TBool DownloadsOpen() const = 0; + + /** + * To access user-defined homepage URL setting + */ + virtual TInt HomePageUrlL( TDes& aUrl, TBool aForceLoadFromSD = EFalse ) const = 0; + + /** + * Get the home page URL from belongs to the access point. + */ + virtual TInt HomePageFromIapL( TDes& aUrl, TUint aIap ) const = 0; + + /** + * To access user-defined search page URL setting + */ + virtual TPtrC SearchPageUrlL() = 0; + + /** + * To access Query Exit setting + */ + virtual TBool QueryOnExit() const = 0; + + /** + * To access Send Referrer setting + */ + virtual TBool SendReferrer() const = 0; + + /** + * To access Media Volume setting + */ + virtual TInt MediaVolume() const = 0; + + /** + * To access ShowConnectionDialogs setting + */ + virtual TBool ShowConnectionDialogs() const = 0; + + /** + * To check that an engine local feature is supported or not + */ + + virtual TBool EngineLocalFeatureSupported( const TInt aFeature ) const = 0; + + /** + * To check that a ui local feature is supported or not + */ + + virtual TBool UiLocalFeatureSupported( const TInt aFeature ) const = 0; + + /** + * To access home page's type: AP/user defined. + */ + virtual enum TWmlSettingsHomePage HomePageType() const = 0; + + /** + * To access Popup Blocking Enabled setting# + */ + virtual TBool PopupBlocking() const = 0; + + /** + * To access Form Data Saving setting + */ + virtual TWmlSettingsFormData FormDataSaving() const = 0; + + /** + * To access Access Keys setting : Enabled/Disabled + */ + virtual TBool AccessKeys() const = 0; + + /** + * To modify DefaultAccessPoint setting + */ + virtual void SetDefaultAccessPointL( TUint aDefaultAccessPoint, TUint aAssocVpn = KWmlNoDefaultAccessPoint ) = 0; + + /** + * To modify DefaultSnapId setting + */ + virtual void SetDefaultSnapId (TUint aSnapId) = 0; + + /** + * To modify AutoLoadContent setting + */ + virtual void SetAutoLoadContentL( TInt aAutoLoadContent ) = 0; + + /** + * To modify PageOverview setting + */ + virtual void SetPageOverviewL( TBool aPageOverview ) = 0; + + /** + * To modify BackList setting + */ + virtual void SetBackListL( TBool aBackList ) = 0; + + /** + * To modify AutoRefresh setting + */ + virtual void SetAutoRefreshL( TBool aAutoRefresh ) = 0; + + /** + * To modify TextWrap setting + */ + virtual void SetTextWrapL( TBool aTextWrap ) = 0; + + /** + * To modify FontSize setting + */ + virtual void SetFontSizeL( TInt aFontSize ) = 0; + + /** + * To modify encoding settings + */ + virtual void SetEncodingL( TUint32 aEncoding ) = 0; + + /** + * To modify Adaptive Bookmarks setting + */ + virtual void SetAdaptiveBookmarksL( TWmlSettingsAdaptiveBookmarks aAdaptiveBookmarks ) = 0; + + /** + * To modify FullScreen setting + */ + virtual void SetFullScreenL( TWmlSettingsFullScreen aFullScreen ) = 0; + + /** + * To modify Cookies setting + */ + virtual void SetCookiesL( TWmlSettingsCookies aCookies ) = 0; + + /** + * To modify ECMA setting + */ + virtual void SetEcmaL( TWmlSettingsECMA aEcma ) = 0; + + /** + * To modify Script Console setting + */ + virtual void SetScriptLogL( TUint32 aScriptLog ) = 0; + + /** + * To modify HTTP security warnings setting + */ + virtual void SetHttpSecurityWarningsL( TBool aWarningsOn ) = 0; + + /** + * To modify IMEI notification setting + */ + virtual void SetIMEINotificationL( TWmlSettingsIMEI aIMEINotification ) = 0; + + /** + * To modify Downloads Open setting + */ + virtual void SetDownloadsOpenL( TBool aOpen ) = 0; + + /** + * To modify Media Volume setting + */ + virtual void SetMediaVolumeL( TInt aMediaVolume ) = 0; + + /** + * To modify HomePage's type: AP/user defined. + */ + virtual void SetHomePageTypeL( TWmlSettingsHomePage aHomePageType ) = 0; + + /** + * To modify user-defined HomePage. + */ + virtual void SetHomePageUrlL( const TDesC& aHomePageURL ) = 0; + + /** + * To modify user-defined Search page URL + */ + virtual void SetSearchPageUrlL( const TDesC& aSearchPageURL ) = 0; + + /** + * To determine that is there an overridden default access point defined or not + */ + virtual TBool CustomAccessPointDefined() = 0; + + /** + * To access to the list of self download content types. + * See CBrCtlInterface::SetSelfDownloadContentTypesL()! + */ + virtual TPtrC SelfDownloadContentTypesL() = 0; + + /** + * To access Default Access Point selection mode settings. + */ + virtual TCmSettingSelectionMode AccessPointSelectionMode() = 0; + + /** + * To modify Default Access Point Settings + */ + virtual void SetAccessPointSelectionModeL( TCmSettingSelectionMode aAccessPointSelectionMode ) = 0; + + /** + * To modify Popup Blocking Enabled settign + */ + virtual void SetPopupBlockingL( TBool aPopupBlocking ) = 0; + + /** + * To modify Form Data Saving setting + */ + virtual void SetFormDataSavingL( TWmlSettingsFormData aFormDataSaving ) = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncHomePg() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncBkMark() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncFindKeyWord() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncPrePage() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncSwitchWin() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncMiniImage() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncFullScreen() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncGoAddr() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncZoomIn() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncZoomOut() const = 0; + + /** + * To access pre defined short cut keys + */ + virtual HBufC* ShortCutFuncZoomMode() const = 0; + + /** + * To get value of Rotate Display setting + */ + virtual TBool RotateDisplay() const = 0; + + /** + * To get Toolbar On/Off value + */ + virtual TInt ShowToolbarOnOff() const = 0; + + /** + * To set Toolbar On/Off value + */ + virtual void SetToolbarOnOffL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 1 command value + */ + virtual TInt ShowToolbarButton1Cmd() const = 0; + + /** + * To set Toolbar Button 1 command value + */ + virtual void SetToolbarButton1CmdL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 2 command value + */ + virtual TInt ShowToolbarButton2Cmd() const = 0; + + /** + * To set Toolbar Button 2 command value + */ + virtual void SetToolbarButton2CmdL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 3 command value + */ + virtual TInt ShowToolbarButton3Cmd() const = 0; + + /** + * To set Toolbar Button 3 command value + */ + virtual void SetToolbarButton3CmdL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 4 command value + */ + virtual TInt ShowToolbarButton4Cmd() const = 0; + + /** + * To set Toolbar Button 4 command value + */ + virtual void SetToolbarButton4CmdL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 5 command value + */ + virtual TInt ShowToolbarButton5Cmd() const = 0; + + /** + * To set Toolbar Button 5 command value + */ + virtual void SetToolbarButton5CmdL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 6 command value + */ + virtual TInt ShowToolbarButton6Cmd() const = 0; + + /** + * To set Toolbar Button 6 command value + */ + virtual void SetToolbarButton6CmdL(TInt aCommand) = 0; + + /** + * To get Toolbar Button 7 command value + */ + virtual TInt ShowToolbarButton7Cmd() const = 0; + + /** + * To set Toolbar Button 7 command value + */ + virtual void SetToolbarButton7CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 1 command value + */ + virtual TInt ShortcutKey1Cmd() const = 0; + + /** + * To set Shortcut Key 1 command value + */ + virtual void SetShortcutKey1CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 2 command value + */ + virtual TInt ShortcutKey2Cmd() const = 0; + + /** + * To set Shortcut Key 2 command value + */ + virtual void SetShortcutKey2CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 3 command value + */ + virtual TInt ShortcutKey3Cmd() const = 0; + + /** + * To set Shortcut Key 3 command value + */ + virtual void SetShortcutKey3CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 4 command value + */ + virtual TInt ShortcutKey4Cmd() const = 0; + + /** + * To set Shortcut Key 4 command value + */ + virtual void SetShortcutKey4CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 5 command value + */ + virtual TInt ShortcutKey5Cmd() const = 0; + + /** + * To set Shortcut Key 5 command value + */ + virtual void SetShortcutKey5CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 6 command value + */ + virtual TInt ShortcutKey6Cmd() const = 0; + + /** + * To set Shortcut Key 6 command value + */ + virtual void SetShortcutKey6CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 7 command value + */ + virtual TInt ShortcutKey7Cmd() const = 0; + + /** + * To set Shortcut Key 7 command value + */ + virtual void SetShortcutKey7CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 8 command value + */ + virtual TInt ShortcutKey8Cmd() const = 0; + + /** + * To set Shortcut Key 8 command value + */ + virtual void SetShortcutKey8CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 9 command value + */ + virtual TInt ShortcutKey9Cmd() const = 0; + + /** + * To set Shortcut Key 9 command value + */ + virtual void SetShortcutKey9CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key 0 command value + */ + virtual TInt ShortcutKey0Cmd() const = 0; + + /** + * To set Shortcut Key 0 command value + */ + virtual void SetShortcutKey0CmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key Star command value + */ + virtual TInt ShortcutKeyStarCmd() const = 0; + + /** + * To set Shortcut Key Star command value + */ + virtual void SetShortcutKeyStarCmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key Hash command value + */ + virtual TInt ShortcutKeyHashCmd() const = 0; + + /** + * To set Shortcut Key Hash command value + */ + virtual void SetShortcutKeyHashCmdL(TInt aCommand) = 0; + + /** + * To get Shortcut Key for Qwerty command value + */ + virtual TInt ShortcutKeysForQwerty() const = 0; + + /** + * Zoom Level minimum (percentage) value + */ + virtual inline TUint32 ZoomLevelMinimum() const = 0; + + /** + * Zoom Level maximum (percentage) value + */ + virtual inline TUint32 ZoomLevelMaximum() const = 0; + + /** + * Zoom Level default (percentage) value + */ + virtual inline TUint32 ZoomLevelDefault() const = 0; + + /** + * Maximum Recent URLs to show + */ + virtual TInt MaxRecentUrls() const = 0; + + /** + * Search Feature Enabled or Disabled. + */ + virtual inline TBool SearchFeature() const = 0; + + /** + * Service Feature Enabled or Disabled. + */ + virtual inline TBool ServiceFeature() const = 0; + + /** + * To access an int value key in ini file + * @param aKey the ini file key to read + * @return the value of the given key + */ + virtual TInt GetIntValue( TUint32 aKey) const = 0; + + /** + * To access an string value key in ini file + * @param aKey the ini file key to read + * @return the value of the given key + */ + virtual TInt GetStringValueL ( TUint32 aKey, TInt aMaxBufSize, TDes& aBuf ) const = 0; + + /** + * Cursor show mode + */ + virtual TBrCtlDefs::TCursorSettings CursorShowMode() const = 0; + + /** + * Enter key mode + */ + virtual TBrCtlDefs::TEnterKeySettings EnterKeyMode() const = 0; + + public: // observer support + + /** + * Adds an observer to be notified about changes. Derived classes MUST + * notify all observers when preferences changed! + * @param anObserver Observer to be notified about events. + */ + virtual void AddObserverL( MPreferencesObserver* anObserver ) = 0; + + /** + * Removes an observer. + * @param anObserver The observer. + */ + virtual void RemoveObserver( MPreferencesObserver* anObserver ) = 0; + + /** + * To flush share data key settings + */ + virtual void FlushSD() = 0; + + virtual void NotifyObserversL( TPreferencesEvent aEvent, + TBrCtlDefs::TBrCtlSettings aSettingType ) = 0; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/SessionAndSecurity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/SessionAndSecurity.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CSessionAndSecurity +* +* +*/ + + +#ifndef SESSION_SECURITY_H +#define SESSION_SECURITY_H + +// INCLUDE FILES +#include +#include + + + + +// FORWARD DECLARATIONS + +class MApiProvider; +class TCertInfo; +class TDNInfo; + +// CLASS DECLARATION + +/** +* CSessionAndSecurity +* @lib Browser.app +* @since Series60 1.2 +*/ +class CSessionAndSecurity : public CBase + { + public: // Constructors and destructor + /** + * Destructor. + */ + ~CSessionAndSecurity(); + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed CSessionAndSecurity object. + */ + static CSessionAndSecurity* NewL(MApiProvider& aApiProvider); + static CSessionAndSecurity* NewLC(MApiProvider& aApiProvider); + + public: // New functions + /** + * Shows session info dialog + */ + void ShowSessionInfoL(); + + /** + * Shows security info dialog / certificate details + */ + void ShowSecurityInfoL(); + + /** + * Shows page info dialog + */ + void ShowPageInfoL(); + + private: + + /** + * Converts TDesC8 buffer to HBufC16 + * @since Series60 2.0 + * @param aSource + * @param aDestination ownership passed to caller + */ + void ConvertTDesC8ToHBufC16LC( TDesC8& aSource, HBufC16*& aDestination ); + + /** + * Adds two distinguished names to security info + * (names are: CN, O, OU, L, C) + * @since Series60 2.0 + * @param aDNInfo + * @param aBuf + */ + void FillDNinfoL ( TDNInfo aDNInfo, HBufC* aBuf ); + + /** + * Creates security info message for WPS connection + * @since Series60 2.0 + * @param aCertInfo + * @param aMessage + */ + // void WspSecurityInfoL( TCertInfo* aCertInfo, HBufC& aMessage ); + + /** + * Creates security info message for HTTP connection + * @since Series60 2.0 + * @param aCertInfo + * @param aMessage + */ + // TO DO: changed to fit in with BaP + void HttpSecurityInfoL( const TCertInfo* aCertInfo, HBufC& aMessage ); + + inline MApiProvider& ApiProvider() { return iApiProvider; } + + private: + /** + * Default constructor. + */ + CSessionAndSecurity(MApiProvider& aApiProvider); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + MApiProvider& iApiProvider; + + }; + + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/WindowApiProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/WindowApiProvider.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* API provider. +* +* +*/ + + +#ifndef __MULTIPLE_WINDOWS_APIPROVIDER_H__ +#define __MULTIPLE_WINDOWS_APIPROVIDER_H__ + +// INCLUDES FILES +#include "WmlBrowserBuild.h" + +// FORWARD DECLARATIONS +class CBrCtlInterface; +//class CBrowserDialogsProvider; +class CBrowserDisplay; +class CBrowserLoadObserver; +class CBrowserSoftkeysObserver; +class CBrowserSpecialLoadObserver; +class CBrowserWindowManager; + +// CLASS DECLARATION + +/** +* Interface to query several API implementations via Window class. +* +* @lib Browser.app +* @since Series 60 3.0 +*/ +class MWindowApiProvider + { + public: +#if 0 + virtual CBrCtlInterface& BrCtlInterface() const = 0; + // virtual CBrowserDialogsProvider& DialogsProvider() const = 0; + virtual CBrowserDisplay& Display() const = 0; + virtual CBrowserLoadObserver& LoadObserver() const = 0; + virtual CBrowserSoftkeysObserver& SoftkeysObserver() const = 0; + virtual CBrowserSpecialLoadObserver& SpecialLoadObserver() const = 0; + virtual CBrowserWindowManager& WindowMgr() const = 0; +#endif + virtual TBool IsWindowActive() const = 0; + virtual TInt WindowId() const = 0; + virtual const TDesC* TargetName() const = 0; + }; + +#endif // __MULTIPLE_WINDOWS_APIPROVIDER_H__ + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/WindowInfoProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/WindowInfoProvider.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser content view +* +* +*/ + + +#ifndef __MULTIPLE_WINDOWS_INFOPROVIDER_H__ +#define __MULTIPLE_WINDOWS_INFOPROVIDER_H__ + +// INCLUDE FILES +#include + +// FORWARD DECLARATIONS +class CBrowserWindow; + +class CWindowInfo: public CBase + { + public: + CWindowInfo( HBufC* aText, TInt aWindowId, TBool aCurrent ) : + iWindowText( aText ), + iWindowId( aWindowId ), + iCurrent( aCurrent ) { } + ~CWindowInfo() + { delete iWindowText; } + public: // data members + const HBufC* iWindowText; + TInt iWindowId; + TBool iCurrent; + }; + +class MWindowInfoProvider + { + public: + virtual HBufC* CreateWindowInfoLC( const CBrowserWindow& aWindow ) = 0; + }; + +#endif // __MULTIPLE_WINDOWS_INFOPROVIDER_H__ + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/WindowObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/WindowObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserWebMenuView. +* Observes browser window events. +* +* +*/ + + +#ifndef __WINDOWOBSERVER_H__ +#define __WINDOWOBSERVER_H__ + +// Events sent to observer +enum TWindowEvent + { + EWindowClose, + EWindowOpen, + EWindowActivate, + EWindowLoadStart, + EWindowLoadStop, + EWindowCntDisplayed + }; + + +class MWindowObserver + { + public: + // Called on window events. + virtual void WindowEventHandlerL( TWindowEvent aEvent, TInt aWindowId ) = 0; + }; + +#endif // __WINDOWOBSERVER_H__ + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/WlanObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/WlanObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef WLANOBSERVER_H +#define WLANOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MApiProvider; + + +// CONSTANTS + +// State enum and member variable + +// CLASS DECLARATIONS +/** +* CWlanObserver. +* Observer class for handling wlan status requests +* @since S60 v5.0 +*/ +class CWlanObserver : public CActive + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aApiProvider Reference to API provider + */ + CWlanObserver(MApiProvider& aApiProvider); + + /** + * Destructor. + */ + virtual ~CWlanObserver(); + + /** + * Retrieves current state of wireless lan connection + * @param aWlanStateValue reference to current Wlan state value which is updated here + * @return: EFalse if error condition (ignore aWlanStateValue in this case) + * Etrue if no error (get updated value from aWlanStateValue) + */ + TBool GetCurrentState(TInt &aWlanStateValue); + + protected: // CActive + + /** + * Implements cancellation of an outstanding request. + * @param none + * @return void + */ + void DoCancel(); + + /** + * Handles an active object’s request completion event. + * @param none + * @return void + */ + void RunL(); + + /** + * Handles an active object’s error + * @param error + * @return void + */ + TInt RunError(TInt aError); + + private: // new methods + + MApiProvider& iApiProvider; // Api provider + + RProperty iWlanProperty; + + + }; + +#endif // WLANOBSERVER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppInc/WmlBrowserBuild.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppInc/WmlBrowserBuild.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Defines whether WIM is part of WmlBrowser or not +* +* +*/ + + +// INCLUDES +#if !defined(__WMLBROWSERBUILD_H__) +#define __WMLBROWSERBUILD_H__ + +#include + +// Use this flag to send bookmark as plaing ascii text +// instead of binary OTA. +#define _BOOKMARK_SENT_ASCII + +#define CHANGECONN_ALWAYSASK_FEATURE ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ) + +#define HELP ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + +#define ADAPTIVEBOOKMARKS (FeatureManager::FeatureSupported( KFeatureIdBrowserAdaptiveBookm )) + +// #define WSP ( FeatureManager::FeatureSupported( KFeatureIdWsp ) ) + +//browser autocomplete +#define AUTOCOMP ( FeatureManager::FeatureSupported( KFeatureIdBrowserUrlCompletion ) ) + +#define AVKONELAF ( FeatureManager::FeatureSupported( KFeatureIdAvkonELaf ) ) +#define AVKONAPAC ( FeatureManager::FeatureSupported( KFeatureIdAvkonApac ) ) +#define CHINESE ( FeatureManager::FeatureSupported( KFeatureIdChinese ) ) + +#define IMEI_NOTIFICATION ( FeatureManager::FeatureSupported( KFeatureIdBrowserIMEINotification ) ) + +#define HAS_SIDE_VOLUME_KEYS ( FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) ) + +#define PROGRESSIVE_DOWNLOAD ( FeatureManager::FeatureSupported( KFeatureIdBrowserProgressiveDownload ) ) + +#endif // __WMLBROWSERBUILD_H__ + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/AHLEInterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/AHLEInterface.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,409 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AHLE client interface API definition. + * +*/ + + +// INCLUDE FILES +#include +#include "AHLEInterface.h" + + + +// ================= MEMBER FUNCTIONS ======================= + +CAHLEInterface* CAHLEInterface::NewL( TAHLENewType aNewType, + const TDesC& aDatabase, + TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ) +{ + CAHLEInterface* apiObject = new (ELeave) CAHLEInterface; + CleanupStack::PushL( apiObject ); + apiObject->ConstructL( aNewType, aDatabase, aPrimarySize, aSecondarySize, aAdaptationSpeed ); + CleanupStack::Pop(); + return apiObject; +} + +EXPORT_C CAHLEInterface* CAHLEInterface::NewL( const TDesC& aDatabase, + TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ){ + return NewL( EAHLENewAllArgs, aDatabase, aPrimarySize, aSecondarySize, aAdaptationSpeed ); +} + +EXPORT_C CAHLEInterface* CAHLEInterface::NewL( const TDesC& aDatabase ){ + return NewL( EAHLENewDbOnlyArgs, aDatabase, 0, 0, 0); +} + +EXPORT_C CAHLEInterface* CAHLEInterface::NewL(){ + return NewL( EAHLENewNoArgs, KAHLEInterfaceDummyFile, 0, 0, 0); +} + +EXPORT_C CAHLEInterface* CAHLEInterface::NewL( TUint aPrimarySize ){ + return NewL( EAHLENewPrimarySizeOnlyArgs, KAHLEInterfaceDummyFile, aPrimarySize, 0, 0); +} + + +// ----------------------------------------------------------------------------- +// CAHLEInterface::InitializeAHLE +// Creates the AHLE client if needed. +// Throws exception on failure. This is where the AHLE client finally gets created. +// We defer it as long as possible. +// ----------------------------------------------------------------------------- +void CAHLEInterface::InitializeAHLEL() +{ + //If already done return quickly. + if (iAHLE) return; + + TUint aPrimarySize = 0; + TUint aSecondarySize = 0; + TAHLEScore aAdaptationSpeed = 0; + + //Fire the correct contructor. It should map to the CAHLEInterface contructor. + switch (iNewType) + { + case EAHLENewNoArgs: + iAHLE = CAHLE::NewL(); + break; + + case EAHLENewAllArgs: + iAHLE = CAHLE::NewL( *iDatabase, iPrimarySize, iSecondarySize, iAdaptationSpeed); + break; + + case EAHLENewDbOnlyArgs: + iAHLE = CAHLE::NewL( *iDatabase ); + break; + + case EAHLENewPrimarySizeOnlyArgs: + //The actual value will be added by the initialization later. We + //can't change the AHLE constructors. + iDeferPrimarySize = iPrimarySize; + iAHLE = CAHLE::NewL(); + break; + + default: + iAHLE = CAHLE::NewL(); + } + + //Do the deferred reconfigure. It was not done earlier, the values + //were cached for now. Note that the values could have been set in the + //constructor as well as here. The trick is to keep track of which + //ones to set here. If the deferred one was set use it. Otherwise use + //the one just read in with GetConfiguration() + + iAHLE->GetConfigurationL( aPrimarySize, aSecondarySize, aAdaptationSpeed ); + iAHLE->ReconfigureL( iDeferPrimarySize ? iDeferPrimarySize : aPrimarySize, + iDeferSecondarySize ? iDeferSecondarySize : aSecondarySize, + iDeferAdaptationSpeed ? iDeferAdaptationSpeed: aAdaptationSpeed ); +} + +// ----------------------------------------------------------------------------- +// Idle Callback Function +// Called when the thread is not busy. The code will be initialized +// now. If it was initialized explicitly bu other code than this call +// won't do very much. In any case this will always return false. It +// doesn't need to run a second time since it will run to completion. +// ----------------------------------------------------------------------------- +TInt CAHLEInterface::AHLEInitializationCB(TAny* thisObj) +{ + ((CAHLEInterface*)thisObj)->InitializeAHLEL(); + return EFalse; +} + + + +// ----------------------------------------------------------------------------- +// CAHLEInterface::CAHLEInterface +// ----------------------------------------------------------------------------- +CAHLEInterface::CAHLEInterface() +{ + iAHLE = NULL; + iDatabase = NULL; + + iPrimarySize = 0; + iSecondarySize = 0; + iAdaptationSpeed = 0; + + iDeferPrimarySize = 0; + iDeferSecondarySize = 0; + iDeferAdaptationSpeed = 0; +} + + +// ----------------------------------------------------------------------------- +// CAHLEInterface::~CAHLEInterface +// C++ destructor +// ----------------------------------------------------------------------------- +CAHLEInterface::~CAHLEInterface() +{ +if(iIdle != NULL) + { + iIdle->Cancel(); + } + delete iIdle; + delete iAHLE; + delete iDatabase; +} + + +// ----------------------------------------------------------------------------- +// CAHLEInterface::IsConnected +// Check if the client has been connected to the server. Note that if the actual +// AHLE client has not been created yet we ARE considered connected. Otherwise we +// would need to connect almost immediately. +// ----------------------------------------------------------------------------- +EXPORT_C TBool CAHLEInterface::IsConnected() + { + return (iAHLE ? iAHLE->IsConnected(): ETrue); + } + + +// --------------------------------------------------------- +// CAHLEInterface::ConstructL +// Light weight constructor. Real work is deferred until later. +// An active idle object is created to do the construction when +// things are not busy. If it is done by a task that explicitly +// requires the AHLE client it will not need to run. +// --------------------------------------------------------- +void CAHLEInterface::ConstructL( TAHLENewType aNewType, + const TDesC& aDatabase, + TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ) +{ + iAHLE = NULL; + iPrimarySize = aPrimarySize; + iSecondarySize = aSecondarySize; + iAdaptationSpeed = aAdaptationSpeed; + iDatabase = aDatabase.Alloc(); + iNewType = aNewType; + iIdle = CIdle::NewL(CActive::EPriorityIdle); + iIdle->Start(TCallBack(AHLEInitializationCB, this)); +} + + +// ----------------------------------------------------------------------------- +// CAHLEInterface::SetObserverL +// ----------------------------------------------------------------------------- +EXPORT_C void CAHLEInterface::SetObserverL( const MAHLEClientObserver* aClientObs ) +{ + InitializeAHLEL(); + iAHLE->SetObserverL(aClientObs); +} + + +// --------------------------------------------------------- +// CAHLEInterface::Reconfigure +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::ReconfigureL( TUint aPrimarySize, + TUint aSecondarySize, + TAHLEScore aAdaptationSpeed ) +{ + InitializeAHLEL(); + return iAHLE->ReconfigureL(aPrimarySize, aSecondarySize, aAdaptationSpeed ); +} + + +// --------------------------------------------------------- +// CAHLEInterface::GetConfiguration +// --------------------------------------------------------- +EXPORT_C void CAHLEInterface::GetConfigurationL( TUint& aPrimarySize, + TUint& aSecondarySize, + TAHLEScore& aAdaptationSpeed ) +{ + InitializeAHLEL(); + iAHLE->GetConfigurationL(aPrimarySize, aSecondarySize, aAdaptationSpeed ); +} + + +// ---------------------------------------------------------------- +// CAHLEInterface::GetParameters +// ---------------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::GetParameters( TAHLESortOrder& /* aOrder */ ) const +{ + return KErrNotSupported; +} + + +// ---------------------------------------------------------------- +// CAHLEInterface::GetParameters +// ---------------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::GetParameters( TAHLESortOrder& /* aOrder */, + TAny* /* aReserved */ ) const +{ + return KErrNotSupported; +} + + +// ---------------------------------------------------------------- +// CAHLEInterface::SetParameters +// ---------------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::SetParameters( TAHLESortOrder /* aOrder */ ) +{ + return KErrNotSupported; +} + +EXPORT_C TInt CAHLEInterface::SetParameters( TAHLESortOrder /* aOrder */, + TAny* /* aReserved */ ) +{ + return KErrNotSupported; +} + + +// --------------------------------------------------------- +// CAHLEInterface::NewAccessL +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::NewAccessL( const TDesC& aItem, + const TDesC& aItemName ) +{ + InitializeAHLEL(); + return (iAHLE->NewAccessL(aItem, aItemName)); +} + + +EXPORT_C void CAHLEInterface::NewAccessL( TRequestStatus& aStatus, + const TDesC& aItem, + const TDesC& aItemName ) +{ + InitializeAHLEL(); + iAHLE->NewAccessL(aStatus, aItem, aItemName); +} + + +// ---------------------------------------------------------------- +// CAHLEInterface::AdaptiveListL +// ---------------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::AdaptiveListL( CDesCArray& aItems, + CDesCArray& aItemNames, + const TInt aSize, + const TDesC& aMatch, + const TAHLEState aState ) +{ + InitializeAHLEL(); + return (iAHLE->AdaptiveListL( aItems, aItemNames, aSize, aMatch, aState )); +} + + +// --------------------------------------------------------- +// CAHLEInterface::OrderByScoreL +// --------------------------------------------------------- +// +EXPORT_C TInt CAHLEInterface::OrderByScoreL( CDesCArray& aItems, + CDesCArray& aItemsSorted ) +{ + InitializeAHLEL(); + return (iAHLE->OrderByScoreL( aItems, aItemsSorted )); +} + +EXPORT_C TInt CAHLEInterface::OrderByScoreL( CDesCArray& /* aItems */, + RArray& /* aSortOrder */ ) +{ + return KErrNotSupported; +} + + +// --------------------------------------------------------- +// CAHLEInterface::RemoveL +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::RemoveL( const TDesC& aItem ) +{ + InitializeAHLEL(); + return (iAHLE->RemoveL( aItem )); +} + +EXPORT_C void CAHLEInterface::RemoveL( const TDesC& aItem, + TRequestStatus& aStatus ) +{ + InitializeAHLEL(); + iAHLE->RemoveL( aItem, aStatus ); +} + +EXPORT_C void CAHLEInterface::RemoveL( const CDesCArray& aItems, + TRequestStatus &aStatus) +{ + InitializeAHLEL(); + iAHLE->RemoveL( aItems, aStatus ); +} + +EXPORT_C TInt CAHLEInterface::RemoveL(const CDesCArray& aItems ) +{ + InitializeAHLEL(); + return (iAHLE->RemoveL( aItems )); +} + + +// --------------------------------------------------------- +// CAHLEInterface::RemoveMatching +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::RemoveMatchingL( const TDesC& aMatch ) +{ + InitializeAHLEL(); + return (iAHLE->RemoveMatchingL( aMatch )); +} + +EXPORT_C void CAHLEInterface::RemoveMatchingL( const TDesC& aMatch, + TRequestStatus& aStatus ) +{ + InitializeAHLEL(); + iAHLE->RemoveMatchingL( aMatch, aStatus); +} + + +// --------------------------------------------------------- +// CAHLEInterface::Rename +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::RenameL( const TDesC& aItem, + const TDesC& aNewName ) +{ + InitializeAHLEL(); + return (iAHLE->RenameL( aItem, aNewName )); +} + + +// --------------------------------------------------------- +// CAHLEInterface::GetName +// --------------------------------------------------------- +// +EXPORT_C TInt CAHLEInterface::GetNameL( const TDesC& /* aItem */, + TDesC& /* aName */ ) +{ + return KErrNotSupported; +} + + +// --------------------------------------------------------- +// CAHLEInterface::Clear +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::Clear() +{ + //Exception may be thrown but is not expected. Return something + //harmless in that case. + TRAPD( error, InitializeAHLEL()); + return (error ? 0 : iAHLE->Clear()); +} + + +// --------------------------------------------------------- +// CAHLEInterface::Flush +// --------------------------------------------------------- +EXPORT_C TInt CAHLEInterface::Flush() +{ + //Exception may be thrown but is not expected. Return something + //harmless in that case. + TRAPD( error, InitializeAHLEL()); + return (error ? 0 : iAHLE->Flush()); +} + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAnimation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAnimation.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class to put animation to contextPane. +* +* +*/ + + +// INCLUDE FILES + +#include "BrowserAnimation.h" +#include "logger.h" + +#include +#include +#include +#include +#include // for TResourceReader +#include // for TAknsItemID + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserAnimation::NewL() +// --------------------------------------------------------- +// +CBrowserAnimation* CBrowserAnimation::NewL( TInt aResourceId ) + { +LOG_ENTERFN("Anim::NewL"); + CBrowserAnimation* self = new( ELeave )CBrowserAnimation; + CleanupStack::PushL( self ); + self->ConstructL( aResourceId ); + CleanupStack::Pop(); // self + return self; + } + +// --------------------------------------------------------- +// CBrowserAnimation::~CBrowserAnimation() +// --------------------------------------------------------- +// +CBrowserAnimation::~CBrowserAnimation() + { + delete iAnimation; + } + +// --------------------------------------------------------- +// CBrowserAnimation::StartL() +// --------------------------------------------------------- +// +void CBrowserAnimation::StartL() + { +LOG_ENTERFN("Anim::StartL"); + if ( iAnimation && !iIsRunning ) + { + // Getting status pane control + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() ) + ->StatusPane(); + + // Fetch pointer to contextpane + CAknContextPane* contextPane = STATIC_CAST( CAknContextPane*, + sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) ); + + //this sets an empty bitmap to the contextpanes background to + //avoid to have the original one in the back of the animation + //the ownership is taken by the contextpane + CFbsBitmap *emptyFbsBitmap = new (ELeave) CFbsBitmap(); + + CleanupStack::PushL( emptyFbsBitmap ); + emptyFbsBitmap->Create( TSize(1, 1), ENone); + CEikImage * emptyEikImage = new (ELeave) CEikImage( ); + emptyEikImage->SetBitmap( emptyFbsBitmap ); + contextPane->SetPicture( emptyEikImage ); + CleanupStack::Pop();//emptyFbsBitmap ownership is taken + + iAnimation->StartAnimationL(); // displays the animation + iIsRunning = ETrue; + } + } + +// --------------------------------------------------------- +// CBrowserAnimation::StopL() +// --------------------------------------------------------- +// +void CBrowserAnimation::StopL() + { +LOG_ENTERFN("Anim::StopL"); + if ( iAnimation && iIsRunning ) // Is the animation running? + { + iAnimation->CancelAnimation(); // ends the animation + iIsRunning = EFalse; + + // Getting status pane control + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() )->StatusPane(); + + // Fetch pointer to contextpane + CAknContextPane* contextPane = NULL; + TRAP_IGNORE( contextPane = STATIC_CAST( CAknContextPane*, sp->ControlL + ( TUid::Uid( EEikStatusPaneUidContext ) ) ) ); + + if ( contextPane ) + { + contextPane->SetPictureToDefaultL(); + contextPane->DrawNow(); // draw original icon + } + } + } + +// --------------------------------------------------------- +// CBrowserAnimation::ConstructL() +// --------------------------------------------------------- +// +void CBrowserAnimation::ConstructL( TInt aResourceId ) + { +LOG_ENTERFN("Anim::ConstructL"); +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + // Getting status pane control + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() ) ->StatusPane(); + + if ((sp && sp->PaneCapabilities( + TUid::Uid(EEikStatusPaneUidContext)).IsInCurrentLayout())) + { + // Fetch pointer to contextpane + CAknContextPane* contextPane = + STATIC_CAST( CAknContextPane*, + sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) ); + + iAnimation = CAknBitmapAnimation::NewL(); + iAnimation->SetContainerWindowL( *contextPane ); + + TResourceReader rr; + TAknsItemID animationSkinID; + animationSkinID.Set( EAknsMajorAvkon, aResourceId ); + + if( !iAnimation->ConstructFromSkinL( animationSkinID ) ) + { + iAnimation->ControlEnv()->CreateResourceReaderLC( rr, aResourceId ); + iAnimation->ConstructFromResourceL( rr ); // read from resource + CleanupStack::PopAndDestroy(); // rr + } + + iAnimation->SetRect(contextPane->Rect()); +PERFLOG_STOP_WRITE("Animation ConstructL phase 1") +#if 0 + // Start and stop animation out of the screen. + // This way it saves context pane's content as background frame. + const TInt KWmlAnimationDummyPos = 1000; + iAnimation->SetPosition( TPoint( KWmlAnimationDummyPos, + KWmlAnimationDummyPos ) ); + iAnimation->SetRect(contextPane->Rect()); +PERFLOG_STOPWATCH_START + StartL(); + StopL(); + iAnimation->SetPosition( TPoint( 0, 0 ) ); +PERFLOG_STOP_WRITE("Animation ConstructL phase 2") +#endif + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAppDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAppDocument.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser app document +* +* +*/ + +#include "BrowserAppDocument.h" +#include "BrowserAppUi.h" +#include +#include +#include "CommonConstants.h" + +CBrowserAppDocument::CBrowserAppDocument(CEikApplication& aApp): CAknDocument(aApp) +{ + iFolderToOpen = KFavouritesRootUid; +} + +CBrowserAppDocument::~CBrowserAppDocument() +{ + if ( iUrlToOpen ) + { + delete iUrlToOpen; + iUrlToOpen = NULL; + } +} + +CEikAppUi* CBrowserAppDocument::CreateAppUiL() +{ + return new (ELeave) CBrowserAppUi; +} + +TInt CBrowserAppDocument::GetFolderToOpen() const +{ + return iFolderToOpen; +} + +HBufC* CBrowserAppDocument::GetUrlToOpen() const +{ + return iUrlToOpen; +} + +MDownloadedContentHandler *CBrowserAppDocument::GetDownloadedContentHandler() const +{ + return iDownloadedContentHandler; +} + +CFileStore* CBrowserAppDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC& aFileName, RFs& /*aFs*/) +{ + TInt len = aFileName.Length(); + delete iUrlToOpen; + iUrlToOpen = NULL; + iUrlToOpen = HBufC::NewL(len); + *iUrlToOpen = aFileName; + HBufC8 *url8 = HBufC8::NewL(len); + + url8->Des().Copy( aFileName ); + //STATIC_CAST(CBrowserAppUi*, iAppUi)->FetchL(*iUrlToOpen); + STATIC_CAST(CBrowserAppUi*, iAppUi)->ParseAndProcessParametersL( url8->Des() ); + delete url8; + return NULL; +} + +// From CAknDocument +void CBrowserAppDocument::OpenFileL( CFileStore*& aFileStore, RFile& aFile ) + { + CBrowserAppUi* appUi = STATIC_CAST(CBrowserAppUi*, iAppUi); + appUi->InitBrowserL(); + + TBuf dataTypeDes; + + // See if Browser UI should handle this open file or not + if(appUi->RecognizeUiFileL(aFile, dataTypeDes)) + { + // confirm the filehandling with the user, + // retrieving filename from the RFILE + TFileName fileName; + User::LeaveIfError(aFile.Name(fileName)); + if(appUi->ConfirmUiHandlingL(fileName, dataTypeDes)) + { + // need to copy file to a temp file, then pass off to Feeds + // prepend the path to the fileName + TFileName filePath = _L("c:\\system\\temp\\"); + filePath.Append(fileName); + appUi->CopyUiRFileToFileL(aFile,filePath); + + // Pass off to appUi to set up views, etc. + appUi->HandleUiFileL(filePath, dataTypeDes); + } + else + { + appUi->HandleCommandL( EWmlCmdCloseBrowser ); + } + } + else + { + // send to content view + appUi->WaitCVInit(); + appUi->SetLastActiveViewId( KUidBrowserContentViewId ); + // view activation and bringing the browser to foreground are two + // distinct actions. + appUi->ActivateLocalViewL( KUidBrowserContentViewId ); + appUi->HandleForegroundEventL( ETrue ); + + TFileName fileName; + User::LeaveIfError( aFile.FullName( fileName ) ); + if ( fileName.Find( KMailerStoreUid ) != KErrNotFound ) + { + appUi->CopyUiRFileToFileL( aFile,KAttachment() ); + appUi->BrCtlInterface().LoadFileL( KAttachment() ); + } + else + { + appUi->BrCtlInterface().LoadFileL( aFile ); + } + + } + aFileStore = 0; + aFile.Close(); + } + +TBrowserOverriddenSettings* CBrowserAppDocument::GetOverriddenSettings() + { + return iOverriddenSettings; + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAppEntryPoint.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser App Entry point +* +* +*/ + + +#include "BrowserApplication.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KBrowserResourceFile, "BrowserNG.rsc"); + + +const int KFreeMemoryTarget = 6000000; + + +LOCAL_C CApaApplication* NewApplication( ) + { + return new CBrowserApplication; + } + +// ----------------------------------------------------------------------------- +// SetupThreadHeap - Called for heap creation of thread in this process. +// This approach used to keep correct heap for pointers held in static data objects +// when they are destructed after E32Main() by OS. +// ----------------------------------------------------------------------------- +EXPORT_C TInt UserHeap::SetupThreadHeap(TBool aSubThread, SStdEpocThreadCreateInfo& aInfo) + { + TInt r = KErrNone; + if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0) + { + // new heap required + RHeap* pH = NULL; + r = CreateThreadHeap(aInfo, pH); + if (r == KErrNone && !aSubThread) + { + // main thread - new allocator created and set as default heap + MemoryManager::CreateFastAllocator(); + } + } + else if (aInfo.iAllocator) + { + // sharing a heap + RAllocator* pA = aInfo.iAllocator; + pA->Open(); + User::SwitchAllocator(pA); + } + + return r; + } + + +// --------------------------------------------------------------------------- +// GetUiUtilitiesResourceFilenameL +// --------------------------------------------------------------------------- +// +TInt GetCorrectResourceFilenameL(TFileName& aResourceFileName) + { + + TParse parse; + parse.Set(KBrowserResourceFile, &KDC_APP_RESOURCE_DIR, NULL); + aResourceFileName.Copy(parse.FullName()); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL( fs ); + + // Resource File Name on C: + aResourceFileName.Insert( 0, TDriveUnit( EDriveC).Name() ); + // try to locate the localised resource + BaflUtils::NearestLanguageFile( fs, aResourceFileName ); + + // if the localised resource is found, the file name is changed to the localised name (z:\resources\webkit.r001) + if( !BaflUtils::FileExists( fs, aResourceFileName ) ) { + + aResourceFileName.Replace( 0, KMaxDriveName, TDriveUnit( EDriveZ ).Name() ); + // not found on c drive, try z try to locate the localised resource again + BaflUtils::NearestLanguageFile( fs, aResourceFileName ); + + // if file was not found this time, there is no localised resource with the name + if (!BaflUtils::FileExists( fs, aResourceFileName ) ) { + User::Leave(KErrNotFound); + } + } + CleanupStack::PopAndDestroy( &fs ); + return KErrNone; + } + +void ShowOOMDialogWithNotifierL() + { + + TFileName resourceFileName; + User::LeaveIfError(GetCorrectResourceFilenameL(resourceFileName)); + + RFs fsSession; + User::LeaveIfError(fsSession.Connect()); + CleanupClosePushL(fsSession); + + RResourceFile resFile; + resFile.OpenL(fsSession,resourceFileName ); + resFile.ConfirmSignatureL(0); + + HBufC8* dataOkButtonBuffer = resFile.AllocReadLC(R_QTN_OK_BUTTON); + HBufC8* dataOOMMessageBuffer = resFile.AllocReadLC(R_QTN_BROWSER_DIALOG_OOM); + + TPtrC16 OkButtonBuffer( ( TUint16* ) dataOkButtonBuffer->Ptr(),dataOkButtonBuffer->Length() / 2 ); + TPtrC16 OOMMessageBuffer( ( TUint16* ) dataOOMMessageBuffer->Ptr(),dataOOMMessageBuffer->Length() / 2 ); + + _LIT(KTxtEmptyLine," "); + _LIT(KTxtEmptyButton,""); + + RNotifier notifier; + TInt err = notifier.Connect(); + if(err == KErrNone) { + TInt whichbutton(-1); + TRequestStatus stat; + notifier.Notify(OOMMessageBuffer,KTxtEmptyLine,OkButtonBuffer,KTxtEmptyButton,whichbutton,stat); + User::WaitForRequest(stat); + } + + notifier.Close(); + + //this will clear OkButtonBuffer and OOMMessageBuffer + CleanupStack::PopAndDestroy(2); + resFile.Close(); + CleanupStack::PopAndDestroy(&fsSession); + + } + +// ----------------------------------------------------------------------------- +// E32Main +// ----------------------------------------------------------------------------- +GLDEF_C TInt E32Main() + { + //Initilize memory manager... + MemoryManager::InitFastAllocator(); + + TInt freeRAM = 0; + TInt r = HAL::Get(HAL::EMemoryRAMFree, freeRAM); + + if ((r != KErrNone) || freeRAM < KFreeMemoryTarget) + { + // create clean-up stack as none is created + CTrapCleanup* cleanup=CTrapCleanup::New(); + + // Show OOM message through RNotifier ... + TRAP_IGNORE(ShowOOMDialogWithNotifierL()); + + // destroy clean-up stack + delete cleanup; + return KErrNoMemory; + } + + // Run application event loop + return EikStart::RunApplication(NewApplication); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAppServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAppServer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserAppServer +* +* +*/ + + +// INCLUDES +#include +#include "BrowserAppServer.h" +#include "BrowserLauncherService.h" + +// ----------------------------------------------------------------------------- +// CBrowserAppServer::CreateServiceL() +// ----------------------------------------------------------------------------- +// +CApaAppServiceBase* CBrowserAppServer::CreateServiceL( TUid aServiceType ) const + { + + // Create the requested service object. + if ( aServiceType == TUid::Uid( 0x01010101 ) ) + { + CBrowserLauncherService* service = new( ELeave ) CBrowserLauncherService; + CleanupStack::PushL( service ); + service->ConstructL( ); + CleanupStack::Pop( service ); + return service; + } + else + { + return CAknAppServer::CreateServiceL( aServiceType ); + } + + } + +// ----------------------------------------------------------------------------- +// CBrowserAppServer::ConstructL() +// ----------------------------------------------------------------------------- +// +void CBrowserAppServer::ConstructL( const TDesC& aFixedServerName ) + { + CAknAppServer::ConstructL( aFixedServerName ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppServer::CustomSecurityCheckL() +// ----------------------------------------------------------------------------- +// +CPolicyServer::TCustomResult CBrowserAppServer::CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing ) + {/* + switch (aMsg.Function()) + { + case RLauncherClientService::EMessageId: + return aMsg.HasCapability(iClientReqs) ? CPolicyServer::EPass : CPolicyServer::EFail; + break; + + default: + return CApaAppServer::CustomSecurityCheckL (aMsg, aAction, aMissing); + break; + }*/ + return CApaAppServer::CustomSecurityCheckL (aMsg, aAction, aMissing); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppServer::CustomFailureActionL() +// ----------------------------------------------------------------------------- +// +CPolicyServer::TCustomResult CBrowserAppServer::CustomFailureActionL(const RMessage2& aMsg, TInt /*aAction*/, const TSecurityInfo& /*aMissing*/) + {/* + switch (aMsg.Function()) + { + case RLauncherClient::EMessageId: + return aMsg.HasCapability(iClientReqs) ? CPolicyServer::EPass : CPolicyServer::EFail; + break; + + default: + return CApaAppServiceBase::CustomFailureActionL (aMsg, aAction, aMissing); + break; + }*/ + //Dummy return, because CustomFailureActionL is not implemented. + return aMsg.HasCapability(iClientReqs) ? CPolicyServer::EPass : CPolicyServer::EFail; + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAppUi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,4753 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserAppUi +* +* +*/ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BRDO_APP_GALLERY_SUPPORTED_FF +#include +#include +#endif + +#include +#include + +#include +#include "BrowserLauncherService.h" + +#include "cookiemanagerclient.h" + +#ifdef __SERIES60_HELP +#include +#endif //__SERIES60_HELP + +#include "BrowserAppDocument.h" +#include +#include "BrowserBmOTABinSender.h" +#include "BrowserCommandLineParser.h" +#include "BrowserApplication.h" +#include "BrowserContentView.h" +#include "BrowserContentViewContainer.h" +#include "BrowserContentViewToolbar.h" +#include "BrowserBookmarksView.h" +#include "SettingsView.h" +#include "BrowserWindowSelectionView.h" +#include "BrowserInitialView.h" +#include "CommonConstants.h" +#include "BrowserDialogs.h" +#include "BrowserDisplay.h" +#include "BrowserCommsModel.h" +#include "BrowserUtil.h" +#include "BrowserPreferences.h" +#include "SessionAndSecurity.h" +#include "BrowserUIVariant.hrh" +#include "BrowserWindowQueue.h" +#include "Logger.h" +#include + +#include +#include +#include "BrowserSoftkeysObserver.h" +#include "BrowserLoadObserver.h" +#include "BrowserSpecialLoadObserver.h" +#include "BrowserAsyncExit.h" +#include "CommonConstants.h" + + +// Dialogs Provider +#include +#include +#include + +// Multiple Windows +#include "BrowserPopupEngine.h" +#include "BrowserDialogsProviderProxy.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include "AknInfoPopupNoteController.h" + +#include "BrowserAppUi.h" + +#include "BrowserPushMtmObserver.h" + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +#include +#include +#include +#endif + +//CONSTANTS +const TUint KBookmarkId = 1; +const TUint KUrlId = 4; +_LIT8 ( KLongZeroIdString, "5" ); +const TUint KFolderId = 6; +const TUint KLaunchFeeds = 7; + +const TInt KMaxNumOfOpenedWindows = 5; +const TInt KMinNumOfOpenedWindows = 2; // must allow at least 2 windows for most use cases + +const TUint KDot('.'); +const TUint KSlash('/'); +_LIT( KDefaultSchema, "http://" ); +const TInt KDefaultSchemaLength = 7; + +const TInt KMinimumCDriveDiskSpace = 512 * 1024; + +const TInt KRetryConnectivityTimeout( 2*1000*1000 ); // 2 seconds + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +const TUint KBrowser8xUID = 0x200267CC; +_LIT( KUpdateFileName, "lastupdatechecked.txt" ); +const TInt64 KMaxTimeToPostponeUpdate = 604800000000; +#endif + +//Following array stores Uids for external applications. +//This can be appended. This is used in HandleMessageL to enable Single Window browsing. +static TInt mArrayOfExternalAppUid[] = { 0x2001f3a9, 0x200159D0}; +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CBrowserAppUi() +// ----------------------------------------------------------------------------- +// +CBrowserAppUi::CBrowserAppUi(): +iCalledFromAnotherApp( EFalse ), +iIsForeground( EFalse ), +iLastViewId( KUidBrowserNullViewId ), +iExitInProgress( EFalse ), +iShutdownRequested( EFalse ), +iParametrizedLaunchInProgress( 0 ), +iExitFromEmbeddedMode( EFalse ), +iLongZeroPressed( EFalse ), +iStartedUp( EFalse ), +iFeatureManager( EFalse ), +iUserExit( EFalse ), +iPgNotFound( EFalse ), +iOverriddenLaunchContextId( EBrowserContextIdNormal ), +iBrowserAlreadyRunning (EFalse), +iSameWinApp( EFalse ), +iFeedsClientUtilities( 0 ) + { + iViewToBeActivatedIfNeeded.iUid = 0; + iViewToReturnOnClose.iUid = 0; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::~CBrowserAppUi() +// ----------------------------------------------------------------------------- +// +CBrowserAppUi::~CBrowserAppUi() + { + LOG_ENTERFN("CBrowserAppUi::~CBrowserAppUi"); + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF + delete iDelayedUpdate; + iFs.Close(); +#endif + + SetExitInProgress( ETrue ); + if(iBrowserAsyncExit) + { + iBrowserAsyncExit->Cancel(); + } + if(iIdle) + { + iIdle->Cancel(); + } + + + if( iFeatureManager ) + { + FeatureManager::UnInitializeLib(); + iFeatureManager = EFalse; + } + + // + delete iPushMtmObserver; + +#ifdef __RSS_FEEDS + delete iFeedsClientUtilities; + LOG_WRITE( "iFeedsClientUtilities deleted" ); +#endif //__RSS_FEEDS + + delete iPopupEngine; + LOG_WRITE(" iPopupEngine deleted."); + + // set user exit for 'save launch param' command handling + if ( iWindowManager ) + { + iWindowManager->SetUserExit( iUserExit ); + } + delete iWindowManager; + LOG_WRITE( " iWindowManager deleted" ); + +#ifdef BRDO_OCC_ENABLED_FF + if(iRetryConnectivity) + iRetryConnectivity->Cancel(); + + delete iRetryConnectivity; + iRetryConnectivity = NULL; +#endif + + // Delete the inetconman after deleting window manager + CInternetConnectionManager* inetconman = (CInternetConnectionManager*)iConnection; + delete inetconman; + LOG_WRITE( " inetconman deleted" ); + delete iConnStageNotifier; + LOG_WRITE( " iConnStageNotifier deleted" ); + + delete iPreferences; + LOG_WRITE( " iPreferences deleted" ); + delete iCommsModel; + LOG_WRITE( " iCommsModel deleted" ); + + delete iLateSendUi; + LOG_WRITE( " iLateSendUi deleted" ); + + delete iSender; + LOG_WRITE( " iSender deleted" ); + + delete iIdle; + LOG_WRITE( " iIdle deleted" ); + + delete iRecentUrlStore; + LOG_WRITE( " iRecentUrlStore deleted" ); + + if ( iDoorObserver ) + { + iDoorObserver->NotifyExit(MApaEmbeddedDocObserver::ENoChanges); + LOG_WRITE( " NotifyExit deleted" ); + } + delete iDialogsProvider; + LOG_WRITE( " iDialogsProvider deleted" ); + + TBool isStandAlone = !IsEmbeddedModeOn(); + LOG_WRITE_FORMAT( " isStandAlone: %d", isStandAlone ); + + delete iBrowserAsyncExit; + LOG_WRITE( " iBrowserAsyncExit deleted" ); + + iFavouritesSess.Close(); + LOG_WRITE( " iFavouritesSess.Close() deleted" ); +#ifdef BRDO_IAD_UPDATE_ENABLED_FF + CleanUpdateParams(); +#endif + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ConstructL() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ConstructL() + { + LOG_CREATE; + LOG_ENTERFN( "CBrowserAppUi::ConstructL" ); +PERFLOG_CREATE; +PERFLOG_LOCAL_INIT; +PERFLOG_STOPWATCH_START; + + +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible); +#else + BaseConstructL( EAknEnableSkin | EAknEnableMSK ); +#endif + + + if ( !IsEmbeddedModeOn( ) ) + { + // This is for handling low phone memory (c:) condition. Just leave in case phone memory is not sufficient. + TBool lowdisk = SysUtil::DiskSpaceBelowCriticalLevelL(&(CCoeEnv::Static()->FsSession()), KMinimumCDriveDiskSpace, EDriveC ); + if (lowdisk) User::Leave(KErrDiskFull); + +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + InitBookmarksL(); +#else + InitBrowserL(); +#endif + LOG_WRITE( "Browser started standalone" ); + } + else + { + iStartedUp = EFalse; + LOG_WRITE( "Browser started embedded" ); + } +PERFLOG_STOP_WRITE("BrowserUI::ConstructL"); + + } +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +// --------------------------------------------------------- +// CBrowserAppUi::CheckUpdatesL +// --------------------------------------------------------- +void CBrowserAppUi::CheckUpdatesL() + { + LOG_ENTERFN("CBrowserAppUi::CheckUpdatesL"); + LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() entering" ); + User::LeaveIfError(iFs.Connect()); + if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() IAD Update supported" ); + TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) ); + LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() IAD Update Client Created" ); + if ( iUpdate ) + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() creating IAD Update paramentes" ); + iParameters = CIAUpdateParameters::NewL(); + // Search for updates using SIS package UID + iParameters->SetUid( TUid::Uid( KBrowser8xUID ) ); + //check the updates + iUpdate->CheckUpdates( *iParameters ); + } + } + LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() exiting" ); + } + +// --------------------------------------------------------- +// CBrowserAppUi::CheckUpdatesComplete +// rest of the details commented in the header +// --------------------------------------------------------- +// +void CBrowserAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) + { + LOG_ENTERFN("CBrowserAppUi::CheckUpdatesComplete"); + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Entry" ); + + TBool result = EFalse; + TBool showDialog = EFalse; + + if ( aErrorCode == KErrNone ) + { + if ( aAvailableUpdates > 0 ) + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update available" ); + //Check if the file is available in folder or not + if(CheckUpdateFileAvailable()) + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update file available" ); + TTime timenow; + timenow.HomeTime(); + TInt64 time = timenow.Int64(); + TInt64 dataValue = ReadUpdateFile(); + //If the diference of the current time and the Previous Check time is more than 1 Week + //then show the dialog + if((time - dataValue)>KMaxTimeToPostponeUpdate) + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - diference of the current time and the time available in th file is more than 7 days" ); + showDialog = ETrue; + } + } + else + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update file is not available" ); + showDialog = ETrue; + } + + if(showDialog) + { + HBufC* message = StringLoader::LoadLC(R_INSTALL_ADDON_BROWSER); + HBufC* lsc_now = StringLoader::LoadLC(R_INSTALL_BROWSER_NOW); + HBufC* rsc_later = StringLoader::LoadLC(R_INSTALL_BROWSER_LATER); + + TRAPD(err, result = iDialogsProvider->DialogConfirmL(_L(""), + *message, + *lsc_now, + *rsc_later)); + + CleanupStack::PopAndDestroy(3); //message, lsc_now, rsc_later + + if (err != KErrNone) + { + return ; + } + if ( result ) // user selected NOW + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - if file exists, just delete it." ); + // if file exists, just delete it. + DeleteUpdateFile(); + iUpdate->ShowUpdates( *iParameters ); + } + if ( !result ) // user selected LATER + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - create the file and store the current time." ); + //create the file and store the current time. + WriteUpdateFile(); + } + } + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update available" ); + } + else + { + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - no update available" ); + // The answer was 'Later'. CIAUpdate object could be deleted + CleanUpdateParams(); + } + } + LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Exit" ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CleanUpdateParams +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::CleanUpdateParams() + { + LOG_ENTERFN("CBrowserAppUi::CleanUpdateParams"); + LOG_WRITE( "CBrowserAppUi::CleanUpdateParams() entering" ); + if(iUpdate) + { + delete iUpdate; + iUpdate = NULL; + } + if(iParameters) + { + delete iParameters; + iParameters = NULL; + } + LOG_WRITE( "CBrowserAppUi::CleanUpdateParams() exiting" ); + } + +// --------------------------------------------------------- +// CBrowserAppUi::UpdateComplete +// rest of the details commented in the header +// --------------------------------------------------------- +// +void CBrowserAppUi::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult ) + { + LOG_ENTERFN("CBrowserAppUi::UpdateComplete"); + LOG_WRITE( "CBrowserAppUi::UpdateComplete - Entry" ); + delete aResult; // Ownership was transferred, so this must be deleted by the client + CleanUpdateParams(); + LOG_WRITE( "CBrowserAppUi::UpdateComplete - Exit" ); + } +#endif + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::InitBookmarksL() +// Initialize only bookmarks view related dependencies here. +// Note - Do not add unnecessary code here, it increases startup time for bookmarks view. +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::InitBookmarksL() + { + //New constructor that just replaces the default primary storage size with this one. + iRecentUrlStore = CRecentUrlStore::NewL(); + + // Init CommsModel + iCommsModel = CBrowserCommsModel::NewL(); + + // check if it can be delayed ?? +#ifdef BRDO_OCC_ENABLED_FF + iConnection = CInternetConnectionManager::NewL( &iCommsModel->CommsDb(), ETrue ); +#else + iConnection = CInternetConnectionManager::NewL( &iCommsModel->CommsDb(), EFalse ); +#endif + + // Creating object to hold application settings + CBrowserAppDocument* doc = STATIC_CAST(CBrowserAppDocument*, Document()); + iPreferences = CBrowserPreferences::NewL( *iCommsModel, *this, doc->GetOverriddenSettings()); + + // Create bookmarkview + CBrowserBookmarksView* bookmarksView = NULL; + TInt folderUid = doc->GetFolderToOpen(); + if ( IsEmbeddedModeOn() && folderUid!= KFavouritesRootUid) + { + bookmarksView = CBrowserBookmarksView::NewLC( *this, *iRecentUrlStore, folderUid ); + } + else + { + bookmarksView = CBrowserBookmarksView::NewLC( *this, *iRecentUrlStore ); + } + + iBookmarksView = bookmarksView; + AddViewL( bookmarksView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // bookmarksView + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CompleteDelayedInit() +// Delayed (async) init callback. This method can be invoked explicitly in case +// some early startup cases fail if Browser has not initialized fully. No harm +// if called multiple times since there is check in the beginning of thsi function. +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::CompleteDelayedInit() + { + // Should not be called for other that 9.2 onward devices +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + if ( iStartedUp ) + return EFalse; // no need to re-invoke automatically + // complete initialization + TRAP_IGNORE(DelayedInitL()); + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF + // complete the IAD check asynchronously + iDelayedUpdate = CIdle::NewL( CActive::EPriorityIdle ); + iDelayedUpdate->Start(TCallBack( CompleteIADUpdateCallback, this )); +#endif +#endif + + return EFalse; // no need to re-invoke automatically + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::DelayedInitL() +// Delayed (Async) initialization - whatever remains after InitBookmarksL(), do it here. +// Note: - Do not add unnecessary code here, it increases startup time for contenview. +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::DelayedInitL() + { + LOG_ENTERFN("CBrowserAppUi::DelayedInitL"); + + // Create Favengine session + User::LeaveIfError( iFavouritesSess.Connect() ); + + // Init FeatureManager + FeatureManager::InitializeLibL(); + iFeatureManager = ETrue; + + // check flash present + iFlashPresent = CheckFlashPresent(); + + // this is required, browser's connection oberver should be hit first. + // (incase of netscape plgins, transactions will be closed.) + iConnStageNotifier = CConnectionStageNotifierWCB::NewL(); + iConnStageNotifier->SetPriority(CActive::EPriorityHigh); + + // Starts a background processing, so it must be started early, to get + // finished before the first send operation! Or it must be synchronized! + iLateSendUi = CIdle::NewL( CActive::EPriorityIdle ); + iLateSendUi ->Start( TCallBack( DelayedSendUiConstructL, this ) ); + + iHTTPSecurityIndicatorSupressed = iPreferences->HttpSecurityWarningsStatSupressed(); + + // set AP to be a default one (for Push messages) + SetRequestedAP( Preferences().DefaultAccessPoint() ); + + // Create ContentView + TRect rect = ClientRect(); + CBrowserContentView* contentView = CBrowserContentView::NewLC( *this, rect ); + AddViewL( contentView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // contentView + + // proxy will handle dialog events through load observer + iDialogsProvider = CBrowserDialogsProvider::NewL( NULL); + +#ifdef __RSS_FEEDS + iFeedsClientUtilities = CFeedsClientUtilities::NewL( *this, *this ); + BROWSER_LOG( ( _L("Feeds up.") ) ); +#endif //__RSS_FEEDS + + // Is Multiple Window feature suported? + if ( Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) ) + { + if (Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows ))//midrange + { + iWindowManager = CBrowserWindowManager::NewL( *this, *contentView, KMinNumOfOpenedWindows ); + } + else + { + iWindowManager = CBrowserWindowManager::NewL( *this, *contentView, KMaxNumOfOpenedWindows ); + } + LOG_WRITE_FORMAT("WindowManager Up. Max windows number. %d", KMaxNumOfOpenedWindows ); + } + else + { + iWindowManager = CBrowserWindowManager::NewL( *this, *contentView, KMinNumOfOpenedWindows ); + BROWSER_LOG( ( _L( "WindowManager Up. MWs not supported." ) ) ); + } + + contentView->SetZoomLevelL(); + BrCtlInterface().AddLoadEventObserverL(iBookmarksView); + + // create settings view + CBrowserSettingsView* settingsView = CBrowserSettingsView::NewLC( *this ); + AddViewL( settingsView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // settingsView + BROWSER_LOG( ( _L( "SettingsView up" ) ) ); + + // window selection view + CBrowserWindowSelectionView* windowSelectionView = CBrowserWindowSelectionView::NewLC( *this ); + AddViewL( windowSelectionView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // windowSelectionView + BROWSER_LOG( ( _L( "windowSelectionView up" ) ) ); + + // Create asyncronous object to call when exit requires it. + iBrowserAsyncExit = CBrowserAsyncExit::NewL( this ); + iIdle = CIdle::NewL( CActive::EPriorityIdle ); + + iPushMtmObserver = CBrowserPushMtmObserver::NewL( this ); + iPushMtmObserver->StartObserver(); + +#ifdef BRDO_OCC_ENABLED_FF + iRetryConnectivity = CPeriodic::NewL(CActive::EPriorityStandard); +#endif + + // Create two Panes of CBrowserContentViewContainer + CBrowserGotoPane* gotoPane = CBrowserGotoPane::NewL( contentView->Container(), + EMbmAvkonQgn_indi_find_goto, + EMbmAvkonQgn_indi_find_goto_mask, + ETrue, + contentView ); + + // Create the find pane with magnifier glass icon, and + // without adaptive popup list... + CBrowserGotoPane* findKeywordPane = CBrowserGotoPane::NewL( contentView->Container(), + EMbmAvkonQgn_indi_find_glass, + EMbmAvkonQgn_indi_find_glass_mask, + EFalse, + contentView, + ETrue ); + contentView->Container()->SetGotoPane(gotoPane); + contentView->Container()->SetFindKeywordPane(findKeywordPane); + //contentView->Container()->SetRect( rect ); // causes suncRepaint + contentView->Container()->GotoPane()->SetGPObserver(contentView); + contentView->Container()->FindKeywordPane()->SetGPObserver(contentView); + contentView->Container()->FindKeywordPane()->SetOrdinalPosition( 0 ); + contentView->Container()->GotoPane()->SetOrdinalPosition( 0 ); + + iStartedUp = ETrue; + iSecureSiteVisited = EFalse; + +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + if(LastActiveViewId() == KUidBrowserBookmarksViewId) + { + iBookmarksView->CheckForDownloads(); + iBookmarksView->UpdateFavIconsL(); + } +#endif + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::InitBrowserL() - THIS METHOD IS NOT USED FOR NORMAL STARTUP +// This method is just for supporting Browser initialization if launched in Embedded mode +// Normal initialization if split in BookmarksInit() and DelayedInit(). iStartedUp is FALSE +// if BRowser has not initialized or partially initialized. +// NOTE: DO NOT ADD ANY CODE HERE. IT IS JUST A WRAPPER. +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::InitBrowserL() + { + // Bookmarks initialization + InitBookmarksL(); + + // 2nd part of initialization + DelayedInitL(); + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF + // complete the IAD check asynchronously + if(!IsEmbeddedModeOn()) + { + iDelayedUpdate = CIdle::NewL( CActive::EPriorityIdle ); + iDelayedUpdate->Start(TCallBack( CompleteIADUpdateCallback, this )); + } +#endif + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ProcessCommandL(TInt aCommand) +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ProcessCommandL(TInt aCommand) + { + MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory(); + if (appUiFactory->MenuBar()) + { + StopDisplayingMenuBar(); + } + CAknViewAppUi::ProcessCommandL(aCommand); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::HandleCommandL() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::HandleCommandL(TInt aCommand) + { + // Default handling for all the thingies. + switch (aCommand) + { + case EEikCmdExit: + { + ExitBrowser ( IsAppShutterActive() ); + break; + } + case EAknSoftkeyExit:// closes the whole application chain if embedded browser + case EAknCmdExit: + { + if ( IsEmbeddedModeOn() ) + { + CAknEnv::RunAppShutter(); + break; + } + else + { + ExitBrowser ( ETrue ) ; + break; + } + } + //Fix for TSW error ICHV-75UFKZ + case EWmlCmdUserExit://closes the current browser instance only + case EWmlCmdCloseBrowser: + { + ExitBrowser ( ETrue ); + break; + } + case EWmlCmdChangeConnection : + { + ChangeConnectionL(); + break; + } + case EWmlCmdPreferences: + { + SetViewToBeActivatedIfNeededL( KUidBrowserSettingsViewId ); + break; + } + case EWmlCmdPreferencesToolbar: + { + SetViewToBeActivatedIfNeededL( KUidBrowserSettingsViewId, KUidSettingsGotoToolbarGroup.iUid ); + break; + } + case EWmlCmdFavourites: + { + SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + break; + } + case EWmlCmdSearchWeb: + { + LoadSearchPageL(); + break; + } + case EWmlCmdReload: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandReload + + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + } +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + case EWmlCmdSetAsHomePage: + { + ContentView()->HandleCommandL(EWmlCmdSetAsHomePage); + break; + } +#endif + case EAknSoftkeyBack: + case EWmlCmdBack: + { + HistoryLoadPrevious(); + break; + } + case EWmlCmdBackToFeedsView: + { + //Note: iPreviousView in this case will always be one of the Feeds view. + //In general iPreviousView holds the UID of the previous view. + SetViewToBeActivatedIfNeededL( iPreviousView ); + break; + } + case EWmlCmdClearTheCache: + { + ClearTheCacheL(ETrue, ETrue); + break; + } + case EWmlCmdDeleteCookies: + { + DeleteCookiesL(); + TBrowserDialogs::InfoNoteL( + R_BROWSER_OK_NOTE, R_QTN_BROWSER_NOTE_COOKIES_DELETED ); + break; + } + + case EWmlCmdClearAllPrivacy: + { + ClearAllPrivacyL(); + break; + } + + case EWmlCmdClearHistory: + { + ClearHistoryWithPromptL(); + break; + } + + case EWmlCmdClearFormAndPasswd: + { + ClearFormAndPasswdDataL(ETrue); + break; + } + + case EWmlCmdLaunchHomePage: + { + if (!IsLaunchHomePageDimmedL()) + { + LaunchHomePageL( /* EFalse */ ); + } + break; + } + case EWmlCmdDisconnect : + { + DisconnectL(); + TBrowserDialogs::InfoNoteL( + R_BROWSER_INFO_NOTE, R_WML_DISCONNECT ); + break; + } + case EWmlCmdCancelFetch: + { + if (SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing + { // try to Cancel. + SpecialLoadObserver().CancelConnection(); + Connection().Disconnect(); + } + else + { + CancelFetch( ETrue ); + } + break; + } + case EWmlCmdPageInfo: + { + CSessionAndSecurity* security = CSessionAndSecurity::NewLC(*this); + security->ShowPageInfoL(); + CleanupStack::PopAndDestroy(); // security + break; + } + case EWmlCmdInfoSession: + { + CSessionAndSecurity* session = CSessionAndSecurity::NewLC(*this); + session->ShowSessionInfoL(); + CleanupStack::PopAndDestroy(); // session + break; + } + case EWmlCmdInfoSecurity: + { + CSessionAndSecurity* security = CSessionAndSecurity::NewLC(*this); + security->ShowSecurityInfoL(); + CleanupStack::PopAndDestroy(); // security + break; + } + // browser engine specific command +#ifdef __SERIES60_HELP + + case EAknCmdHelp: + { + HlpLauncher::LaunchHelpApplicationL + ( iEikonEnv->WsSession(), AppHelpContextL() ); + break; + } + +#endif //__SERIES60_HELP + + case EWmlCmdForward: + { + HistoryLoadNext(); + break; + } + + case EWmlCmdRotateDisplay: + { + if ( Orientation() == EAppUiOrientationPortrait ) + { + SetOrientationL(EAppUiOrientationLandscape); + } + else if (Orientation() == EAppUiOrientationLandscape) + { + SetOrientationL(EAppUiOrientationPortrait); + } + else // EAppUiOrientationUnspecified + { + TRect rect = ApplicationRect(); + TInt width = rect.Width(); + TInt height = rect.Height(); + + if (width > height) + { + SetOrientationL(EAppUiOrientationPortrait); + } + else + { + SetOrientationL(EAppUiOrientationLandscape); + } + } + if(ContentView()->KeymapIsUp()) + { + ContentView()->RedrawKeymap(); + } + break; + } + + case EWmlCmdAboutProduct: + { + // get version info from browser control and display it + ShowNameAndVersionL(); + break; + } + case EWmlCmdProductUpdate: + { + /*if(!iAppUpdate) + { + iAppUpdate = CBrowserAppUpdate::NewL(); + } + iAppUpdate->CheckUpdates();*/ + break; + } + + //===================================================================== + // Multiple Windows Support + // + case EWmlCmdSwitchWindow: + { + if(WindowMgr().WindowCount() > 1) + { +#ifdef BRDO_MULTITOUCH_ENABLED_FF + // use switch window tab view if pageoverview bitmaps are available + if (Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) + || Preferences().UiLocalFeatureSupported( KBrowserGraphicalHistory )) +#else + // use switch window tab view if pageoverview bitmaps are available + if (Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage )) +#endif + { + SetViewToBeActivatedIfNeededL( KUidBrowserWindowSelectionViewId ); + } + else + { + SwitchWindowL(); + } + } + break; + } + case EWmlCmdCloseWindow: + { + if ( IsEmbeddedInOperatorMenu() ) + { + ExitBrowser( ETrue ); + } + else + { + CloseWindowL(); + } + break; + } + case EWmlCmdAllowPopups: + { + // Add url to whitelist + HBufC* url( WindowMgr().CurrentWindow()->BrCtlInterface(). + PageInfoLC( TBrCtlDefs::EPageInfoUrl ) ); + PopupEngine().AddUrlToWhiteListL( *url ); + CleanupStack::PopAndDestroy( url ); + break; + } + case EWmlCmdBlockPopups: + { + // Remove from whitelist + HBufC* url( WindowMgr().CurrentWindow()->BrCtlInterface(). + PageInfoLC( TBrCtlDefs::EPageInfoUrl ) ); + PopupEngine().RemoveUrlFromWhiteListL( *url ); + CleanupStack::PopAndDestroy( url ); + break; + } + case EWmlCmdShowAnchorHref: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandShowAnchorHref ); + break; + } + case EWmlCmdSaveToGallery: + { + SaveFocusedImageToGalleryL(); + break; + } + case EWmlCmdOpenToViewer: + { + TBrCtlImageCarrier* imageCarrier = BrCtlInterface().FocusedImageLC(); + if (imageCarrier) + { + CArrayFixFlat* imageArray = new( ELeave ) CArrayFixFlat(1); + CleanupStack::PushL(imageArray); + imageArray->AppendL(*imageCarrier); + iDialogsProvider->DialogDisplayPageImagesL( *imageArray ); + CleanupStack::PopAndDestroy(2); // imageArray, imageCarrier + } + break; + } + case EWmlCmdSaveUrlAsBookmark: + { + HBufC* url = BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoFocusedNodeUrl); + ContentView()->AddNewBookmarkL(EFalse, url); + CleanupStack::PopAndDestroy(); // url + break; + } + case EWmlCmdSmartLinkMakeCall: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkMakeCall ); + break; + } + case EWmlCmdSmartLinkSendEmail: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkSendEmail ); + break; + } + case EWmlCmdSmartLinkSendSms: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkSendMessage ); + break; + } + case EWmlCmdSmartLinkAddToContacts: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandSmartLinkAddToPhoneBook ); + break; + } + case EWmlCmdLoadFocusedImage: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandLoadFocusedImage ); + break; + } + case EWmlCmdLoadImagesOnly: + { + iPreferences->SetAutoLoadContentL(EWmlSettingsAutoloadImagesNoFlash); + break; + } + case EWmlCmdLoadImagesAndFlash: + { + iPreferences->SetAutoLoadContentL(EWmlSettingsAutoloadAll); + break; + } + case EWmlCmdOneStepBack: + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandOneStepBack ); + break; + } + case EEikCmdEditPaste: + { + TKeyEvent keyEvent; + keyEvent.iCode = EKeyF18; //member of TKeyCode + keyEvent.iScanCode = EEikCmdEditPaste; + keyEvent.iModifiers = EModifierCtrl; + keyEvent.iRepeats = 0; + TRAP_IGNORE( BrCtlInterface().OfferKeyEventL(keyEvent, EEventKey)); + } + break; + //===================================================================== + default: + { + if( iStartedUp ) + { + // pass to Browser Control + BrCtlInterface().HandleCommandL( aCommand ); + } + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ActiveView() +// ----------------------------------------------------------------------------- +// +CBrowserViewBase* CBrowserAppUi::ActiveView() + { + TVwsViewId activeViewId; + TInt err = GetActiveViewId( activeViewId ); + + if ( !err ) + { + return STATIC_CAST( CBrowserViewBase*, View(activeViewId.iViewUid) ); + } + else + { + //We should not panic + //On 3.0 wk40 it was observed that GetActiveViewId returned with KErrNotFound + //in case Browser was in the background + //Symbian error? + return NULL; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SetRequestedAP() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetRequestedAP( TInt aAp ) + { + iRequestedAp = aAp; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::IsPageLoaded() +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsPageLoaded() + { +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + if(!iStartedUp) // ContentView/WindowMgr is not yet up => no page loaded + return EFalse; +#endif + + TBool ret( EFalse ); + TInt winCount( WindowMgr().WindowCount() ); + + // at least 2 window -> there is a page loaded + if( winCount > 1 ) + { + ret = ETrue; + } + // 1 window with a loaded content + else if( winCount == 1 ) + { + // This checks to see if a dialog is launched and if that is the case, then + // the current window is being used, hence returning true. + if( iDialogsProvider->IsDialogLaunched() ) + { + ret = ETrue; + } + else + { + ret = WindowMgr().IsContentExist(); + } + } + // else (winCount == 0), no content view -> no page loaded + return ret; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::Fetching() +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::Fetching() const + { + // TO DO: + // use load obs., remove ifetchstate from this class and use from loadobs. + // iLoadState + //return ( iFetchState == MFetchObserver::ELoadStart ); +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + if (!iStartedUp) // ContentView is not yet started up, so we are not fetching + return EFalse; + else +#endif + return ( LoadObserver().LoadState() != CBrowserLoadObserver::ELoadStateIdle ); + } +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ContentDisplayed() +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::ContentDisplayed() const + { + return ( LoadObserver().ContentDisplayed() ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SetContentDisplayed() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetContentDisplayed(TBool aValue) + { + LoadObserver().SetContentDisplayed( aValue ); + } +// ----------------------------------------------------------------------------- +// CBrowserAppUi::FetchBookmarkL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::FetchBookmarkL( TInt aBookmarkUid ) + { + // complete initialization if not done yet, can happen if user selects + // a bookmark quickly after launch (within 1 second) + if ( !iStartedUp ) + CompleteDelayedInit(); + + SetViewToReturnOnClose( KUidBrowserBookmarksViewId ); + if ( aBookmarkUid == KFavouritesStartPageUid ) + { + TUint defaultAp = Preferences().DefaultAccessPoint(); + if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is no access point defined + { + CApAccessPointItem* apItem = Preferences().AllPreferencesL().iDefaultAPDetails; + if ( apItem ) + { + const HBufC* currentHP = apItem->ReadConstLongTextL( EApWapStartPage ); + //TPtrC currentHP(apItem->StartPage()); // Get the start page of the access point. + TFavouritesWapAp accessPoint; + + FetchL( *currentHP, KNullDesC, KNullDesC, accessPoint, + CBrowserLoadObserver::ELoadUrlTypeStartPage ); // Fetch the start page. + } + } + } + else + { + RFavouritesDb db; + User::LeaveIfError( db.Open( iFavouritesSess, KBrowserBookmarks ) ); + CleanupClosePushL( db ); + + CFavouritesItem* item = CFavouritesItem::NewLC(); + User::LeaveIfError( db.Get( aBookmarkUid, *item ) ); + + FetchBookmarkL( *item ); + CleanupStack::PopAndDestroy( 2 ); // item, db + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::FetchBookmarkL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::FetchBookmarkL( const CFavouritesItem& aBookmarkItem ) + { + // complete initialization if not done yet, can happen if user selects + // a bookmark quickly after launch (within 1 second) + if ( !iStartedUp ) + CompleteDelayedInit(); + + SetViewToReturnOnClose( KUidBrowserBookmarksViewId ); + if ( Util::CheckBookmarkApL( *this, aBookmarkItem.WapAp()) ) + FetchL + ( + aBookmarkItem.Url() , + aBookmarkItem.UserName(), + aBookmarkItem.Password(), + aBookmarkItem.WapAp(), + CBrowserLoadObserver::ELoadUrlTypeOther + ); + else + TBrowserDialogs::ErrorNoteL( R_WML_INVALID_AP ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SetViewToBeActivatedIfNeededL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetViewToBeActivatedIfNeededL( TUid aUid, TInt aMessageId ) + { + CBrowserAppDocument* doc = STATIC_CAST(CBrowserAppDocument*, Document()); + + if((iCurrentView != aUid) && (aUid != KUidBrowserSettingsViewId)) + { + iPreviousView = iCurrentView; + iCurrentView = aUid; + } + + //Check view id validity first + if ( aUid == KUidBrowserNullViewId ) + { + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + return; + } + + if ( ( aUid != KUidBrowserContentViewId ) && + ( LastActiveViewId() == KUidBrowserContentViewId ) ) + { + ContentView()->SetFullScreenOffL(); + } + + if ( iWindowManager && iWindowManager->ContentView()->FullScreenMode() ) + { + if ( aUid == KUidBrowserFeedsFeedViewId ) + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + + (TInt)TBrCtlDefs::ECommandLeaveFullscreenBrowsing ); + } + + else if ( aUid != KUidBrowserFeedsTopicViewId && + aUid != KUidBrowserFeedsFolderViewId && + aUid != KUidBrowserBookmarksViewId ) + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase + + (TInt)TBrCtlDefs::ECommandEnterFullscreenBrowsing ); + } + } + + + if ( iIsForeground ) + { + if ( aUid == KUidBrowserSettingsViewId ) + { + //complete initialisation + if( !iStartedUp ) + CompleteDelayedInit(); + + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() ) + ->StatusPane(); + sp->DrawNow(); + } + + ActivateLocalViewL( aUid, TUid::Uid( aMessageId ), KNullDesC8 ); + } + else + { + iViewToBeActivatedIfNeeded = aUid; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::LastActiveViewId +// ----------------------------------------------------------------------------- +// +TUid CBrowserAppUi::LastActiveViewId() const + { + return iLastViewId; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SetLastActiveViewId +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetLastActiveViewId( TUid aUid ) + { +LOG_ENTERFN("CBrowserAppUi::SetLastActiveViewId"); + LOG_WRITE_FORMAT(" SetLastActiveViewId: %d", aUid); + iLastViewId = aUid; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ExitInProgress +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::ExitInProgress() const + { + return iExitInProgress; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ExitInProgress +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetExitInProgress( TBool aValue ) + { + iExitInProgress = aValue; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::IsConnecting +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsConnecting() const + { + return ( LoadObserver().LoadState() != CBrowserLoadObserver::ELoadStateIdle ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::HandleForegroundEventL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::HandleForegroundEventL( TBool aForeground ) + { + // Handle this event only if the browser is started up + iIsForeground = IsForeground(); + if (!iStartedUp) + return; + + if( iIsForeground ) + { + if (iViewToBeActivatedIfNeeded.iUid) + { + ActivateLocalViewL( iViewToBeActivatedIfNeeded ); + } + else + { + TVwsViewId activeViewId; + if( ( GetActiveViewId( activeViewId ) == KErrNone ) && + ( LastActiveViewId() != activeViewId.iViewUid ) ) + { + // LastActiveViewId() might return with 0! + TRAP_IGNORE( ActivateLocalViewL( LastActiveViewId() ) ); + } + } + } + iViewToBeActivatedIfNeeded.iUid = 0; + CAknViewAppUi::HandleForegroundEventL( aForeground ); + + if( iIsForeground ) + { + if ( Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) + { + ContentView()->UpdateFullScreenL(); + } + + if( !Fetching() ) + { + Display().StopProgressAnimationL(); + } + } + + if (iWindowManager) + { + iWindowManager->SendCommandToAllWindowsL( iIsForeground + ? (TInt)TBrCtlDefs::ECommandAppForeground + (TInt)TBrCtlDefs::ECommandIdBase + : (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase); + } + + // if browser comes to foreground and exit is requested, + // asyncronous exit is started + if( iIsForeground && iExitFromEmbeddedMode && !IsEmbeddedInOperatorMenu() ) + { + iBrowserAsyncExit->Start(); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::FetchL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::FetchL( + const TDesC& aUrl, + const TDesC& aUsername, + const TDesC& aPassword, + const TFavouritesWapAp& aAccessPoint, + CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ) + { +LOG_ENTERFN("CBrowserAppUi::FetchL"); + + // complete the initialization if not done yet + if(!iStartedUp) + CompleteDelayedInit(); + + // Let's cancel the previous fetch if any + if ( Fetching() ) + { + CancelFetch(); + } +#ifndef __WINS__ +//Fix for bookmark specific access point + if( iConnection && iConnection->Connected() ) + { + TUint32 passedIap( 0 ); + if ( aAccessPoint.ApId() != KWmlNoDefaultAccessPoint ) + { + passedIap = Util::IapIdFromWapIdL( *this, aAccessPoint.ApId()); + BROWSER_LOG((_L("CBrowserAppUi::FetchL Passed Iap: %d"), passedIap)); + TUint32 connectedAp = iConnection->CurrentAPId(); + BROWSER_LOG((_L("CBrowserAppUi::FetchL Existing connected Iap: %d"), connectedAp)); + if(passedIap != connectedAp) + { + StopConnectionObserving(); + BROWSER_LOG((_L("CBrowserAppUi::FetchL Stopped the connection observation."))); + DisconnectL(); + BROWSER_LOG((_L("CBrowserAppUi::FetchL Given iap and Connected iap are not same. Disconnected the existing connection."))); + } + } + + } +#endif // __WINS__ + // iDoNotRestoreContentFlag = EFalse; + + TInt toPop = 0; + TUriParser uriParser; + TInt err = uriParser.Parse(aUrl); + if ( !err && aUrl.Length() ) + { + // check url for missing scheme and add default scheme if needed + HBufC* url = NULL; + HBufC* resultUrlBuf = NULL; + //find :// + TPtrC scheme = uriParser.Extract( EUriScheme ); + // add http:// scheme as default if it is missing + if( scheme.Length() == 0 ) + { + //put the "http://" schema before the string + url = HBufC::NewLC( aUrl.Length() + KDefaultSchemaLength ); + url->Des().Copy( KDefaultSchema ); + url->Des().Append( aUrl ); + ++toPop; // url + resultUrlBuf = CreateFullUrlLC( url->Des(), aUsername, aPassword ); + LogRequestedPageToRecentUrlL( url->Des() ); + } + else + { + resultUrlBuf = CreateFullUrlLC( aUrl, aUsername, aPassword ); + LogRequestedPageToRecentUrlL( aUrl ); + } + ++toPop; // resultUrlBuf + + + if ( aAccessPoint.IsNull() || aAccessPoint.IsDefault() || (!Util::IsValidAPFromParamL( *this, aAccessPoint.ApId() )) ) + { + if ( (Preferences().AccessPointSelectionMode() == EConnectionMethod) || + (Preferences().AccessPointSelectionMode() == EAlwaysAsk) ) + { + iRequestedAp = Preferences().DefaultAccessPoint(); + } + else if ( Preferences().AccessPointSelectionMode() == EDestination ) + { + // for bug fix MLAN-7EKFV4 + iRequestedAp = KWmlNoDefaultAccessPoint; + } + } + else + { + iRequestedAp = aAccessPoint.ApId(); + } +#ifndef __WINSCW__ //On WINS we don't want this dlg to come up + //as the ConnMan will present us with a selection + BROWSER_LOG( ( _L( "requestedAp: %d" ), iRequestedAp ) ); + // it's ok to assign in the case of EDest, since CBrCtl doesn't use the apId passed in LoadUrlL() + TUint32 IAPid = iRequestedAp; + TUint32 defaultSnap = iPreferences->DefaultSnapId(); +#ifndef BRDO_OCC_ENABLED_FF + // if no AP or SNAP is defined, define it + if( (iRequestedAp == KWmlNoDefaultAccessPoint && iPreferences->AccessPointSelectionMode() == EConnectionMethod) || + (defaultSnap == KWmlNoDefaultSnapId && iPreferences->AccessPointSelectionMode() == EDestination) ) + { + StartPreferencesViewL( EShowAlwaysAsk | EShowDestinations | EShowConnectionMethods ); + } + //Check AP and snap if it is still not defined, set always ask mode this case + if ( (iRequestedAp == KWmlNoDefaultAccessPoint && iPreferences->AccessPointSelectionMode() == EConnectionMethod) || + (defaultSnap == KWmlNoDefaultSnapId && iPreferences->AccessPointSelectionMode() == EDestination) ) + { + BROWSER_LOG( ( _L( "AP or SNAP was not added set to Always ask mode" ) ) ); + iPreferences->SetAccessPointSelectionModeL(EAlwaysAsk ); + } + if ( iRequestedAp != KWmlNoDefaultAccessPoint ) + { + BROWSER_LOG( ( _L( "AP added" ) ) ); + IAPid = Util::IapIdFromWapIdL( *this, iRequestedAp ); // Get currently active ap + BROWSER_LOG( ( _L( "Access point: %d" ), IAPid ) ); + } + +#endif // BRDO_OCC_ENABLED_FF +#else //we can use any numbers here + // alr: snap on emulator should not exist; use cm mode instead? + iRequestedAp = 2; + TUint32 IAPid = 2; +#endif //__WINSCW__ + + err = KErrNone; + BROWSER_LOG( ( _L( "Load the URL" ) ) ); + + if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature()) + { + iSpecialSchemeinAddress = EFalse; + + HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr searchSchemePtr( searchScheme->Des() ); + ++toPop; + + HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr serviceSchemePtr( serviceScheme->Des() ); + ++toPop; + + iPreferences->GetStringValueL( KBrowserSearchProviderUrl, KMaxHomePgUrlLength, searchSchemePtr ); + iPreferences->GetStringValueL( KBrowserServiceUrl, KMaxHomePgUrlLength, serviceSchemePtr ); + + TInt err = uriParser.Parse(searchSchemePtr); + if (!err) + searchSchemePtr = uriParser.Extract( EUriScheme ); + + err = uriParser.Parse(serviceSchemePtr); + if (!err) + serviceSchemePtr = uriParser.Extract( EUriScheme ); + + + if( scheme.Length() != 0 && (!scheme.Compare(serviceSchemePtr) || !scheme.Compare(searchSchemePtr)) ) + { + iSpecialSchemeinAddress = ETrue; + TRAP( err, BrCtlInterface().LoadUrlL( resultUrlBuf->Des(), IAPid ) ); + } + else + { + LoadObserver().DoStartLoad( aUrlType ); + TRAP( err, BrCtlInterface().LoadUrlL( resultUrlBuf->Des(), IAPid ) ); + } + } + else + { + LoadObserver().DoStartLoad( aUrlType ); + BROWSER_LOG( ( _L( "PASSED IAP: %d" ), IAPid ) ); + TRAP( err, BrCtlInterface().LoadUrlL( resultUrlBuf->Des(), IAPid ) ); + } + + CleanupStack::PopAndDestroy(toPop); //resultUrlBuf and url if needed + BROWSER_LOG( ( _L( "No AP 4 %d" ), err ) ); + if ( err != KErrNone ) + { + CancelFetch(); + } + } + + BROWSER_LOG( ( _L( "Check the result" ) ) ); + switch ( err ) + { + case KErrNotFound: + { + (*(CBrowserBookmarksView*)View( KUidBrowserBookmarksViewId )).UpdateGotoPaneL(); + iCoeEnv->HandleError( KBrsrMalformedUrl ); + BROWSER_LOG( ( _L( "KErrNotFound" ) ) ); + break; + } + case KUriUtilsErrInvalidUri: // return value of TUriParser::Parse + { + (*(CBrowserBookmarksView*)View( KUidBrowserBookmarksViewId )).UpdateGotoPaneL(); + iCoeEnv->HandleError( KBrsrUnknownScheme ); + BROWSER_LOG( ( _L( "KUriUtilsErrInvalidUri" ) ) ); + break; + } + case KErrNone: + { + BROWSER_LOG( ( _L( "KErrNone" ) ) ); + ContentView()->ResetPreviousViewFlag(); + break; + } + case KErrCancel: + { + BROWSER_LOG( ( _L( "KErrCancel" ) ) ); + // do nothing, it is already cancelled by CancelFetch(). + break; + } + default: + { + BROWSER_LOG( ( _L( "default" ) ) ); + User::Leave( err ); // pass error code to caller + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ExitBrowser() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ExitBrowser( TBool aUserInitiated ) + { + LOG_ENTERFN("CBrowserAppUi::ExitBrowser"); + + TInt err( KErrNone ); + TBool isStandAlone = !IsEmbeddedModeOn(); + BROWSER_LOG( ( _L( " isStandAlone: %d" ), isStandAlone ) ); + + if(isStandAlone && aUserInitiated ) + { + if( iStartedUp && !BrCtlInterface().OkToExit() ) + { + return; + } + } + + //If launch with parameters is in progress, do not exit now + //as it can lead to synchronisation problems in embedded mode + if ( iParametrizedLaunchInProgress == 1 ) + { + BROWSER_LOG( ( _L( " iParametrizedLaunchInProgress" ) ) ); + return; + } + + // Operator feature - Display confirmation note on exit only if exit is initiated by user. + // Skip displaying exit confirmation if exit is initiated from fast swap window. + BROWSER_LOG( ( _L( " iPreferences: %d" ), iPreferences ) ); + if ( iPreferences->QueryOnExit() && aUserInitiated ) + { + BROWSER_LOG( ( _L( " iPreferences->QueryOnExit()" ) ) ); + TBool confirmdialog( EFalse ); + TRAP( err, confirmdialog = TBrowserDialogs::ConfirmQueryYesNoL( R_TEXT_WML_EXIT_CONFIRM ) ); + if ( !confirmdialog ) + { + return; + } + } + + //delete attacment from mailer if existing + CCoeEnv::Static()->FsSession().Delete( KAttachment() ); + + BROWSER_LOG( ( _L(" iConnection: %d"), iConnection ) ); + BROWSER_LOG( ( _L(" iExitFromEmbeddedMode: %d"), iExitFromEmbeddedMode ) ); + // if browser is embedded, should not call Exit(), + // just delete the object, otherwise leave occurs. + if( ( IsEmbeddedInOperatorMenu() || IsEmbeddedModeOn() ) && + !ExitInProgress() && iStartedUp && + ((LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl) || + (LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeOther) ) ) + // ELoadUrlTypeEmbeddedBrowserWithUrl is typical for load via Phonebook, MMS, OperatorMenu + // ELoadUrlTypeOther is typical via Media download since those are via GotoPane entered urls + { + // Simulate an escape key event in order to close any open resources (for example an open dialog) + TKeyEvent keyEvent; + keyEvent.iModifiers = 0; + keyEvent.iRepeats = 0; + keyEvent.iCode = EKeyEscape; + keyEvent.iScanCode = EStdKeyEscape; + TRAP_IGNORE(iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey )); + + // force not to load Exit() when next time call this function, + // just delete the object + SetExitFromEmbeddedMode( ETrue ); + SetExitInProgress( ETrue ); + BROWSER_LOG( ( _L( " iBrowserAsyncExit->Start()" ) ) ); + iBrowserAsyncExit->Start(); + } + else if( iExitFromEmbeddedMode ) + { + BROWSER_LOG( ( _L( " delete this;" ) ) ); + if ( iConnection ) + { + TRAP_IGNORE( SendDisconnectEventL() ); + iConnection->Disconnect(); +#ifdef __RSS_FEEDS + BROWSER_LOG( ( _L( " iFeedsClientUtilities->DisconnectFeedsViewL()" ) ) ); + if ( iFeedsClientUtilities ) + { + TRAP_IGNORE( iFeedsClientUtilities->DisconnectFeedsViewL() ); + //notify feeds engine to close the connection + TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() ); + } +#endif + } + if (iStartedUp && SpecialLoadObserver().IsConnectionStarted()) + { + BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) ); + iWindowManager->SetUserExit( iUserExit ); + delete iWindowManager; + BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) ); + User::Exit(KErrNone); + } + else + { + PrepareToExit(); + Exit(); + } + } + else + { + BROWSER_LOG( ( _L( " Exit()" ) ) ); + if ( iConnection ) + { + TRAP_IGNORE( SendDisconnectEventL() ); + iConnection->Disconnect(); +#ifdef __RSS_FEEDS + if ( iFeedsClientUtilities ) + { + BROWSER_LOG( ( _L( " iFeedsClientUtilities->DisconnectFeedsViewL()" ) ) ); + TRAP_IGNORE( iFeedsClientUtilities->DisconnectFeedsViewL() ); + //notify feeds engine to close the connection + TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() ); + } +#endif + } + if (iStartedUp && SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing calling CAknAppUI::Exit() causes crash (JSAA-84RG9R) + { + //ensure that the params are saved in BrCtl + if ( iWindowManager ) + { + BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) ); + iWindowManager->SetUserExit( iUserExit ); + } + delete iWindowManager; + BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) ); + User::Exit(KErrNone); + } + else + { + // normal exit + Exit(); + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::Display +// ----------------------------------------------------------------------------- +// +MDisplay& CBrowserAppUi::Display() const + { + CBrowserWindow *window = iWindowManager->CurrentWindow(); + __ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); + return window->Display(); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SoftkeysObserver() +// ----------------------------------------------------------------------------- +// +CBrowserSoftkeysObserver& CBrowserAppUi::SoftkeysObserver() const + { + CBrowserWindow *window = iWindowManager->CurrentWindow(); + __ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); + return window->SoftkeysObserver(); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CommsModel +// ----------------------------------------------------------------------------- +// +MCommsModel& CBrowserAppUi::CommsModel() const + { + __ASSERT_DEBUG( iCommsModel, + Util::Panic( Util::EUninitializedData ) ); + return *iCommsModel; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::Preferences +// ----------------------------------------------------------------------------- +// +MPreferences& CBrowserAppUi::Preferences() const + { + __ASSERT_DEBUG( iPreferences, + Util::Panic( Util::EUninitializedData ) ); + return *iPreferences; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::Connection +// ----------------------------------------------------------------------------- +// +MConnection& CBrowserAppUi::Connection() const + { + __ASSERT_DEBUG( iConnection, + Util::Panic( Util::EUninitializedData ) ); + return *iConnection; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::BrCtlInterface +// ----------------------------------------------------------------------------- +CBrCtlInterface& CBrowserAppUi::BrCtlInterface() const + { + CBrowserWindow *window = iWindowManager->CurrentWindow(); + __ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); + return window->BrCtlInterface(); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::LoadObserver +// ----------------------------------------------------------------------------- +// +CBrowserLoadObserver& CBrowserAppUi::LoadObserver() const + { + CBrowserWindow *window = iWindowManager->CurrentWindow(); + __ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); + return window->LoadObserver(); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SpecialLoadObserver +// ----------------------------------------------------------------------------- +// +CBrowserSpecialLoadObserver& CBrowserAppUi::SpecialLoadObserver() const + { + CBrowserWindow *window = iWindowManager->CurrentWindow(); + __ASSERT_DEBUG( window, Util::Panic( Util::EUninitializedData ) ); + return window->SpecialLoadObserver(); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::DialogsProvider +// ----------------------------------------------------------------------------- +// +CBrowserDialogsProvider& CBrowserAppUi::DialogsProvider() const + { + return *iDialogsProvider; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::PopupEngine +// ----------------------------------------------------------------------------- +// +CBrowserPopupEngine& CBrowserAppUi::PopupEngine() const + { + LOG_ENTERFN("CBrowserAppUi::PopupEngine"); + if(!iPopupEngine) + { + if ( Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) ) + { + iPopupEngine = CBrowserPopupEngine::NewL(); + BROWSER_LOG( ( _L( "PopupEngine up" ) ) ); + } + } + return *iPopupEngine; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::WindowMgr() +// ----------------------------------------------------------------------------- +// +CBrowserWindowManager& CBrowserAppUi::WindowMgr() const + { + return *iWindowManager; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::IsCancelFetchAllowed +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsCancelFetchAllowed() const + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::UpdateCbaL() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::UpdateCbaL() + { + if( ActiveView() ) + { + ActiveView()->UpdateCbaL(); + } + } + +void CBrowserAppUi::LogAccessToRecentUrlL( CBrCtlInterface& aBrCtlInterface ) + { + if ((ADAPTIVEBOOKMARKS)&&(!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff ))) + { + HBufC* url = aBrCtlInterface.PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + HBufC* name = aBrCtlInterface.PageInfoLC( TBrCtlDefs::EPageInfoTitle ); + if( url && url->Length() ) + { + // If url is same as the one in the store delete it because the url will be rewritten + // along with the name + iRecentUrlStore->DeleteData(*url); + + TInt index; + index = url->Des().LocateReverse(KSlash); + // If the only difference between the url in the store and the one we are writing is a "/" + // at the end of the url, delete the one in the store because it will be rewritten along + // with the name + if (index == url->Length()-1) + { + HBufC* urlwoslash = HBufC::NewLC( url->Length() ); + urlwoslash->Des().Copy( *url ); + urlwoslash->Des().Delete(url->Length() -1, 2); + + iRecentUrlStore->DeleteData(*urlwoslash); + + CleanupStack::PopAndDestroy(); //urlwoslash + } + + if (name && name->Length()) + { + iRecentUrlStore->SaveDataL(*url,*name); + } + else + { + if (url->Length() > KFavouritesMaxName) + { + // name will be the url but it needs to be compressed to fit max name length + HBufC* cname = HBufC::NewLC(KFavouritesMaxName); + TInt edgeStringLen = ((KFavouritesMaxName / 2) - 3); + TPtrC cnameRight( url->Right( edgeStringLen ) ); + TPtrC cnameLeft( url->Left( edgeStringLen )); + TPtr cnameDes = cname->Des(); + + cnameDes.Append( cnameLeft ); + cnameDes.AppendFill( TChar(KDot),5 ); // '.....' + cnameDes.Append( cnameRight ); + iRecentUrlStore->SaveDataL(*url,*cname); + CleanupStack::PopAndDestroy();//cname + } + else + { + iRecentUrlStore->SaveDataL(*url,*url); + } + } + } + CleanupStack().PopAndDestroy(2); // url, name + } + } + +void CBrowserAppUi::LogRequestedPageToRecentUrlL( const TDesC& aUrl ) + { + if ((ADAPTIVEBOOKMARKS)&&(!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff ))) + { + HBufC *url = HBufC::NewLC( aUrl.Length() ); + url->Des().Copy( aUrl ); + + if( url && url->Length() ) + { + if (url->Length() > KFavouritesMaxName) + { + // name will be the url but it needs to be compressed to fit max name length + HBufC* cname = HBufC::NewLC(KFavouritesMaxName); + TInt edgeStringLen = ((KFavouritesMaxName / 2) - 3); + TPtrC cnameRight( url->Right( edgeStringLen ) ); + TPtrC cnameLeft( url->Left( edgeStringLen )); + TPtr cnameDes = cname->Des(); + + cnameDes.Append( cnameLeft ); + cnameDes.AppendFill( TChar(KDot),5 ); // '.....' + cnameDes.Append( cnameRight ); + iRecentUrlStore->SaveDataL(*url,*cname); + CleanupStack::PopAndDestroy();//cname + } + else + { + iRecentUrlStore->SaveDataL(*url,*url); + } + } + CleanupStack().PopAndDestroy(); // url + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SwitchWindowL() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SwitchWindowL() + { +LOG_ENTERFN("CBrowserAppUi::SwitchWindowL"); + CArrayFixFlat* windowBuf = iWindowManager->GetWindowInfoL( this ); + CleanupStack::PushL( windowBuf ); + + // Open 'Switch Window' selection dialog + HBufC* title = StringLoader::LoadLC( R_BROWSER_SWITCH_WINDOW_HEADER ); + + CArrayFixFlat* optDataArray = new ( ELeave ) + CArrayFixFlat( KGranularityMedium ); + CleanupStack::PushL( optDataArray ); + + TInt i( 0 ); + TInt numWindows = windowBuf->Count(); + +LOG_WRITE_FORMAT("Window's count: %d", numWindows ); + for ( i = 0; i < numWindows; ++i ) + { + TBrCtlSelectOptionData optData( *((*windowBuf)[i]->iWindowText), + (*windowBuf)[i]->iCurrent, + EFalse, + EFalse ); + optDataArray->AppendL( optData ); + } + + TBool ret = DialogsProvider().DialogSelectOptionL( *title, + ESelectTypeSingle, + *optDataArray ); + if ( ret ) + { + for( i = 0; i < numWindows; ++i) + { + if( (*optDataArray)[i].IsSelected() ) + { + LOG_WRITE_FORMAT("Selected window: %d", (*windowBuf)[i]->iWindowId ); + iWindowManager->SwitchWindowL( (*windowBuf)[i]->iWindowId ); + break; + } + } + } + CleanupStack::PopAndDestroy( 3 ); // optDataArray, title, windowBuf + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SetCalledFromAnotherApp +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetCalledFromAnotherApp( TBool aValue ) + { + iCalledFromAnotherApp = aValue; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CalledFromAnotherApp +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::CalledFromAnotherApp() + { + return iCalledFromAnotherApp; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::NoHomePageToBeLaunchedL +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::NoHomePageToBeLaunchedL() + { + LOG_ENTERFN("CBrowserAppUi::NoHomePageToBeLaunchedL"); + TWmlSettingsHomePage pgtype = iPreferences->HomePageType(); + TBool alwaysAskCase = (( Preferences().AccessPointSelectionMode() == EAlwaysAsk ) && + ( EWmlSettingsHomePageAccessPoint == pgtype )); + BROWSER_LOG( ( _L( "pgtype: %d, alwaysAsk: %d" ), pgtype, alwaysAskCase ) ); + + if( ( pgtype == EWmlSettingsHomePageBookmarks ) || alwaysAskCase ) + { // Can't load home page since set to Bookmarks or (AlwaysAsk AP and homepage set to AP homepage) + return ETrue; + } + else + { + // now check for other cases where homepage string might be defined and will be used + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr ptr( buf->Des() ); + TInt pgFound = Preferences().HomePageUrlL( ptr ); + CleanupStack::PopAndDestroy( buf ); + if (pgFound != KErrNone) + { // no homepage string found + return ETrue; + } + else + { // homepage string was found + return EFalse; + } + } + } + +// CBrowserAppUi::ProcessCommandParametersL() +// ----------------------------------------------------------------------------- +// +TBool CBrowserAppUi::ProcessCommandParametersL( TApaCommand aCommand, + TFileName& /*aDocumentName*/ , + const TDesC8& /*aTail*/ ) + { + LOG_ENTERFN("CBrowserAppUi::ProcessCommandParametersL"); + LOG_WRITE_FORMAT(" aCommand: %d", aCommand); + + // The browser is in embedded mode and it is not initialized yet + if ( IsEmbeddedModeOn() && !iStartedUp) + { + EnableLocalScreenClearer( EFalse ); + return EFalse; + } + + if ( aCommand == EApaCommandOpen ) + { + //Startup parameters are given to browser at CBrowserAppDocument::OpenFileL(). + //- a part of shell starting (ConstructAppFromCommandLineL calls OpenFileL) + } + + else if ( aCommand == EApaCommandRun ) + { + + if ( LastActiveViewId() == KUidBrowserNullViewId ) + { + TBool specialSchemeInHomePageAddress = EFalse; + + if (NoHomePageToBeLaunchedL()) + { + // No homepage to be launched so start browser in bookmarks view + SetLastActiveViewId(KUidBrowserBookmarksViewId); + } + else if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature()) + { + + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr ptr( buf->Des() ); + TInt pgFound( KErrNotFound ); + pgFound = Preferences().HomePageUrlL( ptr ); + HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr searchSchemePtr( searchScheme->Des() ); + + HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr serviceSchemePtr( serviceScheme->Des() ); + + iPreferences->GetStringValueL( KBrowserSearchProviderUrl, KMaxHomePgUrlLength, searchSchemePtr ); + iPreferences->GetStringValueL( KBrowserServiceUrl, KMaxHomePgUrlLength, serviceSchemePtr ); + + + if( !ptr.Compare(serviceSchemePtr) || !ptr.Compare(searchSchemePtr) ) + { + specialSchemeInHomePageAddress = ETrue; + SetLastActiveViewId(KUidBrowserBookmarksViewId); + SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId, 0); + TRAPD( err, FetchL( ptr, CBrowserLoadObserver::ELoadUrlTypeOther ) ); + } + else + { + SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId, 0); + StartFetchHomePageL(); + } + CleanupStack::PopAndDestroy( 3,buf ); + } + else + { + SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId, 0); + StartFetchHomePageL(); + } + + if( !specialSchemeInHomePageAddress ) + { + if( iCurrentView != iLastViewId ) + ActivateLocalViewL( LastActiveViewId() ); + } + } + } + else if ( aCommand == EApaCommandViewActivate ) + // Get when activated from soft notification (Downloads List). + // Must behave as in case of EApaCommandOpen, but no OpenFileL() is called. + { + ParseAndProcessParametersL( KNullDesC8 ); + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::Static() +// ----------------------------------------------------------------------------- +// +CBrowserAppUi* CBrowserAppUi::Static() + { + return REINTERPRET_CAST( CBrowserAppUi*, CEikonEnv::Static()->EikAppUi() ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ParseAndProcessParametersL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ParseAndProcessParametersL( const TDesC8& aDocumentName, TBool aDoFetch ) + { + LOG_ENTERFN("CBrowserAppUi::ParseAndProcessParametersL"); + TInt err = KErrNone; + + TUid ViewToActivate = { 0 }; + + HBufC8* params = NULL; + TLex8 parameter(aDocumentName); + + // Here we check if the url contains control characters. + TBool urlError( EFalse ); // If there is a Control caracter in the url. + parameter.Mark(); // Save the start position in the string. + while ( !parameter.Eos() && !urlError ) + { + if ( parameter.Get().IsControl() ) + { + urlError = ETrue; + } + } + parameter.UnGetToMark(); // Now go back to the beginning of the string. + + //Check for parameter validity + if( !parameter.Peek().IsDigit() || urlError ) //First char of aDocumentName is NOT a digit + { + if( ( aDocumentName.Locate( ':' ) > 0) && (!urlError) ) //There is a ":" character in aDocumentName (->probably a valid url) + { + //Add "4" + before the given parameter to make the parameter legal for url launch + _LIT8(KUrlId, "4 "); + params = HBufC8::NewL(aDocumentName.Length() + 2 + 1); + params->Des().Copy( KUrlId ); + params->Des().Append(aDocumentName); + params->Des().ZeroTerminate(); + ViewToActivate = KUidBrowserContentViewId; + } + else + { + //Activate bookmarks view if parameters are invalid and browser is not embedded. + // In embedded mode bookmarks are not shown, so if there is an + // error in the url, we make the browser to pop up a + // "Page not found" note, by defining a not existing url. + if ( IsEmbeddedModeOn() ) + { + params = HBufC8::NewL( 10 ); + params->Des().Copy(_L8("4 http://") ); + } + else + { + params = HBufC8::NewL(aDocumentName.Length() + 1 ); + params->Des().Copy(aDocumentName); + } + params->Des().ZeroTerminate(); + ViewToActivate = KUidBrowserBookmarksViewId; + } + } + else + { + params = HBufC8::NewL(aDocumentName.Length() + 1); + params->Des().Copy(aDocumentName); + params->Des().ZeroTerminate(); + ViewToActivate = KUidBrowserContentViewId; + } + CleanupStack::PushL( params ); + + //Set view to activate if no view yet activated + if ( LastActiveViewId() == KUidBrowserNullViewId ) + { + SetLastActiveViewId(ViewToActivate); + } + + CBrowserCommandLineParser8* command = CBrowserCommandLineParser8::NewL( *params ); + CleanupStack::PopAndDestroy( params ); + CleanupStack::PushL( command ); + + + // complete the delayed initialization if bookmarks view is not the first view + if(ViewToActivate != KUidBrowserBookmarksViewId && !iStartedUp) + CompleteDelayedInit(); + + //wait a while, contentview initializing itself + WaitCVInit(); + switch ( command->Count() ) + { + case 0: + { + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + break; + } + case 1: + { + if ( !aDocumentName.Compare( KLongZeroIdString ) ) + { + // Long 0 is pressed and Browser is started up for the first time... + // if no AP or SNAP is defined, define it + TUint32 defaultAp = iPreferences->DefaultAccessPoint(); + TUint32 defaultSnap = iPreferences->DefaultSnapId(); + // AP or SNAP is not defined + if( (defaultAp == KWmlNoDefaultAccessPoint && iPreferences->AccessPointSelectionMode() == EConnectionMethod) || + (defaultSnap == KWmlNoDefaultSnapId && iPreferences->AccessPointSelectionMode() == EDestination) ) + { + StartPreferencesViewL( EShowAlwaysAsk | EShowDestinations | EShowConnectionMethods ); + } + // If there is a homepage url then try to fetch it + if ( !NoHomePageToBeLaunchedL() ) + { + iLongZeroPressed = ETrue; + FetchHomePageL(); + } + else + { + if (iStartedUp) + ContentView()->SetFullScreenOffL(); + + if ( !IsEmbeddedModeOn() ) + { + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + } + } + } + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + break; + } + case 2: + case 3: + { + // UID and wml adress and optional access point UID + + TUint typeId; + TInt dataId; + TLex8 param0( command->Param( 0 ) ); + TLex8 param1( command->Param( 1 ) ); + err = param0.Val( typeId ); + if ( !err ) + { + BROWSER_LOG( ( _L( " typeId: %d" ), typeId ) ); + + if ( typeId == KUrlId ) + { // FIX THIS! + TUriParser8 uri8; + err = uri8.Parse(command->Param(1)); // what if parsing fails? + User::LeaveIfError(err); + // Url decoding section was removed from here. + HBufC* url = HBufC::NewL(command->Param(1).Length()+1); + url->Des().Copy( command->Param(1) ); + CleanupStack::PushL(url); + BROWSER_LOG( ( _L( " url: %S" ), url ) ); + + TFavouritesWapAp accessPoint; // Initially "default". + BROWSER_LOG( ( _L( " Count: %d" ), command->Count() ) ); + if ( command->Count() == 3 ) + { + // URL Typeid, url, ap + TUint ap; + TLex8 param2( command->Param( 2 ) ); + err = param2.Val( ap ); + if ( !err ) + { + BROWSER_LOG( ( _L( " ap: %d" ), ap ) ); + if (iSuppressAlwaysAsk) + { + // Always ask was temporarily disabled, enable it again + iPreferences->SetAccessPointSelectionModeL(EAlwaysAsk); + + iSuppressAlwaysAsk = EFalse; + } + + // Note: OTA Provisioning application requires the + // KBrowserAccessPointSelectionMode key value to be + // read directly from cenrep, rather than use the + // cached cenrep value taken at browser initialization + // time. + TInt selectionMode; + + CRepository* repository = CRepository::NewLC( KCRUidBrowser ); + User::LeaveIfError( repository->Get( KBrowserAccessPointSelectionMode, selectionMode ) ); + CleanupStack::PopAndDestroy( repository ); + + // If selectionMode cenrep value is always ask, then + // temporarily change selection mode + if ( EBrowserCenRepApSelModeAlwaysAsk == selectionMode ) + { + iSuppressAlwaysAsk = ETrue; + iPreferences->SetAccessPointSelectionModeL(EConnectionMethod); + } + accessPoint.SetApId( ap ); + SetCalledFromAnotherApp( ETrue ); + CBrowserLoadObserver::TBrowserLoadUrlType urlType = + IsEmbeddedModeOn() ? + CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl : + CBrowserLoadObserver::ELoadUrlTypeOther; + if( IsPageLoaded() && + !(WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) && + Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + !Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) + { + // Cancel history view, mini map, toolbar or any other active control on the current window + BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); + // there is already a window, so create a new one + CBrowserWindow *win = WindowMgr().CreateWindowL( 0, &KNullDesC ); + if (win != NULL) + { + + CleanupStack::PushL( win ); + WindowMgr().SwitchWindowL( win->WindowId() ); + TRAP( err, FetchL( *url, + KNullDesC, + KNullDesC, + accessPoint, + urlType ) ); + CleanupStack::Pop(); // win + SetLastActiveViewId( KUidBrowserContentViewId ); + } + } + else + { + // Cancel history view, mini map, toolbar or any other active control on the current window + if (iStartedUp) + BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); + TRAP( err, FetchL( *url, + KNullDesC, + KNullDesC, + accessPoint, + urlType ) ); + SetLastActiveViewId( KUidBrowserContentViewId ); + } + } + } + else + { + // URL Typeid, url + SetCalledFromAnotherApp( ETrue ); + + if ( aDoFetch ) + { + CBrowserLoadObserver::TBrowserLoadUrlType urlType = + IsEmbeddedModeOn() ? + CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl : + CBrowserLoadObserver::ELoadUrlTypeOther; + if( IsPageLoaded() && + !(WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) && + Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + !Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) + { + // Cancel history view, mini map, toolbar or any other active control on the current window + BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); + // there is already a window, so create a new one + CBrowserWindow *win = NULL; + if(WindowMgr().CurrentWindow()) + { + if(iSameWinApp) + { + //We will be using same/already opened window if call is from external + //application. So no new windows will be opened. + win = WindowMgr().CurrentWindow(); + iWindowIdFromFromExternApp = win->WindowId(); + } + if(!win) + { + //If not called from external app, then create window. + win = WindowMgr().CreateWindowL( (WindowMgr().CurrentWindow()->WindowId()) ? WindowMgr().CurrentWindow()->WindowId() : 0, &KNullDesC ); + } + } + else + win = WindowMgr().CreateWindowL( 0, &KNullDesC ); + if (win != NULL) + { + + CleanupStack::PushL( win ); + WindowMgr().SwitchWindowL( win->WindowId() ); + TRAP( err, FetchL( *url, + KNullDesC, + KNullDesC, + accessPoint, + urlType ) ); + CleanupStack::Pop(); // win + } + } + else + { + // Cancel history view, mini map, toolbar or any other active control on the current window + if (iStartedUp) + BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); + TRAP( err, FetchL( *url, + KNullDesC, + KNullDesC, + accessPoint, + urlType ) ); + } + } + if (err==KErrNone) + { + SetLastActiveViewId(ViewToActivate); + } + } + CleanupStack::PopAndDestroy(); // url + } + else if( typeId == KLaunchFeeds ) + { + // Special facility to launch non-embedded into the feeds view + if( !iBrowserAlreadyRunning ) + { + SetOverriddenLaunchContextId(EBrowserContextIdFeeds); + SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); + } + LaunchIntoFeedsL(); + } + else + { + err = param1.Val( dataId ); + if ( !err ) + { + switch ( typeId ) + { + case KBookmarkId: + { + // Bookmark typeid, uid + SetCalledFromAnotherApp( ETrue ); + + if( IsPageLoaded() && + !(WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) && + Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + !Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) + { + // Cancel history view, mini map, toolbar or any other active control on the current window + BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); + // there is already a window, so create a new one + CBrowserWindow *win = WindowMgr().CreateWindowL( 0, &KNullDesC ); + if (win != NULL) + { + CleanupStack::PushL( win ); + WindowMgr().SwitchWindowL( win->WindowId() ); + TRAP( err, FetchBookmarkL( dataId ) ); + CleanupStack::Pop(); // win + } + } + else + { + // Cancel history view, mini map, toolbar or any other active control on the current window + if (iStartedUp) + BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase ); + TRAP( err, FetchBookmarkL( dataId ) ); + } + + if ( err ) + { + // Unable to fetch bookmark + TBrowserDialogs::InfoNoteL( + R_BROWSER_INFO_NOTE, R_WML_UNABLE_TO_FETCH_BOOKMARK ); + } + if (err==KErrNone) + { + SetLastActiveViewId(ViewToActivate); + } + + break; + } + case KFolderId: + { + SetCalledFromAnotherApp( EFalse ); + iIsForeground = IsForeground(); + CloseContentViewL(); + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + break; + } + default: + { + // Typeid was not readable + // TBD: error message! + break; + } + } + } + else + { + // Dataid was not readable + User::Leave( err ); + } + } + } + else + { + // Sender Uid was not readable + User::Leave( err ); + } + if( !iSpecialSchemeinAddress ) + { + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + } + break; + } + + default: + { + SendBrowserToBackground(); + break; + } + } + CleanupStack::PopAndDestroy(); // command + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::WaitCVInit +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::WaitCVInit() + { + if( iParametrizedLaunchInProgress == 0 && iStartedUp) + { + iParametrizedLaunchInProgress = 1; + iIdle->Cancel(); + iIdle->Start( TCallBack( StopDelay, this ) ); + iWait.Start(); + iParametrizedLaunchInProgress = 2; + } + } +void CBrowserAppUi::StopConnectionObserving() + { + LOG_ENTERFN("CBrowserAppUi::StopConnectionObserving"); + if ( iConnStageNotifier && iConnStageNotifier->IsActive() ) + { + BROWSER_LOG( ( _L( " CBrowserAppUi::StopConnectionObserving Cancelling Observer" ) ) ); + iConnStageNotifier->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ConnNeededStatusL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ConnNeededStatusL( TInt aErr ) + { + LOG_ENTERFN("CBrowserAppUi::ConnNeededStatusL"); + UpdateSoftKeys(); + if (iSuppressAlwaysAsk) + { + // Always ask was temporarily disabled, after creating the network connection, enable it again + iPreferences->SetAccessPointSelectionModeL(EAlwaysAsk); + iSuppressAlwaysAsk = EFalse; + } + if ( aErr != KErrNone ) + { + if( iCalledFromAnotherApp ) + { + // This function call should be replaced by ExitBrowser(ETrue) + // so that the blank content view is not displayed. + // SendBrowserToBackground(); + } + // if any error, return Cancel to Kimono. + return; + } + + BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL First Stop Connection Observer" ) ) ); + StopConnectionObserving(); //Need to stop the connection observer first + + + if ( !iConnStageNotifier->IsActive() ) + { + BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL Starting Connection Observer" ) ) ); + TName* connectionName = Connection().ConnectionNameL(); + CleanupStack::PushL( connectionName ); + + iConnStageNotifier->StartNotificationL(connectionName, KLinkLayerClosed, this); + + CleanupStack::PopAndDestroy(); //connectionName + } + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SendBrowserToBackground +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SendBrowserToBackground() + { + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + + // Browser might be embedded. + TUid appUid; + if ( iEmbeddingApplicationUid != KNullUid ) + { + appUid = iEmbeddingApplicationUid; + } + else + { + appUid = KUidBrowserApplication; + } + TApaTask task = taskList.FindApp( appUid ); + task.SendToBackground(); + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CreateWindowInfoLC() +// ----------------------------------------------------------------------------- +// +HBufC* CBrowserAppUi::CreateWindowInfoLC( const CBrowserWindow& aWindow ) + { + HBufC* buf = aWindow.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoTitle ); + if( !buf || !buf->Length() ) + { + CleanupStack::PopAndDestroy( buf ); + buf = aWindow.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( !buf ) + { + + CleanupStack::PopAndDestroy( buf ); + buf = KNullDesC().AllocLC(); + } + } + return buf; + } + +#ifdef BRDO_OCC_ENABLED_FF +// ----------------------------------------------------------------------------- +// CBrowserContentView::SetRetryFlag +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SetRetryFlag(TBool flag) + { + LOG_ENTERFN("CBrowserAppUi::SetRetryFlag"); + BROWSER_LOG( ( _L(" CBrowserAppUi::SetRetryFlag flag: %d"), flag ) ); + reConnectivityFlag = flag; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::GetRetryFlag +// ----------------------------------------------------------------------------- +// + TBool CBrowserAppUi::GetRetryFlag() + { + LOG_ENTERFN("CBrowserAppUi::GetRetryFlag"); + BROWSER_LOG( ( _L(" CBrowserAppUi::GetRetryFlag flag: %d"), reConnectivityFlag ) ); + return reConnectivityFlag; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::RetryConnectivity +// ----------------------------------------------------------------------------- +// +TInt CBrowserAppUi::RetryConnectivity(TAny* aCBrowserAppUi) + { + LOG_ENTERFN("CBrowserAppUi::RetryConnectivity"); + __ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData )); + + TInt err = ((CBrowserAppUi*)aCBrowserAppUi)->RetryInternetConnection(); + + BROWSER_LOG( ( _L(" CBrowserAppUi::RetryConnectivity Error: %d"), err ) ); + return err; + } + +TInt CBrowserAppUi::RetryInternetConnection() + { + LOG_ENTERFN("CBrowserAppUi::RetryInternetConnection"); + //First cancel the timer + if ( iRetryConnectivity && iRetryConnectivity->IsActive() ) + { + iRetryConnectivity->Cancel(); + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Timer Cancelled successfully " ) ) ); + } + TInt err = KErrNone; + if ( !iConnection->Connected() ) + { + TRAP_IGNORE( err = iConnection->StartConnectionL( ETrue ) ); + } + if( err == KErrNone ) + { + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Connection restablished successfully " ) ) ); + + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection UNSET retry flags " ) ) ); + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); + SetRetryFlag(EFalse); + + TRAP_IGNORE(ConnNeededStatusL(err)); //Start the observer again + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandRetryTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); + //Let download manager knows about this new connection + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandConnToDownloadManager + (TInt)TBrCtlDefs::ECommandIdBase ) ); + } + else + { + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Connection failed " ) ) ); + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection unset retry flags " ) ) ); + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); + SetRetryFlag(EFalse); + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection clear queued transactions " ) ) ); + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearQuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); + Display().StopProgressAnimationL(); //Stop Progress animation + if ( Fetching() ) + { + BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection cancel fetch " ) ) ); + CancelFetch(); + } + iDialogsProvider->UploadProgressNoteL(0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); //Close the uploading dialog. + iDialogsProvider->CancelAll(); //connection has been lost, so cancel the authentication dialog. + } + + return err; + } + +void CBrowserAppUi::CheckOccConnectionStage() + { + LOG_ENTERFN("CBrowserAppUi::CheckOccConnectionStage"); + + //Disconnect first + BROWSER_LOG( ( _L( "CBrowserAppUi::CheckOccConnectionStage Disconnecting..." ) ) ); + iConnection->Disconnect(); + + TNifProgressBuf buf = iConnStageNotifier->GetProgressBuffer(); + if( buf().iError == KErrDisconnected ) + { + BROWSER_LOG( ( _L("CBrowserAppUi::CheckOccConnectionStage This is OCC roaming error : %d"), buf().iError ) ); + BROWSER_LOG( ( _L( "CBrowserAppUi::CheckOccConnectionStage Set retry flags " ) ) ); + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); + SetRetryFlag(ETrue); + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); + + if( iRetryConnectivity && iRetryConnectivity->IsActive()) + { + iRetryConnectivity->Cancel(); + } + iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this)); + } + else + { + BROWSER_LOG( ( _L("CBrowserAppUi::CheckOccConnectionStage This is NOT OCC roaming error : %d"), buf().iError ) ); + Display().StopProgressAnimationL(); + if ( Fetching() ) + { + CancelFetch(); + } + iDialogsProvider->UploadProgressNoteL(0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); + iDialogsProvider->CancelAll(); + } + } +#endif + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ConnectionStageAchievedL() +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ConnectionStageAchievedL() + { +#ifdef BRDO_OCC_ENABLED_FF + LOG_ENTERFN("CBrowserAppUi::ConnectionStageAchievedL"); + CheckOccConnectionStage(); +#else + // this function is called only when network is lost + // because we set notifier for KAgentUnconnected only + Display().StopProgressAnimationL(); + if ( Fetching() ) + { + CancelFetch(); + } + //Close the uploading dialog. + iDialogsProvider->UploadProgressNoteL( + 0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); + //connection has been lost, so cancel the authentication dialog. + iDialogsProvider->CancelAll(); + // SendDisconnectEventL(); + // not needed as by that point HTTPSession was already shutdown by executing disconnect menu option + // will cause a crash when user tries to quickly reconnect right after disconnecting, as HTTP session + // is starting to initialize, while this call is trying to close it. +#endif + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::UpdateSoftKeys +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::UpdateSoftKeys() + { + TRAP_IGNORE( UpdateCbaL() ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::DeleteCookiesL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::DeleteCookiesL() + { + // stringPool is not needed to initialize + RStringPool stringPool; + RCookieManager cookieManager( stringPool ); + TInt num(0); + + User::LeaveIfError( cookieManager.Connect() ); + CleanupClosePushL( cookieManager ); + User::LeaveIfError( cookieManager.ClearCookies( num ) ); + CleanupStack::PopAndDestroy( &cookieManager ); + + stringPool.Close(); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::LaunchHomePageL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::LaunchHomePageL() + { + LOG_ENTERFN( "CBrowserAppUi::LaunchHomePageL" ); + TWmlSettingsHomePage pgtype = iPreferences->HomePageType(); + TBool alwaysAskCase = (( Preferences().AccessPointSelectionMode() == EAlwaysAsk ) && + ( EWmlSettingsHomePageAccessPoint == pgtype )); + BROWSER_LOG( ( _L( "pgtype: %d, alwaysAsk: %d" ), pgtype, alwaysAskCase ) ); + + if( ( pgtype == EWmlSettingsHomePageBookmarks ) || alwaysAskCase ) + // Bookmarks is selected as HomePage + // has effect only for startup, otherwise 'Home' command is not shown + { + ContentView()->SetFullScreenOffL(); + // view change will be done somewhere else + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + return; + } + + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr ptr( buf->Des() ); + TInt pgFound( KErrNotFound ); + + pgFound = Preferences().HomePageUrlL( ptr ); + BROWSER_LOG( ( _L( "pgFound 1: %d" ), pgFound ) ); + + + if( pgFound == KErrNone ) // Home page url found, fetch the url + { + SetLastActiveViewId( KUidBrowserContentViewId ); + FetchL( ptr ); + } + else // Home page not found, or not defined, go to BookMarksView + { + TVwsViewId activeViewId; + if( ( GetActiveViewId( activeViewId ) != KErrNone ) || + ( activeViewId.iViewUid == KUidBrowserContentViewId ) ) + { + ContentView()->SetFullScreenOffL(); + } + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + } + CleanupStack::PopAndDestroy( buf ); + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ClearTheCacheL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::ClearTheCacheL(TBool afterQuery, TBool aShowDoneNote) + { + TUint32 totalBytesFlushed = BrCtlInterface().ClearCache(); + if(afterQuery || totalBytesFlushed) + { + + HBufC* resultText = NULL; + HBufC* tempText = NULL; + TBuf<12> totalText; + + totalText.Num ((TInt)totalBytesFlushed); + + resultText = StringLoader::LoadLC( R_TEXT_WML_CACHE_EMPTIED_NOTE); + //CleanupStack::PushL(resultText); + tempText = HBufC::NewLC( resultText->Length() + totalText.Length() ); + //CleanupStack::PushL(tempText); + + tempText->Des().AppendFormat( resultText->Des(), totalBytesFlushed ); + + + + if(aShowDoneNote) + { + TBrowserDialogs::InfoNoteL ( R_BROWSER_OK_NOTE, tempText->Des() ); + } + CleanupStack::PopAndDestroy(2); //resultText, tempText + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::ClearFormAndPasswdDataL +// --------------------------------------------------------- +// +void CBrowserAppUi::ClearFormAndPasswdDataL(TBool aShowPromptAndComplete) + { + if (aShowPromptAndComplete) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + if ( query->ExecuteLD( R_BROWSER_CLEARFORMPASSWDDATA_QUERY ) ) + { + // call brctl to clear form and password data + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillData + + (TInt)TBrCtlDefs::ECommandIdBase ); + + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData + + (TInt)TBrCtlDefs::ECommandIdBase ); + + TBrowserDialogs::InfoNoteL( + R_BROWSER_OK_NOTE, R_QTN_BROWSER_NOTE_FORM_AND_PASSWD_DATA_CLEARED ); + } + + } + else + { + // call brctl to clear form and password data + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillData + + (TInt)TBrCtlDefs::ECommandIdBase ); + + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData + + (TInt)TBrCtlDefs::ECommandIdBase ); + + } + } + + +// --------------------------------------------------------- +// CBrowserAppUi::ClearHistoryWithPromptL +// --------------------------------------------------------- +// +void CBrowserAppUi::ClearHistoryWithPromptL() + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + + if ( query->ExecuteLD( R_BROWSER_CLEARHISTORYDATA_QUERY ) ) + { + ClearHistoryL(); + TBrowserDialogs::InfoNoteL( R_BROWSER_OK_NOTE, + R_QTN_BROWSER_NOTE_HISTORY_CLEARED ); + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::ClearHistoryL +// --------------------------------------------------------- +// +void CBrowserAppUi::ClearHistoryL() + { + if (iWindowManager) + { + iWindowManager->SendCommandToAllWindowsL( + (TInt)TBrCtlDefs::ECommandClearHistory + (TInt)TBrCtlDefs::ECommandIdBase); + } + + if (!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff )) + { + // This call will ensure that the bookmarks are cleared when we are + // outside the bookmarksview since the next call doesn't do anything in + // that case due to the unset Container pointer. + iRecentUrlStore->ClearData(); + + // Below will serve for when we are called from BookmarksView to ensure + // thorough clearing and view refresh after clearing adapt bookmarks + iBookmarksView->HandleCommandL(EWmlCmdClearAdaptiveBookmarksNoPrompt); + } + + UpdateCbaL(); + + } + +// --------------------------------------------------------- +// CBrowserAppUi::ClearAllPrivacyL +// --------------------------------------------------------- +// +void CBrowserAppUi::ClearAllPrivacyL() + { + + CAknQueryDialog* query = CAknQueryDialog::NewL(); + if ( query->ExecuteLD( R_BROWSER_CLEARPRIVACYDATA_QUERY ) ) + { + ClearTheCacheL(EFalse, EFalse); // false -> no prompt or info note after op + DeleteCookiesL(); + ClearHistoryL(); + ClearFormAndPasswdDataL(EFalse); // no prompt or completed info note + + TBrowserDialogs::InfoNoteL( + R_BROWSER_OK_NOTE, R_QTN_BROWSER_NOTE_CLEAR_ALL_PRIVACY_DONE ); + } + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::DisconnectL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::DisconnectL() + { +//#pragma message("TODO: inform LoadObserver?") + SendDisconnectEventL(); + Connection().Disconnect(); + +#ifdef __RSS_FEEDS + iFeedsClientUtilities->DisconnectFeedsViewL(); + //notify feeds engine to close the connection + iFeedsClientUtilities->DisconnectManualUpdateConnectionL(); +#endif + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::BmOTABinSenderL() +// ----------------------------------------------------------------------------- +// +MBmOTABinSender& CBrowserAppUi::BmOTABinSenderL() + { + if (!iSender) + { + iLateSendUi->Cancel(); + DoConstructSendUiL(); + } + return *iSender; + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::ContentView() +// ----------------------------------------------------------------------------- +// +CBrowserContentView* CBrowserAppUi::ContentView() const + { + return (CBrowserContentView*)View( KUidBrowserContentViewId ); + } + + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::FetchL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::FetchL( const TDesC& aUrl, CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ) + { + TFavouritesWapAp ap; + ap.SetDefault(); + FetchL( aUrl, KNullDesC, KNullDesC, ap, aUrlType ); + } + +// TO DO: done by BaP +// ----------------------------------------------------------------------------- +// CBrowserAppUi::CancelFetch +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::CancelFetch( TBool aIsUserInitiated /*= EFalse*/ ) + { + LoadObserver().DoEndLoad( aIsUserInitiated ); + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); + SetContentDisplayed(ETrue); + } + + +// ---------------------------------------------------------------------------------------- +// CBrowserAppUi::HandleMessageL +// +// Changes the URL to another if WAP is running before Wap Url +// is started from Desk +// ---------------------------------------------------------------------------------------- +// +MCoeMessageObserver::TMessageResponse CBrowserAppUi::HandleMessageL( + TUint32 aClientHandleOfTargetWindowGroup, + TUid aMessageUid, + const TDesC8& aMessageParameters ) + { + iBrowserAlreadyRunning = ETrue; + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + TUid wapUid = KUidBrowserApplication; + TApaTask task = taskList.FindApp( wapUid ); + task.BringToForeground(); + //Check for aMessageUid. If it is in array then set iSameWinApp = ETrue + iSameWinApp = IsSameWinApp(aMessageUid); + if ( aMessageParameters.Compare( KLongZeroIdString ) ) + { + ParseAndProcessParametersL( aMessageParameters ); + } + return CAknViewAppUi::HandleMessageL( + aClientHandleOfTargetWindowGroup, + aMessageUid, + aMessageParameters); + } + +// ---------------------------------------------------------------------------------- +// CBrowserAppUi::UpdateNaviPaneL +// ---------------------------------------------------------------------------------- +// +void CBrowserAppUi::UpdateNaviPaneL( TDesC& aStatusMsg ) + { + ContentView()->UpdateNaviPaneL( aStatusMsg ); + } + +// ---------------------------------------------------------------------------------- +// CBrowserAppUi::StopDelay +// ---------------------------------------------------------------------------------- +// +TInt CBrowserAppUi::StopDelay( TAny* aCBrowserAppUi ) + { + __ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData )); + + ((CBrowserAppUi*)aCBrowserAppUi)->DoStopDelay(); + return 0; + } + + +// ---------------------------------------------------------------------------------- +// CBrowserAppUi::DoStopDelay +// ---------------------------------------------------------------------------------- +// +void CBrowserAppUi::DoStopDelay() + { + iWait.AsyncStop(); + } + +// ---------------------------------------------------------------------------------- +// CBrowserAppUi::DelayedSendUiConstructL +// ---------------------------------------------------------------------------------- +// +/*static*/ TInt CBrowserAppUi::DelayedSendUiConstructL( TAny* aCBrowserAppUi ) + { + __ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData )); + TRAP_IGNORE( + ((CBrowserAppUi*)aCBrowserAppUi)->DoConstructSendUiL(); + ); + return KErrNone; + } + + +// ---------------------------------------------------------------------------------- +// CBrowserAppUi::DoConstructSendUiL +// ---------------------------------------------------------------------------------- +// +void CBrowserAppUi::DoConstructSendUiL() + { + __ASSERT_DEBUG(!iSender, Util::Panic( Util::EUnExpected )); + iSender = CWmlBrowserBmOTABinSender::NewL(); + } + +// ----------------------------------------------------------------------------------- +// CBrowserAppUi::SetViewToReturnOnClose +// ----------------------------------------------------------------------------------- +// +void CBrowserAppUi::SetViewToReturnOnClose( TUid const &aUid ) + { + iViewToReturnOnClose.iUid = aUid.iUid; + } + +// ----------------------------------------------------------------------------------- +// CBrowserAppUi::CloseContentViewL +// ----------------------------------------------------------------------------------- +// +void CBrowserAppUi::CloseContentViewL() + { +LOG_ENTERFN("CBrowserAppUi::CloseContentViewL"); + CBrowserAppDocument* doc = STATIC_CAST(CBrowserAppDocument*, Document()); + + // Close should Exit asynchronously if called from another application + // & if not in feeds view +#ifdef __RSS_FEEDS + if(CalledFromAnotherApp() && (!IsEmbeddedModeOn()) + && (GetPreviousViewFromViewHistory() != KUidBrowserFeedsFolderViewId) + && (GetPreviousViewFromViewHistory() != KUidBrowserFeedsTopicViewId) + && (GetPreviousViewFromViewHistory() != KUidBrowserFeedsFeedViewId )) + { + SetExitInProgress( ETrue ); + BROWSER_LOG( ( _L( " iBrowserAsyncExit->Start()" ) ) ); + iBrowserAsyncExit->Start(); + } +#else + if(CalledFromAnotherApp() && !IsEmbeddedModeOn()) + { + SetExitInProgress( ETrue ); + BROWSER_LOG( ( _L( " iBrowserAsyncExit->Start()" ) ) ); + iBrowserAsyncExit->Start(); + } +#endif // __RSS_FEEDS + + else + { + if ( IsEmbeddedModeOn() && + doc->GetFolderToOpen() == KFavouritesRootUid ) + { + ExitBrowser(ETrue); + } + else + { + if ( iStartedUp && ContentView()->GetPreviousViewID() == KUidBrowserBookmarksViewId ) + { + if ( GetBookmarksView()->GetAdaptiveBookmarksFolderWasActive() ) + { + GetBookmarksView()->OpenAdaptiveBookmarksWhenActivated(); + } + SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + } + else if ( IsEmbeddedModeOn()) + { + if( !iExitInProgress ) + { + ExitBrowser( ETrue ); + } + } + else + { + if(CalledFromAnotherApp() && (!IsEmbeddedModeOn())) + { + SetViewToBeActivatedIfNeededL( GetPreviousViewFromViewHistory()); + SetCalledFromAnotherApp(EFalse); + SendBrowserToBackground(); + } + else + { + SetViewToBeActivatedIfNeededL( iViewToReturnOnClose ); + } + } + } + } + } + +// ----------------------------------------------------------------------------------- +// CBrowserAppUi::IsEmbeddedModeOn +// ----------------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsEmbeddedModeOn() const + { + return iEikonEnv->StartedAsServerApp(); + } + +// ----------------------------------------------------------------------------------- +// CBrowserAppUi::HistoryLoadPrevious +// ----------------------------------------------------------------------------------- +// +void CBrowserAppUi::HistoryLoadPrevious() + { + if( BrCtlInterface().NavigationAvailable( TBrCtlDefs::ENavigationBack ) ) + { + TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandBack + + (TInt)TBrCtlDefs::ECommandIdBase ) ); + } + } + +// ----------------------------------------------------------------------------------- +// CBrowserAppUi::HistoryLoadNext +// ----------------------------------------------------------------------------------- +// +void CBrowserAppUi::HistoryLoadNext() + { + if( BrCtlInterface().NavigationAvailable( TBrCtlDefs::ENavigationForward ) ) + { + LoadObserver().DoStartLoad( CBrowserLoadObserver::ELoadUrlTypeOther ); + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandForward + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + } + + +// --------------------------------------------------------------------------- +// CBrowserAppUi::IsShutdownRequested +// --------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsShutdownRequested() const + { + return iShutdownRequested; + } + +// --------------------------------------------------------------------------- +// CBrowserAppUi::IsEmbeddedInOperatorMenu +// --------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsEmbeddedInOperatorMenu() const + { + const TUid KUidOperatorMenuApp = { 0x10008D5E }; + const TUid KUidVideoServicesApp = { 0x10281893 }; + + // If the embedding application is the Operator Menu or Video Services + if ( iEmbeddingApplicationUid == KUidOperatorMenuApp || iEmbeddingApplicationUid == KUidVideoServicesApp ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// CBrowserAppUi::IsAppShutterActive +// --------------------------------------------------------------------------- +// +TBool CBrowserAppUi::IsAppShutterActive() const + { + CAknAppUi* shuttingApp = CAknEnv::AppWithShutterRunning(); + + if ( shuttingApp ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// CBrowserAppUi::FetchHomePage +// -------------------------------------------------------------------------- +// +void CBrowserAppUi::FetchHomePageL() + { +LOG_ENTERFN( "CBrowserAppUi::FetchHomePageL" ); + if(!iStartedUp) // just in case, not done + CompleteDelayedInit(); + + if ( !Fetching() ) + { + UpdateSoftKeys(); + + // If the last active view is content view, return to the bookmark view on close. + // Otherwise if the last active view is bookmark view and we return to the appropriate view on close. + TUid lastViewId = LastActiveViewId(); + if( lastViewId == KUidBrowserContentViewId || + lastViewId == KUidBrowserNullViewId ) + { + lastViewId = KUidBrowserBookmarksViewId; + } + SetViewToReturnOnClose( lastViewId ); + + if( iLongZeroPressed ) + { + BROWSER_LOG( ( _L( " LongZeroPressed." ) ) ); + + // There should only be one special load observer at startup + SpecialLoadObserver().SetLongZeroStartup( iLongZeroPressed ); + iLongZeroPressed = EFalse; + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); + TPtr ptr( buf->Des() ); + TBool homePgFound( KErrNotFound ); + + // try to read Access Points homepage + TUint defaultAp( KWmlNoDefaultAccessPoint ); + // 'always ask' feature doesn't let to read the AP + if( Preferences().AccessPointSelectionMode() == EConnectionMethod ) + { + defaultAp = Preferences().DefaultAccessPoint(); + } + if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is an access point defined + { + CApAccessPointItem* apItem = Preferences().AllPreferencesL().iDefaultAPDetails; + if ( apItem ) + { + const HBufC* defaultHP = apItem->ReadConstLongTextL( EApWapStartPage ); + if ( defaultHP->Length() ) + { + ptr.Zero(); + ptr.Append( *defaultHP ); + homePgFound = KErrNone; + } + } + } + // in case of error, read user defined home page from SD + TInt err( KErrNone ); + if( homePgFound == KErrNotFound ) + { + // do not let leaving + if ((Preferences().HomePageType() == EWmlSettingsHomePageAddress) + ||(Preferences().HomePageType() == EWmlSettingsHomePageUseCurrent)) + { + TRAP( err, homePgFound = Preferences().HomePageUrlL( ptr, ETrue ) ); + } + } + // we have a url to load + if( err == KErrNone && + homePgFound == KErrNone && + ptr.Length() > 0 ) + { + TRAP( err, FetchL( ptr, CBrowserLoadObserver::ELoadUrlTypeOther ) ); + // in case of any error switch back to BookmarksView + if( err != KErrNone ) + { + ContentView()->SetFullScreenOffL(); + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + } + } + else + { + // we already switched to ContentView, so change the layout back + ContentView()->SetFullScreenOffL(); + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + } + CleanupStack::PopAndDestroy( buf ); + } + else + { + // it checks HomePageSettings + LaunchHomePageL( /* EFalse */ ); + } + } + } + +// --------------------------------------------------------------------------- +// CBrowserAppUi::StartPreferencesViewL +// --------------------------------------------------------------------------- +// +TBool CBrowserAppUi::StartPreferencesViewL( TUint aListItems ) + { + TBool retVal( EFalse ); + TInt retUi( KErrNone ); + TInt err(KErrNone); + + //start the connection dialog + CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL(); + CleanupStack::PushL( settings ); + TCmSettingSelection selection; + // empty filter array because no filtering is wanted + TBearerFilterArray filterArray; + TRAP ( err, retUi = settings->RunApplicationSettingsL( selection, aListItems, filterArray ) ); + CleanupStack::PopAndDestroy(); // settings + + //if something has been selected + if (retUi) + { + //set the selection mode + iPreferences->SetAccessPointSelectionModeL( + STATIC_CAST( TCmSettingSelectionMode, selection.iResult ) ); + + //based on the chosen connection type, store the connection identifier(iapid, snap id, always ask) + //in the preferences list + switch ( iPreferences->AccessPointSelectionMode() ) + { + case EConnectionMethod: + { + TUint32 id = iPreferences->DefaultAccessPoint(); + // CMManager gives us IAPid, need to translate to WAPid + if (selection.iId != 0) + { + id = Util::WapIdFromIapIdL( *this, selection.iId ); + } + iPreferences->SetDefaultAccessPointL( id ); + // Requested AP is preset for PushMtm + id = iPreferences->DefaultAccessPoint(); + if( id != KWmlNoDefaultAccessPoint ) + { + SetRequestedAP( id ); + retVal = ETrue; + } + break; + } + + case EDestination: + { + TUint32 snapId = iPreferences->DefaultSnapId(); + if (selection.iId != 0) + { + snapId = selection.iId; + } + iPreferences->SetDefaultSnapId( snapId ); + if( snapId != KWmlNoDefaultSnapId ) + { + retVal = ETrue; + } + break; + } + + case EAlwaysAsk: + default: + { + break; + } + } + } + + // alr: is return val needed? should it be true or false in EAA and default? check how it's used + return retVal; + } +// --------------------------------------------------------------------------- +// CBrowserAppUi::AhleConnection +// --------------------------------------------------------------------------- +// +CRecentUrlStore* CBrowserAppUi::RecentUrlStore() + { + return iRecentUrlStore; + } + +// --------------------------------------------------------------------------- +// CBrowserAppUi::SomeItemsNotSecure +// --------------------------------------------------------------------------- +// +TBool CBrowserAppUi::SomeItemsNotSecure() const + { + return !( LoadObserver().LoadStatus( CBrowserLoadObserver::ELoadStatusAllItemIsSecure ) ); + } + +// ---------------------------------------------------- +// CBrowserAppUi::IsProgressShown +// ---------------------------------------------------- +// +TBool CBrowserAppUi::IsProgressShown() const + { + return iShowProgress; + } + +// ---------------------------------------------------- +// CBrowserAppUi::SetProgressShown +// ---------------------------------------------------- +// +void CBrowserAppUi::SetProgressShown( TBool aProgressShown ) + { + iShowProgress = aProgressShown; + } + +// ---------------------------------------------------- +// CBrowserAppUi::RecognizeUiFileL +// ---------------------------------------------------- +// +TBool CBrowserAppUi::RecognizeUiFileL( RFile& aFile, TBuf& aDataTypeDes ) + { + TBool recognized = EFalse; + HBufC8* buffer = NULL; + + TFileName fileName; + User::LeaveIfError(aFile.FullName(fileName)); + + TInt fileSize; + + // Read the file from the beginning into a buffer + User::LeaveIfError(aFile.Size(fileSize)); + buffer = HBufC8::NewLC(fileSize); + TPtr8 bufferPtr(buffer->Des()); + TInt startPos = 0; + User::LeaveIfError(aFile.Read(startPos, bufferPtr, fileSize)); + // move the seek position back to start + User::LeaveIfError(aFile.Seek(ESeekStart, startPos)); + + _LIT( KDotOPML, ".opml"); + _LIT( KDotXML, ".xml"); + + // First try the name extension + if ( fileName.Length() >= 3 ) + { + TInt dotPos = fileName.LocateReverse( '.' ); + if ( dotPos != KErrNotFound ) + { + TInt extLength = fileName.Length() - dotPos; + HBufC* ext = fileName.Right( extLength ).AllocL(); + CleanupStack::PushL( ext ); + + // if .opml return true + if ( ext->CompareF( KDotOPML ) == 0) + { + aDataTypeDes = KOPMLMimeType; + recognized = ETrue; + } + else if (ext->CompareF( KDotXML ) == 0 ) + { + _LIT8( dtd, " 5) && + (bufferPtr.FindF( dtd ) != KErrNotFound )) + { + aDataTypeDes = KOPMLMimeType; + recognized = ETrue; + } + } + + CleanupStack::PopAndDestroy(); //buffer + + return recognized; + } + + +// --------------------------------------------------------- +// CBrowserAppUi::ConfirmUiHandlingL +// --------------------------------------------------------- +// +TBool CBrowserAppUi::ConfirmUiHandlingL( TFileName& aFilename, TBuf& aDataTypeDes ) + { + // switch on data type desc and handle file accordingly + if(aDataTypeDes.Compare( KOPMLMimeType ) == 0) + { + // Display confirmation dialog before activating feeds view + HBufC* message = StringLoader::LoadLC(R_FEEDS_QUERY_IMPORT_NOW, aFilename); + HBufC* lsc_yes = StringLoader::LoadLC(R_FEEDS_IMPORT_NOW_YES); + HBufC* rsc_no = StringLoader::LoadLC(R_FEEDS_IMPORT_NOW_NO); + + TBool ret(iDialogsProvider->DialogConfirmL( _L(""), *message, *lsc_yes, *rsc_no )); + + CleanupStack::PopAndDestroy(3); //message, lsc_yes, rsc_no + + if(ret) + { + return ETrue; + } + } + + return EFalse; + } + +// --------------------------------------------------------- +// CBrowserAppUi::CopyUiRFileToFileL +// --------------------------------------------------------- +// + +void CBrowserAppUi::CopyUiRFileToFileL( RFile& aFile, const TDesC& aFilepath ) + { + // + // copy r-file to a temporary file + // + RFs tempRFs; + RFile tempRFile; + TInt fileSize; + HBufC8* buffer = NULL; + + // Connect to file server + User::LeaveIfError(tempRFs.Connect()); + CleanupClosePushL(tempRFs); + + // Create the filepath to copy to + // Replace the file if it already exists + User::LeaveIfError(tempRFile.Replace(tempRFs, aFilepath, EFileWrite)); + CleanupClosePushL(tempRFile); + + // Copy the file + User::LeaveIfError(aFile.Size(fileSize)); + buffer = HBufC8::NewLC(fileSize); + TPtr8 bufferPtr(buffer->Des()); + + // Read from the start of the file + User::LeaveIfError(aFile.Read(0, bufferPtr, fileSize)); + User::LeaveIfError(tempRFile.Write(bufferPtr, fileSize)); + + tempRFile.Close(); + tempRFs.Close(); + + // Cleanup Buffer and file copy stuff + CleanupStack::PopAndDestroy(3); //buffer, tempRFile, tempRFs + } + +// --------------------------------------------------------- +// CBrowserAppUi::HandleUiFileL +// --------------------------------------------------------- +// +void CBrowserAppUi::HandleUiFileL( TFileName& aFilepath, TBuf& aDataTypeDes ) + { + // switch on data type desc and handle file accordingly + if(aDataTypeDes.Compare(KOPMLMimeType) == 0) + { + // Activate Content view first in order to + // get it's BrowserControl instance ready to go + // (as opposed to Feeds' BC instance) to be used to render + // feeds content in case the user wants to read + // the feed in-page. + SetLastActiveViewId( KUidBrowserContentViewId ); + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + ActivateLocalViewL( LastActiveViewId() ); + + // Now activate bookmarks view + SetLastActiveViewId( KUidBrowserBookmarksViewId ); + SetViewToBeActivatedIfNeededL( LastActiveViewId() ); + ActivateLocalViewL( LastActiveViewId() ); + HandleForegroundEventL( ETrue ); + + // wait until the content view is completely ready + WaitCVInit(); + + // begin import, pass to feeds view + iFeedsClientUtilities->BeginImportOPMLFeedsFileL(aFilepath); + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::HandleUiDownloadL +// --------------------------------------------------------- +// +void CBrowserAppUi::HandleUiDownloadL( TFileName& aFilepath, TBuf& aDataTypeDes ) + { + // switch on data type desc and handle file accordingly + if(aDataTypeDes.Compare(KOPMLMimeType) == 0) + { + SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); + // begin import + iFeedsClientUtilities->BeginImportOPMLFeedsFileL(aFilepath); + // switch back to FeedsView, so change layout + ContentView()->SetFullScreenOffL(); + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::LaunchIntoFeedsL +// --------------------------------------------------------- +// +void CBrowserAppUi::LaunchIntoFeedsL() +{ + if(iBrowserAlreadyRunning && (LastActiveViewId() == KUidBrowserContentViewId)) + { + iFeedsClientUtilities->ShowFolderViewL(KUidBrowserContentViewId); + } + else + { + iFeedsClientUtilities->ShowFolderViewL(); + } +} + +// ---------------------------------------------------- +// CBrowserAppUi::CreateFullUrlLC +// ---------------------------------------------------- +// +HBufC* CBrowserAppUi::CreateFullUrlLC( + const TDesC& aUrl, + const TDesC& aUsername, + const TDesC& aPassword ) + { + // username[:password]@server/document + TInt lPw = aPassword.Length(); + TInt lUn = aUsername.Length(); + _LIT( KBrowserScheme, "://" ); + TInt index = aUrl.Find( KBrowserScheme ); + if( index == KErrNotFound ) + { + index = 0; // insert at first position + } + else + { + index += 3; // insert after scheme + } + + HBufC *fullUrl = HBufC::NewLC( aUrl.Length() + lUn + lPw + 3 ); + fullUrl->Des().Copy( aUrl ); + if( lPw + lUn ) + { + fullUrl->Des().Insert( index, _L( "@" ) ); + } + if( lPw ) + { + fullUrl->Des().Insert( index, aPassword ); + fullUrl->Des().Insert( index, _L( ":" ) ); + } + if( lUn ) + { + fullUrl->Des().Insert( index, aUsername ); + } + // insert scheme??? + fullUrl->Des().ZeroTerminate(); + + return fullUrl; + } + +// --------------------------------------------------------- +// CBrowserAppUi::HandleResourceChangeL( TInt aType ) +// --------------------------------------------------------- +// +void CBrowserAppUi::HandleResourceChangeL( TInt aType ) + { + LOG_ENTERFN("CBrowserAppUi::HandleResourceChangeL"); + LOG_WRITE_FORMAT(" aType: %d", aType); + if( iExitInProgress ) + { + BROWSER_LOG( ( _L(" iExitInProgress ETrue ") ) ); + return; + } + + CAknViewAppUi::HandleResourceChangeL( aType ); + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + CBrowserViewBase* activeView = ActiveView( ); + if( activeView != NULL ) + { + activeView->HandleClientRectChange(); + if ( ContentView() && (activeView != ContentView()) ) + { + ContentView()->HandleClientRectChange(); + } + } + } + if (aType == KEikMessageFadeAllWindows) + { + if (ContentView() && ContentView()->PenEnabled()) + { + if (iCurrentView == KUidBrowserContentViewId) + { + ContentView()->Toolbar()->DisableToolbarL(ETrue); + } + } + } + + if (aType == KEikMessageUnfadeWindows) + { + if (ContentView()&& ContentView()->PenEnabled() && !ExitInProgress()) + { + if (iCurrentView == KUidBrowserContentViewId) + { + ContentView()->MakeZoomSliderVisibleL(EFalse); + ContentView()->Toolbar()->DisableToolbarL(EFalse); + } + } + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::ChangeConnectionL() +// --------------------------------------------------------- +// +void CBrowserAppUi::ChangeConnectionL() + { + TConManChangeConn change; + // This will contain the new IAP as well, but it needs to pass the old one + TUint32 newAp = Util::IapIdFromWapIdL( *this, RequestedAp() ); + iConnection->ChangeIapL( change, newAp ); + if( EConManDoNothing == change ) + { + // Do nothing + } + else + { + //cancel transaction + SendDisconnectEventL(); + /* start all */ + if( EConManCloseAndStart == change ) + { + //close connection + iConnection->Disconnect(); + +#ifdef __RSS_FEEDS + //notify feeds engine to close the connection + iFeedsClientUtilities->DisconnectManualUpdateConnectionL(); +#endif + } + iConnection->SetRequestedAP( newAp ); + TInt err = iConnection->StartConnectionL( ETrue ); + if( err == KErrNone ) + { + iConnection->ShowConnectionChangedDlg(); + } + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::HandleContentL() +// --------------------------------------------------------- +// +TBool CBrowserAppUi::HandleContentL( const TDesC& aFileName, + const CAiwGenericParamList& aParamList, + TBool& aContinue ) + { + // Put the file name to the generic parameter list, if it is not there yet + TInt index(0); + aParamList.FindFirst( index, EGenericParamFile, EVariantTypeDesC ); + if ( index == KErrNotFound ) + { + TAiwVariant paramVariant( aFileName ); + TAiwGenericParam genericParam( EGenericParamFile, paramVariant ); + CAiwGenericParamList* paramList = (CAiwGenericParamList*)&aParamList; + paramList->AppendL( genericParam ); + } + + // Set EGenericParamAllowMove - we allow handlers to apply move instead + // of copy for the file. + aParamList.FindFirst( index, EGenericParamAllowMove, EVariantTypeAny ); + if ( index == KErrNotFound ) + { + TBool allowMove( ETrue ); + TAiwVariant allowMoveVariant( allowMove ); + TAiwGenericParam genericParamAllowMove( EGenericParamAllowMove, allowMoveVariant ); + CAiwGenericParamList* paramList = (CAiwGenericParamList*)&aParamList; + paramList->AppendL( genericParamAllowMove ); + } + + BrowserLauncherService()->DownloadFinishedL( KErrNone, aParamList ); + + // Wait until the client sends two TBools (contentHandled & continueBrowsing). + iClientWantsToContinue = EFalse; + iWasContentHandled = EFalse; + + iLauncherServiceWait.Start(); + + // iClientWantsToContinue and iWasContentHandled contains the results + aContinue = iClientWantsToContinue; + return iWasContentHandled; + } + +// --------------------------------------------------------- +// CBrowserAppUi::DownloadedContentHandlerReserved1() +// --------------------------------------------------------- +// +TAny* CBrowserAppUi::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ) + { + return 0; + } + +// --------------------------------------------------------- +// CBrowserAppUi::SetContentHandlingResult() +// --------------------------------------------------------- +// +void CBrowserAppUi::SetContentHandlingResult + ( TBool aClientWantsToContinue, TBool aWasContentHandled ) + { + iClientWantsToContinue = aClientWantsToContinue; + iWasContentHandled = aWasContentHandled; + + // continue handling the content + iLauncherServiceWait.AsyncStop(); + } + +// --------------------------------------------------------- +// CBrowserAppUi::LoadSearchPageL() +// --------------------------------------------------------- +// +void CBrowserAppUi::LoadSearchPageL() + { + TPtrC url = iPreferences->SearchPageUrlL(); + + // url undefined + if ( !url.Length() ) + { + HBufC* query = StringLoader::LoadLC( + R_BROWSER_QUERY_DEF_SEARCHPAGE ); + // Ask if user want to define the search web setting now + if ( + TBrowserDialogs::DialogQueryReqL( query->Des(), + KNullDesC, + KNullDesC ) + ) + { + HBufC* prompt = StringLoader::LoadLC( + R_BROWSER_PROMPT_SEARCH_URL ); + HBufC* retBuf = HBufC::NewLC( KMaxSearchPgUrlLength ); + TPtr retString = retBuf->Des(); + retString.Copy( KNullDesC ); + + TInt result = TBrowserDialogs::DialogPromptReqL( + prompt->Des(), + &retString, + ETrue, + KMaxSearchPgUrlLength + ); + + if( result ) // URL was accepted + { + Preferences().SetSearchPageUrlL( retString ); + url.Set( iPreferences->SearchPageUrlL() ); + } + CleanupStack::PopAndDestroy( 2 ); // retBuf, prompt + } + CleanupStack::PopAndDestroy( query ); + } + + FetchL( url ); + } + +// --------------------------------------------------------- +// CBrowserAppUi::CloseWindowL() +// --------------------------------------------------------- +// +void CBrowserAppUi::CloseWindowL( TInt aWindowId ) + { +LOG_ENTERFN("AppUi::CloseWindowL"); + + //There are only two cases for closing window. One is user initialized and the + //other is script initialized. For both cases, the window should be deleted. + TBool forceDelete( ETrue ); + // this variable is useful to know if the window has a parent window which needs to be activated on closing current window + TBool parentPresent(EFalse); + if ( WindowMgr().CurrentWindowQue() && WindowMgr().CurrentWindowQue()->iParent ) + { + parentPresent = ETrue; + } + // delete the current window by default + if( aWindowId == 0 ) + { + aWindowId = WindowMgr().CurrentWindow()->WindowId(); + // scripts directly pass a real windowId, + // so if user initiated the process, we really delete the window + forceDelete = ETrue; + } + //If this window has been created from Search app + if(aWindowId == iWindowIdFromFromExternApp) + { + //Make it false as window is going to close down + iSameWinApp = EFalse; + } +#ifdef __RSS_FEEDS + // If we are closing a Feeds Full Story then go back to feeds + TBool feedsWindow(EFalse); + CBrowserWindow* win; + TInt err = WindowMgr().Window(aWindowId, win); + if (err == KErrNone) + { + feedsWindow = win->HasFeedsContent(); + win->SetHasFeedsContent(EFalse); + } +#endif + + TInt winId = WindowMgr().DeleteWindowL( aWindowId, forceDelete ); + +#ifdef __RSS_FEEDS + if (feedsWindow) + { + SetViewToBeActivatedIfNeededL( KUidBrowserFeedsFeedViewId ); + return; + } +#endif + + if( winId > 0 ) // still remain a window to be activated + { + WindowMgr().SwitchWindowL( winId ); + if(CalledFromAnotherApp() && (!IsEmbeddedModeOn()) && !parentPresent) + { + SetCalledFromAnotherApp(EFalse); + SendBrowserToBackground(); + } + } + else if( winId == 0) // last window was closed + { + if(CalledFromAnotherApp() && (!IsEmbeddedModeOn())) + { +#ifdef __RSS_FEEDS + if ((GetPreviousViewFromViewHistory() == KUidBrowserFeedsFolderViewId) || + (GetPreviousViewFromViewHistory() == KUidBrowserFeedsTopicViewId) || + (GetPreviousViewFromViewHistory() == KUidBrowserFeedsFeedViewId)) + { + SetViewToBeActivatedIfNeededL( GetPreviousViewFromViewHistory() ); + SetCalledFromAnotherApp(EFalse); + SendBrowserToBackground(); + } + else + { + ExitBrowser(ETrue); + } +#else + ExitBrowser(ETrue); +#endif // __RSS_FEEDS + } + else + { + ExitBrowser(ETrue); + } + } + // else a background window was closed + + } + +// --------------------------------------------------------- +// CBrowserAppUi::StartProgressAnimationL +// --------------------------------------------------------- +// +void CBrowserAppUi::StartProgressAnimationL() + { +LOG_ENTERFN("AppUi::StartProgressAnimationL"); + } + +// --------------------------------------------------------- +// CBrowserAppUi::StopProgressAnimationL +// --------------------------------------------------------- +// +void CBrowserAppUi::StopProgressAnimationL() + { +LOG_ENTERFN("AppUi::StopProgressAnimationL"); + } + +#ifdef __RSS_FEEDS +// --------------------------------------------------------- +// CBrowserAppUi::FeedsClientUtilities +// --------------------------------------------------------- +// +CFeedsClientUtilities& CBrowserAppUi::FeedsClientUtilities() const + { + return *iFeedsClientUtilities; + } +#endif // __RSS_FEEDS + +// --------------------------------------------------------- +// CBrowserAppUi::OpenLinkInNewWindowL() +// --------------------------------------------------------- +// +void CBrowserAppUi::OpenLinkInNewWindowL( const CFavouritesItem& aBookmarkItem ) + { + if( ( aBookmarkItem.IsItem() ) && + ( aBookmarkItem.Uid() != KFavouritesRSSItemUid ) ) + { + // Check if we should/can create a new window + // In most cases when the feature is not allowed option menu items have been dimmed. + // In the case where a long key press on a bookmark happens we fall through to this function + // and check the feature here. If a new window is not allowed we can open in the current window + if( IsPageLoaded() && + Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + !Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) + { + // there is already a window, so create a new one + CBrowserWindow *win = WindowMgr().CreateWindowL( 0, &KNullDesC ); + if (win != NULL) + { + CleanupStack::PushL( win ); + WindowMgr().SwitchWindowL( win->WindowId() ); + FetchBookmarkL( aBookmarkItem ); + CleanupStack::Pop(); // win + } + } + else + { + // no page is loaded yet, so do not create new window + FetchBookmarkL( aBookmarkItem ); + } + } + } + +// --------------------------------------------------------- +// CBrowserAppUi::SendDisconnectEventL +// --------------------------------------------------------- +// +void CBrowserAppUi::SendDisconnectEventL() + { + LOG_ENTERFN("CBrowserAppUi::SendDisconnectEventL"); + + if(!iStartedUp) + return; + + SpecialLoadObserver().CancelConnection(); + CArrayFixFlat* windows = iWindowManager->GetWindowInfoL( this ); + if( windows ) + { + TInt i; + + for ( i = 0; i < windows->Count(); i++ ) + { + CBrowserWindow* window = NULL; + iWindowManager->Window( windows->At( i )->iWindowId, window ); + if( window ) + { + TInt err; + // BROWSER_LOG( ( _L( " iConnection Connected" ) ) ); + TRAP( err, window->BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); + // BROWSER_LOG( ( _L( " HandleCommandL: %d"), err ) ); + } + } + + CBrowserWindow* window = NULL; + iWindowManager->Window( windows->At( 0 )->iWindowId, window ); + + // delete the window items before deleting the array + for( i=0; iCount(); ++i ) + delete windows->At( i ); + + delete windows; + } + } + /* + +// ---------------------------------------------------- +// CBrowserAppUi::IsPgNotFound +// ---------------------------------------------------- +// +TBool CBrowserAppUi::IsPgNotFound() const + { + return iPgNotFound; + } +*/ +// ---------------------------------------------------- +// CBrowserAppUi::HandleApplicationSpecificEventL +// ---------------------------------------------------- +// +void CBrowserAppUi::HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent) + { + CAknAppUi::HandleApplicationSpecificEventL(aEventType, aWsEvent); + + /* + * Note: Even though we get these memory events from the system for handling OOM, and we pass them off + * to the command handler, there is no code further down the line that actually handles them (it would + * normally be in BrCtl). We totally ignore these events. This is because the system has too high of an OOM threshold. + * I.e. the system may only have 6m left and think it's out of memory, however, the browser can still render + * many pages in only 6m. So, these system events are ignored and the browser handles OOM with its own mechanism. + * (See OOMStopper and OOMHandler) + */ + if(aEventType == KAppOomMonitor_FreeRam ) + { + iWindowManager->CloseAllWindowsExceptCurrent(); + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandFreeMemory + (TInt)TBrCtlDefs::ECommandIdBase); + } + else if(aEventType == KAppOomMonitor_MemoryGood) + { + BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandMemoryGood + (TInt)TBrCtlDefs::ECommandIdBase); + } + else if ( KAknFullOrPartialForegroundGained == aEventType ) + { + if ( iViewToBeActivatedIfNeeded.iUid ) + { + ActivateLocalViewL( iViewToBeActivatedIfNeeded ); + } + else + { + // LastActiveViewId() might return with 0! + TRAP_IGNORE( ActivateLocalViewL( LastActiveViewId() ) ); + } + iViewToBeActivatedIfNeeded.iUid = 0; + } + } + +// ---------------------------------------------------- +// CBrowserAppUi::OfferApplicationSpecificKeyEventL +// +// Use this function to handle key events that are application wide and not specific to any view +// All views (containers) call this first and should return if key was consumed +// As a note for future reference the red end key shows up as iCode = EKeyNo...though you would +// think it would be EKeyEnd... +// ---------------------------------------------------- +// +TKeyResponse CBrowserAppUi::OfferApplicationSpecificKeyEventL(const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/) + { + TKeyResponse result( EKeyWasNotConsumed ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::GetPreviousViewFromViewHistory +// ----------------------------------------------------------------------------- +// +TUid CBrowserAppUi::GetPreviousViewFromViewHistory() +{ + return iPreviousView; +} + +// ----------------------------------------------------------------------------- +// CBrowserAppUi::SaveFocusedImageToGalleryL +// ----------------------------------------------------------------------------- +// +void CBrowserAppUi::SaveFocusedImageToGalleryL() + { + TBrCtlImageCarrier* imageCarrier = BrCtlInterface().FocusedImageLC(); + CDocumentHandler* docHandler = CDocumentHandler::NewLC(); + TUriParser uriParser; + User::LeaveIfError(uriParser.Parse(imageCarrier->Url())); + TPtrC path; + path.Set( uriParser.Extract( EUriPath ) ); + HBufC* fileName = NULL; + if( path.Length() ) + { + TInt slash = path.LocateReverse( '/' ); + if( slash != KErrNotFound && slash != path.Length() ) + { + TPtrC temp( path.Right( path.Length() - slash - 1 ) ); + if( temp.Length() ) + { + fileName = HBufC::NewLC(temp.Length() + 4); // leave room for edding extenstion if needed + fileName->Des().Copy(temp); + } + } + } + HBufC8* dataType8 = NULL; + dataType8 = HBufC8::NewLC(imageCarrier->ContentType().Length()); + dataType8->Des().Copy(imageCarrier->ContentType()); + TDataType dataType(*dataType8); + if (fileName) + { + TPtr fileNamePtr(fileName->Des()); + docHandler->CheckFileNameExtension(fileNamePtr, dataType); + docHandler->SaveL(imageCarrier->RawData(), dataType, *fileName, KEntryAttNormal); + } + else + { + docHandler->SaveL(imageCarrier->RawData(), dataType, KEntryAttNormal); + } + if (fileName) + { + CleanupStack::PopAndDestroy(2); // fileName, dataType8 + } + else + { + CleanupStack::PopAndDestroy(dataType8); // dataType8 + } + + TFileName fName; + User::LeaveIfError(docHandler->GetPath(fName)); + + #ifdef BRDO_APP_GALLERY_SUPPORTED_FF + + CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(CEikonEnv::Static()->FsSession()); + CleanupStack::PushL(mgFileManager); + if( fName.Length() > 0 ) + { + TRAP_IGNORE( mgFileManager->UpdateL( fName ) ); + } + else + { + TRAP_IGNORE( mgFileManager->UpdateL() ); + } + CleanupStack::PopAndDestroy(1); // mgFileManager + + #endif + + CleanupStack::PopAndDestroy(1); // imageCarrier + } + +// --------------------------------------------------------- +// CBrowserAppUi::CheckFlashPresent +// --------------------------------------------------------- +// +TBool CBrowserAppUi::CheckFlashPresent() + { + RImplInfoPtrArray animPluginList; + + TRAP_IGNORE( REComSession::ListImplementationsL( KBrowserPluginInterfaceUid, + animPluginList ) ); + + + _LIT8(KFlashMimeType, "application/x-shockwave-flash"); + + const TInt count = animPluginList.Count(); + TBool found = EFalse; + for ( TInt i = 0; i < count; i++ ) + { + CImplementationInformation* implInfo = animPluginList[i]; + if (( implInfo->DataType( ) ).Find( KFlashMimeType) != KErrNotFound) + { + found = ETrue; //flash plugin is present + break; + } + } + animPluginList.ResetAndDestroy(); + + return found; + + } + +// --------------------------------------------------------- +// CBrowserAppUi::FlashPresent +// --------------------------------------------------------- +// +TBool CBrowserAppUi::FlashPresent() + { + return iFlashPresent; + } + +// --------------------------------------------------------- +// CBrowserAppUi::ShowNameAndVersionL +// --------------------------------------------------------- +// +void CBrowserAppUi::ShowNameAndVersionL() +{ + HBufC* header = StringLoader::LoadLC( R_BROWSER_QUERY_BROWSER_VERSION ); + HBufC* browserVersion = BrCtlInterface().VersionInfoLC(TBrCtlDefs::EBrowserVersion); + + // output browser version to dialog + CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *browserVersion ); + CleanupStack::PushL(dlg); + dlg->PrepareLC( R_BROWSER_PAGE_VERSION ); + CleanupStack::Pop(dlg); + CAknPopupHeadingPane* hPane = dlg->QueryHeading(); + if ( hPane ) + { + CleanupStack::PushL(hPane); + hPane->SetTextL( *header ); + CleanupStack::Pop(hPane); + } + dlg->RunLD(); + CleanupStack::PopAndDestroy(2); // browserVersion, header +} + + +// --------------------------------------------------------- +// CBrowserAppUi::IsLaunchHomePageDimmedL +// --------------------------------------------------------- +// +TBool CBrowserAppUi::IsLaunchHomePageDimmedL() +{ + + // Set dimmed flag if shortcut key for launch home page is dimmed and was selected + TBool dimmed = EFalse; + TBool homepage = Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ); + if( homepage ) + { + TWmlSettingsHomePage pgtype = Preferences().HomePageType(); + TBool alwaysAskCase = ((Preferences().AccessPointSelectionMode() == EAlwaysAsk ) && + ( EWmlSettingsHomePageAccessPoint == pgtype )); + + if (alwaysAskCase || (pgtype == EWmlSettingsHomePageBookmarks)) + { + dimmed = ETrue; + } + else if (pgtype == EWmlSettingsHomePageAccessPoint) + { + // check to see if no home page defined on the access point + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr ptr( buf->Des() ); + TInt pgFound = Preferences().HomePageUrlL( ptr ); + if( pgFound != KErrNone ) + { + dimmed = ETrue; + } + CleanupStack::PopAndDestroy( buf ); + } + } + else + { + dimmed = ETrue; + } + + return(dimmed); +} + +// --------------------------------------------------------- +// CBrowserAppUi::IsDisplayingMenuOrDialog +// --------------------------------------------------------- +// +TBool CBrowserAppUi::IsDisplayingMenuOrDialog() +{ + return CCoeAppUi::IsDisplayingMenuOrDialog(); +} +// --------------------------------------------------------- +// CBrowserAppUi::HandleWsEventL +// --------------------------------------------------------- +void CBrowserAppUi::HandleWsEventL(const TWsEvent& aEvent, + CCoeControl* aDestination) +{ + /** + * We need a special handling for pointer events to handle the situation + * when the pointer is crossing the boundaries of plugin window. Browser + * scrolling id done using PointerMove events not a Drag. + * When PointerMoveBuffer is ready HandlePointerBufferReadyL() is called by + * Symbian framework. By default if Pointer Down event wasn't issued on the + * current CoeControl Pointer Move events are not sent to this control. + * The code below makes sure that when we entering the Content View window + * from pluging window we are still getting move events. + * When we are leaving Content window we are generating fake Pointer Up + * event in order to on-demand scrollbars disapear properly. The later is a + * hack and needs to be re-designed in such way that pluging will pass + * pointer event back to the browser. + */ + if (aDestination != NULL) + { + TInt type=aEvent.Type(); + + switch (type) + { + case EEventPointerExit: + { + + break; + } + + case EEventPointerEnter: + { + if (iCurrentView == KUidBrowserContentViewId) + { + CCoeControl* ctrl = &(BrCtlInterface()); + ctrl->DrawableWindow()->DiscardPointerMoveBuffer(); + const TInt count = ctrl->CountComponentControls(); + for (TInt i = 0; i < count; i++) + { + CCoeControl* c = ctrl->ComponentControl(i); + if (c) + { + c->ClaimPointerGrab(EFalse); + } + } + ctrl->ClaimPointerGrab(EFalse); + } + break; + } + + } + } + CAknViewAppUi::HandleWsEventL(aEvent, aDestination); +} + +// --------------------------------------------------------- +// CBrowserAppUi::HandleSystemEventL +// --------------------------------------------------------- +#if defined(__S60_50__) +void CBrowserAppUi::HandleSystemEventL(const TWsEvent& aEvent) + { + + /** + * We need a special handling for System events to handle the situation + * like when the shut down is done while download is going on. + */ + + switch (*(TApaSystemEvent*)(aEvent.EventData())) + { + case EApaSystemEventShutdown: + // do things here + ExitBrowser ( IsAppShutterActive() ); + break; + default: + break; + } + // call base class implementation + CAknAppUi::HandleSystemEventL(aEvent); + } +#endif +// --------------------------------------------------------- +// CBrowserAppUi::StartFetchHomePageL +// --------------------------------------------------------- +void CBrowserAppUi::StartFetchHomePageL(void) + { + if(!iStartedUp) + CompleteDelayedInit(); + + // There's a homepage to be launched so start in content view + SetLastActiveViewId(KUidBrowserContentViewId); + //wait for contentview to initialize itself + WaitCVInit(); + + TInt error( KErrNone ); + TRAP( error, FetchHomePageL() ); + if( error != KErrNone ) + { + CloseContentViewL(); + } + } + +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +// --------------------------------------------------------- +// CBrowserAppUi::CompleteIADUpdateCallback +// --------------------------------------------------------- +TInt CBrowserAppUi::CompleteIADUpdateCallback( TAny* aBrowserAppUi ) + { + TRAP_IGNORE( ((CBrowserAppUi*)aBrowserAppUi)->CheckUpdatesL() ) + return KErrNone; + } + + +// --------------------------------------------------------- +// CBrowserAppUi::CheckUpdateFileAvailable +// --------------------------------------------------------- +TBool CBrowserAppUi::CheckUpdateFileAvailable() + { + LOG_ENTERFN("CBrowserAppUi::CheckUpdateFileAvailable"); + TBuf privatePath; + TBuf updateFileName; + iFs.PrivatePath( privatePath ); + updateFileName.Copy( privatePath ); + updateFileName.Append( KUpdateFileName ); + RFile updatefile; + TInt err = updatefile.Open( iFs, updateFileName, EFileRead ); + if ( err == KErrNotFound ) + { + LOG_WRITE( "CBrowserAppUi::CheckUpdateFileAvailable - update file not available" ); + return EFalse; + } + else + { + LOG_WRITE( "CBrowserAppUi::CheckUpdateFileAvailable - update file available" ); + updatefile.Close(); + } + return ETrue; + } + +// --------------------------------------------------------- +// CBrowserAppUi::WriteUpdateFile +// --------------------------------------------------------- +void CBrowserAppUi::WriteUpdateFile() + { + LOG_ENTERFN("CBrowserAppUi::WriteUpdateFile"); + TBuf privatePath; + TBuf updateFileName; + iFs.PrivatePath( privatePath ); + updateFileName.Copy( privatePath ); + updateFileName.Append( KUpdateFileName ); + RFile updatefile; + TInt err = updatefile.Open( iFs, updateFileName, EFileWrite | EFileShareExclusive ); + if(err == KErrNotFound) + { + LOG_WRITE( "CBrowserAppUi::WriteUpdateFile - update file not available so create it" ); + err = updatefile.Create( iFs, updateFileName, EFileWrite | EFileShareExclusive ); + } + //Get the current time + TTime timenow; + timenow.HomeTime(); + TInt64 time = timenow.Int64(); + TBuf8<50> data; + data.AppendNum(time); + LOG_WRITE( "CBrowserAppUi::WriteUpdateFile - write the current time in update file" ); + updatefile.Write(data); + updatefile.Close(); + } + +// --------------------------------------------------------- +// CBrowserAppUi::DeleteUpdateFile +// --------------------------------------------------------- +void CBrowserAppUi::DeleteUpdateFile() + { + TBuf privatePath; + TBuf updateFileName; + iFs.PrivatePath( privatePath ); + updateFileName.Copy( privatePath ); + updateFileName.Append( KUpdateFileName ); + iFs.Delete(updateFileName); + } + +// --------------------------------------------------------- +// CBrowserAppUi::ReadUpdateFile +// --------------------------------------------------------- +TInt64 CBrowserAppUi::ReadUpdateFile() + { + TBuf privatePath; + TBuf updateFileName; + //Get the private path then append the filename + iFs.PrivatePath( privatePath ); + updateFileName.Copy( privatePath ); + updateFileName.Append( KUpdateFileName ); + RFile updatefile; + TInt err = updatefile.Open( iFs, updateFileName, EFileRead ); + TInt64 dataValue = 0; + //If file is found + if ( err != KErrNotFound ) + { + TBuf8<50> readBuf; + err = updatefile.Read(readBuf); + updatefile.Close(); + if((err == KErrNone) && (readBuf.Length()>NULL)) + { + //Convert from TBuf8 to TInt64 + TLex8 lex(readBuf); + lex.Val(dataValue); + } + } + return dataValue; + } +#endif + +TBool CBrowserAppUi::IsSameWinApp(TUid aMessageUid) +{ + TInt nElements = sizeof(mArrayOfExternalAppUid)/sizeof(TInt); + for(TInt nIndex = 0;nIndex < nElements; nIndex++) + { + if(aMessageUid == TUid::Uid(mArrayOfExternalAppUid[nIndex])) + { + return ETrue; + } + } + return EFalse; +} +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAppViewBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAppViewBase.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,321 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserAppViewBase. +* +* +*/ + + +#include "BrowserAppViewBase.h" +#include "BrowserAppUi.h" +#include "ApiProvider.h" +#include +#include "CommonConstants.h" +#include +#include +#include +#include // check landscape/portrait modes +#include +#include +#include +#include "BrowserUtil.h" +#include +#include +#include +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TSKPair::TSKPair +// --------------------------------------------------------- +// +TSKPair::TSKPair(): + iCmdId(EWmlNoCmd),iQtnRsc(R_BROWSER_DYN_SK_NULL) +{ +} + +// --------------------------------------------------------- +// TSKPair::TSKPair +// --------------------------------------------------------- +// +TSKPair::TSKPair(TInt aId,TInt aRsc): + iCmdId(aId),iQtnRsc(aRsc) +{ +} + +// --------------------------------------------------------- +// TSKPair::IsNotDefault +// --------------------------------------------------------- +// +TBool TSKPair::IsAssigned() +{ + return ( (iCmdId != EWmlNoCmd) && (iQtnRsc != R_BROWSER_DYN_SK_NULL) ); +} + +// --------------------------------------------------------- +// TSKPair::operator== +// --------------------------------------------------------- +// +TBool TSKPair::operator==(TSKPair aSkPair) +{ + return( (iCmdId == aSkPair.id()) && (iQtnRsc == aSkPair.qtn()) ); +} + +// --------------------------------------------------------- +// TSKPair::operator= +// --------------------------------------------------------- +// +void TSKPair::operator=(TSKPair aSKPair) +{ + iCmdId = aSKPair.id(); + iQtnRsc = aSKPair.qtn(); +} + +// --------------------------------------------------------- +// TSKPair::set +// --------------------------------------------------------- +// +void TSKPair::setPair(TInt aId, TInt aRsc) +{ + iCmdId = aId; + iQtnRsc = aRsc; +} + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserViewBase::CBrowserViewBase +// --------------------------------------------------------- +// +CBrowserViewBase::CBrowserViewBase( MApiProvider& aApiProvider ): + iApiProvider( aApiProvider ), + iLastCommandSet( R_BROWSER_BUTTONS_CBA_NULL ) + { + } + +// --------------------------------------------------------- +// CBrowserViewBase::ApiProvider +// --------------------------------------------------------- +// +MApiProvider& CBrowserViewBase::ApiProvider() + { + return iApiProvider; + } + +// --------------------------------------------------------- +// CBrowserViewBase::UpdateCbaL +// --------------------------------------------------------- +// +void CBrowserViewBase::UpdateCbaL() +{ + if ( !iApiProvider.ExitInProgress() ) + { + TInt commandSet = CommandSetResourceIdL(); + TUid currViewId = Id(); + + // Ask BrowserAppUi which view we were in when we last updated the CBA + // this will help decide if we should do it again + TUid previousCBAUpdateViewId = iApiProvider.GetLastCBAUpdateView(); + + if ( commandSet ) + { + // Don't perform updates to the CBA when + // + // - We're still in the same view we were just in AND + // - We're not dynamically setting CBA (do more checking below) AND + // - The command set is the same as the one we just set last time + // this was called + // - We're currently in the content view (the update-cba is more complex here + // and we should just do it when asked by ContentView class) + // + // NOTE that we rely on CommandSetResource to set the commandSet to + // R_BROWSER_BUTTONS_CBA_DYNAMIC to signal a desire to update the keys + // dynamically. + if( currViewId == iPreviousViewID && + commandSet != R_BROWSER_BUTTONS_CBA_DYNAMIC && + currViewId == previousCBAUpdateViewId && + currViewId != KUidBrowserContentViewId) + { + return; + } + + // If command set is our special dynamic cba set, + // now ask derived class for the resources dynamically. + if(commandSet == R_BROWSER_BUTTONS_CBA_DYNAMIC) + { + TSKPair lsk,rsk,msk; + CommandSetResourceDynL(lsk,rsk,msk); + + // Similar exclusion as above: + // Don't update the LSK, RSK, MSK dynamic assignments if: + // + // - We're still in the same view we were just in + // - The lsk, rsk, msk are all the same settings we set last time + if(currViewId == previousCBAUpdateViewId && + lsk == iLastLSK && + rsk == iLastRSK && + msk == iLastMSK) + { + return; + } + + // Save the settings + iLastLSK = lsk; + iLastRSK = rsk; + iLastMSK = msk; + + // + // Update each softkey in turn + // + // If the CommandSetResourceDynL command assigned something to the key + // (in other words, it changed the key assignment from its default - it does have the option not to do so), + // + // Update each key now. + // + // Each derived-class view should update them as a general rule, even if it is to some default value + // + if( lsk.IsAssigned() ) + { + HBufC* txt = StringLoader::LoadLC( lsk.qtn() ); + Cba()->SetCommandL(CEikButtonGroupContainer::ELeftSoftkeyPosition, lsk.id(), *txt); + CleanupStack::PopAndDestroy(); // txt + } + if( rsk.IsAssigned() ) + { + HBufC* txt = StringLoader::LoadLC( rsk.qtn() ); + Cba()->SetCommandL(CEikButtonGroupContainer::ERightSoftkeyPosition, rsk.id(), *txt); + CleanupStack::PopAndDestroy(); // txt + } + if( msk.IsAssigned() ) + { + HBufC* txt = StringLoader::LoadLC( msk.qtn() ); + Cba()->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, msk.id(), *txt); + CleanupStack::PopAndDestroy(); // txt + } + } + else // Else - the exisiting case: set the softkeys as a block by assigning a pre-defined resource id + { + // The usual case is to set the command set to + // whatever CommandSetResourceIdL has said + Cba()->SetCommandSetL( commandSet ); + } + + // Save the last command set and set view id + iLastCommandSet = commandSet; + iApiProvider.SetLastCBAUpdateView(currViewId); + + // DrawNow() doesn't refresh MSK properly + Cba()->DrawDeferred(); + } + } +} + + + + + + + + +// --------------------------------------------------------- +// CBrowserViewBase::MakeCbaVisible +// --------------------------------------------------------- +// +void CBrowserViewBase::MakeCbaVisible(TBool aVisible) + { + // don't turn off the cba in landscape mode since it will still be visible and + // calling MakeVisible(EFalse) will just make it not update correctly + + TBool vis = aVisible; + if (!vis) + { + CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); + TInt currentStatusPaneLayoutResId = 0; + if (statusPane) + { + currentStatusPaneLayoutResId = statusPane->CurrentLayoutResId(); + } + else + { + // If this CBA:s owner does not have statuspane, then we ask the layout from AknCapServer. + currentStatusPaneLayoutResId = AVKONENV->StatusPaneResIdForCurrentLayout(CAknSgcClient::CurrentStatuspaneResource()); + } + + TBool staconPane = ((currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT) || + (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT) || + (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT) || + (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT) || + (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT) || + (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT)); + vis = staconPane; + } + Cba()->MakeVisible( vis ); + } + +// --------------------------------------------------------- +// CBrowserViewBase::UpdateGotoPaneL +// --------------------------------------------------------- +// +void CBrowserViewBase::UpdateGotoPaneL() + { + } + +// --------------------------------------------------------- +// CBrowserViewBase::ClearCbaL +// --------------------------------------------------------- +// +void CBrowserViewBase::ClearCbaL() + { + TInt commandSet = R_AVKON_SOFTKEYS_EMPTY; + Cba()->SetCommandSetL( commandSet ); + Cba()->DrawNow(); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::LaunchSearchApplicationL +// ----------------------------------------------------------------------------- +// +void CBrowserViewBase::LaunchSearchApplicationL( const TDesC& aSearchString ) + { + TInt id = iApiProvider.Preferences().GetIntValue( KBrowserSearchAppUid ); + TUid searchAppId( TUid::Uid( id ) ); + TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); + TApaTask task = taskList.FindApp( searchAppId ); + HBufC8* searchParam8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aSearchString ); + CleanupStack::PushL( searchParam8 ); + if ( task.Exists() ) + { + User::LeaveIfError( task.SendMessage( TUid::Uid( 0 ), *searchParam8 ) ); + } + else + { + RApaLsSession appArcSession; + TApaAppInfo appInfo; + User::LeaveIfError(appArcSession.Connect()); + CleanupClosePushL( appArcSession ); + TInt err = appArcSession.GetAppInfo( appInfo, searchAppId ); + if( err == KErrNone ) + { + CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); + cmdLine->SetExecutableNameL( appInfo.iFullName ); + cmdLine->SetTailEndL( *searchParam8 ); + User::LeaveIfError( appArcSession.StartApp( *cmdLine )); + CleanupStack::PopAndDestroy( cmdLine ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + } + CleanupStack::PopAndDestroy( searchParam8 ); + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserApplication.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser application class +* +* +*/ + + +#include "BrowserApplication.h" +#include "BrowserAppDocument.h" +#include "BrowserAppServer.h" + + +TUid CBrowserApplication::AppDllUid() const +{ + return KUidBrowserApplication; +} + +CApaDocument* CBrowserApplication::CreateDocumentL() +{ + return new (ELeave) CBrowserAppDocument(*this); +} + +void CBrowserApplication::NewAppServerL(CApaAppServer*& aAppServer) + { + aAppServer = new(ELeave) CBrowserAppServer; + } + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserAsyncExit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserAsyncExit.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CBrowserAsyncExit class can exit the Browser in async mode. It calls the CBrowserAppUi`s +* ExitBrowser() method, when the object completes the request. +* The class helps avoiding to send event.iCode EKeyApplication1; event +* to the embedded browser to exit. +* +* +*/ + + +#include "BrowserAsyncExit.h" +#include "ApiProvider.h" +#include "Logger.h" + + +// --------------------------------------------------------------------------- +// staticCBrowserAsyncExit* CBrowserAsyncExit::NewL( ) +// Create a CBrowserAsyncExit object. Leaves on failure. +// --------------------------------------------------------------------------- +// +CBrowserAsyncExit* CBrowserAsyncExit::NewL( MApiProvider* aApiProvider ) + { + LOG_ENTERFN("CBrowserAsyncExit::NewL"); + CBrowserAsyncExit* self = NewLC( aApiProvider ); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// static CBrowserAsyncExit* CBrowserAsyncExit::NewLC( ) +// Create a CBrowserAsyncExit object. Leaves on failure. +// --------------------------------------------------------------------------- +// +CBrowserAsyncExit* CBrowserAsyncExit::NewLC( MApiProvider* aApiProvider ) + { + LOG_ENTERFN("CBrowserAsyncExit::NewLC"); + CBrowserAsyncExit* self = new (ELeave) CBrowserAsyncExit( aApiProvider ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CBrowserAsyncExit::CBrowserAsyncExit( ):CActive(CActive::EPriorityStandard) +// Constructs this object +// --------------------------------------------------------------------------- +// +CBrowserAsyncExit::CBrowserAsyncExit( MApiProvider* aApiProvider ):CActive(CActive::EPriorityStandard) + { + LOG_ENTERFN("CBrowserAsyncExit::CBrowserAsyncExit"); + CActiveScheduler::Add( this ); + iApiProvider = aApiProvider; + } + +// --------------------------------------------------------------------------- +// CBrowserAsyncExit::~CBrowserAsyncExit() +// Destroy the object and release all memory objects +// --------------------------------------------------------------------------- +// +CBrowserAsyncExit::~CBrowserAsyncExit() + { + LOG_ENTERFN("CBrowserAsyncExit::~CBrowserAsyncExit"); + Cancel(); + } + +// --------------------------------------------------------------------------- +// void CBrowserAsyncExit::ConstructL() +// Two-pase constructor +// --------------------------------------------------------------------------- +// +void CBrowserAsyncExit::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// void CBrowserAsyncExit::Start() +// Complete an asynchronous request. +// --------------------------------------------------------------------------- +// +void CBrowserAsyncExit::Start() + { + if ( !IsActive() ) + { + LOG_ENTERFN("CBrowserAsyncExit::Start"); + TRequestStatus* status = &iStatus; + SetActive(); + User::RequestComplete( status, KErrNone ); + } + } + +// --------------------------------------------------------------------------- +// void CBrowserAsyncExit::DoCancel() +// Cancel any outstanding requests. +// --------------------------------------------------------------------------- +// +void CBrowserAsyncExit::DoCancel() + { + LOG_ENTERFN("CBrowserAsyncExit::DoCancel"); + } + +// --------------------------------------------------------------------------- +// void CBrowserAsyncExit::RunL() +// Handles object`s request completion event. +// --------------------------------------------------------------------------- +// +void CBrowserAsyncExit::RunL() + { + LOG_ENTERFN("CBrowserAsyncExit::RunL"); + iApiProvider->ExitBrowser( EFalse ); // Exit the browser. + } + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserBmOTABinSender.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserBmOTABinSender.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,453 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +*/ + + +// INCLUDE FILES + // System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + + // User includes +#include "BrowserAppUi.h" +#include "BrowserUtil.h" +#include "BrowserDialogs.h" +#include "BrowserBmOTABinSender.h" + + +// MACROS + +#ifndef _BOOKMARK_SENT_ASCII +// Calculates the byte size of 16bits (a) +#define TUINT16_LEN(a) ( sizeof(a) / sizeof(TUint16) ) +#endif + +// ================= LOCAL CONSTANTS ======================= + +/// Granularity of the bookmark list. +LOCAL_C const TInt KGranularity = 1; + +/// Attachment file name. +_LIT( KAttachmentFilename, "c:\\system\\temp\\Bookmark.txt"); + +#ifndef _BOOKMARK_SENT_ASCII +// Binary encoded BM data. See OTA spec +static const TUint16 Kch_lstart[] = { 0x00, 0x01, 0x00, 0x45 }; +static const TUint16 Kch_lend[] = { 0x01 }; +static const TUint16 Kch_start[] = { 0xC6,0x7F,0x01,0x87,0x15,0x11,0x03 }; +static const TUint16 Kch_mid[] = { 0x00,0x01,0x87,0x17,0x11,0x03 }; +static const TUint16 Kch_end[] = { 0x00,0x01,0x01 }; +#endif // _BOOKMARK_SENT_ASCII + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// CBookmarkOTAItem::CBookmarkOTAItem +// --------------------------------------------------------------------------- +// +CBookmarkOTAItem::CBookmarkOTAItem() + { + } + +// --------------------------------------------------------------------------- +// CBookmarkOTAItem::~CBookmarkOTAItem +// --------------------------------------------------------------------------- +// +CBookmarkOTAItem::~CBookmarkOTAItem() + { + delete iBookmark; + } + +// --------------------------------------------------------------------------- +// CBookmarkOTAItem::NewL +// --------------------------------------------------------------------------- +// +CBookmarkOTAItem* CBookmarkOTAItem::NewL( const TDesC& aUrl, const TDesC& aTitle ) + { + CBookmarkOTAItem *item = new (ELeave) CBookmarkOTAItem(); + CleanupStack::PushL( item ); + + item->ConstructL( aUrl, aTitle ); + + CleanupStack::Pop(); // item + + return item; + } + +// --------------------------------------------------------------------------- +// CBookmarkOTAItem::ConstructL +// --------------------------------------------------------------------------- +// +void CBookmarkOTAItem::ConstructL( const TDesC& aUrl, +#ifdef _BOOKMARK_SENT_ASCII + const TDesC& /*aTitle*/ ) +#else // _BOOKMARK_SENT_ASCII + const TDesC& aTitle ) +#endif // _BOOKMARK_SENT_ASCII + + { +#ifdef _BOOKMARK_SENT_ASCII + iBookmark = aUrl.AllocL(); +#else // _BOOKMARK_SENT_ASCII + TInt length = TUINT16_LEN( Kch_start ) + + TUINT16_LEN( Kch_mid ) + + TUINT16_LEN( Kch_end ); + + // calculate full length of BOOKMARK + length += aTitle.Length() + aUrl.Length(); + + iBookmark = HBufC::NewL( length ); + + TPtrC start( Kch_start, TUINT16_LEN(Kch_start) ); + TPtrC mid( Kch_mid, TUINT16_LEN(Kch_mid) ); + TPtrC end( Kch_end, TUINT16_LEN(Kch_end) ); + + iBookmark->Des().Append( start ); + iBookmark->Des().Append( aTitle ); + iBookmark->Des().Append( mid ); + iBookmark->Des().Append( aUrl ); + iBookmark->Des().Append( end ); + +#endif // _BOOKMARK_SENT_ASCII + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::NewL +// --------------------------------------------------------------------------- +// +CWmlBrowserBmOTABinSender* CWmlBrowserBmOTABinSender::NewL() + { + CWmlBrowserBmOTABinSender* sender = new (ELeave) + CWmlBrowserBmOTABinSender(); + CleanupStack::PushL( sender ); + + sender->ConstructL(); + + CleanupStack::Pop(); // sender + + return sender; + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::~CWmlBrowserBmOTABinSender +// --------------------------------------------------------------------------- +// +CWmlBrowserBmOTABinSender::~CWmlBrowserBmOTABinSender() + { + ResetAndDestroy(); + delete iSendUi; + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::ResetAndDestroy +// --------------------------------------------------------------------------- +// +void CWmlBrowserBmOTABinSender::ResetAndDestroy() + { + iBookmarks.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::AppendL +// --------------------------------------------------------------------------- +// +void CWmlBrowserBmOTABinSender::AppendL( const TText *aUrl, + const TText *aTitle ) + { + __ASSERT_DEBUG( (aUrl != NULL), Util::Panic( Util::EUninitializedData ) ); + TPtrC tempUrl( aUrl ); + CBookmarkOTAItem *item = NULL; + + if( !aTitle ) + { + _LIT( KEmptyText, "" ); + + item = CBookmarkOTAItem::NewL( tempUrl, (TDesC&)KEmptyText ); + } + else + { + TPtrC tempTitle( aTitle ); + + item = CBookmarkOTAItem::NewL( tempUrl, tempTitle ); + } + + CleanupStack::PushL( item ); + + iBookmarks.AppendL( item ); + + CleanupStack::Pop(); // item + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::AppendL +// --------------------------------------------------------------------------- +// +void CWmlBrowserBmOTABinSender::AppendL( const TDesC& aUrl, const TDesC& aTitle ) + { + CBookmarkOTAItem *item = CBookmarkOTAItem::NewL( aUrl, aTitle ); + CleanupStack::PushL( item ); + + iBookmarks.AppendL( item ); + + CleanupStack::Pop(); // item + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::SendAddressL +// --------------------------------------------------------------------------- +// +void CWmlBrowserBmOTABinSender::SendAddressL( ) + { + CMessageData* msgData = CMessageData::NewLC();//Cl St: 1 + __ASSERT_DEBUG( iBookmarks.Length(), + Util::Panic( Util::EUninitializedData ) ); + + // sending error indicator + // used with CreateAndSendMessageL() + // to free up allocated memory + // and than leave at the and of + // this function + TInt error = KErrNone; + + // calculate full length of OTA message + TInt length = 0; + + TSendingCapabilities capa; + CArrayFixFlat* servicesToDim = new(ELeave) CArrayFixFlat( 2 ); + CleanupStack::PushL( servicesToDim ); + servicesToDim->AppendL( KSenduiMtmAudioMessageUid ); + // service: audio message to dim + servicesToDim->AppendL( KSenduiMtmPostcardUid ); + // service: postcard to dim + TUid service = iSendUi->ShowSendQueryL(NULL, capa, servicesToDim, KNullDesC); + iSendUi->ServiceCapabilitiesL( service, capa ); + + CleanupStack::PopAndDestroy(); // destroy serviceToDim + +#ifndef _BOOKMARK_SENT_ASCII + length += TUINT16_LEN( Kch_lstart ) + TUINT16_LEN( Kch_lend ); +#endif // _BOOKMARK_SENT_ASCII + + for( TInt index = 0; index < iBookmarks.Count(); ++index ) + { + length += iBookmarks[index]->iBookmark->Length(); + } + +#ifdef _BOOKMARK_SENT_ASCII + // +1 '\n' per bookmarks + // no need '\n' after the last one + length += iBookmarks.Count() - 1; +#endif // _BOOKMARK_SENT_ASCII + + // body contains the binary sequence + HBufC* body = HBufC::NewLC( length ); + +#ifndef _BOOKMARK_SENT_ASCII + TPtrC lstart( Kch_lstart, TUINT16_LEN( Kch_lstart ) ); + TPtrC lend( Kch_lend, TUINT16_LEN( Kch_lend ) ); + // body starts with CHARACTERISTIC-LIST + body->Des().Append( lstart ); +#endif // _BOOKMARK_SENT_ASCII + + for( TInt index2 = 0; index2 < iBookmarks.Count(); ++index2 ) + { + // Append CHARACTERISTIC to CHARACTERISTIC-LIST + body->Des().Append( iBookmarks[index2]->iBookmark->Des().Ptr(), + iBookmarks[index2]->iBookmark->Length() ); + +#ifdef _BOOKMARK_SENT_ASCII + // append '\n' after ever bookmark except the last one + if( index2 < iBookmarks.Count() - 1 ) + { + _LIT( KNewLine, "\n" ); + body->Des().Append( KNewLine ); + } +#endif // _BOOKMARK_SENT_ASCII + } + +#ifndef _BOOKMARK_SENT_ASCII + // CHARACTERISTIC-LIST termination + body->Des().Append( lend ); +#endif // _BOOKMARK_SENT_ASCII + + // The issue is because of the deletion of the temp file . + // As we are sending address only , we can just create a buffer & send it in message + // body. + + if ( capa.iFlags & (TSendingCapabilities::ESupportsBodyText || TSendingCapabilities::ESupportsAttachments)) + { + CRichText* text = + CRichText::NewL(CEikonEnv::Static()->SystemParaFormatLayerL(), + CEikonEnv::Static()->SystemCharFormatLayerL()); + CleanupStack::PushL(text); + text->InsertL(0, *body); + msgData->SetBodyTextL( text ); + CleanupStack::PopAndDestroy(text ); + +#ifdef _BOOKMARK_SENT_ASCII + TRAP( error, iSendUi->CreateAndSendMessageL( service, msgData ) ); +#else + TRAP( error, iSendUi->CreateAndSendMessageL( service, + msgData, + KMsgBioUidWmlBrSettings ) ); +#endif // _BOOKMARK_SENT_ASCII + } + + ResetAndDestroy(); + + CleanupStack::PopAndDestroy( 2 ); // body, msgData + + // if any error occured during sending process + User::LeaveIfError( error ); + } + + + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::SendOPMLFileL +// --------------------------------------------------------------------------- +// +void CWmlBrowserBmOTABinSender::SendOPMLFileL(const TDesC& aOPMLFileName) + { + CMessageData* msgData = CMessageData::NewLC(); + + // sending error indicator + // used with CreateAndSendMessageL() + // to free up allocated memory + // and than leave at the and of + // this function + TInt error = KErrNone; + + TSendingCapabilities capa; + + CArrayFixFlat* servicesToDim = new(ELeave) CArrayFixFlat( 2 ); + CleanupStack::PushL( servicesToDim ); + servicesToDim->AppendL( KSenduiMtmAudioMessageUid ); + // service: audio message to dim + servicesToDim->AppendL( KSenduiMtmPostcardUid ); + // service: postcard to dim + TUid service = iSendUi->ShowSendQueryL(NULL, capa, servicesToDim, KNullDesC); + iSendUi->ServiceCapabilitiesL( service, capa ); + + CleanupStack::PopAndDestroy(); // destroy serviceToDim + + // body contains the binary sequence + //HBufC* body = HBufC::NewLC( aOPMLFileName.Length() ); + //body->Des().Copy( aOPMLFileName ); + + if ( capa.iFlags & TSendingCapabilities::ESupportsAttachments ) + { + // connect to file session + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); + CleanupClosePushL( fsSession ); + CFileMan* fman = CFileMan::NewL( fsSession ); + CleanupStack::PushL( fman ); + + // between WriteMessageBodyIntoFile() + // and CreateAndSendMessageL, or + // you have to take care of deleting + // temporary file + //error = WriteMessageBodyIntoFileL( fsSession, *body ); + + // send attachment + // this function has to be trapped + // because I have to be sure that the + // temproray file is removed! + msgData->AppendAttachmentL( aOPMLFileName ); + TRAP( error, iSendUi->CreateAndSendMessageL( service, + msgData ) ); + // delete temporary file + fman->Delete( aOPMLFileName ); + // close file session + fsSession.Close(); + + CleanupStack::PopAndDestroy( 2 ); // fsSession, fman + } + + CleanupStack::PopAndDestroy( 1 ); // msgData + + // if any error occured during sending process + User::LeaveIfError( error ); + } +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::ConstructL +// --------------------------------------------------------------------------- +// +void CWmlBrowserBmOTABinSender::ConstructL() + { + iSendUi = CSendUi::NewL(); + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::CWmlBrowserBmOTABinSender +// --------------------------------------------------------------------------- +// +CWmlBrowserBmOTABinSender::CWmlBrowserBmOTABinSender() +: iBookmarks( KGranularity ) + { + } + +// --------------------------------------------------------------------------- +// CWmlBrowserBmOTABinSender::WriteMessageBodyIntoFileL +// +// This function leaves only if the file creating failed. +// Do not need to be trapped to delete file. +// --------------------------------------------------------------------------- +// +TInt CWmlBrowserBmOTABinSender::WriteMessageBodyIntoFileL( RFs &fs, + TDesC& aBody ) + { + TInt result; + RFile otaFile; + TFileName filename( KAttachmentFilename ); + + if( (result = otaFile.Replace( fs, filename, EFileShareExclusive)) == + KErrNone ) + { + +#ifdef _BOOKMARK_SENT_ASCII + HBufC8 *tempBody = HBufC8::NewL( aBody.Length() ); + // convert 16bits -> 8bits + tempBody->Des().Copy( aBody ); + + // write message into file + result = otaFile.Write( *tempBody ); +#else // _BOOKMARK_SENT_ASCII + // put 16bits binary data to 8bits (double byte -> two byte) + TPtrC8 tempBody( (TUint8*)aBody.Ptr(), aBody.Length() * 2 ); + + // write message into file + result = otaFile.Write( tempBody ); +#endif // _BOOKMARK_SENT_ASCII + + otaFile.Close(); + } + + return result; + } + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserCommandLineParser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserCommandLineParser.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* parsing command lines could be used in view activation +* +* +*/ + + +// INCLUDE FILES +#include "BrowserCommandLineParser.h" +#include "Logger.h" + +LOCAL_D const TInt KParamsArrayGranularity = 8; + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::CBrowserCommandLineParser8() +// --------------------------------------------------------------------------- +CBrowserCommandLineParser8::CBrowserCommandLineParser8() + { + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::~CBrowserCommandLineParser8 +// --------------------------------------------------------------------------- +CBrowserCommandLineParser8::~CBrowserCommandLineParser8() + { + LOG_ENTERFN("CBrowserCommandLineParser8::~CBrowserCommandLineParser8"); + delete ( iParamString ); + delete ( iParams ); + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::NewL +// --------------------------------------------------------------------------- +CBrowserCommandLineParser8* CBrowserCommandLineParser8::NewL( + const TDesC8& aParamString ) + { + CBrowserCommandLineParser8* self = + CBrowserCommandLineParser8::NewLC( aParamString ); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::NewLC +// --------------------------------------------------------------------------- +CBrowserCommandLineParser8* CBrowserCommandLineParser8::NewLC( + const TDesC8& aParamString ) + { + LOG_ENTERFN("CBrowserCommandLineParser8::NewLC"); + CBrowserCommandLineParser8* self = + new ( ELeave ) CBrowserCommandLineParser8 ( ); + CleanupStack::PushL( self ); + self->ConstructL( aParamString ); + return self; + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::ConstructL +// --------------------------------------------------------------------------- +void CBrowserCommandLineParser8::ConstructL( const TDesC8& aParamString ) + { + LOG_ENTERFN("CBrowserCommandLineParser8::ConstructL"); + TInt length = aParamString.Length(); + iParamString = HBufC8::NewL( length );//the maxlength of buf = the length of the param + *iParamString = aParamString; + iParams = new( ELeave ) CArrayFixFlat( KParamsArrayGranularity ); + FillUpParamsL(); + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::Count +// --------------------------------------------------------------------------- +TUint CBrowserCommandLineParser8::Count() const + { + LOG_ENTERFN("CBrowserCommandLineParser8::Count"); + return iParams->Count(); + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::SetL +// --------------------------------------------------------------------------- +void CBrowserCommandLineParser8::SetL( const TDesC8& aParamString ) + { + LOG_ENTERFN("CBrowserCommandLineParser8::SetL"); + iParamString->ReAllocL( aParamString.Length() ); + *iParamString = aParamString; + iParams->Reset(); + FillUpParamsL(); + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::Param +// --------------------------------------------------------------------------- +TPtrC8 CBrowserCommandLineParser8::Param( TUint aIndex ) + { + LOG_ENTERFN("CBrowserCommandLineParser8::Param"); + TPtrC8 retVal; + ( aIndex < Count( ) )? ( retVal.Set( iParams->At( aIndex ) ) ) : + ( retVal.Set( KNullDesC8 ) ); + return retVal; + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::IntegerParam +// --------------------------------------------------------------------------- +TBool CBrowserCommandLineParser8::IntegerParam( TUint aIndex ) + { + LOG_ENTERFN("CBrowserCommandLineParser8::IntegerParam"); + if ( aIndex >= Count () ) + { + return EFalse; + } + TLex8 lex( iParams->At ( aIndex ) ); + TInt a; + if ( lex.Val( a ) == KErrNone ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::ParamToInteger +// --------------------------------------------------------------------------- +TInt CBrowserCommandLineParser8::ParamToInteger( TUint aIndex ) + { + LOG_ENTERFN("CBrowserCommandLineParser8::ParamToInteger"); + TInt retInt = KMaxTInt; + if ( aIndex < Count () ) + { + TLex8 lex ( iParams -> At( aIndex )); + lex.Val( retInt ); + } + return retInt; + } + +// --------------------------------------------------------------------------- +// CBrowserCommandLineParser8::FillUpParamsL +// --------------------------------------------------------------------------- +void CBrowserCommandLineParser8::FillUpParamsL() + { + LOG_ENTERFN("CBrowserCommandLineParser8::FillUpParamsL"); + TLex8 lex( *iParamString ); + while ( !lex.Eos() ) + { + TPtrC8 token = lex.NextToken(); + iParams->AppendL( token ); + } + } + +//End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserCommsModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserCommsModel.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserCommsModel. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include "BrowserCommsModel.h" +#include "BrowserDialogs.h" +#include "Browser.hrh" + +// CONSTANTS + +/// Granularity of observer list. +LOCAL_D const TInt KObserverListGranularity = 4; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserCommsModel::NewL +// --------------------------------------------------------- +// +CBrowserCommsModel* CBrowserCommsModel::NewL() + { + CBrowserCommsModel* model = new (ELeave) CBrowserCommsModel(); + CleanupStack::PushL( model ); + model->ConstructL(); + CleanupStack::Pop(); // model + return model; + } + +// --------------------------------------------------------- +// CBrowserCommsModel::~CBrowserCommsModel +// --------------------------------------------------------- +// +CBrowserCommsModel::~CBrowserCommsModel() + { + delete iObservers; + if ( iDb ) + { + iDb->RemoveObserver( this ); + } + delete iCachedApList; + delete iDb; + } + +// --------------------------------------------------------- +// CBrowserCommsModel::CBrowserCommsModel +// --------------------------------------------------------- +// +CBrowserCommsModel::CBrowserCommsModel(): iUpdatePending( EFalse ) + { + } + +// --------------------------------------------------------- +// CBrowserCommsModel::ConstructL +// --------------------------------------------------------- +// +void CBrowserCommsModel::ConstructL() + { + iDb = CActiveApDb::NewL( EDatabaseTypeIAP ); + iDb->AddObserverL( this ); + iCachedApList = new (ELeave) CApListItemList(); + iObservers = new (ELeave) CArrayPtrFlat + ( KObserverListGranularity ); + iDelayedRefresh = ETrue; + //GetAccessPointsL(); + } + +// --------------------------------------------------------- +// CBrowserCommsModel::HandleApDbEventL +// --------------------------------------------------------- +// +void CBrowserCommsModel::HandleApDbEventL +( MActiveApDbObserver::TEvent aEvent ) + { + // We try to refresh AP list in two cases: + // 1. Database changed; + // 2. Database unlocked and we have a pending update (previous update was + // unsuccessful). + if ( aEvent == MActiveApDbObserver::EDbChanged || + ( aEvent == MActiveApDbObserver::EDbAvailable && iUpdatePending ) ) + { + // Try to refresh cached AP list. + iDelayedRefresh = ETrue; + //GetAccessPointsL(); + NotifyObserversL(); + } + // MActiveApDbObserver::EDbClosing: + // MActiveApDbObserver::EDbAvailable: + // These events will never come. Commdb cannot be closed + // with a notifier still on it. (It must be deleted to close.) + } + +// --------------------------------------------------------- +// CBrowserCommsModel::ApDb +// --------------------------------------------------------- +// +CActiveApDb& CBrowserCommsModel::ApDb() const + { + return *iDb; + } + +// --------------------------------------------------------- +// CBrowserCommsModel::CommsDb +// --------------------------------------------------------- +// +CCommsDatabase& CBrowserCommsModel::CommsDb() const + { + return *(iDb->Database()); + } + +// --------------------------------------------------------- +// CBrowserCommsModel::CopyAccessPointsL +// --------------------------------------------------------- +// +CApListItemList* CBrowserCommsModel::CopyAccessPointsL() + { + if ( iDelayedRefresh ) + { + GetAccessPointsL(); + iDelayedRefresh = EFalse; + } + CApListItemList* accessPoints = new (ELeave) CApListItemList(); + CleanupStack::PushL( accessPoints ); + CApListItem* ap; + TInt i; + TInt count = iCachedApList->Count(); + for ( i = 0; i < count; i++ ) + { + ap = CApListItem::NewLC( iCachedApList->At( i ) ); + accessPoints->AppendL( ap ); + CleanupStack::Pop(); // ap; owner is now the list. + } + CleanupStack::Pop(); // accessPoints + return accessPoints; + } + +// --------------------------------------------------------- +// CBrowserCommsModel::AccessPoints +// --------------------------------------------------------- +// +const CApListItemList* CBrowserCommsModel::AccessPointsL() + { + if ( iDelayedRefresh ) + { + GetAccessPointsL(); + iDelayedRefresh = EFalse; + } + return iCachedApList; + } + +// --------------------------------------------------------- +// CBrowserCommsModel::RefreshAccessPointsL +// --------------------------------------------------------- +// +void CBrowserCommsModel::RefreshAccessPointsL() + { + iDelayedRefresh = ETrue; + //GetAccessPointsL(); + } + +// --------------------------------------------------------- +// CBrowserCommsModel::AddObserverL +// --------------------------------------------------------- +// +void CBrowserCommsModel::AddObserverL( MCommsModelObserver& aObserver ) + { + iObservers->AppendL( &aObserver ); + } + +// --------------------------------------------------------- +// CBrowserCommsModel::RemoveObserver +// --------------------------------------------------------- +// +void CBrowserCommsModel::RemoveObserver( MCommsModelObserver& aObserver ) + { + TInt i; + TInt count = iObservers->Count(); + for ( i = 0; i < count; i++ ) + { + if ( iObservers->At( i ) == &aObserver ) + { + iObservers->Delete( i ); + break; + } + } + } + + +// --------------------------------------------------------- +// CBrowserCommsModel::GetAccessPointsL +// --------------------------------------------------------- +// +void CBrowserCommsModel::GetAccessPointsL() + { + CApListItemList* apList = new (ELeave) CApListItemList(); + CleanupStack::PushL( apList ); + TRAPD( err, DoGetAccessPointsL( *apList ) ); + switch ( err ) + { + case KErrNone: + { + // Got new data. + delete iCachedApList; + CleanupStack::Pop(); // apList: now member. + iCachedApList = apList; + iUpdatePending = EFalse; + //NotifyObserversL(); + break; + } + + case KErrLocked: + case KErrAccessDenied: + case KErrPermissionDenied: + { + // Could not access database. Update now pending, old data remains. + CleanupStack::PopAndDestroy(); // apList + iUpdatePending = ETrue; + break; + } + + default: + { + // Other error. Propagate. + User::Leave( err ); + break; + } + } + } + +// --------------------------------------------------------- +// CBrowserCommsModel::DoGetAccessPointsL +// --------------------------------------------------------- +// +void CBrowserCommsModel::DoGetAccessPointsL( CApListItemList& aList ) const + { + CApSelect* apSelect = CApSelect::NewLC + ( + *(iDb->Database()), + KEApIspTypeAll, +// KEApIspTypeAll | KEApIspTypeWAPMandatory, + EApBearerTypeAll, + KEApSortNameAscending, + EIPv4 | EIPv6, + EVpnFilterBoth, //For VPNs + ETrue //Easy Wlan ap + ); + (void)apSelect->AllListItemDataL( aList ); + CleanupStack::PopAndDestroy(); // apSelect + } + +// --------------------------------------------------------- +// CBrowserCommsModel::NotifyObserversL +// --------------------------------------------------------- +// +void CBrowserCommsModel::NotifyObserversL() + { + if ( iObservers ) + { + TInt i; + TInt count = iObservers->Count(); + for ( i = 0; i < count; i++ ) + { + iObservers->At( i )->HandleCommsModelChangeL(); + } + } + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserContentView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserContentView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,3467 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser content view +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For Layout_Meta_Data landscape/portrait status + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "CommsModel.h" +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "Browser.hrh" +#include "BrowserContentView.h" +#include "BrowserContentViewToolbar.h" +#include "BrowserContentViewContainer.h" +#include "BrowserContentViewZoomModeTimer.h" +#include "BrowserBookmarksView.h" +#include "CommonConstants.h" +#include "BrowserAppUi.h" +#include "BrowserGotoPane.h" +#include "Preferences.h" +#include "BrowserPreferences.h" +#include "Display.h" +#include +#include "BrowserBookmarksModel.h" +#include "BrowserDialogs.h" +#include "BrowserUtil.h" +#include "BrowserBmOTABinSender.h" +#include +#include "BrowserUiVariant.hrh" +#include "BrowserAdaptiveListPopup.h" +#include "BrowserApplication.h" +#include "logger.h" +#include +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include "BrowserPopupEngine.h" + +#include +#include +#include +#include +#ifdef RD_SCALABLE_UI_V2 +#include +#endif +#include + +#include "BrowserShortcutKeyMap.h" +_LIT( KSchemaIdentifier, "://" ); +const TInt KSchemaIdentifierLength = 3; + +// Time interval in milliseconds that status pane stays visible after download in fullscreen mode +const TInt KFullScreenStatusPaneTimeout( 3 * 1000000 ); // 3 seconds + +const TInt KAutoFullScreenTimeout( 5 * 1000000 ); // 5 seconds + +const TInt KAutoFullScreenIdleTimeout( 10 * 1000000 ); // 10 seconds +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserContentView::NewLC +// ----------------------------------------------------------------------------- +// +CBrowserContentView* CBrowserContentView::NewLC( MApiProvider& aApiProvider, + TRect& aRect ) + { + CBrowserContentView* view = + new (ELeave) CBrowserContentView( aApiProvider ); + CleanupStack::PushL(view); + view->ConstructL( aRect ); + + return view; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::CBrowserContentView +// ----------------------------------------------------------------------------- +// +// Scroll indicators may become deprecated +CBrowserContentView::CBrowserContentView( MApiProvider& aApiProvider ) : + CBrowserViewBase( aApiProvider ), + iZoomMode(EFalse), + iContentFullScreenMode( EFalse ), + iIsPluginFullScreenMode( EFalse), + iWasContentFullScreenMode( EFalse ), + iTitle( NULL ) + { + iFindItemIsInProgress = EFalse; + iWasInFeedsView = EFalse; + iPenEnabled = AknLayoutUtils::PenEnabled(); + iFullScreenBeforeEditModeEntry = EFalse; + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::Id +// ----------------------------------------------------------------------------- +// +TUid CBrowserContentView::Id() const + { + return KUidBrowserContentViewId; + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::~CBrowserContentView +// ----------------------------------------------------------------------------- +// +CBrowserContentView::~CBrowserContentView() + { + delete iBrowserContentViewToolbar; + delete iNaviDecorator; + delete iBookmarksModel; + delete iContainer; + delete iEnteredKeyword; + delete iTextZoomLevelArray; + delete iFontSizeArray; + delete iZoomModeTimer; + iNaviPane = NULL; + if ( iToolBarInfoNote ) + { + iToolBarInfoNote->HideInfoPopupNote(); + } + delete iToolBarInfoNote; + delete iStylusPopupMenu; + delete iPeriodic; + delete iAutoFSPeriodic; + delete iIdlePeriodic; + delete iTitle; + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::ConstructL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::ConstructL( TRect& aRect ) + { + + BaseConstructL( R_BROWSER_CONTENT_VIEW ); + + ConstructMenuAndCbaEarlyL(); + + iContainer = CBrowserContentViewContainer::NewL( this, ApiProvider() ); + + iEnteredKeyword = NULL; + + // get the StatusPane pointer + if ( !iNaviPane ) + { + CEikStatusPane *sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane(); + // Fetch pointer to the default navi pane control + iNaviPane = + (CAknNavigationControlContainer*)sp->ControlL( + TUid::Uid(EEikStatusPaneUidNavi) ); + } + + // Array for zoom levels (..., 70%, 80%, 90%, 100%,... ) + iTextZoomLevelArray = new( ELeave )CArrayFixFlat ( 1 ); + // Array for zoom font sizes ( 1, 2, ... ) + iFontSizeArray = new( ELeave )CArrayFixFlat ( 1 ); + + // Get the possibile zoom levels + GetTextZoomLevelsL(); + iZoomModeTimer = CBrowserContentViewZoomModeTimer::NewL( this ); + + iToolBarInfoNote = CAknInfoPopupNoteController::NewL(); + HBufC* str = StringLoader::LoadLC(R_BROWSER_TOOLTIP_TOOLBAR); + iToolBarInfoNote->SetTextL(*str); + CleanupStack::PopAndDestroy(); + iBrowserContentViewToolbar = CBrowserContentViewToolbar::NewL(this); + if (iPenEnabled) + { + Toolbar()->SetToolbarObserver(this); + Toolbar()->SetFocusing(EFalse); + ShowToolbarOnViewActivation(ETrue); + } + iShortcutKeyMap = NULL; + iHistoryAtBeginning = EFalse; + iHistoryAtEnd = EFalse; + iZoomSliderVisible = EFalse; + iPeriodic = CPeriodic::NewL(CActive::EPriorityIdle); + iAutoFSPeriodic = CPeriodic::NewL(CActive::EPriorityIdle); + iIdlePeriodic = CPeriodic::NewL(CActive::EPriorityIdle); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::HandleCommandL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::HandleCommandL( TInt aCommand ) + { + // Disabling FullScreen for non-touch devices, before processing some dialog-based shortcut and toolbar actions + if ( !iPenEnabled && iContentFullScreenMode && ( ( aCommand == EWmlCmdFindKeyword ) || + ( aCommand == EWmlCmdHistory ) || + ( aCommand == EWmlCmdGoToAddress ) || + ( aCommand == EWmlCmdShowShortcutKeymap ) || + ( aCommand == EWmlCmdShowMiniature )|| + ( aCommand == EWmlCmdShowToolBar)) ) + { + iWasContentFullScreenMode = iContentFullScreenMode; + EnableFullScreenModeL( EFalse ); + } + + // resume js timers + ApiProvider().BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandResumeScriptTimers ); + +#ifdef RD_SCALABLE_UI_V2 + // Close the extended toolbar whenever any item on it is selected + if ( iPenEnabled && Toolbar()->ToolbarExtension()->IsShown() ) + { + Toolbar()->ToolbarExtension()->SetShown( EFalse ); + StartAutoFullScreenTimer(); + } +#endif + +#ifdef __RSS_FEEDS + // Handle the subscribe to submenu. + TInt cmd = aCommand - TBrCtlDefs::ECommandIdBase; + + if ((cmd >= TBrCtlDefs::ECommandIdSubscribeToBase) && + (cmd < TBrCtlDefs::ECommandIdPluginBase)) + { + HandleSubscribeToL(cmd); + return; + } +#endif // __RSS_FEEDS + + if ( ( aCommand != EWmlCmdZoomSliderShow ) && ZoomSliderVisible() ) + { + MakeZoomSliderVisibleL( EFalse ); + } + switch ( aCommand ) + { + case EWmlCmdSetAsHomePage: + { + HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoUrl); + if ( url && url->Length() && TBrowserDialogs::ConfirmQueryYesNoL(R_BROWSER_QUERY_SET_AS_HOME_PAGE)) + { + ApiProvider().Preferences().SetHomePageUrlL(url->Des()); + ApiProvider().Preferences().SetHomePageTypeL( EWmlSettingsHomePageAddress ); + } + CleanupStack::PopAndDestroy(); // url + break; + } + case EWmlCmdFavourites: + { + ApiProvider().SetViewToBeActivatedIfNeededL( + KUidBrowserBookmarksViewId ); + break; + } + + case EWmlCmdHistory: + { + ViewHistoryL(); + break; + } + + case EWmlCmdHistoryBack: + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandHistoryNavigateBack + + (TInt)TBrCtlDefs::ECommandIdBase ); + UpdateTitleL( iApiProvider ); + break; + } + case EWmlCmdHistoryForward: + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandHistoryNavigateForward + + (TInt)TBrCtlDefs::ECommandIdBase ); + UpdateTitleL( iApiProvider ); + break; + } + // Set search pane active and then launch editor. + case EIsCmdSearchWeb: + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + CEikButtonGroupContainer* cba = Cba()->Current(); + CEikCba* eikCba = static_cast( cba->ButtonGroup() ); + if( eikCba ) + { + eikCba->EnableItemSpecificSoftkey( EFalse ); + } +#endif + iContainer->GotoPane()->SetSearchPaneActiveL(); + LaunchGotoAddressEditorL(); + break; + } + case EWmlCmdGoToAddress: + case EWmlCmdGoToAddressAndSearch: + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + CEikButtonGroupContainer* cba = Cba()->Current(); + CEikCba* eikCba = static_cast( cba->ButtonGroup() ); + if( eikCba ) + { + eikCba->EnableItemSpecificSoftkey( EFalse ); + } +#endif + iContainer->GotoPane()->SetGotoPaneActiveL(); + LaunchGotoAddressEditorL(); + + // pause js timer to allow quicke vkb response + ApiProvider().BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandPauseScriptTimers ); + break; + } + + case EWmlCmdGotoPaneCancel: + { + CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() ); + // Cancel editing and sets Goto Pane text back. + if (iContainer->GotoPane()->PopupList() != NULL) + { + iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + iContainer->GotoPane()->PopupList()->HidePopupL(); + } + iContainer->ShutDownGotoURLEditorL(); + UpdateCbaL(); + if (iPenEnabled) + { + Toolbar()->SetDimmed(EFalse); + Toolbar()->DrawNow(); + iBrowserContentViewToolbar->UpdateButtonsStateL(); + } + if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) + { + MakeCbaVisible( EFalse ); + } + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + break; + } + + case EWmlCmdGotoPaneGoTo: + { + HBufC* input = iContainer->GotoPane()->GetTextL(); + CleanupStack::PushL( input ); + if( iContainer->GotoPane()->GotoPaneActive() ) + { + if ((input) && (input->CompareF(KWWWString)) && input->Length() ) + { + if (iPenEnabled) + { + Toolbar()->SetDimmed(EFalse); + Toolbar()->DrawNow(); + } + CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() ); + // Cancel editing and sets Goto Pane text back. + if (iContainer->GotoPane()->PopupList() != NULL) + { + iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + iContainer->GotoPane()->PopupList()->HidePopupL(); + } + GotoUrlInGotoPaneL(); + if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) + { + MakeCbaVisible( EFalse ); + } + } + } + else + { + // Search Editor was active, So launch Search application with + // search parameters and cancel editing of search and goto. + if ( (input) && input->Length() ) + { + if (iPenEnabled) + { + Toolbar()->SetDimmed(EFalse); + Toolbar()->DrawNow(); + } + + CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() ); + if ( iContainer->GotoPane() ) + { + iContainer->ShutDownGotoURLEditorL(); + LaunchSearchApplicationL( *input ); + } + UpdateCbaL(); + UpdateFullScreenL(); + } + } + CleanupStack::PopAndDestroy( input ); + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + break; + } + + case EWmlCmdGotoPaneSelect: + { + // Cancel editing and sets Goto Pane text back. + if (iContainer->GotoPane()->PopupList() != NULL) + { + iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + iContainer->GotoPane()->PopupList()->HidePopupL(); + } + // set LSK to GOTO now + UpdateCbaL(); + break; + } + + //adaptive popuplist + case EWmlCmdOpenFolder: + { + if (iContainer->GotoPane()->PopupList() != NULL) + { + iContainer->GotoPane()->PopupList()->SetDirectoryModeL( EFalse ); + } + break; + } + + case EAknSoftkeyCancel: + { + if ( isZoomMode() ) + { + SaveCurrentZoomLevel(EFalse); + //reset the zooming to the original settings + SetZoomModeL( EFalse ); + //Exit in zooming, enable the cursor + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomSliderHide + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + + if (iSynchRequestViewIsUp) + { + ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ); + } + else + { + ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancel + (TInt)TBrCtlDefs::ECommandIdBase ); + } + break; + } + + case EWmlCmdSaveAsBookmark: + { + AddNewBookmarkL(EFalse); + break; + } + + // UI notifies the BrCtl which calls the DialogsProvider with a list of images + case EWmlCmdShowImages: + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowImages + + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + } + + case EWmlCmdShowMiniature: + { + if (ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) && + !ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(ETrue)) + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowThumbnailView + (TInt)TBrCtlDefs::ECommandIdBase ); + } + break; + } + + // Download Manager UI Library shows a list of ongoing downloads + case EWmlCmdDownloads: + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowDownloads + + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + } + + // Loads images on a page + case EWmlCmdLoadImages: + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandLoadImages + + (TInt)TBrCtlDefs::ECommandIdBase ); + ApiProvider().WindowMgr().CurrentWindow()->SetImagesLoaded(ETrue); + break; + } + + // UI notifies the BrCtl which calls the DialogsProvider to show the toolbar + case EWmlCmdShowToolBar: + { + if ( !PenEnabled() && iApiProvider.Preferences().ShowToolbarOnOff() && + !iApiProvider.WindowMgr().CurrentWindow()->WMLMode() ) + { + iToolBarInfoNote->ShowInfoPopupNote(); + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowToolBar + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + + break; + } + //zoom in and set the cursor's position for non-touch + case EWmlCmdZoomIn: + { + if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ) + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomIn + + (TInt)TBrCtlDefs::ECommandIdBase ); + ZoomImagesInL(); + } + break; + } + + //zoom out and set the cursor's position for non-touch + case EWmlCmdZoomOut: + { + if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ) + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomOut + + (TInt)TBrCtlDefs::ECommandIdBase ); + ZoomImagesOutL(); + } + break; + } + + /* Zoom Mode currently disabled + case EWmlCmdZoomMode: + { + // Disable the cursor: by using the zoom slider show cmd (temp) + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomSliderShow + + (TInt)TBrCtlDefs::ECommandIdBase ); + + // Disable any activated objects (i.e. plugins, input boxes) + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandCancel + + (TInt)TBrCtlDefs::ECommandIdBase ); + + // Display softkeys if in full screen mode. i.e. go to normal screen + if ( !iPenEnabled && iContentFullScreenMode ) + { + iWasContentFullScreenMode = iContentFullScreenMode; + EnableFullScreenModeL( EFalse ); + } + + // Enter zoom mode + ZoomModeImagesL(); + break; + } + */ + + case EWmlCmdZoomSliderShow: + { + // Toggle displaying the zoom slider, when the zoom button + // on toolbar is selected + MakeZoomSliderVisibleL( !iZoomSliderVisible ); + break; + } + case EWmlCmdZoomSliderHide: + { + // Currently not used + MakeZoomSliderVisibleL( EFalse ); + break; + } + + // Find keyword commands + case EWmlCmdFindKeyword: + { + LaunchFindKeywordEditorL(); + break; + } + + case EWmlCmdFindKeywordPaneFind : + { + break; + } + + case EWmlCmdFindKeywordPaneClose : + { + iContainer->FindKeywordPane()->ResetPrevText(); + CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->FindKeywordPane() ); + // Cancel editing and sets Goto Pane text back. + iContainer->ShutDownFindKeywordEditorL(); + UpdateCbaL(); + if (iPenEnabled) + { + iBrowserContentViewToolbar->UpdateButtonsStateL(); + } + + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandClearFind + + (TInt)TBrCtlDefs::ECommandIdBase ); + + if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) + { + MakeCbaVisible( EFalse ); + } + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + break; + } + + case EWmlCmdFindNext : + { + // Find next keyword + FindKeywordL( NULL, ETrue ); + break; + } + case EWmlCmdFindPrevious : + { + // Find previous keyword + FindKeywordL( NULL, EFalse ); + break; + } + + case EAknSoftkeySelect: + { + if( iHistoryViewIsUp ) + { + if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode ) + { + EnableFullScreenModeL( ETrue ); + iWasContentFullScreenMode = EFalse; + } + + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandOpen + (TInt)TBrCtlDefs::ECommandIdBase ); + } + + // Save zoom factor and quit the zoom mode + if ( isZoomMode() ) + { + SaveCurrentZoomLevel(ETrue); + // Disable the zoom mode + SetZoomModeL( EFalse ); + // Return to full screen, if we were in full screen before + if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode ) + { + EnableFullScreenModeL( ETrue ); + iWasContentFullScreenMode = EFalse; + } + // Exiting zoom mode, enable the cursor + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomSliderHide + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + break; + } + case EAknSoftkeyOk: + { + if( iThumbnailViewIsUp ) + { + if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode ) + { + EnableFullScreenModeL( ETrue ); + iWasContentFullScreenMode = EFalse; + } + + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandOpen + (TInt)TBrCtlDefs::ECommandIdBase ); + } + break; + } + + case EAknSoftkeyClose: + { + if( iWasInFeedsView) + { + // FeedsView library + + } + else + { + if ( isZoomMode() ) + { + SetZoomModeL( EFalse ); + } + AppUi()->HandleCommandL( EWmlCmdCloseWindow ); + } + break; + } + + case EWmlCmdSendAddressViaUnifiedMessage: + { + SendAddressL( ); + } + break; + + case EWmlCmdBack: + { + if( iWasInFeedsView) + { + // FeedsView library + + } + else if( iImageMapActive ) + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandBack + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + else if( ApiProvider().BrCtlInterface().NavigationAvailable( + TBrCtlDefs::ENavigationBack ) ) + { + AppUi()->HandleCommandL( aCommand ); + } + else + { + AppUi()->HandleCommandL( EWmlCmdCloseWindow ); + } + break; + } + + case EWmlCmdOneStepBack: + { + if( ApiProvider().BrCtlInterface().NavigationAvailable(TBrCtlDefs::ENavigationBack ) ) + { + AppUi()->HandleCommandL( aCommand ); + } + break; + } + + case EAknCmdHelp: + { + if ( HELP ) + { + AppUi()->HandleCommandL( EAknCmdHelp ); + } + break; + } + + case EWmlCmdCancelFetch: + { + // give it to AppUi + AppUi()->HandleCommandL( aCommand ); + break; + } + + case EWmlCmdOpenLinkInNewWindow: + { + iApiProvider.BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandOpenNewWindow + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + } + + case EWmlCmdOpenLink: + { + iApiProvider.BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandOpen + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + } + + case EWmlCmdShowSubscribeList: + { + const RPointerArray& subscribeToList = iApiProvider.BrCtlInterface().SubscribeToMenuItemsL(); + TInt len(subscribeToList.Count()); + if (len > 0) + { + CArrayFixFlat* optList = new( ELeave ) CArrayFixFlat(10); + CleanupStack::PushL( optList ); + HBufC* title = StringLoader::LoadLC(R_BROWSER_SUBSCRIBE_LIST); + TInt i; + for(i = 0; i < len; i++) + { + if(subscribeToList[i]->Title().Length()) + { + TBrCtlSelectOptionData t(subscribeToList[i]->Title(), EFalse, EFalse, EFalse); + optList->AppendL(t); + } + else + { + TBrCtlSelectOptionData t(subscribeToList[i]->Url(), EFalse, EFalse, EFalse); + optList->AppendL(t); + } + } + TBool ret(ApiProvider().DialogsProvider().DialogSelectOptionL( *title, ESelectTypeNone, *optList)); + if( ret ) + { + TInt i; + for (i = 0; i < optList->Count(); i++) + { + if ((*optList)[i].IsSelected()) + { + HandleSubscribeToL(subscribeToList[i]->CommandID() - TBrCtlDefs::ECommandIdBase); + break; + } + } + } + optList->Reset(); + CleanupStack::PopAndDestroy( 2 ); // optList, title + } + break; + } + + case EWmlCmdHome: + if (ApiProvider().Preferences().HomePageType() == EWmlSettingsHomePageAddress ) + { + HBufC* url = HBufC::NewLC( KMaxHomePgUrlLength ); + TPtr ptr( url->Des() ); + User::LeaveIfError(ApiProvider().Preferences().HomePageUrlL( ptr )); + ApiProvider().FetchL( ptr ); + CleanupStack::PopAndDestroy(); // url + } + else + { + HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoUrl); + if ( url && url->Length() && TBrowserDialogs::ConfirmQueryYesNoL(R_BROWSER_QUERY_SET_AS_HOME_PAGE)) + { + ApiProvider().Preferences().SetHomePageUrlL(url->Des()); + ApiProvider().Preferences().SetHomePageTypeL( EWmlSettingsHomePageAddress ); + } + CleanupStack::PopAndDestroy(); // url + } + break; + + case EWmlCmdGo: + break; + + case EWmlCmdConfigureShortcutKeymap: + { + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserSettingsViewId, KUidSettingsGotoShortcutsGroup.iUid ); + break; + } + + case EWmlCmdShowShortcutKeymap: + { + ShowKeymap(); + break; + } + + case EWmlCmdHideShortcutKeymap: + { + HideKeymap(); + break; + } + + case EWmlCmdOpenFeedsFolder: + // Launch into feeds view, telling it that we came from content view + ApiProvider().FeedsClientUtilities().ShowFolderViewL(KUidBrowserContentViewId); + break; + + case EWmlCmdEnterFullScreenBrowsing: + { + if ( iPenEnabled ) + { + EnableFullScreenModeL( ETrue ); + } + else + { + if ( iContentFullScreenMode ) + { + EnableFullScreenModeL( EFalse ); + } + else + { + EnableFullScreenModeL( ETrue ); + } + } + break; + } + + case EWmlCmdExitFullScreenBrowsing: + EnableFullScreenModeL( EFalse ); + break; + + default: + { + // DO element and toolbar commands are passed to BrCtl via AppUi + AppUi()->HandleCommandL( aCommand ); + break; + } + } // end of switch (aCommand) + + // Enabling FullScreen for non-touch devices, after processing some dialog-based shortcut and toolbar actions + if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode && + ( ( aCommand == EWmlCmdFindKeywordPaneClose ) || + ( aCommand == EWmlCmdHideShortcutKeymap ) || + ( aCommand == EWmlCmdGotoPaneGoTo ) || + ( aCommand == EWmlCmdGotoPaneCancel ) || + ( aCommand == EAknSoftkeyCancel ) ) ) + { + EnableFullScreenModeL( ETrue ); + iWasContentFullScreenMode = EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::ViewHistoryL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::ViewHistoryL() + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowHistory + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::DoActivateL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + CBrowserAppUi* ui; + + ui = STATIC_CAST( CBrowserAppUi*, AppUi() ); + iPreviousViewID = ApiProvider().LastActiveViewId(); + if ( ui->LastActiveViewId() == KUidBrowserNullViewId ) + { + //No view has been yet set as startup view -> use bookmarks view + ui->SetLastActiveViewId ( KUidBrowserBookmarksViewId ); + ui->SetViewToBeActivatedIfNeededL( ui->LastActiveViewId() ); + ApiProvider().SetLastActiveViewId ( ui->LastActiveViewId() ); + } + else + { + HandleStatusPaneCallBack(); + ApiProvider().SetLastActiveViewId(Id()); + } + + iContainer->ActivateL(); + + AppUi()->AddToViewStackL( *this, iContainer ); + + //Reset the title before updating the title in case of view activation + delete iTitle; + iTitle = NULL; + + ApiProvider().Display().FSPaneOnL( ); + ApiProvider().Display().SetGPRSIndicatorOnL(); + + UpdateTitleL( ApiProvider() ); + + ApiProvider().BrCtlInterface().MakeVisible(ETrue); + ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandGainFocus + + (TInt)TBrCtlDefs::ECommandIdBase); + + if( ui->Connection().Connected() && + !ui->Preferences().HttpSecurityWarningsStatSupressed() ) + { + // Update security indicators + if ( ui->SomeItemsNotSecure() ) + { + ui->Display().UpdateSecureIndicatorL( EAknIndicatorStateOff ); + } + else + { + ui->Display().UpdateSecureIndicatorL( + ui->LoadObserver().LoadStatus( + CBrowserLoadObserver::ELoadStatusSecurePage ) ? + EAknIndicatorStateOn : EAknIndicatorStateOff ); + } + } + UpdateCbaL(); + if(KeymapIsUp()) + { + RedrawKeymap(); + } + + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + iContainer->SetRect(ClientRect()); +PERFLOG_STOP_WRITE("ContentView::DoActivate") + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::UpdateFullScreenL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::UpdateFullScreenL() + { + TVwsViewId activeViewId; + if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone ) + { + if ( activeViewId.iViewUid == KUidBrowserContentViewId ) + { + if ( iContentFullScreenMode ) + { + SetContentContainerRect(); + if (iPenEnabled) + { + Toolbar()->SetToolbarVisibility( EFalse, EFalse ); + Toolbar()->MakeVisible( EFalse ); + } + if(Cba()->IsVisible()) + { + Cba()->MakeVisible( EFalse ); + UpdateCbaL(); + } + if (!ApiProvider().Fetching()) + { + if(StatusPane()->IsVisible()) + { + StatusPane()->MakeVisible(EFalse); + } + } + else + { + if(!StatusPane()->IsVisible()) + { + ShowFsStatusPane(ETrue); + } + } + } + else + { + Cba()->MakeVisible( ETrue ); + StatusPane()->MakeVisible( ETrue ); + } + + ApiProvider().Display().FSPaneOnL( ); + ApiProvider().Display().SetGPRSIndicatorOnL(); + + //Reset the title before updating the title in case of view activation + delete iTitle; + iTitle = NULL; + UpdateTitleL(ApiProvider()); + ApiProvider().Display().RestoreTitleL(); + StatusPane()->ApplyCurrentSettingsL(); + } + } + } + +TRect CBrowserContentView::ResizeClientRect() + { + TRect clientRect = ClientRect(); + + if(iContentFullScreenMode && (Toolbar() && Toolbar()->IsVisible()) && Cba()->IsVisible()) + { + TRect screenRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, screenRect); + clientRect = screenRect; + } + + if (Layout_Meta_Data::IsLandscapeOrientation() && + (StatusPane() && StatusPane()->IsVisible()) && !Cba()->IsVisible() && IsForeground()) + { + TRect screenRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect); + clientRect.iBr.iY = screenRect.iBr.iY; + + } + + return clientRect; + } + +void CBrowserContentView::SetContentContainerRect() + { + TRect clientRect = ResizeClientRect(); + iContainer->SetRect(clientRect); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SetFullScreenOffL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SetFullScreenOffL() + { + TVwsViewId activeViewId; + if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone ) + { + Cba()->MakeVisible( ETrue ); + UpdateCbaL(); + if ( Layout_Meta_Data::IsLandscapeOrientation() ) + StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); + StatusPane()->ApplyCurrentSettingsL(); + StatusPane()->MakeVisible( ETrue ); + iContainer->SetRect( ClientRect() ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SetZoomLevelL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SetZoomLevelL() + { + // Get the current index of the array. + iCurrentZoomLevel = ApiProvider().BrCtlInterface(). + BrowserSettingL(TBrCtlDefs::ESettingsCurrentZoomLevelIndex); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::DoDeactivate +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::DoDeactivate() + { + if ( !ApiProvider().ExitInProgress() ) + { + TBrCtlDefs::TBrCtlElementType focusedElementType = + ApiProvider().BrCtlInterface().FocusedElementType(); + if (focusedElementType == TBrCtlDefs::EElementActivatedInputBox) + { + ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandAccept + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + TRAP_IGNORE( ApiProvider().Display().UpdateSecureIndicatorL( + EAknIndicatorStateOff )); + iContainer->SetFocus( EFalse ); + + EnableFullScreenModeL( EFalse); + + TRAP_IGNORE( ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandLoseFocus + + (TInt)TBrCtlDefs::ECommandIdBase ) ); + ApiProvider().BrCtlInterface().MakeVisible(EFalse); + } + + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + +// ---------------------------------------------------------------------------- +// CBrowserContentView::CommandSetResourceIdL +// ---------------------------------------------------------------------------- +// +TInt CBrowserContentView::CommandSetResourceIdL() + { + LOG_ENTERFN("ContentView::CommandSetResourceIdL"); + + // default case for normal screen + TInt result( R_BROWSER_DEFAULT_BUTTONS ); + + // default case for full screen + if ( iContentFullScreenMode ) + { + result = R_BROWSER_SOFTKEYS_EXIT_FULL_SCREEN; + } + if ( isZoomMode() ) + { + return R_BROWSER_DEFAULT_BUTTONS_AT_ZOOM_MODE_ON; + } + if( KeymapIsUp() ) + { + return R_BROWSER_SOFTKEYS_CONFIGURE_HIDE; + } + if( iHistoryViewIsUp ) + { + return R_BROWSER_SOFTKEYS_SELECT_CANCEL_SELECT; + } + if( iPluginPlayerIsUp ) + { + return R_BROWSER_SOFTKEYS_CANCEL; + } + if( iSmartTextViewIsUp ) + { + return R_INPUT_ELEMENT_BUTTONS; + } + if( iThumbnailViewIsUp ) + { + return R_BROWSER_DEFAULT_BUTTONS_AT_THUMBNAIL_VIEW_ON; + } + if( iImageMapActive ) + { + return R_BROWSER_DEFAULT_BUTTONS; + } + if( iSynchRequestViewIsUp ) + { + if ( !iContentFullScreenMode ) + { + result = R_BROWSER_SOFTKEYS_CANCEL; + } + return result; + } + + if( iContainer->GotoPane()->IsVisible() ) + // when goto pane is up there is no focusable element or active fetching + // process in place + { + if( iContainer->GotoPane()->SearchPaneActive() ) + { + result = R_BROWSER_BOOKMARKS_CBA_SEARCH_PANE_SEARCH_CANCEL; + } + else + { + //check wheter there is an active popuplist + if( (iContainer->GotoPane()->PopupList() != NULL) && + ( iContainer->GotoPane()->PopupList()->IsOpenDirToShow() )) + { + result = R_BROWSER_BOOKMARKS_CBA_GOTO_PANE_OPENDIR_CANCEL; + } + else if(iContainer->GotoPane()->PopupList() && + iContainer->GotoPane()->PopupList()->IsPoppedUp() && + !iPenEnabled) + { + // LSK Select is only for non-touch devices + result = R_BROWSER_BOOKMARKS_CBA_GOTO_PANE_SELECT_CANCEL; + } + else + { + result = R_BROWSER_BOOKMARKS_CBA_GOTO_PANE_GOTO_CANCEL; + } + } + } + else if ( iContainer->FindKeywordPane()->IsVisible() ) + { + result = R_BROWSER_CBA_FIND_KEYWORD_PANE_OPTION_CLOSE; + } + else if ( ApiProvider().Fetching() ) + { + if ( !iContentFullScreenMode ) + { + // Enable Options menu during download can be done here + // otherwise use defualt Full Screen buttons + result = R_BROWSER_OPTIONS_MENU_DURING_DOWNLOAD; + } + } + else + { + TBrCtlDefs::TBrCtlElementType elementtype = + ApiProvider().BrCtlInterface().FocusedElementType(); + if( elementtype == TBrCtlDefs::EElementActivatedObjectBox ) + { + if ( !iContentFullScreenMode ) + { + result = R_INPUT_ELEMENT_BUTTONS; + } + } + else if ( !ApiProvider().BrCtlInterface().NavigationAvailable( + TBrCtlDefs::ENavigationBack ) ) + // at the beginning of the history list + { + if ( !iContentFullScreenMode ) + { + // Options + Close + result = R_BROWSER_DEFAULT_BUTTONS_AT_BEGINNING_OF_HISTORY; + } + } + } +BROWSER_LOG( ( _L(" ContentView's buttons:%d"), result ) ); + return result; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::ProcessCommandL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::ProcessCommandL(TInt aCommand) + { + CBrowserViewBase::ProcessCommandL( aCommand ); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::DynInitMenuPaneL +// ----------------------------------------------------------------------------- +void CBrowserContentView::DynInitMenuPaneL( TInt aResourceId, + CEikMenuPane* aMenuPane ) + { + LOG_ENTERFN("CBrowserContentView::DynInitMenuPaneL"); + __ASSERT_DEBUG(aMenuPane, Util::Panic(Util::EUninitializedData)); + + // pasue js timers + ApiProvider().BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandPauseScriptTimers ); + + if ( aResourceId == R_MENU_PANE ) + { + // web feeds + #ifndef __RSS_FEEDS + aMenuPane->SetItemDimmed( EWmlCmdShowSubscribeList, ETrue ); + #else + const RPointerArray& items = ApiProvider().BrCtlInterface().SubscribeToMenuItemsL(); + if ( items.Count() == 0 ) + { + aMenuPane->SetItemDimmed( EWmlCmdShowSubscribeList, ETrue ); + } + #endif // __RSS_FEEDS + + // downloads + aMenuPane->SetItemDimmed( EWmlCmdDownloads, + !ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads ) ); + + // If we have a touch device, check to see if the zoom slider is up, if so disable + if ( PenEnabled() && ZoomSliderVisible() ) + { + MakeZoomSliderVisibleL( EFalse ); + } + + // find + aMenuPane->SetItemDimmed( EWmlCmdFindNext, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdFindPrevious, ETrue ); + +/* + // help menu sub-menu - depending if Independent Application Update is available + if (BRDO_BROWSER_UPDATE_UI_FF) + { + aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdHelpMenu, ETrue ); + } +*/ + if ( iContainer->FindKeywordPane()->IsVisible() ) + { + CEikMenuPaneItem::SData menuFindNext = + aMenuPane->ItemData( EWmlCmdFindNext ); + CEikMenuPaneItem::SData menuFindPrevious = + aMenuPane->ItemData( EWmlCmdFindPrevious ); + + // Delete all menu items + aMenuPane->DeleteBetweenMenuItems( 0, + aMenuPane->NumberOfItemsInPane() - 1 ); + + aMenuPane->AddMenuItemL( menuFindNext ); + aMenuPane->AddMenuItemL( menuFindPrevious ); + aMenuPane->SetItemDimmed( EWmlCmdFindNext, EFalse ); + aMenuPane->SetItemDimmed( EWmlCmdFindPrevious, EFalse ); + return; + } + + // wml option menu items + if ( ApiProvider().BrCtlInterface().WMLOptionMenuItemsL()->Count() < 1 ) + { + // there isn't DO element, or only the first one with PREV exist + aMenuPane->SetItemDimmed( EWmlCmdServiceOptions, ETrue ); + } + + // find window + if (ApiProvider().WindowMgr().CurrentWindow()->WMLMode()) + { + aMenuPane->SetItemDimmed(EWmlCmdFindKeyword, ETrue); + } + + // shortcut key map + if (PenEnabled() || ApiProvider().IsEmbeddedModeOn()) + { + aMenuPane->SetItemDimmed( EWmlCmdShowShortcutKeymap, ETrue); + } + + // BrCtl adds menu items to UI options menu list + ApiProvider().BrCtlInterface().AddOptionMenuItemsL( *aMenuPane, aResourceId ); + } + else if ( aResourceId == R_DO_ELEMENTS ) + { + RPointerArray* wmlElements; + wmlElements = ApiProvider().BrCtlInterface().WMLOptionMenuItemsL(); + + for ( TInt i=0; iCount(); i++ ) + { + TBrCtlWmlServiceOption* option = (*wmlElements)[i]; + if ( option != NULL) + { + CEikMenuPaneItem::SData item; + item.iText.Copy( option->Text() ); + item.iCommandId = option->ElemID(); + item.iFlags = 0; + item.iCascadeId = 0; + aMenuPane->InsertMenuItemL(item, 0); + } + } + } + else if ( aResourceId == R_GOTO_SUBMENU ) + { + // back to page + aMenuPane->SetItemDimmed( EWmlCmdBackToPage, ETrue ); + + // bookmarks/webfeeds + if( ApiProvider().IsEmbeddedModeOn() ) + { + aMenuPane->SetItemDimmed( EWmlCmdFavourites, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdOpenFeedsFolder, ETrue ); + } + + // home + aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ApiProvider().IsLaunchHomePageDimmedL() ); + //search + if ( ! ApiProvider().Preferences().SearchFeature() ) + { + aMenuPane->SetItemDimmed( EIsCmdSearchWeb, ETrue ); + } + } + else if ( aResourceId == R_PAGEACTIONS_SUBMENU ) + { + // bookmark + if ( ApiProvider().IsEmbeddedModeOn() && CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu() ) + { + aMenuPane->SetItemDimmed( EWmlCmdSaveAsBookmark, ETrue ); + } + HBufC *pageUrl = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( ( pageUrl == NULL ) || ( pageUrl->Length() == 0 ) ) + { + aMenuPane->SetItemDimmed( EWmlCmdSaveAsBookmark, ETrue ); + } + CleanupStack::PopAndDestroy( pageUrl ); + + // send + aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); + + if (ApiProvider().IsEmbeddedModeOn()) + { + aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); + } + + // set as home page + //aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, ETrue); + + + // pop-up blocking + if ( ApiProvider().IsEmbeddedModeOn() || ApiProvider().WindowMgr().CurrentWindow()->WMLMode()) + { + aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, EFalse ); + aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, EFalse ); + + if ( ApiProvider().Preferences().PopupBlocking()) + { + HBufC* url = ApiProvider().WindowMgr().CurrentWindow()->BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + TBool dimAllow = EFalse; + if( url ) + { + // 'Allow Popups' needed if the current URL is not on the whitelist + TRAPD( errWhite, dimAllow = ApiProvider().PopupEngine().IsUrlOnWhiteListL( *url );); + // Error handling + if ( !errWhite ) + { + aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, !dimAllow ); + aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, dimAllow ); + } + } + // else no url (strange case), so no popup specific menuitem + CleanupStack::PopAndDestroy( url ); + } + else + { + //not shown any popupblocks related menu items when it's setting noblock + aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, ETrue ); + } + } + } + else if ( aResourceId == R_VIEW_SUBMENU ) + { + // toolbar + if ( !PenEnabled() && iApiProvider.Preferences().ShowToolbarOnOff() ) + { + aMenuPane->SetItemDimmed( EWmlCmdShowToolBar, ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ); + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdShowToolBar, ETrue); + } + + // disable fullscreen mode for touch only -- which has auto fullscreen now + if (iPenEnabled) + { + aMenuPane->SetItemDimmed(EWmlCmdEnterFullScreenBrowsing, ETrue); + } + + // rotate + if (!ApiProvider().Preferences().RotateDisplay() ) + { + aMenuPane->SetItemDimmed( EWmlCmdRotateDisplay, ETrue ); + } + + // page overview + if ( !ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) || + ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ) + { + aMenuPane->SetItemDimmed( EWmlCmdShowMiniature, ETrue); + } + + // show images + if( !ApiProvider().BrCtlInterface().ImageCountL() ) + { + aMenuPane->SetItemDimmed( EWmlCmdShowImages, ETrue ); + } + + // load images + if (( ApiProvider().Preferences().AutoLoadContent() == EWmlSettingsAutoloadImagesNoFlash) || + (ApiProvider().Preferences().AutoLoadContent() == EWmlSettingsAutoloadAll) || + ApiProvider().WindowMgr().CurrentWindow()->HasLoadedImages() ) + { + aMenuPane->SetItemDimmed( EWmlCmdLoadImages, ETrue ); + } + + // window + if ( !ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) || + ApiProvider().IsEmbeddedModeOn() || + ApiProvider().WindowMgr().WindowCount() < 2) + { + aMenuPane->SetItemDimmed( EWmlCmdSwitchWindow, ETrue ); + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::CheckForEmptyWindowsMenuL +// Checks for the existence of Windows Submenu Items return true if no submenu items exist +// ----------------------------------------------------------------------------- +// +TBool CBrowserContentView::CheckForEmptyWindowsMenuL(TWindowsMenuItemsDimCheck* aWindowMenuItems) + { + + __ASSERT_DEBUG( (aWindowMenuItems != NULL), Util::Panic( Util::EUninitializedData )); + + // 'OpenLinkInNewWindow is not available for 'non-anchor' elements or + // if current page has wml content. + //TBrCtlDefs::TBrCtlElementType elementtype = + // ApiProvider().BrCtlInterface().FocusedElementType(); + + // The commented part below enables the "Open link in new window" option. + // Currently the option is permanently dimmed + // UI change request AHUN-6U3NT4, S60 bug AHUN-6UYT6N + aWindowMenuItems->dimOpenInNewWin = ETrue; /*( (elementtype != TBrCtlDefs::EElementAnchor) || + (ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) ); */ + + + // Multiple Windows Supported + if ( ApiProvider().Preferences().UiLocalFeatureSupported( + KBrowserMultipleWindows ) ) + { + TInt winCount = ApiProvider().WindowMgr().WindowCount(); + + // 'Close Window' & Switch Window needed if are 2+ open windows + if ( winCount > 1 ) + { + aWindowMenuItems->dimCloseWin = EFalse; + // don't allow window switching if current window has wml. must close this window first + aWindowMenuItems->dimSwitchWin = ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(EFalse /*is any page wml?*/);//EFalse; + } + + // Pop-up blocking is enabled + if ( ApiProvider().Preferences().PopupBlocking() ) + { + //--------------------------------------------------------------------- + // Popup Blocking Menu items + HBufC* url = ApiProvider().WindowMgr().CurrentWindow()-> + BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( url ) + { + // 'Allow Popups' needed if the current URL is not on the whitelist + TRAPD( errWhite, + aWindowMenuItems->dimAllowPopups = ApiProvider().PopupEngine().IsUrlOnWhiteListL( *url ); + ); + // Error handling + if ( errWhite ) + { + // Better to have the menu item than not + aWindowMenuItems->dimAllowPopups = aWindowMenuItems->dimBlockPopups = EFalse; + } + else + { + aWindowMenuItems->dimBlockPopups = !aWindowMenuItems->dimAllowPopups; + } + } + // else no url (strange case), so no popup specific menuitem + + CleanupStack::PopAndDestroy( url ); + } + //========================================================================= + } + return (aWindowMenuItems->dimOpenInNewWin && + aWindowMenuItems->dimSwitchWin && + aWindowMenuItems->dimCloseWin && + aWindowMenuItems->dimAllowPopups && + aWindowMenuItems->dimBlockPopups); + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::DimMultipleWindowsMenuItems +// Dims the items of the windows submenu according to aWindowMenuItems +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::DimMultipleWindowsMenuItems( CEikMenuPane& aMenuPane, TWindowsMenuItemsDimCheck aWindowMenuItems ) + { + aMenuPane.SetItemDimmed( EWmlCmdOpenLinkInNewWindow, aWindowMenuItems.dimOpenInNewWin ); + aMenuPane.SetItemDimmed( EWmlCmdSwitchWindow, aWindowMenuItems.dimSwitchWin ); + aMenuPane.SetItemDimmed( EWmlCmdCloseWindow, aWindowMenuItems.dimCloseWin ); + aMenuPane.SetItemDimmed( EWmlCmdAllowPopups, aWindowMenuItems.dimAllowPopups ); + aMenuPane.SetItemDimmed( EWmlCmdBlockPopups, aWindowMenuItems.dimBlockPopups ); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::OptionListInit +// Callback - we should initialize the list of DO elements +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::OptionListInitL() + { + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::HandleGotoPaneEventL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::HandleGotoPaneEventL( + CBrowserGotoPane* /*aGotoPane*/, + MGotoPaneObserver::TEvent aEvent ) + { + switch ( aEvent ) + { + case MGotoPaneObserver::EEventEnterKeyPressed: + { + if( !MenuBar()->MenuPane()->IsVisible() ) + { + if (iContainer->GotoPane()->PopupList() != NULL) + { + if ( iContainer->GotoPane()->PopupList()->IsOpenDirToShow() ) + { + HandleCommandL( EWmlCmdOpenFolder ); + } + else + { + HandleCommandL( EWmlCmdGotoPaneGoTo ); + } + } + } + break; + } + + default: + { + break; + } + } + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::OnScreenPosition +// ----------------------------------------------------------------------------- +// +TPoint CBrowserContentView::OnScreenPosition() + { + TRect rect = AppUi()->ApplicationRect(); + TPoint point (rect.iTl); + if (iPenEnabled) + { + if (AppUi()->TouchPane()) + { + TRect touchRect = AppUi()->TouchPane()->Rect(); + if (touchRect.iTl == rect.iTl) + { + if (touchRect.Width() > touchRect.Height()) // Horizontal, on top + { + point = TPoint(rect.iTl.iX, touchRect.iBr.iY); + } + else // Vertical, on the left + { + point = TPoint(touchRect.iBr.iX, rect.iTl.iY); + } + } + } + } + return point; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::GotoUrlInGotoPaneL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::GotoUrlInGotoPaneL() + { + if ( iContainer->GotoPane() ) + { + HBufC* url = iContainer->GotoPane()->GetTextL(); // the url + if( url ) + { + iContainer->ShutDownGotoURLEditorL(); + + TFavouritesWapAp accessPoint; + // if current ap exists then use it. other ways use default ap. + if( ApiProvider().Connection().CurrentAPId() ) + { + TUint apId = ApiProvider().Connection().CurrentAPId(); + apId = Util::WapIdFromIapIdL( ApiProvider(), apId ); + accessPoint.SetApId( apId ); + } + else + { + accessPoint.SetApId( + ApiProvider().Preferences().DefaultAccessPoint() ); + } + UpdateCbaL(); + UpdateFullScreenL(); + + ApiProvider().FetchL( url->Des(), + KNullDesC, + KNullDesC, + accessPoint, + CBrowserLoadObserver::ELoadUrlTypeOther ); + + } + else // no URL entered + { + iContainer->ShutDownGotoURLEditorL(); + UpdateCbaL(); + UpdateFullScreenL(); + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::UpdateGotoPaneL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::UpdateGotoPaneL() + { + // Reset goto pane content + if( AUTOCOMP ) //ask the feature manager + { + //2.1 does not put http:// there + iContainer->GotoPane()->SetTextL( KNullDesC ); + } + else + { + //2.0 does need http:// + iContainer->GotoPane()->SetTextL( KHttpString ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::LaunchGotoAddressEditorL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::LaunchGotoAddressEditorL() + { + // Cancel editing and sets Goto Pane text back. + if (iContainer->GotoPane()->PopupList() != NULL) + { + iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + iContainer->GotoPane()->PopupList()->HidePopupL(); + } + + if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) + { + MakeCbaVisible( ETrue ); + } + + CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() ); + CCoeEnv::Static()->AppUi()->AddToStackL( iContainer->GotoPane(), ECoeStackPriorityMenu ); + iContainer->GotoPane()->MakeVisible( ETrue ); + HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC( + TBrCtlDefs::EPageInfoUrl ); + if ( url && url->Length() ) + { + iContainer->GotoPane()->SetTextL(*url); + iContainer->GotoPane()->SelectAllL(); + } + else + { + // nor url; use default name. + // set "http://www." per Browser UI spec + iContainer->GotoPane()->SetTextL(KWWWString ); + } + CleanupStack::PopAndDestroy(); // url + iContainer->GotoPane()->SetFocus( ETrue ); + UpdateCbaL(); + + if (iPenEnabled) + { + Toolbar()->SetDimmed(ETrue); + Toolbar()->DrawNow(); + } + + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::LaunchFindKeywordEditorL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::LaunchFindKeywordEditorL() + { + // Cancel editing and sets Goto Pane text back. + if (iContainer->FindKeywordPane()->PopupList() != NULL) + { + iContainer->FindKeywordPane()->PopupList()->SetDirectoryModeL( ETrue ); + iContainer->FindKeywordPane()->PopupList()->HidePopupL(); + } + + if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen ) + { + MakeCbaVisible( ETrue ); + } + + CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->FindKeywordPane() ); + CCoeEnv::Static()->AppUi()->AddToStackL( iContainer->FindKeywordPane(), ECoeStackPriorityMenu ); + iContainer->FindKeywordPane()->MakeVisible( ETrue ); + iContainer->FindKeywordPane()->SetFocus( ETrue ); + UpdateCbaL(); + if (iPenEnabled) + { +#ifdef RD_SCALABLE_UI_V2 + Toolbar()->ToolbarExtension()->SetShown(EFalse); +#endif + iBrowserContentViewToolbar->UpdateButtonsStateL(); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::UpdateTitleL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::UpdateTitleL( MApiProvider& aApiProvider ) + { + HBufC* title = aApiProvider.BrCtlInterface().PageInfoLC( + TBrCtlDefs::EPageInfoTitle ); + if ( title && title->Length() ) + { + if( !iTitle || (iTitle && (iTitle->Des().Compare( title->Des())!= 0))) + { + delete iTitle; + iTitle = title->Des().AllocL(); + aApiProvider.Display().SetTitleL( title->Des() ); + } + } + else + { + + TInt offset = 0; + HBufC* titleUrl = aApiProvider.BrCtlInterface().PageInfoLC( + TBrCtlDefs::EPageInfoUrl ); + if( titleUrl == NULL ) // is this really possible? + { + CleanupStack::PopAndDestroy( titleUrl ); + titleUrl = KNullDesC().AllocLC(); + } + offset = titleUrl->Find( KSchemaIdentifier ); + if(offset != KErrNotFound ) + { + titleUrl->Des().Delete(0,offset + KSchemaIdentifierLength); + } + aApiProvider.Display().SetTitleL( titleUrl->Des() ); + CleanupStack::PopAndDestroy( ); // titleUrl + } + + CleanupStack::PopAndDestroy(); // title + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::AddNewBookmarkL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::AddNewBookmarkL( TBool aAsLastVisited, HBufC* aUrl ) + { + TInt pop = 0; + HBufC* cardTitle = NULL; + TPtrC cardTitlePtr( KNullDesC ); + + // Make a bookmark model. + iBookmarksModel = CBrowserBookmarksModel::NewL(ApiProvider()); + + // Create a bookmark item. + CFavouritesItem* item = CFavouritesItem::NewLC(); + + HBufC* theUrl = NULL; + if (aUrl == NULL) + { + // Set URL. + theUrl = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( !theUrl || !theUrl->Length() ) + { + CleanupStack::PopAndDestroy( theUrl ); + theUrl = KNullDesC().AllocLC(); + } + pop++; + // Get the title + cardTitle = ApiProvider().BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoTitle ); + pop++; + } + else + { + theUrl = aUrl; + } + + if ( cardTitle ) + { + cardTitle->Des().Trim(); + cardTitlePtr.Set( cardTitle->Des() ); + } + + if ( cardTitlePtr.Length() ) + { + // Current card has non-empty title, use that as bookmark name. + item->SetNameL( cardTitlePtr.Left(KFavouritesMaxName) ); + } + else + { + // Get the URL + HBufC* url = theUrl->AllocLC(); + pop++; + + if ( url && url->Length() ) + { + TUriParser16 urlParser; + urlParser.Parse(*url); + url->Des().SetLength( 0 ); + url->Des().Append( urlParser.Extract( EUriHost) ); + url->Des().Append( urlParser.Extract( EUriPath ) ); + item->SetNameL( url->Left(KFavouritesMaxName) ); + } + else + { + // No title, nor url; use default name. + iBookmarksModel->SetNameToDefaultL( *item ); + } + } + + // set url, username, password + Util::RetreiveUsernameAndPasswordFromUrlL( *theUrl, *item ); + CleanupStack::PopAndDestroy(pop); // url, cardTitle, theUrl + + item->SetParentFolder( KFavouritesRootUid ); + + // Set WAP AP. + TFavouritesWapAp ap; // default AP + item->SetWapAp( ap ); + + if ( aAsLastVisited ) + { + iBookmarksModel->SetLastVisitedL( *item, EFalse, + CBrowserFavouritesModel::EAutoRename ); + } + + else + { + HBufC* prompt = StringLoader::LoadLC( R_WML_ENTER_BOOKMARK_NAME ); + TBuf retString; + retString.Copy( item->Name() ); + + TBool queryName = ETrue; + while( queryName ) + { + TInt result = TBrowserDialogs::DialogPromptReqL( + prompt->Des(), + &retString, + EFalse, + KFavouritesMaxBookmarkNameDefine ); + if( result ) + { + item->SetNameL(retString.Left(KFavouritesMaxName)); + TInt err = iBookmarksModel->AddL( + *item, + ETrue, + CBrowserFavouritesModel::EDontRename ); + if ( !err ) + { + TBrowserDialogs::InfoNoteL( + R_BROWSER_OK_NOTE, + iBookmarksModel->StringResourceId + ( *item, CBrowserFavouritesModel::ESaved ) ); + queryName = EFalse; + AddBMUidToLastPlaceToCurrentListL( item->Uid() ); + + // To retain FavIcon in iconDatabase, we need to reference icon bitmap reference at least once + HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoUrl); + CGulIcon *icon = ApiProvider().BrCtlInterface().GetBitmapData(*url, TBrCtlDefs::EBitmapFavicon); + CleanupStack::PopAndDestroy(); //url + delete icon; + } + else if( KErrAlreadyExists == err ) + { + TBrowserDialogs::InfoNoteL( + R_BROWSER_INFO_NOTE, R_WML_NAME_ALREADY_IN_USE ); + } + else + { + TBrowserDialogs::ErrorNoteL( + iBookmarksModel->StringResourceId( + *item, + CBrowserFavouritesModel::ENotSaved ) ); + + } + } + else + queryName = EFalse; + } + CleanupStack::PopAndDestroy(); // prompt + } + + CleanupStack::PopAndDestroy(); // item + + delete iBookmarksModel; + iBookmarksModel = NULL; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::AddBMUidToLastPlaceToCurrentListL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::AddBMUidToLastPlaceToCurrentListL(const TInt aUid ) + { + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL( orderArray ); + + CBrowserBookmarksOrder* currentOrder = CBrowserBookmarksOrder::NewLC(); + if ( iBookmarksModel->Database().GetData( KFavouritesRootUid ,*currentOrder ) == KErrNone) + { + if ( currentOrder->GetBookMarksOrder().Count() > 0 ) + { + orderArray->AppendL( &( currentOrder->GetBookMarksOrder()[0] ), + currentOrder->GetBookMarksOrder().Count() ); + } + } + iBookmarksModel->AddUidToLastPlaceL(aUid, orderArray, currentOrder ); + currentOrder->SetBookMarksOrderL( *orderArray ); + iBookmarksModel->Database().SetData( KFavouritesRootUid ,*currentOrder ); + CleanupStack::PopAndDestroy( 2 );// currentOrder, orderArray + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SendAddressL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SendAddressL( ) + { + HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( url == NULL ) + { + CleanupStack::PopAndDestroy( url ); // remove previous + url = KNullDesC().AllocLC(); + } + +#ifndef _BOOKMARK_SENT_ASCII + if( url->Length() <= KMaxUrlLenghtInOTA ) +#endif // _BOOKMARK_SENT_ASCII + { + HBufC* title = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoTitle ); + if( title == NULL ) + { + CleanupStack::PopAndDestroy( title ); // remove previous + title = KNullDesC().AllocLC(); + } + + //CBrowserAppUi* ui = reinterpret_cast(AppUi()); + MBmOTABinSender& sender = ApiProvider().BmOTABinSenderL(); + + sender.ResetAndDestroy(); + sender.AppendL( url->Des(), title->Des() ); + sender.SendAddressL( ); + CleanupStack::PopAndDestroy( title ); // title + } +#ifndef _BOOKMARK_SENT_ASCII + else + { +#pragma message ( __FILE__ ": Length of bookmark addr cannot exceed 255bytes!") + _LIT( KErrMsg, "URL address of bookmark is too long. It cannot be sent."); + + TBrowserDialogs::ErrorNoteL( KErrMsg ); + } +#endif // _BOOKMARK_SENT_ASCII + CleanupStack::PopAndDestroy( url ); // url + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::UpdateOptionMenuItemLabelL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::UpdateOptionMenuItemLabelL(CEikMenuPane* aMenuPane, const TInt aCommandId, const TInt aResourceId) + { + + __ASSERT_DEBUG( (aMenuPane != NULL), Util::Panic( Util::EUninitializedData )); + + HBufC* browserLabel = CCoeEnv::Static()->AllocReadResourceLC(aResourceId); + aMenuPane->SetItemTextL(aCommandId, *browserLabel); + CleanupStack::PopAndDestroy(); + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::DoSearchL +// Do search for specified items in current page +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::DoSearchL( + CFindItemEngine::TFindItemSearchCase aSearchCase ) + { + HBufC* findText = NULL; + findText = ApiProvider().BrCtlInterface().PageInfoLC( + TBrCtlDefs::EPageInfoContent ); + if( findText == NULL ) + { + CleanupStack::PopAndDestroy( findText ); + return; + } + + if( findText->Length() != 0 ) + { + + TPtr findTextDes = findText->Des(); + + for( int i = 0; i < findText->Length(); ++i ) + { + if( (*findText)[i] == TUint16( 0x0a ) ) + { + findTextDes[i] = TUint16( CEditableText::EParagraphDelimiter ); + } + + else if( (*findText)[i] == TUint16( CEditableText::ETabCharacter ) ) + { + findTextDes[i] = TUint16( CEditableText::ESpace ); + } + else if( (*findText)[i] == TUint16( CEditableText::ELineBreak ) ) + { + findTextDes[i] = TUint16( CEditableText::EParagraphDelimiter ); + } + } + } + + SetFullScreenOffL(); + CFindItemDialog* dialog = CFindItemDialog::NewL( *findText, aSearchCase ); + dialog->ExecuteLD(); + UpdateFullScreenL(); + UpdateTitleL( ApiProvider() ); + + CleanupStack::PopAndDestroy( findText ); + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SetLastVisitedBookmarkL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SetLastVisitedBookmarkL() + { + AddNewBookmarkL( ETrue ); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::UpdateNaviPaneL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::UpdateNaviPaneL( TDesC& aStatusMsg ) + { + //Set text that will be shown in navipane + iStatusMsg.Des().Copy(aStatusMsg.Left(KStatusMessageMaxLength));//Might be longer than iStatusMsg + SetNavipaneViewL(); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SetNavipaneViewL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SetNavipaneViewL() + { + TVwsViewId activeViewId; + if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone ) + { + if ( (activeViewId.iViewUid == KUidBrowserContentViewId) ) + { + if (!iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + + if( iNaviPane ) + { + if (iStatusMsg.Length()) + { + iNaviDecorator = iNaviPane->CreateNavigationLabelL( + iStatusMsg ); + } + else + { + iNaviDecorator = iNaviPane->CreateNavigationLabelL(_L("")); + } + iNaviPane->PushL( *iNaviDecorator ); + } + } + else + { + CAknNaviLabel* naviLabel = STATIC_CAST( CAknNaviLabel*, + iNaviDecorator->DecoratedControl()); + naviLabel->SetTextL(iStatusMsg); + // make sure at top and redraw + iNaviPane->PushL( *iNaviDecorator ); + } + + iNaviDecorator->MakeScrollButtonVisible(ETrue); + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::FindItemIsInProgress +// ----------------------------------------------------------------------------- +// +TBool CBrowserContentView::FindItemIsInProgress() + { + return iFindItemIsInProgress; + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::HandleStatusPaneSizeChange +// --------------------------------------------------------------------------- +// +void CBrowserContentView::HandleStatusPaneSizeChange() + { + SetContentContainerRect(); + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::StateChanged +// --------------------------------------------------------------------------- +// +void CBrowserContentView::StateChanged( + TBrCtlDefs::TBrCtlState aState, + TInt aValue ) + { +LOG_ENTERFN(" CBrowserContentView::StateChanged" ); +LOG_WRITE_FORMAT(" state: %d", aState ); +LOG_WRITE_FORMAT(" value: %d", aValue ); + switch(aState) + { + case TBrCtlDefs::EStateImageMapView: + { + iImageMapActive = (TBool) aValue; + TRAP_IGNORE( UpdateCbaL() ); + break; + } + case TBrCtlDefs::EStateHistoryView: + { + iHistoryViewIsUp = (TBool) aValue; + iHistoryAtBeginning = EFalse; + iHistoryAtEnd = EFalse; + if ( iPenEnabled ) + { + TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() ); + } + TRAP_IGNORE( UpdateCbaL() ); + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + break; + } + case TBrCtlDefs::EStateThumbnailView: + { + iThumbnailViewIsUp = (TBool) aValue; + if ( iPenEnabled ) + { + TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() ); + } + TRAP_IGNORE( UpdateCbaL() ); + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + break; + } + case TBrCtlDefs::EStatePluginPlayer: + { + iPluginPlayerIsUp = (TBool) aValue; + TRAP_IGNORE( UpdateCbaL() ); + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + break; + } + case TBrCtlDefs::EStateSmartTextView: + { + iSmartTextViewIsUp = (TBool) aValue; + TRAP_IGNORE( UpdateCbaL() ); + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + break; + } + case TBrCtlDefs::EStateToolBarMode: + { + if(!aValue) + { + TRAP_IGNORE( UpdateCbaL() ); + } + break; + } + case TBrCtlDefs::EStateScriptLog: + { + TRAP_IGNORE( ApiProvider().Preferences().SetScriptLogL( aValue ) ); + break; + } + case TBrCtlDefs::EStateZoomSliderMode: + { + if ( aValue ) + { + iZoomSliderVisible = ETrue; + } + else + { + iZoomSliderVisible = EFalse; + if (iPenEnabled) + { + StartAutoFullScreenTimer(); + } + } + // Inform Toolbar of this fact + if ( iPenEnabled ) + { + TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() ); + } + break; + } + case TBrCtlDefs::EStateFullscreenBrowsing: + { + if (!iPenEnabled && IsEditMode()) + { + if (!aValue) + { // exit fullscreen so remember what to go back to after edit mode is exited + iFullScreenBeforeEditModeEntry = iContentFullScreenMode; + TRAP_IGNORE( EnableFullScreenModeL( EFalse ) ); + } + else if (aValue && iFullScreenBeforeEditModeEntry) + { + TRAP_IGNORE( EnableFullScreenModeL( ETrue ) ); + } + } + else if (!aValue) + { + TRAP_IGNORE( EnableFullScreenModeL( EFalse ) ); + } + break; + } + case TBrCtlDefs::EStateHistoryBeginning: + { + if(aValue) + { + iHistoryAtBeginning = ETrue; + } + else + { + iHistoryAtBeginning = EFalse; + } + if (iPenEnabled) + { + TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() ); + } + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + break; + } + case TBrCtlDefs::EStateHistoryEnd: + { + if(aValue) + { + iHistoryAtEnd = ETrue; + } + else + { + iHistoryAtEnd = EFalse; + } + if (iPenEnabled) + { + TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() ); + } + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + break; + } + case TBrCtlDefs::EStateSynchRequestMode: + { + iSynchRequestViewIsUp = (TBool) aValue; + if (iPenEnabled) + { + TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() ); + } + TRAP_IGNORE( UpdateCbaL() ); + TRAP_IGNORE( UpdateTitleL( ApiProvider() ) ); + break; + } + case TBrCtlDefs::EStatePluginFullScreen: + HandlePluginFullScreen((TBool) aValue); + break; + default: + break; + } + + ApiProvider().WindowMgr().SetCurrentWindowViewState(aState, aValue); + if (iPenEnabled && ApiProvider().WindowMgr().CurrentWindow()->WMLMode()) + { + EnableFullScreenModeL( EFalse ); + } + + } + +// ------------------------------------------------------------------- +// CBrowserContentView::HandleCommandL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::HandleCommandL( + TBrCtlDefs::TBrCtlClientCommands aCommand, + const CArrayFix& /*aAttributesNames*/, + const CArrayFix& aAttributeValues) + { + + // resume js timers + ApiProvider().BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandResumeScriptTimers ); + + switch(aCommand) + { + case TBrCtlDefs::EClientCommandLaunchFindKeyword: + { + // Find Keyword not initiated from options menu so don't set menupane to visible. + LaunchFindKeywordEditorL(); + MenuBar()->MenuPane()->MakeVisible(EFalse); + break; + } + case TBrCtlDefs::EClientCommandGotoWebAddress: + { + HandleCommandL(EWmlCmdGoToAddress); + break; + } + + case TBrCtlDefs::EClientCommandSaveAsBookmark: + { + HandleCommandL(EWmlCmdSaveAsBookmark); + break; + } + + case TBrCtlDefs::EClientCommandManageBookmarks: + { + HandleCommandL(EWmlCmdFavourites); + break; + } + + case TBrCtlDefs::EClientCommandZoomIn: + { + ZoomImagesInL(); + break; + } + + case TBrCtlDefs::EClientCommandZoomOut: + { + ZoomImagesOutL(); + break; + } + + case TBrCtlDefs::EClientCommandZoomMode: + { + ZoomModeImagesL(); + break; + } + + case TBrCtlDefs::EClientCommandGoToHompage: + { + HandleCommandL(EWmlCmdLaunchHomePage); + break; + } + case TBrCtlDefs::EClientCommandRotateScreen: + { + HandleCommandL(EWmlCmdRotateDisplay); + break; + } + case TBrCtlDefs::EClientCommandSavePage: + { + HandleCommandL(EWmlCmdSavePage); + break; + } + case TBrCtlDefs::EClientCommandSwitchWindow: + { + HandleCommandL(EWmlCmdSwitchWindow); + break; + } + case TBrCtlDefs::EClientCommandShowHelp: + { + HandleCommandL(EAknCmdHelp); + break; + } + + case TBrCtlDefs::EClientCommandToolbarConfigure: + { + // open settings view in toolbar group + AppUi()->HandleCommandL( EWmlCmdPreferencesToolbar ); + break; + } + + case TBrCtlDefs::EClientCommandToolbarShowKeymap: + { + ShowKeymap(); + break; + } + + case TBrCtlDefs::EClientCommandSubscribeToFeeds: + { +#ifdef __RSS_FEEDS + const TPtrC16 name(aAttributeValues.At(0)); + const TPtrC16 url(aAttributeValues.At(1)); + + ApiProvider().SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); + ApiProvider().FeedsClientUtilities().SubscribeToL( name, url ); + // switch back to FeedsView, so change layout + SetFullScreenOffL(); +#endif + break; + } + + case TBrCtlDefs::EClientCommandShowContextMenu: + { + // Get ElementType + const TPtrC elTypePtr(aAttributeValues.At(0)); + TLex lex(elTypePtr); + TInt elType; + TInt resourceId = 0; + if (lex.Val(elType) == KErrNone) + { + switch (elType) + { + case TBrCtlDefs::EElementNone: + resourceId = R_BROWSER_EMPTY_SPACE_STYLUS_POPUP_MENU; + break; + case TBrCtlDefs::EElementAnchor: + case TBrCtlDefs::EElementTelAnchor: + case TBrCtlDefs::EElementMailtoAnchor: + resourceId = R_BROWSER_ANCHOR_STYLUS_POPUP_MENU; + break; + case TBrCtlDefs::EElementSmartLinkTel: + resourceId = R_BROWSER_PHONE_NUMBER_STYLUS_POPUP_MENU; + break; + case TBrCtlDefs::EElementSmartLinkEmail: + resourceId = R_BROWSER_EMAIL_ADDRESS_STYLUS_POPUP_MENU; + break; + case TBrCtlDefs::EElementImageBox: + resourceId = R_BROWSER_IMAGE_STYLUS_POPUP_MENU; + break; + case TBrCtlDefs::EElementBrokenImage: + if (ApiProvider().Preferences().AutoLoadContent() == EWmlSettingsAutoloadText) + { + if (ApiProvider().FlashPresent()) + { + resourceId = R_BROWSER_IMAGE_PLACEHOLDER_STYLUS_POPUP_MENU_WITH_FLASH; + } + else + { + resourceId = R_BROWSER_IMAGE_PLACEHOLDER_STYLUS_POPUP_MENU_NO_FLASH; + } + } + break; + case TBrCtlDefs::EElementAreaBox: + resourceId = R_BROWSER_IMAGEMAP_STYLUS_POPUP_MENU; + break; + default: + break; + } + if (resourceId != 0) + { + TPoint point; + // Get point X + const TPtrC xPtr(aAttributeValues.At(1)); + lex.Assign(xPtr); + lex.Val(point.iX); + // Get point Y + const TPtrC yPtr(aAttributeValues.At(2)); + lex.Assign(yPtr); + lex.Val(point.iY); + + delete iStylusPopupMenu; + iStylusPopupMenu = NULL; + iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this, point); + TResourceReader rr; + CCoeEnv::Static()->CreateResourceReaderLC(rr, resourceId); + iStylusPopupMenu->ConstructFromResourceL( rr ); + CleanupStack::PopAndDestroy(); // resource reader + iStylusPopupMenu->SetPosition( point); + iStylusPopupMenu->ShowMenu(); + } + } + break; + } + + case TBrCtlDefs::EClientCommandToolbarSettings: + { + // Launch Settings View + HandleCommandL(EWmlCmdPreferences); + break; + } + + case TBrCtlDefs::EClientCommandFullScreen: + { + HandleCommandL(EWmlCmdEnterFullScreenBrowsing); + break; + } + + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::HandleSubscribeToL +// Handles a selection from the subscribe to sub-menu. +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::HandleSubscribeToL( TInt aCommand ) + { +#ifndef __RSS_FEEDS + (void) aCommand; +#else // __RSS_FEEDS + TInt index; + + // Get the corresponding feed info. + const RPointerArray& items = ApiProvider(). + BrCtlInterface().SubscribeToMenuItemsL(); + + index = aCommand - TBrCtlDefs::ECommandIdSubscribeToBase; + if ((index >= 0) && (index < items.Count())) + { + const TPtrC16 name(items[index]->Title()); + const TPtrC16 url(items[index]->Url()); + + ApiProvider().SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); + ApiProvider().FeedsClientUtilities().SubscribeToL( name, url ); + // switch back to FeedsView, so change layout + SetFullScreenOffL(); + } +#endif // __RSS_FEEDS + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::HandleSubscribeToUrlL +// Handles subscribing to a feed from a ur +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::HandleSubscribeToWithUrlL( TPtrC aUrl ) + { +#ifndef __RSS_FEEDS + (void) aUrl; +#else // __RSS_FEEDS + + ApiProvider().SetLastActiveViewId( KUidBrowserFeedsFolderViewId ); + + //Get the 'Title' info by comparing aUrl with the url's populated in array 'items' + const RPointerArray& items = ApiProvider().BrCtlInterface().SubscribeToMenuItemsL(); + TInt index = 0; + TInt itemCount = items.Count(); + + while (itemCount != 0 && index < itemCount) + { + if (!(aUrl.Compare(items[index]->Url()))) + { + break; + } + else + { + index++; + } + } + + + if (itemCount == 0 || index >= itemCount ) + { + ApiProvider().FeedsClientUtilities().SubscribeToL( KNullDesC, aUrl ); + } + else + { + const TPtrC16 name(items[index]->Title()); + ApiProvider().FeedsClientUtilities().SubscribeToL(name , aUrl ); + } + +#endif // __RSS_FEEDS + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::DynInitToolbarL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* /*aToolbar*/ ) + { + // If we have a touch device, check to see if the zoom slider is up, + // if displayed, close it, so the extended toolbar shows without the + // zoomslider displaying on top of it. + if ( PenEnabled() && ZoomSliderVisible() ) + { + MakeZoomSliderVisibleL( EFalse ); + } + + if ( iPenEnabled ) + { + iBrowserContentViewToolbar->UpdateButtonsStateL() ; + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::WindowEventHandlerL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::WindowEventHandlerL( TWindowEvent /*aEvent*/, TInt aWindowId ) + { + if ( aWindowId == ApiProvider().WindowMgr().CurrentWindow()->WindowId() ) + { + if ( iPenEnabled ) + { + iBrowserContentViewToolbar->UpdateButtonsStateL(); + } + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::IsHistoryViewUp +// --------------------------------------------------------------------------- +// +TBool CBrowserContentView::IsHistoryViewUp() + { + return iHistoryViewIsUp; + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::IsHistoryAtBeginning +// --------------------------------------------------------------------------- +// +TBool CBrowserContentView::IsHistoryAtBeginning() + { + return iHistoryAtBeginning; + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::IsHistoryAtEnd +// --------------------------------------------------------------------------- +// +TBool CBrowserContentView::IsHistoryAtEnd() + { + return iHistoryAtEnd; + } + + +// --------------------------------------------------------------------------- +// CBrowserContentView::FindKeywordL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::FindKeywordL( HBufC* aFindString, TBool aFindDirection ) + { + TInt findResponse = 0; + + if ( aFindString ) + { + // Find string + delete iEnteredKeyword; + iEnteredKeyword = NULL; + iEnteredKeyword = aFindString; + findResponse = ApiProvider().BrCtlInterface().FindKeyword( iEnteredKeyword->Des() ); + } + else + { + // Search next/previous + findResponse = ApiProvider().BrCtlInterface().FindKeywordAgain( aFindDirection ); + } + + HBufC* toolTipText = NULL; + + switch ( findResponse ) + { + case TBrCtlDefs::EFindNoMatches: + toolTipText = StringLoader::LoadLC( R_QTN_BROWSER_KEYWORD_FIND_NO_MATCHES ); + break; + case TBrCtlDefs::EFindWrapAround: + toolTipText = StringLoader::LoadLC( R_QTN_BROWSER_KEYWORD_FIND_WRAPAROUND ); + break; + case TBrCtlDefs::EFindAllMatches: + toolTipText = StringLoader::LoadLC( R_QTN_BROWSER_KEYWORD_FIND_ALL_CONTENT_SEARCHED ); + break; + } + + // Show the result of the search. + if ( toolTipText ) + { + ApiProvider().DialogsProvider().ShowTooltipL( *toolTipText ); + CleanupStack::PopAndDestroy( toolTipText ); + } + + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::HandleClientRectChange +// --------------------------------------------------------------------------- +// +void CBrowserContentView::HandleClientRectChange() + { + if( iContainer ) + { + iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + UpdateFullScreenL(); + if(KeymapIsUp()) + { + RedrawKeymap(); + } + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::SetZoomModeL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::SetZoomModeL( TBool aZoomMode ) + { + // if ( !ApiProvider().Fetching() ) + if (ApiProvider().ContentDisplayed()) + { + iZoomMode = aZoomMode; + TRAP_IGNORE( UpdateCbaL() ); + if ( aZoomMode ) + { + // Show the current zoom level in tooltip + SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL); + //MakeZoomSliderVisibleL( ETrue ); + } + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::MakeZoomSliderVisibleL +// Informs Browser Control if the Zoom Slider should be visible or not. +// --------------------------------------------------------------------------- +// +void CBrowserContentView::MakeZoomSliderVisibleL( TBool aVisible ) + { + if ( aVisible && !iZoomSliderVisible ) + { + // If the page is being fetched then don't show the zoom slider + if ( ApiProvider().ContentDisplayed()) + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomSliderShow + + (TInt)TBrCtlDefs::ECommandIdBase ); + iZoomSliderVisible = ETrue; + } + } + // Set the zoom slider to invisible only if the toggle is false, + // and the zoom slider used to be visible + else if (!aVisible && iZoomSliderVisible ) + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomSliderHide + + (TInt)TBrCtlDefs::ECommandIdBase ); + iZoomSliderVisible = EFalse; + } + + if ( iPenEnabled ) + { + iBrowserContentViewToolbar->UpdateButtonsStateL(); + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::ZoomImagesInL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::ZoomImagesInL( TInt aDuration ) + { + if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ) + { + iZoomLevelArray = ApiProvider().BrCtlInterface().ZoomLevels(); + + // Change zoom level + ZoomImagesL( 1, 0, iZoomLevelArray->Count()-2, aDuration ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::ZoomImagesOutL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::ZoomImagesOutL( TInt aDuration ) + { + if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ) + { + iZoomLevelArray = ApiProvider().BrCtlInterface().ZoomLevels(); + + // Change zoom level + ZoomImagesL( -1, 1, iZoomLevelArray->Count()-1, aDuration ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::ZoomModeImagesL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::ZoomModeImagesL() + { + if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() ) + { + // Retrieve the current zooming index value + iCurrentZoomLevel = ApiProvider().BrCtlInterface().BrowserSettingL( + TBrCtlDefs::ESettingsCurrentZoomLevelIndex ); + iSavedZoomLevel = iCurrentZoomLevel; + + // Toggle current zoom mode. Zoom Mode allows the user to change + // the zoom level using the navikey or HW zoom key + SetZoomModeL( ETrue ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::ZoomImagesL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::ZoomImagesL( TInt aDirection, TUint aLow, + TUint aHigh, TInt aDuration ) + { + // Retrieve the current zooming index value, it takes effect right away + iCurrentZoomLevel = ApiProvider().BrCtlInterface().BrowserSettingL( + TBrCtlDefs::ESettingsCurrentZoomLevelIndex ); + TInt currentZoomIndex = FindCurrentZoomIndex(iCurrentZoomLevel); + + // Zoom can be increment, decrement or a direct change to a specific value. + if ( currentZoomIndex >= aLow && currentZoomIndex <= aHigh ) + { + // Set current zoom level. + currentZoomIndex += aDirection; + iCurrentZoomLevel = (*iZoomLevelArray)[currentZoomIndex]; + + // Set actual zoom level. + ApiProvider().BrCtlInterface().SetBrowserSettingL( + TBrCtlDefs::ESettingsCurrentZoomLevelIndex, iCurrentZoomLevel ); + + // Retrieve the current zooming index value, because each page has its + // minimum zoom level, if smaller than it, engine will ignore + // so we have to retrieve the correct zoom level + iCurrentZoomLevel = ApiProvider().BrCtlInterface().BrowserSettingL( + TBrCtlDefs::ESettingsCurrentZoomLevelIndex ); + } + + // Display the zoom indicator + if ( currentZoomIndex <= 0 ) + { + // Display minimum zoom indicator, it will dismiss after aDuration + SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL_MIN, aDuration ); + } + else if ( currentZoomIndex >= iZoomLevelArray->Count()-1 ) + { + TInt arrayCount = iZoomLevelArray->Count()-1; + // Display maximum zoom indicator, it will dismiss after aDuration + SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL_MAX, aDuration ); + } + else + { + // Display zoom percentage indicator, it will dismiss after aDuration + // We turned off displaying zoom indicator for each level + // SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL, aDuration ); + } + } + +// --------------------------------------------------------------------------- +// SaveCurrentZoomLevel +// --------------------------------------------------------------------------- +void CBrowserContentView::SaveCurrentZoomLevel(TBool saveZoom) +{ + if (saveZoom) + { + //save the current zoom level by clicking softkey to confirm + ApiProvider().BrCtlInterface().SetBrowserSettingL( + TBrCtlDefs::ESettingsCurrentZoomLevelIndex, iCurrentZoomLevel ); + } + else + { + iCurrentZoomLevel = iSavedZoomLevel; + ApiProvider().BrCtlInterface().SetBrowserSettingL( + TBrCtlDefs::ESettingsCurrentZoomLevelIndex, iCurrentZoomLevel ); + } +} + +// --------------------------------------------------------------------------- +// FindCurrentZoomIndex +// --------------------------------------------------------------------------- +TInt CBrowserContentView::FindCurrentZoomIndex(TInt aCurrentZoomLevel) +{ + TInt index = -1; + for ( index = 0; indexCount()-1; index++) + { + if (aCurrentZoomLevel <=(*iZoomLevelArray)[index] ) + { + break; + } + } + return index; +} + +// --------------------------------------------------------------------------- +// CBrowserContentView::SetZoomLevelTitleTextL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::SetZoomLevelTitleTextL( TInt aResourceId, TInt aDuration ) + { + HBufC* zoomLevelFormat = NULL; + + if ( aResourceId == R_BROWSER_ZOOM_LEVEL_MIN || + aResourceId == R_BROWSER_ZOOM_LEVEL_MAX ) + { + // Display the zoom max or min string + zoomLevelFormat = StringLoader::LoadLC( aResourceId ); + + // Show zoom indicator for aDuration seconds + ApiProvider().WindowMgr().CurrentWindow()->ChangeTitlePaneTextUntilL( zoomLevelFormat->Des(), aDuration ); + + CleanupStack::PopAndDestroy( ); // zoomLevelFormat + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::GetTextZoomLevelsL +// --------------------------------------------------------------------------- +// +void CBrowserContentView::GetTextZoomLevelsL( ) + { + // Creating the text level + // Levels must be equal to TFontSize, with step percent 25% or 50% + // depending on chinese build. + // This is a temporary solution until make sure if engine + // provides text zoom levels. So it is currently hardcoded. + //------ + // China build has only three font sizes: + // 0, 2, 4 (all small, normal, all large) + TInt fontSize = 0; + if ( !AVKONAPAC ) + { + // font sizes 0,1,2,3,4 + for ( TInt level = 50; level <= 150; level = level + 25 ) + { + iTextZoomLevelArray->AppendL( level ); + iFontSizeArray->AppendL( fontSize ); + fontSize++; + } + } + else + { + // font sizes 0,2,4 + for ( TInt level = 50; level <= 150; level = level + 50 ) + { + iTextZoomLevelArray->AppendL( level ); + iFontSizeArray->AppendL( fontSize ); + fontSize = fontSize + 2; + } + } + + // Get initial text zoom level index, bt comparing + // the preferences value, with the one in iFontSizeArray, + // and get the index (i) + TBool found = EFalse; + for ( TInt i = 0; i < iFontSizeArray->Count(); i++ ) + { + if ( ApiProvider().Preferences().FontSize() == (*iFontSizeArray)[i] ) + { + iCurrentTextZoomLevelIndex = i; + found = ETrue; + } + } + // If the initial font size value is not found, then the cenrep + // default is not right, by default initial cenrep font size value + // should be 0,2,4. So general, and chinese values are the same. + // Because if for example default cenrep value of font size is 1, + // then that is not supported in chinese build. + // General font size values are: 0,1,2,3,4 + // Chinese font size values are: 0,2,4 + if ( !found ) + { + User::Leave( KErrGeneral ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::KeymapIsUp +// --------------------------------------------------------------------------- +// +TBool CBrowserContentView::KeymapIsUp() + { + return (iShortcutKeyMap != NULL); + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::isZoomMode +// --------------------------------------------------------------------------- +// +TBool CBrowserContentView::isZoomMode() + { + // Zoom Mode currently disabled + // return iZoomMode; + return EFalse; + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::ShowKeymap +// --------------------------------------------------------------------------- +// +void CBrowserContentView::ShowKeymap() + { + iShortcutKeyMap = CBrowserShortcutKeyMap::NewL(iContainer, iApiProvider); + UpdateCbaL(); + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::HideKeymap +// --------------------------------------------------------------------------- +// +void CBrowserContentView::HideKeymap() + { + delete(iShortcutKeyMap); + iShortcutKeyMap = NULL; + TRAP_IGNORE(UpdateCbaL()); + TRAP_IGNORE(UpdateFullScreenL()); + } + +// --------------------------------------------------------------------------- +// CBrowserContentView::RedrawKeymap +// --------------------------------------------------------------------------- +// +void CBrowserContentView::RedrawKeymap() + { + HideKeymap(); + ShowKeymap(); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::EnableFullScreenModeL +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::EnableFullScreenModeL( TBool aEnableFullScreen ) + { + if( iContentFullScreenMode == aEnableFullScreen ) + return; + + TInt command( KErrNotFound ); + if ( aEnableFullScreen ) + { + iContentFullScreenMode = ETrue; + UpdateFullScreenL(); + command = TBrCtlDefs::ECommandEnterFullscreenBrowsing; + } + else + { + if (iPenEnabled) + { + Toolbar()->SetToolbarVisibility( ETrue, EFalse ); + } + iContentFullScreenMode = EFalse; + SetFullScreenOffL(); + command = TBrCtlDefs::ECommandLeaveFullscreenBrowsing; + if (iPenEnabled) + { + StartAutoFullScreenIdleTimer(); + } + } + ApiProvider().BrCtlInterface().HandleCommandL( + command + (TInt)TBrCtlDefs::ECommandIdBase ); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::HandlePluginFullScreen +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::HandlePluginFullScreen(TBool aFullScreen) +{ + iIsPluginFullScreenMode = aFullScreen; + if (aFullScreen) { + if (AppUi()->Orientation() != CAknAppUiBase::EAppUiOrientationLandscape) { + iOrientation = AppUi()->Orientation(); + TRAP_IGNORE(AppUi()->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape)); + } + if (iPenEnabled) { + Toolbar()->SetToolbarVisibility( EFalse, EFalse ); + } + iContentFullScreenMode = ETrue; + UpdateFullScreenL(); + } + else { + TInt command( KErrNotFound ); + command = TBrCtlDefs::ECommandLeaveFullscreenBrowsing; + ApiProvider().BrCtlInterface().HandleCommandL( + command + (TInt)TBrCtlDefs::ECommandIdBase ); + TRAP_IGNORE(AppUi()->SetOrientationL(iOrientation)); + if (iPenEnabled) { + Toolbar()->SetToolbarVisibility( ETrue, EFalse ); + } + iContentFullScreenMode = EFalse; + SetFullScreenOffL(); + if (iPenEnabled) + { + StartAutoFullScreenIdleTimer(); + } + } +} + +// ----------------------------------------------------------------------------- +// CBrowserContentView::ShowFsStatusPane +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::ShowFsStatusPane(TBool aShow) + { + + if (aShow) + { +#ifdef RD_SCALABLE_UI_V2 + if ( Layout_Meta_Data::IsLandscapeOrientation() ) + StatusPane()->SwitchLayoutL(R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS); +#endif + StatusPane()->MakeVisible( ETrue ); + + SetContentContainerRect(); + + // Remove any timer that has already been set + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + } + else + { + // Kick off timer for 3 seconds before hiding status pane again + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + iPeriodic->Start(KFullScreenStatusPaneTimeout, 0,TCallBack(CallHideFsStatusPane,this)); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::CallHideFsStatusPane +// ----------------------------------------------------------------------------- +TInt CBrowserContentView::CallHideFsStatusPane(TAny* aCBrowserContentView) + { + __ASSERT_DEBUG(aCBrowserContentView, Util::Panic( Util::EUninitializedData )); + TRAP_IGNORE( + ((CBrowserContentView*)aCBrowserContentView)->HideFsStatusPane(); + ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::HideFsStatusPane +// ----------------------------------------------------------------------------- +void CBrowserContentView::HideFsStatusPane() + { + iPeriodic->Cancel(); + if (iContentFullScreenMode && ApiProvider().LastActiveViewId() == KUidBrowserContentViewId ) + { + StatusPane()->MakeVisible( EFalse ); + + SetContentContainerRect(); + } + } +// ----------------------------------------------------------------------------- +// CBrowserContentView::StartAutoFullScreenTimer +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::StartAutoFullScreenTimer() + { + SuspendAutoFullScreenIdleTimer(); + if ( iAutoFSPeriodic ) + { + iAutoFSPeriodic->Cancel(); + } + iAutoFSPeriodic->Start(KAutoFullScreenTimeout, 0,TCallBack(CallActivateAutoFullScreen,this)); + + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::StartAutoFullScreenIdleTimer +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::StartAutoFullScreenIdleTimer() + { + if ( iIdlePeriodic ) + { + iIdlePeriodic->Cancel(); + } + iIdlePeriodic->Start(KAutoFullScreenIdleTimeout, 0,TCallBack(CallActivateAutoFullScreen,this)); + + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SuspendAutoFullScreenTimer +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SuspendAutoFullScreenTimer() + { + if ( iAutoFSPeriodic ) + { + iAutoFSPeriodic->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SuspendAutoFullScreenIdleTimer +// ----------------------------------------------------------------------------- +// +void CBrowserContentView::SuspendAutoFullScreenIdleTimer() + { + if ( iIdlePeriodic ) + { + iIdlePeriodic->Cancel(); + } + } + + +// ----------------------------------------------------------------------------- +// CBrowserContentView::CallSwitchToAutoFullScreen +// ----------------------------------------------------------------------------- +// +TInt CBrowserContentView::CallActivateAutoFullScreen(TAny* aCBrowserContentView) + { + __ASSERT_DEBUG(aCBrowserContentView, Util::Panic( Util::EUninitializedData )); + TRAP_IGNORE( + ((CBrowserContentView*)aCBrowserContentView)->ActivateAutoFullScreenMode(); + ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::ActivateAutoFullScreen +// ----------------------------------------------------------------------------- +void CBrowserContentView::ActivateAutoFullScreenMode() + { + if ( iAutoFSPeriodic ) + { + iAutoFSPeriodic->Cancel(); + } + if ( iIdlePeriodic ) + { + iIdlePeriodic->Cancel(); + } + + if ( ApiProvider().LastActiveViewId() == KUidBrowserContentViewId ) + { + if( IsForeground() + && ApiProvider().LoadObserver().ContentDisplayed() + && !iZoomSliderVisible + && !iHistoryViewIsUp + && !iContainer->GotoPane()->IsVisible() + && !iContainer->FindKeywordPane()->IsVisible() +#ifdef RD_SCALABLE_UI_V2 + && !Toolbar()->ToolbarExtension()->IsShown() +#endif + && !iThumbnailViewIsUp + && !iOptionsMenuActive + && !ApiProvider().IsDisplayingMenuOrDialog() + && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() + && !iIsPluginFullScreenMode) + { + EnableFullScreenModeL( ETrue); + } + else + { + if (iIsPluginFullScreenMode || !IsForeground()) + { + //Hide the FullscreenExit Button + ApiProvider().BrCtlInterface().HandleCommandL( + TBrCtlDefs::ECommandLeaveFullscreenBrowsing + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + StartAutoFullScreenTimer(); + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::SetEmphasis +// ----------------------------------------------------------------------------- + +void CBrowserContentView::SetEmphasis(CCoeControl* aMenuControl, TBool aEmphasis) + { + if (iPenEnabled) + { + if(aEmphasis) + { + iOptionsMenuActive = ETrue; + SuspendAutoFullScreenTimer(); + } + else + { + iOptionsMenuActive = EFalse; + StartAutoFullScreenTimer(); + } + } + CAknView::SetEmphasis(aMenuControl, aEmphasis); + } + +// ----------------------------------------------------------------------------- +// CBrowserContentView::IsEditMode +// ----------------------------------------------------------------------------- +TBool CBrowserContentView::IsEditMode() + { + TBrCtlDefs::TBrCtlElementType focusedElementType = + ApiProvider().BrCtlInterface().FocusedElementType(); + + TBool retVal = ((focusedElementType == TBrCtlDefs:: EElementActivatedInputBox) || + (focusedElementType == TBrCtlDefs:: EElementInputBox) || + (focusedElementType == TBrCtlDefs:: EElementTextAreaBox)); + return (retVal); + } + +void CBrowserContentView::HandleStatusPaneCallBack() + { + TVwsViewId activeViewId; + TBool resIdChanged(EFalse); + TInt resId = StatusPane()->CurrentLayoutResId(); + + if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone ) + { + if ( activeViewId.iViewUid == KUidBrowserContentViewId ) + { + if ( Layout_Meta_Data::IsLandscapeOrientation() ) + { + resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_USUAL; + StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); + } + else //Portrait + { + resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_SMALL; + StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL); + } + } + } + if(resIdChanged) + SetContentContainerRect(); +} + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserContentViewContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserContentViewContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,903 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +*/ + +#include "BrowserContentViewContainer.h" +#include "BrowserAppUi.h" +#include "BrowserAppViewBase.h" +#include "BrowserGotoPane.h" +#include "CommonConstants.h" +#include "BrowserContentView.h" +#include "Display.h" +#include "Preferences.h" +#include "BrowserUtil.h" + +#include "BrowserPreferences.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include + +#include // For Layout_Meta_Data landscape/portrait status + +#include +#include +#include + +#include + +#include "BrowserUIVariant.hrh" + +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include "BrowserApplication.h" +#include +#include +#endif // __SERIES60_HELP + +#include "eikon.hrh" + + +//Constant +// The interval zoom tooltip is visible, it will disappear after KZoomLevelShowTime seconds +const TInt KZoomLevelShowTime( 2 * 1000 ); // 2 seconds + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::NewL() +// --------------------------------------------------------------------------- +// +CBrowserContentViewContainer* +CBrowserContentViewContainer::NewL(CBrowserContentView* aView, + MApiProvider& aApiProvider ) + { + CBrowserContentViewContainer* container = + new (ELeave) CBrowserContentViewContainer( aView, aApiProvider ); + CleanupStack::PushL( container ); + container->ConstructL(); + CleanupStack::Pop(); // container + + return container; + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::CBrowserContentViewContainer() +// --------------------------------------------------------------------------- +// +CBrowserContentViewContainer:: +CBrowserContentViewContainer(CBrowserContentView* aView, + MApiProvider& aApiProvider ) : + iView( aView ), + iApiProvider( aApiProvider ) + { + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::~CBrowserContentViewContainer() +// --------------------------------------------------------------------------- +// +CBrowserContentViewContainer::~CBrowserContentViewContainer() + { + delete iGotoPane; + delete iFindKeywordPane; + iView = NULL; // Not owned + + iShortCutFuncMap.Close(); + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::ConstructL() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::ConstructL() + { + CreateWindowL(); + +#if defined(BRDO_MULTITOUCH_ENABLED_FF) && !defined (__WINSCW__) + //Enable advance pointer info for multi-touch. + Window().EnableAdvancedPointers(); +#endif + + SetAllowStrayPointers(); + SetMopParent( iView ); + + } + +// ----------------------------------------------------------------------------- +// CBrowserContentViewContainer::HandlePointerEventL +// Handles pointer events +// ----------------------------------------------------------------------------- +void CBrowserContentViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + switch ( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + // Do nothing + break; + } + case TPointerEvent::EDrag: + { + // Do nothing + break; + } + case TPointerEvent::EButton1Up: + { + // Close the zoom silder when the user selects anywhere in the + // BrowserContainerView + if ( iView->ZoomSliderVisible() ) + { + iView->MakeZoomSliderVisibleL( EFalse ); + } + break; + } + default: + { + break; + } + } // end of switch + + // Must pass the pointer event to the CoeControl + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::OfferKeyEventL() +// --------------------------------------------------------------------------- +// +TKeyResponse CBrowserContentViewContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + CBrowserAppUi* ui = CBrowserAppUi::Static(); + TKeyResponse result( EKeyWasNotConsumed ); + + if (ui->OfferApplicationSpecificKeyEventL(aKeyEvent, aType) == EKeyWasConsumed) + { + return EKeyWasConsumed; + } + + // For Short Cut + if (!iShortCutFuncsReady) + { + CreateShortCutFuncsHashTable(); + iShortCutFuncsReady = ETrue; + } + + // Turn off some controls, if we receive events + if ( aType == EEventKey ) + { + // Turn off the keymap if on + if ( iView->KeymapIsUp() ) + { + iView->HandleCommandL( EWmlCmdHideShortcutKeymap ); + } + + // Turn off the zoom slider if on + if ( iView->ZoomSliderVisible() ) + { + iView->MakeZoomSliderVisibleL( EFalse ); + } + } + + // If goto pane is visible, offer key events to it + if ( iGotoPane->IsVisible() ) + { + return iGotoPane->OfferKeyEventL( aKeyEvent, aType ); + } + + TKeyEvent keyEvent( aKeyEvent ); + TBrCtlDefs::TBrCtlElementType elementtype = + iApiProvider.BrCtlInterface().FocusedElementType(); + + // Don't allow virtual keyboard backspace key event to close the window + // And don't close window if editing in an input box or textarea input + if ( !AknLayoutUtils::PenEnabled() && aType == EEventKey + && keyEvent.iCode == EKeyBackspace + && elementtype != TBrCtlDefs::EElementActivatedInputBox + && elementtype != TBrCtlDefs::EElementTextAreaBox ) + { + if ( iApiProvider.Preferences().UiLocalFeatureSupported( + KBrowserMultipleWindows ) ) + { + TInt winCount = iApiProvider.WindowMgr().WindowCount(); + if ( ( winCount > 1 ) && ( !iView->IsMiniatureViewUp() ) ) + { + ui->CloseWindowL(); + result = EKeyWasConsumed; + } + } + } + + // Handle zooming events + // 1. RemConInterface will translate dedicated HW key press to OfferKeyEventL(). + // See eikon.hrh for mapping. + // 2. When the browser is in Zoom Mode (slider or tooltip displayed), the + // navi-keys will zoom. + if ( aType == EEventKey ) + { + // Handle dedicated HW key zoom-in: if not in zoom mode, HW zoom key takes + // zooming immediately without going to zoom mode + // if it's already in zoom mode, then HW zoom key acts the same as up + // and down navigation key mode + // Zoom mode can display tooltip (current) or slider (future) + if ( iView->isZoomMode() ) + { + } + else if (!iView->IsHistoryViewUp() && !iView->IsMiniatureViewUp()) + { + // Not in zoom mode, or history view, or page overview, and HW zoom key + // pressed - zoom immediately without entering zoom mode. + if ( keyEvent.iCode == EKeyZoomIn ) + { + iApiProvider.BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomIn + + (TInt)TBrCtlDefs::ECommandIdBase ); + iView->ZoomImagesInL(KZoomLevelShowTime); + result = EKeyWasConsumed; + } + // Handle dedicated HW key zoom-out + else if ( keyEvent.iCode == EKeyZoomOut ) + { + iApiProvider.BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandZoomOut + + (TInt)TBrCtlDefs::ECommandIdBase ); + iView->ZoomImagesOutL(KZoomLevelShowTime); + result = EKeyWasConsumed; + } + } + + } // End of handling key events for zooming + + + // Web Engine opens the highlighted link into a new window. (long press) + // Currently the option is disabled and the link is opened in the same window + // The commented part below enables the "Open link in new window" option on long press. + // UI change request AHUN-6U3NT4, S60 bug AHUN-6UYT6N + + TBool aEnterKeyForLinksActivation = (keyEvent.iCode == EKeyEnter) && + (iApiProvider.Preferences().EnterKeyMode() == TBrCtlDefs::EEnterKeyCanActivateLink); + if ( aType == EEventKey && + (keyEvent.iCode == EKeyOK || aEnterKeyForLinksActivation) ) + { + if ( keyEvent.iRepeats && iSelectionKeyPressed ) + { + + TInt command( KErrNotFound ); + switch( elementtype ) + { + case TBrCtlDefs::EElementAnchor: + { + // command = TBrCtlDefs::ECommandOpenNewWindow; + command = TBrCtlDefs::ECommandOpen; + break; + } + default: break; + } + // if ( command == TBrCtlDefs::ECommandOpenNewWindow && + // iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + // !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) + if ( command == TBrCtlDefs::ECommandOpen) + { + iSelectionKeyPressed = EFalse; + keyEvent.iCode = EKeyNull; + result = EKeyWasConsumed; + iApiProvider.BrCtlInterface().HandleCommandL( + command + TBrCtlDefs::ECommandIdBase ); + } + } + } + + // stop the event handling when find item was actived + if ( (keyEvent.iScanCode == EStdKeyDevice3 || + keyEvent.iScanCode == EStdKeyXXX || + aEnterKeyForLinksActivation) + && aType == EEventKeyDown && !iView->FindItemIsInProgress() ) + { + iSelectionKeyPressed = ETrue; + keyEvent.iCode = EKeyNull; + } + + // Ignore key event in zoom mode + if ( result == EKeyWasNotConsumed && !iView->isZoomMode()) + { + if ( !iView->PenEnabled() && iView->FullScreenMode() && keyEvent.iRepeats) + { + iView->setFullScreenFlag(); + iView->EnableFullScreenModeL( EFalse ); + } + TRAP_IGNORE(result = iApiProvider.BrCtlInterface().OfferKeyEventL(keyEvent, aType)); + } + + /** + * When checking long or short key presses, iScanCode must be used, because + * when EEventKeyUp/EEventKeyUp are handled, the iCode is not available. + * iIsKeyLongPressed must be checked in short key presses because, when the + * button is released short key code will be called again. And that time it + * must be ignored. + */ + + /** + // This key is inactive, only for testing short / long key presses. + if ( keyEvent.iScanCode == 48 && keyEvent.iRepeats && !iIsKeyLongPressed) + { + iEikonEnv->InfoMsg(_L("0 Long")); + iIsKeyLongPressed = ETrue; + keyEvent.iCode = EKeyNull; + result = EKeyWasConsumed; + } + if ( aType == EEventKeyUp && keyEvent.iScanCode == 48 && !keyEvent.iRepeats) + { + if ( !iIsKeyLongPressed ) + { + iEikonEnv->InfoMsg(_L("0 Short")); + keyEvent.iCode = EKeyNull; + result = EKeyWasConsumed; + } + iIsKeyLongPressed = EFalse; + } + **/ + + /* + * Not processing short keys, if the History view, or the + * Miniature View ( old name: Thumbnail View ) is up, + * except short key: '8'. + */ + if (!iApiProvider.Preferences().AccessKeys()) + { + // Key short press, activate function based on keyEvent.iCode + if ( aType == EEventKey && result == EKeyWasNotConsumed ) + { + if (!AknLayoutUtils::PenEnabled()) + { + if (iView->isZoomMode()) + { + result = EKeyWasConsumed; + } + else + { + if (iApiProvider.Preferences().ShortcutKeysForQwerty()) + { + result = InvokeFunction ( keyEvent.iCode ); + } + else + { + if ( !iView->IsMiniatureViewUp() && !iView->IsHistoryViewUp() ) + { + TInt function = -1; + switch(keyEvent.iCode) + { + case '0': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey0Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '1': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey1Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '2': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey2Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '3': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey3Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '4': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey4Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '5': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey5Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '6': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey6Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '7': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey7Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '8': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey8Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '9': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey9Cmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '*': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyStarCmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + case '#': + { + function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyHashCmd()][KShortcutsCommandDecodeMatrixCmdVal]; + break; + } + default: + { + break; + } + } + + if (function != -1) + { + iView->HandleCommandL(function); + result = EKeyWasConsumed; + } + } + } //endof handle shortcut keys + + if (result == EKeyWasConsumed) + { + keyEvent.iCode = EKeyNull; + } + } + } + } + + if ( iView->IsHistoryViewUp() && result == EKeyWasConsumed ) + { + if ( ( aType == EEventKey || aType == EEventKeyUp ) + && ( keyEvent.iCode == EKeyLeftUpArrow // Northwest + || keyEvent.iCode == EStdKeyDevice10 // : Extra KeyEvent supports diagonal event simulator wedge + || keyEvent.iCode == EKeyLeftArrow // West + || keyEvent.iCode == EKeyLeftDownArrow // Southwest + || keyEvent.iCode == EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge + + || keyEvent.iCode == EKeyRightUpArrow // Northeast + || keyEvent.iCode == EStdKeyDevice11 // : Extra KeyEvent supports diagonal event simulator wedge + || keyEvent.iCode == EKeyRightArrow // East + || keyEvent.iCode == EKeyRightDownArrow // Southeast + || keyEvent.iCode == EStdKeyDevice12 ) ) // : Extra KeyEvent supports diagonal event simulator wedge + { + iView->UpdateTitleL( iApiProvider ); + } + } + + // If in zoom mode, then show the zoom tooltip + if (iView->isZoomMode() && result == EKeyWasConsumed ) + { + iView->SetZoomLevelTitleTextL(R_BROWSER_ZOOM_LEVEL); + } + + } // if (!iApiProvider.Preferences().AccessKeys()) + + if ( result == EKeyWasNotConsumed && + (keyEvent.iScanCode == EStdKeyDevice3 || keyEvent.iScanCode == EStdKeyXXX) && + aType == EEventKeyUp && + iSelectionKeyPressed ) + { + // Selection key was released and it is not a long press! + iSelectionKeyPressed = EFalse; + aType = EEventKey; + keyEvent.iCode = EKeyOK; + + // first offer event to browser control, e.g. link activation + // result = iApiProvider.BrCtlInterface().OfferKeyEventL(keyEvent, aType); + + iView->ResetPreviousViewFlag(); + } + return result; + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::FocusChanged() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::FocusChanged(TDrawNow aDrawNow) + { + // do not proceed further if a browser app exit is in progress + if ( iApiProvider.ExitInProgress() ) + { + return; + } + + if ( iApiProvider.StartedUp() ) + iApiProvider.BrCtlInterface().SetFocus(IsFocused()); + if ( iGotoPane->IsVisible() ) + { + TRAP_IGNORE(iGotoPane->EnableKeyEventHandlerL( IsFocused() )); + } + + CCoeControl::FocusChanged( aDrawNow ); + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::SizeChanged() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::SizeChanged() + { + // BrCtl could be uninitialized + if ( iApiProvider.StartedUp() ) + { + if(iApiProvider.LastActiveViewId() != KUidBrowserFeedsFeedViewId) + { + const TRect& oldRect = iApiProvider.BrCtlInterface().Rect(); + iApiProvider.BrCtlInterface().SetRect( TRect( oldRect.iTl, Size() ) ); + } + } + + if ( iFindKeywordPane->IsVisible() ) + iFindKeywordPane->HandleFindSizeChanged(); + if ( iGotoPane->IsVisible() ) + iGotoPane->HandleFindSizeChanged(); + + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::CountComponentControls() +// --------------------------------------------------------------------------- +// +TInt CBrowserContentViewContainer::CountComponentControls() const + { + TInt ctrls = 0; + ctrls++; // iGotoPane + if ( iApiProvider.StartedUp() ) + { + ctrls++; + } + ctrls++; // iFindKeywordPane + return ctrls; + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::ComponentControl() +// --------------------------------------------------------------------------- +// +CCoeControl* CBrowserContentViewContainer::ComponentControl( TInt aIndex ) const + { + CCoeControl *ctrl = NULL; + switch( aIndex ) + { + case 0: + { + ctrl = iGotoPane; + break; + } + case 1: + { + if ( iApiProvider.StartedUp() ) + ctrl = &(iApiProvider.BrCtlInterface()); + break; + } + case 2: + { + ctrl = iFindKeywordPane; + break; + } + + default: + break; + } + return ctrl; + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::ShutDownGotoURLEditorL() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::ShutDownGotoURLEditorL() + { + iGotoPane->MakeVisible( EFalse ); + iGotoPane->SetFocus( EFalse ); + SetFocus( ETrue ); + } + + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::ShutDownFindKeywordEditorL() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::ShutDownFindKeywordEditorL() + { + iFindKeywordPane->MakeVisible( EFalse ); + iFindKeywordPane->SetFocus( EFalse ); + SetFocus( ETrue ); + } + + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::HandleResourceChange() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::HandleResourceChange(TInt aType) + { + CCoeControl::HandleResourceChange( aType ); + if ( aType == KEikDynamicLayoutVariantSwitch) + { + if (!iView->FindItemIsInProgress()) + { + iView->HandleStatusPaneCallBack(); + iApiProvider.Display().RestoreTitleL(); + } + + iView->SetContentContainerRect(); + + if( iApiProvider.Preferences().SearchFeature() ) + { + iGotoPane->SetTextModeItalicL(); + // To Avoid Flickring, only when layout changed. + iGotoPane->DrawNow(); + } + + DrawDeferred(); + + // For Touch only-If find pane open, force toolbar to show since avkon disables + // touch toolbar whenever a dialog is open and a rotate event is handled. + // ** This workaround was provided by Avkon toolbar group + if ( AknLayoutUtils::PenEnabled() && + iFindKeywordPane->IsVisible() && + iView->Toolbar() ) + { + iView->Toolbar()->DrawableWindow()->SetOrdinalPosition( 0 ); + } + } + } + + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::CreateShortCutFuncsHashTable() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::CreateShortCutFuncsHashTable() + { + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncHomePg(), EWmlSettingsShortCutsActivateHomepage); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncBkMark(), EWmlSettingsShortCutsActivateBkmkview); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncFindKeyWord(), EWmlSettingsShortCutsShowFindKeyword); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncPrePage(), EWmlSettingsShortCutsGotoPreviousPage); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncSwitchWin(), EWmlSettingsShortCutsShowSwitchWindowList); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncMiniImage(), EWmlSettingsShortCutsShowMiniature); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncFullScreen(), EWmlSettingsShortCutsShowFullScreen); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncGoAddr(), EWmlSettingsShortCutsGotoPane); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncZoomIn(), EWmlSettingsShortCutsZoomIn); + InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncZoomOut(), EWmlSettingsShortCutsZoomOut); + // InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncZoomMode(), EWmlSettingsShortCutsZoomMode); + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::InsertFuncToHashTable() +// --------------------------------------------------------------------------- +// +void CBrowserContentViewContainer::InsertFuncToHashTable(HBufC* aKeyStr, TInt aFunc) + { + + __ASSERT_DEBUG( (aKeyStr != NULL), Util::Panic( Util::EUninitializedData )); + + if (aKeyStr->Length() == 0) + { + return; + } + + TBuf<4> key1Str; // Ex.: 0075 + TBuf<4> key2Str; // Ex.: 0032 + + // Get the position of the separator ',' character from '0075, 0032'. + TInt pos = aKeyStr->LocateF( ',' ); + if ( ( pos != KErrNotFound ) ) + { //we have two string + // Extract the first unicode string + key1Str.Copy( aKeyStr->Des().Left( pos ) ); + TUint key1 = MyAtoi(key1Str); + + // Extract the second unicode string; second "-1" below is for remove space + key2Str.Copy( aKeyStr->Des().Right( aKeyStr->Des().Length() - pos - 1 -1) ); + TUint key2 = MyAtoi(key2Str); + + // insert key and function + iShortCutFuncMap.Insert(key1, aFunc); + iShortCutFuncMap.Insert(key2, aFunc); + } + else + { //we only have one string + // Extract the first unicode string + key1Str.Copy( aKeyStr->Des() ); + TUint key1 = MyAtoi(key1Str); + // insert key and function + iShortCutFuncMap.Insert(key1, aFunc); + } + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::MyAtoi() +// --------------------------------------------------------------------------- +// +TUint CBrowserContentViewContainer::MyAtoi(TPtrC aData) + { + TLex lex(aData); + TUint dataValue = 0; + lex.Val(dataValue, EHex); + return dataValue; + } + +//--------------------------------------------------------------------------- +// CBrowserContentViewContainer::InvokeFunction() +// --------------------------------------------------------------------------- +// +TKeyResponse CBrowserContentViewContainer::InvokeFunction(TUint aCode) + { + TInt function = -1; + // if error, no function defined for this shortcut key + TRAPD( err, function = iShortCutFuncMap.FindL(aCode) ); + if ( err != KErrNone ) + { + return EKeyWasNotConsumed; + } + + TBool embedded = iApiProvider.IsEmbeddedModeOn(); + + if ( !iView->IsMiniatureViewUp() && !iView->IsHistoryViewUp() ) + { + CBrowserAppUi* ui = CBrowserAppUi::Static(); + + switch(function) + { + case EWmlSettingsShortCutsActivateHomepage: + { + TBool homepage = iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ); + // home page + if ( homepage ) + { + // + TWmlSettingsHomePage pgtype = iApiProvider.Preferences().HomePageType(); + + if ( !(embedded || pgtype == EWmlSettingsHomePageBookmarks) ) + { + ui->LaunchHomePageL(); + } + else + { + if ( pgtype == EWmlSettingsHomePageBookmarks ) + { + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + } + } + } + return EKeyWasConsumed; + } + case EWmlSettingsShortCutsActivateBkmkview: + { + if ( !embedded ) + { + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + } + return EKeyWasConsumed; + } + case EWmlSettingsShortCutsGotoPane: + { + iView->LaunchGotoAddressEditorL(); + iView->MenuBar()->MenuPane()->MakeVisible(EFalse); + return EKeyWasConsumed; + } + case EWmlSettingsShortCutsShowFindKeyword: + { + if (!iView->ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(ETrue /* is current page wml?*/)) + { + iView->LaunchFindKeywordEditorL(); + iView->MenuBar()->MenuPane()->MakeVisible(EFalse); + } + return EKeyWasConsumed; + } + case EWmlSettingsShortCutsShowSwitchWindowList: + { + if (!iView->ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(EFalse /*is any page wml?*/)) + { + if (iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows ) && + iApiProvider.WindowMgr().WindowCount() > 1) + { + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserWindowSelectionViewId ); + } + else + { + if (iApiProvider.WindowMgr().WindowCount() > 1) + { + ui->SwitchWindowL(); + } + } + } + return EKeyWasConsumed; + } + + case EWmlSettingsShortCutsZoomOut: + { + iView->ZoomImagesOutL(); + return EKeyWasConsumed; + } + + case EWmlSettingsShortCutsZoomIn: + { + iView->ZoomImagesInL(); + return EKeyWasConsumed; + } + + case EWmlSettingsShortCutsGotoPreviousPage: + { + if ( iApiProvider.BrCtlInterface().NavigationAvailable( TBrCtlDefs::ENavigationBack ) ) + { + iApiProvider.LoadObserver().DoStartLoad( CBrowserLoadObserver::ELoadUrlTypeOther ); + iApiProvider.BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandOneStepBack + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + return EKeyWasConsumed; + } + + case EWmlSettingsShortCutsShowFullScreen: + { + iView->HandleCommandL(EWmlCmdEnterFullScreenBrowsing); + return EKeyWasConsumed; + } + } + } // END if ( !iView->IsMiniatureViewUp() && !iView->IsHistoryViewUp() && !iView->isZoomMode()) + + + if ( function == EWmlSettingsShortCutsShowMiniature && !iView->IsHistoryViewUp() ) + { // Process short key '8' only if History view is not shown. + if (!iView->ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(ETrue /* is current page wml?*/)) + { + iApiProvider.BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowThumbnailView + (TInt)TBrCtlDefs::ECommandIdBase ); + } + return EKeyWasConsumed; + } + + return EKeyWasNotConsumed; + } + + + +#ifdef __SERIES60_HELP +// --------------------------------------------------------- +// CBrowserContentViewContainer::GetHelpContext() +// --------------------------------------------------------- +// +void CBrowserContentViewContainer::GetHelpContext( TCoeHelpContext& aContext ) const + { + const TUid KUidOperatorMenuApp = { 0x10008D5E }; + aContext.iMajor = KUidBrowserApplication; + if ( iApiProvider.IsEmbeddedModeOn() ) + { + if ( CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu() ) + { + aContext.iMajor = KUidOperatorMenuApp; + aContext.iContext = KOPERATOR_HLP_OPTIONS_LIST; + } + else + { + aContext.iContext = KOSS_HLP_PAGEVIEW_EMBED; + } + + } + else + { + aContext.iContext = KOSS_HLP_PAGEVIEW; + } + } + +#endif // __SERIES60_HELP + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserContentViewToolbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserContentViewToolbar.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class that handles the toolbar +* +* +*/ + + +// INCLUDE FILES + +#include "BrowserContentView.h" +#include "BrowserContentViewToolbar.h" +#include "BrowserContentViewContainer.h" +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include "ApiProvider.h" +#include "Preferences.h" +#include +#ifdef RD_SCALABLE_UI_V2 +#include +#include "BrowserUiVariant.hrh" +#endif +#include +#include +#include "BrowserAppUi.h" +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ========================================= + +// ---------------------------------------------------------------------------- +// CBrowserContentViewToolbar::CBrowserContentViewToolbar +// ---------------------------------------------------------------------------- +// +CBrowserContentViewToolbar::CBrowserContentViewToolbar(CBrowserContentView* aBrowserContentView) + { + iBrowserContentView = aBrowserContentView; + } + +// ---------------------------------------------------------------------------- +// CBrowserContentViewToolbar::ConstructL +// ---------------------------------------------------------------------------- +// +void CBrowserContentViewToolbar::ConstructL() + { +#ifdef RD_SCALABLE_UI_V2 + // Do not move this code back to UpdateButtonsStateL. + // Avkon does not allow hiding buttons when the extended toolbar is visible. + TBool embeddedMode = iBrowserContentView->ApiProvider().IsEmbeddedModeOn(); + TBool embeddedOperatorMenu = CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu(); + iBrowserContentView->Toolbar()->ToolbarExtension()->HideItemL( EWmlCmdShowSubscribeList, embeddedMode ); + iBrowserContentView->Toolbar()->ToolbarExtension()->HideItemL( EWmlCmdOpenFeedsFolder, embeddedMode ); + iBrowserContentView->Toolbar()->ToolbarExtension()->HideItemL( EWmlCmdFavourites, (embeddedMode || embeddedOperatorMenu) ); + iBrowserContentView->Toolbar()->ToolbarExtension()->HideItemL( EWmlCmdSaveAsBookmark, embeddedOperatorMenu ); + iBrowserContentView->Toolbar()->ToolbarExtension()->HideItemL( EWmlCmdLaunchHomePage, (embeddedMode || embeddedOperatorMenu) ); + + if ( iBrowserContentView->ApiProvider().Preferences().SearchFeature() ) + { + iBrowserContentView->Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue, EFalse ); + } + else + { + iBrowserContentView->Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue, EFalse ); + } + +#endif + } + +// ---------------------------------------------------------------------------- +// CBrowserContentViewToolbar::NewL +// ---------------------------------------------------------------------------- +// +CBrowserContentViewToolbar* CBrowserContentViewToolbar::NewL(CBrowserContentView* aBrowserContentView) + { + CBrowserContentViewToolbar *self = new CBrowserContentViewToolbar(aBrowserContentView); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// CBrowserContentViewToolbar::~CBrowserContentViewToolbar +// ---------------------------------------------------------------------------- +// +CBrowserContentViewToolbar::~CBrowserContentViewToolbar() + { + } + +// ---------------------------------------------------------------------------- +// CBrowserContentViewToolbar::UpdateButtonsStateBasicL +// ---------------------------------------------------------------------------- +// +void CBrowserContentViewToolbar::UpdateButtonsStateL() + { + TBool historyView = iBrowserContentView->IsHistoryViewUp(); + TBool findKeywordPane = iBrowserContentView->Container()->FindKeywordPane()->IsVisible(); + TBool pageOverview = iBrowserContentView->IsMiniatureViewUp(); + TBool zoomSlider = iBrowserContentView->ZoomSliderVisible(); + TBool contentDisplayed = iBrowserContentView->ApiProvider().ContentDisplayed(); + TBool wmlMode = iBrowserContentView->ApiProvider().WindowMgr().CurrentWindow()->WMLMode(); + TBool DimHomePage = iBrowserContentView->ApiProvider().IsLaunchHomePageDimmedL(); + TBool searchMode = iBrowserContentView->ApiProvider().Preferences().SearchFeature(); + TBool embeddedMode = iBrowserContentView->ApiProvider().IsEmbeddedModeOn(); + TBool embeddedOperatorMenu = CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu(); + iBrowserContentView->Toolbar()->SetItemDimmed(EWmlCmdFavourites, (embeddedMode || embeddedOperatorMenu), ETrue); + // Extended Toolbar + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdToolbarExtensionContentView, + (pageOverview), ETrue ); + iBrowserContentView->Toolbar()->HideItem( EWmlCmdToolbarExtensionContentView, + (historyView || findKeywordPane), ETrue ); + + // Goto Url & search + if ( searchMode ) + { + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdGoToAddressAndSearch, + (pageOverview), ETrue ); + iBrowserContentView->Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, + (historyView || findKeywordPane), ETrue ); + } + // Goto Url + else + { + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdGoToAddress, + (pageOverview), ETrue ); + iBrowserContentView->Toolbar()->HideItem( EWmlCmdGoToAddress, + (historyView || findKeywordPane), ETrue ); + } + + + // Zoom Slider button + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdZoomSliderShow, + ( !contentDisplayed || pageOverview || wmlMode ), ETrue ); + + // History buttons + iBrowserContentView->Toolbar()->HideItem( EWmlCmdHistoryBack, (!historyView), ETrue ); + iBrowserContentView->Toolbar()->HideItem( EWmlCmdHistoryForward, (!historyView), ETrue ); + + if ( historyView ) + { + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdHistoryForward, EFalse, ETrue ); + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdHistoryBack, EFalse, ETrue ); + if(iBrowserContentView->IsHistoryAtEnd()) + { + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdHistoryForward, ETrue, ETrue ); + } + if (iBrowserContentView->IsHistoryAtBeginning()) + { + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlCmdHistoryBack, ETrue, ETrue ); + } + } + + // Find keyword buttons + iBrowserContentView->Toolbar()->HideItem( EWmlCmdFindNext, (!findKeywordPane), ETrue ); + iBrowserContentView->Toolbar()->HideItem( EWmlCmdFindPrevious, (!findKeywordPane), ETrue ); + + iBrowserContentView->Toolbar()->SetItemDimmed( EWmlNoCmd, ETrue, ETrue ); + iBrowserContentView->Toolbar()->HideItem( EWmlNoCmd, (!(historyView || findKeywordPane)), ETrue ); + + // Extended Toolbar +#ifdef RD_SCALABLE_UI_V2 + CBrCtlInterface& brctl = iBrowserContentView->ApiProvider().BrCtlInterface(); + TBool subscribeToItems(EFalse); + TRAPD(err, const RPointerArray& items = brctl.SubscribeToMenuItemsL(); + subscribeToItems = (err == KErrNone && items.Count() > 0)); + TBool noMultiWin = ( !iBrowserContentView->ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) || + iBrowserContentView->ApiProvider().IsEmbeddedModeOn() || + iBrowserContentView->ApiProvider().WindowMgr().WindowCount() < 2); + + iBrowserContentView->Toolbar()->ToolbarExtension()->SetItemDimmed( EWmlCmdFindKeyword, wmlMode ); + +//Disable page overview for TB9.2 +#ifdef BRDO_MULTITOUCH_ENABLED_FF + TBool dimDownloads = iBrowserContentView->ApiProvider().BrCtlInterface().BrowserSettingL(TBrCtlDefs::ESettingsNumOfDownloads) ? EFalse : ETrue; + iBrowserContentView->Toolbar()->ToolbarExtension()->SetItemDimmed( EWmlCmdDownloads, dimDownloads ); +#else + iBrowserContentView->Toolbar()->ToolbarExtension()->SetItemDimmed( EWmlCmdShowMiniature, wmlMode ); +#endif + iBrowserContentView->Toolbar()->ToolbarExtension()->SetItemDimmed( EWmlCmdShowSubscribeList, + (!subscribeToItems || wmlMode) ); + iBrowserContentView->Toolbar()->ToolbarExtension()->SetItemDimmed( EWmlCmdSwitchWindow, noMultiWin ); + iBrowserContentView->Toolbar()->ToolbarExtension()->SetItemDimmed( EWmlCmdLaunchHomePage, DimHomePage ); +#endif + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserContentViewZoomModeTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserContentViewZoomModeTimer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Timer for zoom mode. +* +*/ + + +// INCLUDES +#include + +#include "BrowserContentView.h" +#include "BrowserContentViewZoomModeTimer.h" + +// --------------------------------------------------------------------------------------- +// Default C++ constructor +// --------------------------------------------------------------------------------------- +// +CBrowserContentViewZoomModeTimer::CBrowserContentViewZoomModeTimer() + : CTimer( EPriorityUserInput ) + { + } + +// --------------------------------------------------------------------------- +// CBrowserContentViewZoomModeTimer::~CBrowserContentViewZoomModeTimer() +// --------------------------------------------------------------------------- +CBrowserContentViewZoomModeTimer::~CBrowserContentViewZoomModeTimer() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CBrowserContentViewZoomModeTimer::ConstructL() +// --------------------------------------------------------------------------- +void CBrowserContentViewZoomModeTimer::ConstructL( + CBrowserContentView* aBrowserContentView ) + { + iBrowserContentView = aBrowserContentView; + + CTimer::ConstructL(); + CActiveScheduler::Add( this ); + } + +//----------------------------------------------------------------------------- +// CBrowserContentViewZoomModeTimer::NewL() +//----------------------------------------------------------------------------- +// +CBrowserContentViewZoomModeTimer* CBrowserContentViewZoomModeTimer::NewL( + CBrowserContentView* aBrowserContentView ) + { + CBrowserContentViewZoomModeTimer* self = + CBrowserContentViewZoomModeTimer::NewLC( aBrowserContentView ); + CleanupStack::Pop(); + return self; + } + +//----------------------------------------------------------------------------- +// CBrowserContentViewZoomModeTimer::NewLC() +//----------------------------------------------------------------------------- +// +CBrowserContentViewZoomModeTimer* CBrowserContentViewZoomModeTimer::NewLC( + CBrowserContentView* aBrowserContentView ) + { + CBrowserContentViewZoomModeTimer* self = + new (ELeave) CBrowserContentViewZoomModeTimer(); + CleanupStack::PushL(self); + self->ConstructL( aBrowserContentView ); + return self; + } + +// ---------------------------------------------------------------------------- +// CBrowserContentViewZoomModeTimer::RunL() +// ---------------------------------------------------------------------------- +void CBrowserContentViewZoomModeTimer::RunL() + { + if ( iBrowserContentView->isZoomMode() ) + { + // If in zoom mode and timer expires, turn off zoom mode. Zoom indicator + // should also be removed. + iBrowserContentView->SetZoomModeL( EFalse ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::Start() +// ---------------------------------------------------------------------------- +void CBrowserContentViewZoomModeTimer::Start( TTimeIntervalMicroSeconds32 aPeriod ) + { + CTimer::After( aPeriod ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserDialogs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserDialogs.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Helper class that pops up several dialogs. +* +* +*/ + + +// INCLUDE FILES + +// System includes +#include +#include +#include +#include + +// User includes +#include "BrowserDialogs.h" + +// ================= MEMBER FUNCTIONS ========================================= +// ---------------------------------------------------------------------------- +// TBrowserDialogs::DialogPromptReqL +// ---------------------------------------------------------------------------- +// +TInt TBrowserDialogs::DialogPromptReqL( const TDesC& aMsg, + TDes* aResp, + TBool aIsUrlAddress, + TInt aMaxLength + ) + { + TPtrC msg( aMsg ); + CAknTextQueryDialog* dialog = new( ELeave )CAknTextQueryDialog( *aResp, msg ); + if( aMaxLength ) + { + dialog->SetMaxLength(aMaxLength); + } + TInt resource; + if ( aIsUrlAddress ) + { + resource = R_WB_SCRIPT_PROMPT_URL_ADDRESS; + } + else + { + resource = R_WB_SCRIPT_PROMPT_LINES; + } + dialog->SetPredictiveTextInputPermitted(ETrue); + return dialog->ExecuteLD( resource ); + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::DialogQueryReqL +// ---------------------------------------------------------------------------- +// +TInt TBrowserDialogs::DialogQueryReqL( const TDesC& aMsg, + const TDesC& aYesMessage, + const TDesC& aNoMessage ) + { + TPtrC msg(aMsg); + CAknQueryDialog* dialog = + new ( ELeave ) CAknQueryDialog( msg, CAknQueryDialog::ENoTone ); + + dialog->PrepareLC( R_WB_SCRIPT_QUERY_LINES ); + + if( aYesMessage.Length() ) + { + dialog->ButtonGroupContainer().SetCommandL(EAknSoftkeyYes, aYesMessage ); + } + + if( aNoMessage.Length() ) + { + dialog->ButtonGroupContainer().SetCommandL(EAknSoftkeyNo, aNoMessage ); + } + + return dialog->RunLD(); + } + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::ConfirmQueryDialogL +// ---------------------------------------------------------------------------- +// +TInt TBrowserDialogs::ConfirmQueryDialogL( const TInt aPromptResourceId, + TInt aResId, TInt aAnimation ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId ); + TInt ret = ConfirmQueryDialogL( *prompt, aResId, aAnimation ); + CleanupStack::PopAndDestroy(); // prompt + return ret; + } + + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::ConfirmQueryDialogL +// ---------------------------------------------------------------------------- +// +TInt TBrowserDialogs::ConfirmQueryDialogL( const TDesC& aPrompt, + TInt aResId, + TInt aAnimation ) + { + CAknQueryDialog* dialog = new (ELeave) CAknQueryDialog(); + + // TO DO: Store dialog pointer for CBrowserDialogsProvider::CancelAll() + + dialog->PrepareLC( R_BROWSER_CONFIRM_QUERY ); + // passing prompt text in constructor is depracated according to + // AknQueryDialog.h + dialog->SetPromptL( aPrompt ); + if( aResId ) + { + dialog->ButtonGroupContainer().SetCommandSetL( aResId ); + } + + if( aAnimation ) + { + CAknQueryControl* control = STATIC_CAST( CAknQueryControl*, dialog->Control(EGeneralQuery) ); + control->SetAnimationL( aAnimation ); + } + + return dialog->RunLD(); + } + + +// --------------------------------------------------------- +// TBrowserDialogs::ConfirmQueryYesNoL +// --------------------------------------------------------- +// +TBool TBrowserDialogs::ConfirmQueryYesNoL( TDesC& aPrompt ) + { + return ConfirmQueryDialogL( aPrompt ); + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::ConfirmQueryYesNoL +// ---------------------------------------------------------------------------- +// +TBool TBrowserDialogs::ConfirmQueryYesNoL( const TInt aPromptResourceId ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId ); + TBool ret = ConfirmQueryYesNoL( *prompt ); + CleanupStack::PopAndDestroy(); // prompt + return ret; + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::ConfirmQueryYesNoL +// ---------------------------------------------------------------------------- +// +TBool TBrowserDialogs::ConfirmQueryYesNoL + ( const TInt aPromptResourceId, const TDesC& aString ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aString ); + TBool ret = ConfirmQueryYesNoL( *prompt ); + CleanupStack::PopAndDestroy(); // prompt + return ret; + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::ConfirmQueryYesNoL +// ---------------------------------------------------------------------------- +// +TBool TBrowserDialogs::ConfirmQueryYesNoL + ( const TInt aPromptResourceId, const TInt aNum ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aNum ); + TBool ret = ConfirmQueryYesNoL( *prompt ); + CleanupStack::PopAndDestroy(); // prompt + return ret; + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::InfoNoteL +// ---------------------------------------------------------------------------- +// +void TBrowserDialogs::InfoNoteL( TInt aDialogResourceId, + const TDesC& aPrompt ) + { + CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog + ( REINTERPRET_CAST( CEikDialog**, &dialog ) ); + dialog->PrepareLC( aDialogResourceId ) ; + dialog->SetCurrentLabelL( EGeneralNote, aPrompt ); + dialog->RunDlgLD( CAknNoteDialog::EShortTimeout , CAknNoteDialog::ENoTone ); + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::InfoNoteL +// ---------------------------------------------------------------------------- +// +void TBrowserDialogs::InfoNoteL +( TInt aDialogResourceId, const TInt aPromptResourceId ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId ); + InfoNoteL( aDialogResourceId, *prompt ); + CleanupStack::PopAndDestroy(); // prompt + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::InfoNoteL +// ---------------------------------------------------------------------------- +// +void TBrowserDialogs::InfoNoteL ( TInt aDialogResourceId, + const TInt aPromptResourceId, + const TDesC& aString ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aString ); + InfoNoteL( aDialogResourceId, *prompt ); + CleanupStack::PopAndDestroy(); // prompt + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::InfoNoteL +// ---------------------------------------------------------------------------- +// +void TBrowserDialogs::InfoNoteL +( TInt aDialogResourceId, const TInt aPromptResourceId, const TInt aNum ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aNum ); + InfoNoteL( aDialogResourceId, *prompt ); + CleanupStack::PopAndDestroy(); // prompt + } + + +// ---------------------------------------------------------------------------- + // TBrowserDialogs::ErrorNoteL +// ---------------------------------------------------------------------------- +// +void TBrowserDialogs::ErrorNoteL( const TInt aPromptResourceId ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResourceId ); + ErrorNoteL( *prompt ); + CleanupStack::PopAndDestroy(); // prompt + } + + +// ---------------------------------------------------------------------------- +// TBrowserDialogs::ErrorNoteL +// ---------------------------------------------------------------------------- +// +void TBrowserDialogs::ErrorNoteL( const TDesC& aPrompt ) + { + CAknErrorNote* note = new ( ELeave ) CAknErrorNote(); + note->ExecuteLD( aPrompt ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserDialogsProviderBlocker.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserDialogsProviderBlocker.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Blocks dialog requests to the BrowserDialogsProvider if a +* window is in the background. When the window comes to the +* foreground, it will be displayed. +* +* +*/ + +#include "BrowserDialogsProviderBlocker.h" +#include "BrowserWindowFocusNotifier.h" + +// ---------------------------------------------------------------------------- +// static CBrowserDialogsProviderBlocker* +// CBrowserDialogsProviderBlocker::NewLC +// ---------------------------------------------------------------------------- +// +CBrowserDialogsProviderBlocker* CBrowserDialogsProviderBlocker::NewLC( + CBrowserWindowFocusNotifier& aWinFocusNotifier ) + { + CBrowserDialogsProviderBlocker* self = new (ELeave) + CBrowserDialogsProviderBlocker( aWinFocusNotifier ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// CBrowserDialogsProviderBlocker::CBrowserDialogsProviderBlocker() +// ---------------------------------------------------------------------------- +// +CBrowserDialogsProviderBlocker::CBrowserDialogsProviderBlocker( + CBrowserWindowFocusNotifier& aWinFocusNotifier ) + + : CActive( CActive::EPriorityStandard ), + iWinFocusNotifier( aWinFocusNotifier ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CBrowserDialogsProviderBlocker::~CBrowserDialogsProviderBlocker() +// Destroy the object and release all memory objects +// --------------------------------------------------------------------------- +// +CBrowserDialogsProviderBlocker::~CBrowserDialogsProviderBlocker() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// void CBrowserDialogsProviderBlocker::ConstructL() +// Two-pase constructor +// --------------------------------------------------------------------------- +// +void CBrowserDialogsProviderBlocker::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// void CBrowserDialogsProviderBlocker::Start() +// Complete an asynchronous request. +// --------------------------------------------------------------------------- +// +void CBrowserDialogsProviderBlocker::Start() + { + // Register the AO status + iStatus = KRequestPending; + iWinFocusNotifier.Add( &iStatus ); + SetActive(); + + // Asynch wait start + iWait.Start(); + } + +// --------------------------------------------------------------------------- +// void CBrowserDialogsProviderBlocker::DoCancel() +// Cancel any outstanding requests. +// --------------------------------------------------------------------------- +// +void CBrowserDialogsProviderBlocker::DoCancel() + { + // The AO can continue + iWait.AsyncStop(); + } + +// --------------------------------------------------------------------------- +// void CBrowserDialogsProviderBlocker::RunL() +// Handles object`s request completion event. +// --------------------------------------------------------------------------- +// +void CBrowserDialogsProviderBlocker::RunL() + { + // The AO can continue + iWait.AsyncStop(); + } + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserDialogsProviderProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserDialogsProviderProxy.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,501 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the CBrowserDialogsProviderProxy class. +* +*/ + + +// INCLUDE Files + +// User includes +#include "BrowserDialogsProviderProxy.h" +#include "BrowserDialogsProviderBlocker.h" +#include "BrowserWindowFocusNotifier.h" +#include "BrowserWindow.h" +#include "logger.h" + +// System includes +#include +#include + +// CONSTANTS + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::CBrowserDialogsProviderProxy +//----------------------------------------------------------------------------- +CBrowserDialogsProviderProxy::CBrowserDialogsProviderProxy( + CBrowserDialogsProvider& aDialogsProvider, + MBrowserDialogsProviderObserver* aDialogsObserver, + CBrowserWindow& aBrowserWindow ) + : iDialogsProvider( aDialogsProvider ), + iDialogsObserver( aDialogsObserver ), + iBrowserWindow( aBrowserWindow ), + iCancelWaitingDialogs( EFalse ) + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::~CBrowserDialogsProviderProxy +//----------------------------------------------------------------------------- +CBrowserDialogsProviderProxy::~CBrowserDialogsProviderProxy() + { +LOG_ENTERFN("~CBrowserDialogsProviderProxy"); + delete iWinFocusNotifier; + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy* CBrowserDialogsProviderProxy::NewL +//----------------------------------------------------------------------------- +CBrowserDialogsProviderProxy* CBrowserDialogsProviderProxy::NewL( + CBrowserDialogsProvider& aDialogsProvider, + MBrowserDialogsProviderObserver* aDialogsObserver, + CBrowserWindow& aBrowserWindow ) + { + CBrowserDialogsProviderProxy* self = new (ELeave) + CBrowserDialogsProviderProxy( aDialogsProvider, + aDialogsObserver, + aBrowserWindow ); + + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); // self + return self; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::ConstructL +// +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::ConstructL() + { + // Keeps track of blocked dialogs + iWinFocusNotifier = CBrowserWindowFocusNotifier::NewL(); + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogNotifyErrorL +// +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogNotifyErrorL( TInt aErrCode ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogNotifyErrorL"); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.DialogNotifyErrorL( aErrCode ); + if ( iDialogsObserver ) + { + iDialogsObserver->ReportDialogEventL( + MBrowserDialogsProviderObserver::ENotifyError, + aErrCode ); + } + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogNotifyErrorL"); + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL( + TInt aErrCode, const TDesC& aUri ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL"); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.DialogNotifyHttpErrorL( aErrCode, aUri ); + if ( iDialogsObserver ) + { + iDialogsObserver->ReportDialogEventL( + MBrowserDialogsProviderObserver::ENotifyHttpError, + NULL ); + } + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL"); + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogFileSelectLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogFileSelectLC( + const TDesC& aStartPath, + const TDesC& aRootPath, + HBufC*& aSelectedFileName ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogFileSelectLC"); + TBool retVal( EFalse ); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); + TBool softKeysVisible( ETrue ); + if ( currentCba ) + { + softKeysVisible = currentCba->IsVisible(); + } + + retVal = iDialogsProvider.DialogFileSelectLC( aStartPath, + aRootPath, + aSelectedFileName ); + + // If the softkeys were not visible before, then make sure they are not + // visible after. + if ( currentCba && !softKeysVisible ) + { + currentCba->MakeVisible( EFalse ); + } + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogFileSelectLC"); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogSelectOptionL +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogSelectOptionL( + const TDesC& aTitle, + TBrCtlSelectOptionType aBrCtlSelectOptionType, + CArrayFix& aOptions ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogSelectOptionL"); + TBool retVal( EFalse ); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); + TBool softKeysVisible( ETrue ); + if ( currentCba ) + { + softKeysVisible = currentCba->IsVisible(); + } + + retVal = iDialogsProvider.DialogSelectOptionL( + aTitle, + aBrCtlSelectOptionType, + aOptions ); + // If the softkeys were not visible before, then make sure they are not + // visible after. + if ( currentCba && !softKeysVisible ) + { + currentCba->MakeVisible( EFalse ); + } + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogSelectOptionL"); + return retVal; + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogUserAuthenticationLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogUserAuthenticationLC( + const TDesC& aUrl, + const TDesC& aRealm, + const TDesC& aDefaultUserName, + HBufC*& aReturnedUserName, + HBufC*& aReturnedPasswd, + TBool aBasicAuthentication ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogUserAuthenticationLC"); + TBool retVal( EFalse ); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); + TBool softKeysVisible( ETrue ); + if ( currentCba ) + { + softKeysVisible = currentCba->IsVisible(); + } + + retVal = iDialogsProvider.DialogUserAuthenticationLC( + aUrl, + aRealm, + aDefaultUserName, + aReturnedUserName, + aReturnedPasswd, + aBasicAuthentication ); + if ( iDialogsObserver ) + { + iDialogsObserver->ReportDialogEventL( + MBrowserDialogsProviderObserver::EUserAuthentication, + ( TInt ) retVal ); + } + + // If the softkeys were not visible before, then make sure they are not + // visible after. + if ( currentCba && !softKeysVisible ) + { + currentCba->MakeVisible( EFalse ); + } + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogUserAuthenticationLC"); + return retVal; + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogNoteL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogNoteL( const TDesC& aMessage ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogNoteL"); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.DialogNoteL( aMessage ); + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogNoteL"); + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogAlertL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogAlertL( const TDesC& aTitle, + const TDesC& aMessage ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogAlertL"); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.DialogAlertL( aTitle, aMessage ); + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogAlertL"); + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogConfirmL +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogConfirmL( const TDesC& aTitle, + const TDesC& aMessage, + const TDesC& aYesMessage, + const TDesC& aNoMessage ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogConfirmL"); + TBool retVal( EFalse ); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); + TBool softKeysVisible( ETrue ); + if ( currentCba ) + { + softKeysVisible = currentCba->IsVisible(); + } + + retVal = iDialogsProvider.DialogConfirmL( aTitle, aMessage, + aYesMessage, aNoMessage ); + + // If the softkeys were not visible before, then make sure they are not + // visible after. + if ( currentCba && !softKeysVisible ) + { + currentCba->MakeVisible( EFalse ); + } + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogConfirmL"); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogPromptLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogPromptLC( const TDesC& aTitle, + const TDesC& aMessage, + const TDesC& aDefaultInput, + HBufC*& aReturnedInput ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogPromptLC"); + TBool retVal( EFalse ); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); + TBool softKeysVisible( ETrue ); + if ( currentCba ) + { + softKeysVisible = currentCba->IsVisible(); + } + + retVal = iDialogsProvider.DialogPromptLC( aTitle, aMessage, + aDefaultInput, aReturnedInput ); + + // If the softkeys were not visible before, then make sure they are not + // visible after. + if ( currentCba && !softKeysVisible ) + { + currentCba->MakeVisible( EFalse ); + } + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogPromptLC"); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogDownloadObjectL +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogDownloadObjectL( + CBrCtlObjectInfo* aBrCtlObjectInfo ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogDownloadObjectL"); + TBool retVal( EFalse ); + + if (iBrowserWindow.IsWindowActive()) + { + retVal = iDialogsProvider.DialogDownloadObjectL( aBrCtlObjectInfo ); + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogDownloadObjectL"); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogDisplayPageImagesL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogDisplayPageImagesL( + CArrayFixFlat& aPageImages ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogDisplayPageImagesL"); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.DialogDisplayPageImagesL( aPageImages ); + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogDisplayPageImagesL"); + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::CancelAll +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::CancelAll() + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::CancelAll"); + // Dialogs should be flushed, but not displayed + iCancelWaitingDialogs = ETrue; + iDialogsProvider.CancelAll(); + iWinFocusNotifier->FlushAOStatusArray(); +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::CancelAll"); + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogMimeFileSelectLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogMimeFileSelectLC( + HBufC*& aSelectedFileName, + const TDesC& aMimeType ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogMimeFileSelectLC"); + TBool retVal( EFalse ); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); + TBool softKeysVisible( ETrue ); + if ( currentCba ) + { + softKeysVisible = currentCba->IsVisible(); + } + + retVal = iDialogsProvider.DialogMimeFileSelectLC( aSelectedFileName, + aMimeType ); + // If the softkeys were not visible before, then make sure they are not + // visible after. + if ( currentCba && !softKeysVisible ) + { + currentCba->MakeVisible( EFalse ); + } + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogMimeFileSelectLC"); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::ShowTooltipL +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::ShowTooltipL( const TDesC& aText, + TInt aDuration, + TInt aDelay ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::ShowTooltipL"); + + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.ShowTooltipL( aText, aDuration, aDelay ); + } +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::ShowTooltipL"); + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::UploadProgressNoteL +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::UploadProgressNoteL( + TInt32 aTotalSize, + TInt32 aChunkSize, + TBool aIsLastChunk, + MBrowserDialogsProviderObserver* aObserver ) + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::UploadProgressNoteL"); + + // Forward dialog to DialogsProvider if it has not been cancelled + if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) + { + iDialogsProvider.UploadProgressNoteL( aTotalSize, + aChunkSize, + aIsLastChunk, + aObserver ); + } + +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::UploadProgressNoteL"); + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::WindowActivated() +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::WindowActivated() + { + LOG_ENTERFN("CBrowserDialogsProviderProxy::WindowActivated"); + // Window is now topmost, all waiting dialogs should be shown in turn + iWinFocusNotifier->OnFocusGained(); +// LOG_LEAVEFN("CBrowserDialogsProviderProxy::WindowActivated"); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserDisplay.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserDisplay.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,879 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Access to display components +* +* +*/ + + +// INCLUDE FILES +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // For WLAN state checking + +#include // For Layout_Meta_Data landscape/portrait status + +// User includes +#include "ApiProvider.h" +#include "BrowserProgressIndicator.h" +#include "BrowserDisplay.h" +#include "BrowserUtil.h" +#include "Preferences.h" +#include "CommonConstants.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include "Logger.h" + +#include "WlanObserver.h" + +#include + +// TYPES + +struct TIndicatorContainer { + TInt locName; // indicator's local name + TInt aknName; // indicator's avkon name + TInt indState; // indicator's value +}; + +// cosmetic macros +#define _AKN_IND( a ) EAknNaviPaneEditorIndicator ## a +#define _LOC_IND( a ) ELocalIndicator ## a +#define _IND_STATE( a ) KLocalIndicators[ _LOC_IND( a ) ].indState +#define _SET_INDIC( a ) SetIndicatorState( \ + TUid::Uid( _AKN_IND( a ) ), _IND_STATE( a ) ) +#define _SET_INDIC2( a, b ) SetIndicatorState( \ + TUid::Uid( _AKN_IND( a ) ), _IND_STATE( a ), b ) + +// indicators used in this module +enum { + _LOC_IND( SecuredConnection ), + _LOC_IND( MessageInfo ), + _LOC_IND( ProgressBar ), + // _LOC_IND( WaitBar ), // + // _LOC_IND( T9 ), // + // _LOC_IND( UpperCase ), // + // _LOC_IND( LowerCase ), // + // _LOC_IND( AudioAttached ), // + // _LOC_IND( Objects ), // + // _LOC_IND( WmlWaitGlobe ), + _LOC_IND( Gprs ), + _LOC_IND( WlanAvailable ), + _LOC_IND( WlanActive ), + _LOC_IND( WlanActiveSecure ), + _LOC_IND( FileSize ), + // _LOC_IND( MessageLength ), // + _LOC_IND( WmlWindows ), + _LOC_IND( WmlWindowsText ), + _LOC_IND( LastItem ) +}; + +// CONSTANTS +_LIT( KBrowserSpaceChar, " " ); + +// order of the indicators in this structure MUST match the enum definition above! +LOCAL_D TIndicatorContainer KLocalIndicators[] = +{ + { _LOC_IND( SecuredConnection ), _AKN_IND( SecuredConnection ), EAknIndicatorStateOff }, + { _LOC_IND( MessageInfo ), _AKN_IND( MessageInfo ), EAknIndicatorStateOff }, + { _LOC_IND( ProgressBar ), _AKN_IND( ProgressBar ), EAknIndicatorStateOff }, + // { _LOC_IND( WaitBar ), _AKN_IND( WaitBar ), EAknIndicatorStateOff }, + // { _LOC_IND( T9 ), _AKN_IND( T9 ), EAknIndicatorStateOff }, + // { _LOC_IND( UpperCase ), _AKN_IND( UpperCase ), EAknIndicatorStateOff }, + // { _LOC_IND( LowerCase ), _AKN_IND( LowerCase ), EAknIndicatorStateOff }, + // { _LOC_IND( AudioAttached ), _AKN_IND( AudioAttached ), EAknIndicatorStateOff }, + // { _LOC_IND( Objects ), _AKN_IND( Objects ), EAknIndicatorStateOff }, + // { _LOC_IND( WmlWaitGlobe ), _AKN_IND( WmlWaitGlobe ), EAknIndicatorStateOff }, + { _LOC_IND( Gprs ), _AKN_IND( Gprs ), EAknIndicatorStateOn }, + { _LOC_IND( WlanAvailable ), _AKN_IND( WlanAvailable ), EAknIndicatorStateOff }, + { _LOC_IND( WlanActive ), _AKN_IND( WlanActive ), EAknIndicatorStateOff }, + { _LOC_IND( WlanActiveSecure ), _AKN_IND( WlanActiveSecure ), EAknIndicatorStateOff }, + { _LOC_IND( FileSize ), _AKN_IND( FileSize ), EAknIndicatorStateOff }, + // { _LOC_IND( MessageLength ), _AKN_IND( MessageLength ), EAknIndicatorStateOff }, + { _LOC_IND( WmlWindows ), _AKN_IND( WmlWindows ), EAknIndicatorStateOff }, + { _LOC_IND( WmlWindowsText ), _AKN_IND( WmlWindowsText ), EAknIndicatorStateOff }, + { _LOC_IND( LastItem ), 0, 0 } +}; + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBrowserDisplay::CBrowserDisplay( MApiProvider& aApiProvider, CBrowserWindow& aWindow ) +: iApiProvider( aApiProvider ), iWindow( &aWindow ) + { + } + +// --------------------------------------------------------------------------- +// CBrowserDisplay::ConstructL() +// --------------------------------------------------------------------------- +// +void CBrowserDisplay::ConstructL() + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + iProgressIndicator = CBrowserProgressIndicator::NewL( iApiProvider ); + iEditorIndicatorContainer = NULL; + iTitle = NULL; +PERFLOG_STOP_WRITE("BrProgressIndicator") + InitIndicatorsL(); //for full screen + +#ifdef _DEBUG + // check the indicator array's integrity + TInt i = 0; + while( KLocalIndicators[i].locName != _LOC_IND( LastItem ) ) + { + __ASSERT_DEBUG( KLocalIndicators[i].locName == i, + Util::Panic( Util::EUnExpected ) ); + ++i; + } +#endif // _DEBUG + } + +// --------------------------------------------------------------------------- +// CBrowserDisplay::NewL() +// --------------------------------------------------------------------------- +// +CBrowserDisplay* CBrowserDisplay::NewL( MApiProvider& aApiProvider, CBrowserWindow& aWindow ) + { + CBrowserDisplay* self = new (ELeave) CBrowserDisplay( aApiProvider, aWindow ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + + return self; + } + +// --------------------------------------------------------------------------- +// CBrowserDisplay::~CBrowserDisplay() +// --------------------------------------------------------------------------- +// +CBrowserDisplay::~CBrowserDisplay() + { + delete iProgressIndicator; + delete iEditorIndicatorContainer; + delete iTitle; + delete iWlanObserver; + } + +// --------------------------------------------------------------------------- +// CBrowserDisplay::StatusPane() +// --------------------------------------------------------------------------- +// +CEikStatusPane* CBrowserDisplay::StatusPane() const + { + return STATIC_CAST( CAknAppUi*, CEikonEnv::Static()->EikAppUi() )-> + StatusPane(); + } + +// --------------------------------------------------------------------------- +// CBrowserDisplay::NaviPaneL() +// --------------------------------------------------------------------------- +// +CAknNavigationControlContainer* CBrowserDisplay::NaviPaneL() const + { + CEikStatusPane* sp = StatusPane(); + User::LeaveIfNull( sp ); + return STATIC_CAST( CAknNavigationControlContainer*, + sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); + } + +// --------------------------------------------------------- +// CBrowserDisplay::SetTitleL() +// --------------------------------------------------------- +// +void CBrowserDisplay::SetTitleL( const TDesC& aTitle ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + HBufC* temp = aTitle.AllocL(); + delete iTitle; + iTitle = temp; + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + // Checking to see if we are in contentview so that title is updated for other views like + // Bookmarks and Settings. In landscape mode title could be updated all the time regardless of progress bar. + if ( !Layout_Meta_Data::IsLandscapeOrientation() && + (indicContainerEditing) && (ApiProvider().LastActiveViewId() == KUidBrowserContentViewId )) + { + //Under full screen mode, the progress bar is at the bottom and the title should be updated + //all the time. + if (indicContainerEditing->IndicatorState( + TUid::Uid(EAknNaviPaneEditorIndicatorProgressBar) ) != EAknIndicatorStateOn) + { + RestoreTitleL(); + } + } + else + { + RestoreTitleL(); + } +PERFLOG_STOP_WRITE("BrDsply:SetTitle") + } + +// --------------------------------------------------------- +// CBrowserDisplay::ClearMessageInfo() +// --------------------------------------------------------- +// +void CBrowserDisplay::ClearMessageInfo() + { + + if( iEditorIndicatorContainer != NULL ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + _IND_STATE( MessageInfo ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( MessageInfo ); + indicContainerOwn->_SET_INDIC( MessageInfo ); + } + } +// --------------------------------------------------------- +// CBrowserDisplay::RestoreTitleL() +// --------------------------------------------------------- +// +void CBrowserDisplay::RestoreTitleL() + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + if ( (iTitle !=NULL) ) + { + + if(( iApiProvider.LastActiveViewId() == KUidBrowserContentViewId ) + && ( iEditorIndicatorContainer != NULL ) + && (!(AknStatuspaneUtils::StaconPaneActive())) ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + if ( Layout_Meta_Data::IsLandscapeOrientation() ) + { + // Lanscape mode - Title in title pane not navipane/messageinfo + ClearMessageInfo(); + } + else + { // Portrait mode - Title in navipane/messageinfo + _IND_STATE( MessageInfo ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC( MessageInfo ); + indicContainerOwn->_SET_INDIC( MessageInfo ); + indicContainerEditing->SetIndicatorValueL( + TUid::Uid( _AKN_IND( MessageInfo ) ), *iTitle); + indicContainerOwn->SetIndicatorValueL( + TUid::Uid( _AKN_IND( MessageInfo ) ), *iTitle); + } + + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() )->StatusPane(); + CAknTitlePane* title = STATIC_CAST( CAknTitlePane*, + sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + title->SetTextL( *iTitle ); + } + else + { + if( ( iEditorIndicatorContainer != NULL ) + && ( AknStatuspaneUtils::StaconPaneActive() ) ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + //turn off other indicator, because both are visible in landscape mode + _IND_STATE( MessageInfo ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC2( MessageInfo, ETrue ); + indicContainerOwn->_SET_INDIC2( MessageInfo, ETrue ); + } + + // Set title to be page title + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() )->StatusPane(); + CAknTitlePane* title = STATIC_CAST( CAknTitlePane*, + sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + title->SetTextL( *iTitle ); + } + +#ifndef __WINSCW__ + // Wireless Lan Indicator + TInt wlanStateValue; + StartWlanObserverL(); // if needed + if ( iWlanObserver && iWlanObserver->GetCurrentState(wlanStateValue) ) + { + UpdateWlanIndicator(wlanStateValue); + } +#endif // __WINSCW__ + + // Multiple Windows Indicator + TInt winCount = iApiProvider.WindowMgr().WindowCount(); + TBool showMWIndic = (( winCount > 1 ) && + (ApiProvider().LastActiveViewId() == KUidBrowserContentViewId )) ? + ETrue : EFalse; + UpdateMultipleWindowsIndicatorL( showMWIndic, winCount ); + } +PERFLOG_STOP_WRITE("BrDsply:RestoreTitle") + } + +// --------------------------------------------------------- +// CBrowserDisplay::SetTitleL() +// --------------------------------------------------------- +// +void CBrowserDisplay::SetTitleL( TInt aResourceId ) + { + HBufC* title = CEikonEnv::Static()->AllocReadResourceLC( aResourceId ); + SetTitleL( *title ); + CleanupStack::PopAndDestroy(); // title + } + +// --------------------------------------------------------- +// CBrowserDisplay::StartProgressAnimationL() +// --------------------------------------------------------- +// +void CBrowserDisplay::StartProgressAnimationL() + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START +LOG_ENTERFN( "Display::StartProgressAnimationL" ); +BROWSER_LOG( ( _L("myWindow: %d, active: %d"), + iWindow->WindowId(), iWindow->IsWindowActive() ) ); + if ( iApiProvider.IsProgressShown() ) + { + // ProgressIndicator doesn't have pointer to its Window or parent Display + // so check validity here + if( iWindow->IsWindowActive() ) + { + iProgressIndicator->StartL(); + } + // start globe animation + iApiProvider.StartProgressAnimationL(); + } +PERFLOG_STOP_WRITE("BrDsply: StartPrgAnim") + } + +// --------------------------------------------------------- +// CBrowserDisplay::StopProgressAnimationL() +// --------------------------------------------------------- +// +void CBrowserDisplay::StopProgressAnimationL() + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START +LOG_ENTERFN( "Display::StopProgressAnimationL" ); +BROWSER_LOG( ( _L("myWindow: %d"), iWindow->WindowId() ) ); + if ( iApiProvider.IsProgressShown() ) + { + // always stop spinning globe in FavouritesView + // most of the cases View::DoDeactivateL() does it + // other: e.g. Cancel load in BookmarksView + iApiProvider.StopProgressAnimationL(); + + if ( !ApiProvider().Fetching() ) + { + if ( iEditorIndicatorContainer != NULL ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + _IND_STATE( FileSize ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( FileSize ); + indicContainerOwn->_SET_INDIC( FileSize ); + + indicContainerOwn->SetIndicatorValueL( + TUid::Uid( _AKN_IND( FileSize ) ), KNullDesC() ); + + _IND_STATE( ProgressBar ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( ProgressBar ); + indicContainerOwn->_SET_INDIC( ProgressBar ); + + if( iTitle ) + { + RestoreTitleL(); + } + iApiProvider.SetProgressShown( EFalse ); + } + iProgressIndicator->StopL(); + } + } + PERFLOG_STOP_WRITE("BrDsply: StopPrgAnim") + } + +// --------------------------------------------------------- +// CBrowserDisplay::SelectIndicContainerEditing() +// --------------------------------------------------------- +// +CAknIndicatorContainer* CBrowserDisplay::SelectIndicContainerEditing() + { + CAknIndicatorContainer* indicContainer1 = CAknEnv::Static()-> + EditingStateIndicator()->IndicatorContainer(); + return indicContainer1; + } + +// --------------------------------------------------------- +// CBrowserDisplay::SelectIndicContainerOwn() +// --------------------------------------------------------- +// +CAknIndicatorContainer* CBrowserDisplay::SelectIndicContainerOwn() + { + CAknIndicatorContainer* indicContainer2 = STATIC_CAST( + CAknIndicatorContainer*, iEditorIndicatorContainer->DecoratedControl() ); + return indicContainer2; + } + +// --------------------------------------------------------- +// CBrowserDisplay::InitIndicatorsL() +// --------------------------------------------------------- +// +void CBrowserDisplay::InitIndicatorsL() + { + PERFLOG_LOCAL_INIT + PERFLOG_STOPWATCH_START + + if (iEditorIndicatorContainer) + { + return; + } + + if ((iEditorIndicatorContainer == NULL)) + { + PERFLOG_LOCAL_INIT + PERFLOG_STOPWATCH_START + iEditorIndicatorContainer = NaviPaneL()->CreateEditorIndicatorContainerL(); + PERFLOG_STOP_WRITE(" -> BrDsply: EditorContainer") + } + + PERFLOG_STOPWATCH_START + CAknIndicatorContainer* indicContainer = SelectIndicContainerOwn(); + + _IND_STATE( SecuredConnection ) = EAknIndicatorStateOff; + _IND_STATE( MessageInfo ) = EAknIndicatorStateOff; + _IND_STATE( ProgressBar ) = EAknIndicatorStateOff; + // _IND_STATE( WaitBar ) = EAknIndicatorStateOff; + // _IND_STATE( T9 ) = EAknIndicatorStateOff; + // _IND_STATE( UpperCase ) = EAknIndicatorStateOff; + // _IND_STATE( LowerCase ) = EAknIndicatorStateOff; + // _IND_STATE( AudioAttached ) = EAknIndicatorStateOff; + // _IND_STATE( Objects ) = EAknIndicatorStateOff; + // _IND_STATE( WmlWaitGlobe ) = EAknIndicatorStateOff; + _IND_STATE( Gprs ) = EAknIndicatorStateOn; + + _IND_STATE( WlanAvailable ) = EAknIndicatorStateOff; + _IND_STATE( WlanActive ) = EAknIndicatorStateOff; + _IND_STATE( WlanActiveSecure ) = EAknIndicatorStateOff; + + _IND_STATE( FileSize ) = EAknIndicatorStateOff; + // _IND_STATE( MessageLength ) = EAknIndicatorStateOff; + _IND_STATE( WmlWindows ) = EAknIndicatorStateOff; + _IND_STATE( WmlWindowsText ) = EAknIndicatorStateOff; + + indicContainer->_SET_INDIC( SecuredConnection ); + indicContainer->_SET_INDIC( MessageInfo ); + indicContainer->_SET_INDIC( ProgressBar ); + // indicContainer->_SET_INDIC( WaitBar ); + // indicContainer->_SET_INDIC( T9 ); + // indicContainer->_SET_INDIC( UpperCase ); + // indicContainer->_SET_INDIC( LowerCase ); + // indicContainer->_SET_INDIC( AudioAttached ); + // indicContainer->_SET_INDIC( Objects ); + // indicContainer->_SET_INDIC( WmlWaitGlobe ); + indicContainer->_SET_INDIC( Gprs ); + + indicContainer->_SET_INDIC( WlanAvailable ); + indicContainer->_SET_INDIC( WlanActive ); + indicContainer->_SET_INDIC( WlanActiveSecure ); + + indicContainer->_SET_INDIC( FileSize ); + // indicContainer->_SET_INDIC( MessageLength ); + indicContainer->_SET_INDIC( WmlWindows ); + indicContainer->_SET_INDIC( WmlWindowsText ); + PERFLOG_STOP_WRITE( "Display:InitIndicators") + } + +// --------------------------------------------------------- +// CBrowserDisplay::UpdateSecureIndicatorL() +// --------------------------------------------------------- +// +void CBrowserDisplay::UpdateSecureIndicatorL( const TInt aState ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + if( !iApiProvider.ExitInProgress() ) + { + SetFullScreenSecureIndicatorL(aState); + NaviPaneL()->DrawDeferred(); + } +PERFLOG_STOP_WRITE( "Display:UpdateSecureIndicator") + } + +// --------------------------------------------------------- +// CBrowserDisplay::UpdateFSDownloadInitialIndicator() +// --------------------------------------------------------- +// +void CBrowserDisplay::UpdateFSDownloadInitialIndicator( const TBool aState ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + if( !iEditorIndicatorContainer ) + { + InitIndicatorsL(); + } + + if ( iApiProvider.IsProgressShown() && ( iEditorIndicatorContainer != NULL ) ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + if (aState) + { + ClearMessageInfo(); + + _IND_STATE( FileSize ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( FileSize ); + indicContainerOwn->_SET_INDIC( FileSize ); + } + } +PERFLOG_STOP_WRITE("BrDsply: GlobeAnimation init") + } + +// --------------------------------------------------------- +// CBrowserDisplay::SetGPRSIndicatorOnL() +// --------------------------------------------------------- +// +void CBrowserDisplay::SetGPRSIndicatorOnL() + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + if ( iEditorIndicatorContainer != NULL ) + { + // Set GPRS indicator on, it will update itself + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + _IND_STATE( Gprs ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC( Gprs ); + indicContainerOwn->_SET_INDIC( Gprs ); + } +PERFLOG_STOP_WRITE("BrDsply: Gprsidic on") + } + +// --------------------------------------------------------- +// CBrowserDisplay::UpdateWlanIndicator() +// --------------------------------------------------------- +// +void CBrowserDisplay::UpdateWlanIndicator( const TInt aWlanValue ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + + if ( iEditorIndicatorContainer != NULL ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + _IND_STATE( WlanAvailable ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( WlanAvailable ); + indicContainerOwn->_SET_INDIC( WlanAvailable ); + + _IND_STATE( WlanActive ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( WlanActive ); + indicContainerOwn->_SET_INDIC( WlanActive ); + + _IND_STATE( WlanActiveSecure ) = EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( WlanActiveSecure ); + indicContainerOwn->_SET_INDIC( WlanActiveSecure ); + + switch (aWlanValue) + { + case EPSWlanIndicatorNone: + { + // do nothing. + break; + } + + case EPSWlanIndicatorAvailable: + { + _IND_STATE( WlanAvailable ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC( WlanAvailable ); + indicContainerOwn->_SET_INDIC( WlanAvailable ); + break; + } + + case EPSWlanIndicatorActive: + { + _IND_STATE( WlanActive ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC( WlanActive ); + indicContainerOwn->_SET_INDIC( WlanActive ); + break; + } + + case EPSWlanIndicatorActiveSecure: + { + + _IND_STATE( WlanActiveSecure ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC( WlanActiveSecure ); + indicContainerOwn->_SET_INDIC( WlanActiveSecure ); + break; + } + + default: + { + // do nothing. + break; + } + } + } +PERFLOG_STOP_WRITE("BrDsply: UpdateWlanIndicator") + } + +// --------------------------------------------------------- +// CBrowserDisplay::StartWlanObserverL() +// --------------------------------------------------------- +// +void CBrowserDisplay::StartWlanObserverL() + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + + if (iWlanObserver == NULL) + { + iWlanObserver = new ( ELeave ) CWlanObserver( iApiProvider ); + } + +PERFLOG_STOP_WRITE("BrDsply: Wlan Observer Started") + } + +// --------------------------------------------------------- +// CBrowserDisplay::SetFullScreenSecureIndicatorL() +// --------------------------------------------------------- +// +void CBrowserDisplay::SetFullScreenSecureIndicatorL(const TBool aState) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + _IND_STATE( SecuredConnection ) = aState; + if ( iEditorIndicatorContainer != NULL && iWindow->IsWindowActive() ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + _IND_STATE( SecuredConnection ) = aState ? + EAknIndicatorStateOn : EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( SecuredConnection ); + indicContainerOwn->_SET_INDIC( SecuredConnection ); + } +PERFLOG_STOP_WRITE("BrDsply: Secure indic upd") + } + +// --------------------------------------------------------- +// CBrowserDisplay::AddTransActIdL() +// --------------------------------------------------------- +// +void CBrowserDisplay::AddTransActIdL( TUint16 aId ) const + { + iProgressIndicator->AddTransActIdL( aId ); + } + +// --------------------------------------------------------- +// CBrowserDisplay::AddProgressDataL() +// --------------------------------------------------------- +// +void CBrowserDisplay::AddProgressDataL( + TUint16 aId, TUint32 aRecvdData, TUint32 aMaxData ) const + { + iProgressIndicator->AddProgressDataL( aId, aRecvdData, aMaxData ); + } + +// --------------------------------------------------------- +// CBrowserDisplay::TransActIdComplete() +// --------------------------------------------------------- +// +void CBrowserDisplay::TransActIdComplete( TUint16 aId ) const + { + TRAP_IGNORE( iProgressIndicator->TransActIdCompleteL( aId ) ); + } + +// --------------------------------------------------------- +// CBrowserDisplay::StartFSWaitIndicator() +// --------------------------------------------------------- +// +void CBrowserDisplay::StartFSWaitIndicator() + { + if( iEditorIndicatorContainer != NULL && + iWindow->IsWindowActive() ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + } + } + +// --------------------------------------------------------- +// CBrowserDisplay::UpdateFSProgressIndicator() +// --------------------------------------------------------- +// +void CBrowserDisplay::UpdateFSProgressIndicator( const TInt aMaxData, + const TInt aReceivedData ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START +LOG_ENTERFN("UpdateFSProgressIndicator"); +BROWSER_LOG( ( _L( "maxData: %d, recData: %d" ), aMaxData, aReceivedData ) ); + if ( iApiProvider.IsProgressShown() && + ( iEditorIndicatorContainer != NULL ) && + iWindow->IsWindowActive() ) + { + CAknIndicatorContainer* indicContainerEditing = SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + if( indicContainerEditing->IndicatorState( + TUid::Uid( EAknNaviPaneEditorIndicatorProgressBar ) ) + != EAknIndicatorStateOn || + indicContainerOwn->IndicatorState( + TUid::Uid( EAknNaviPaneEditorIndicatorProgressBar ) ) + != EAknIndicatorStateOn + ) + { + _IND_STATE( ProgressBar ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC2( ProgressBar, ETrue ); + indicContainerOwn->_SET_INDIC2( ProgressBar, ETrue ); + } + + indicContainerEditing->SetIndicatorValue( + TUid::Uid( EAknNaviPaneEditorIndicatorProgressBar ), + aReceivedData, aMaxData ); + indicContainerOwn->SetIndicatorValue( + TUid::Uid( EAknNaviPaneEditorIndicatorProgressBar ), + aReceivedData, aMaxData ); + } +PERFLOG_STOP_WRITE("BrDsply: Prg indic upd") + } + +// --------------------------------------------------------- +// CBrowserDisplay::UpdateFSProgressDataL() +// --------------------------------------------------------- +// +void CBrowserDisplay::UpdateFSProgressDataL( const TDesC16& aReceivedDataText ) + { + PERFLOG_LOCAL_INIT + PERFLOG_STOPWATCH_START + if ( iApiProvider.IsProgressShown() &&( iEditorIndicatorContainer != NULL ) ) + { + CAknIndicatorContainer* indicContainerEditing = + SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + if( indicContainerEditing->IndicatorState( + TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo ) ) + != EAknIndicatorStateOff ) + { + ClearMessageInfo(); + } + + if( indicContainerEditing->IndicatorState( + TUid::Uid( EAknNaviPaneEditorIndicatorFileSize ) ) + != EAknIndicatorStateOn || + indicContainerOwn->IndicatorState( + TUid::Uid( EAknNaviPaneEditorIndicatorFileSize ) ) + != EAknIndicatorStateOn ) + { + _IND_STATE( FileSize ) = EAknIndicatorStateOn; + indicContainerEditing->_SET_INDIC( FileSize ); + indicContainerOwn->_SET_INDIC( FileSize ); + } + + indicContainerEditing->SetIndicatorValueL( + TUid::Uid( _AKN_IND( FileSize ) ), aReceivedDataText ); + indicContainerOwn->SetIndicatorValueL( + TUid::Uid( _AKN_IND( FileSize ) ), aReceivedDataText ); + + NaviPaneL()->PushL( *iEditorIndicatorContainer ); + } + PERFLOG_STOP_WRITE("BrDsply: Prg data upd") + } + + +// --------------------------------------------------------- +// CBrowserDisplay::FSPaneOnL() +// --------------------------------------------------------- +// +void CBrowserDisplay::FSPaneOnL() + { + InitIndicatorsL(); + NaviPaneL()->PushL(*iEditorIndicatorContainer); + } + +// --------------------------------------------------------- +// CBrowserDisplay::NotifyProgress() +// --------------------------------------------------------- +// +void CBrowserDisplay::NotifyProgress() + { + if ( iProgressIndicator != NULL && iWindow->IsWindowActive() ) + { + iProgressIndicator->NotifyProgress(); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserDisplay::UpdateMultipleWindowsIndicatorL() +// ---------------------------------------------------------------------------- +// +void CBrowserDisplay::UpdateMultipleWindowsIndicatorL( + TBool aState, TInt aWinCount ) + { + LOG_ENTERFN("CBrowserDisplay::UpdateMultipleWindowsIndicatorL"); + + if ( iEditorIndicatorContainer != NULL ) + { + CAknIndicatorContainer* indicContainerEditing = + SelectIndicContainerEditing(); + CAknIndicatorContainer* indicContainerOwn = SelectIndicContainerOwn(); + + // Show or hide MW Icon + _IND_STATE( WmlWindows ) = aState ? + EAknIndicatorStateOn : EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( WmlWindows ); + indicContainerOwn->_SET_INDIC( WmlWindows ); + + // Show or hide text indicator + _IND_STATE( WmlWindowsText ) = aState ? + EAknIndicatorStateOn : EAknIndicatorStateOff; + indicContainerEditing->_SET_INDIC( WmlWindowsText ); + indicContainerOwn->_SET_INDIC( WmlWindowsText ); + + if ( aState ) + { + // MW Indicator is made of an indicator icon and a number (num wins) + + // Display Number of windows open in text indicator + HBufC* numWins = HBufC::NewLC( 3 ); + numWins->Des().AppendNum( aWinCount ); + numWins->Des().Append( KBrowserSpaceChar ); + indicContainerEditing->SetIndicatorValueL( + TUid::Uid( _AKN_IND( WmlWindowsText ) ), *numWins ); + indicContainerOwn->SetIndicatorValueL( + TUid::Uid( _AKN_IND( WmlWindowsText ) ), *numWins ); + CleanupStack::PopAndDestroy( numWins ); + } + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserDownloadIndicatorTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserDownloadIndicatorTimer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Timer for showing initial download animation in Full Screen Pane of the browser. +* +*/ + + +// INCLUDES +#include +#include +#include "BrowserDownloadIndicatorTimer.h" +#include "BrowserDownloadIndicatorTimerEvent.h" + + +// --------------------------------------------------------------------------------------- +// Default C++ constructor +// --------------------------------------------------------------------------------------- +// +CBrowserDownloadIndicatorTimer::CBrowserDownloadIndicatorTimer() + : CTimer(EPriorityNormal) + { + } + +// --------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::~CBrowserDownloadIndicatorTimer() +// --------------------------------------------------------------------------- +CBrowserDownloadIndicatorTimer::~CBrowserDownloadIndicatorTimer() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::ConstructL() +// --------------------------------------------------------------------------- +void CBrowserDownloadIndicatorTimer::ConstructL( + MBrowserDownloadIndicatorTimerEvent& aProgressIndicator ) + { + iProgressIndicator = &aProgressIndicator; + + CTimer::ConstructL(); + CActiveScheduler::Add( this ); + } + +//----------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::NewLC() +//----------------------------------------------------------------------------- +// +CBrowserDownloadIndicatorTimer* CBrowserDownloadIndicatorTimer::NewLC( + MBrowserDownloadIndicatorTimerEvent& aProgressIndicator ) + { + CBrowserDownloadIndicatorTimer* self = + new (ELeave) CBrowserDownloadIndicatorTimer; + CleanupStack::PushL(self); + self->ConstructL(aProgressIndicator); + return self; + } + +//----------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::NewL() +//----------------------------------------------------------------------------- +// +CBrowserDownloadIndicatorTimer* CBrowserDownloadIndicatorTimer::NewL( + MBrowserDownloadIndicatorTimerEvent& aProgressIndicator) + { + CBrowserDownloadIndicatorTimer* self = + CBrowserDownloadIndicatorTimer::NewLC( aProgressIndicator ); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::RunL() +// ---------------------------------------------------------------------------- +void CBrowserDownloadIndicatorTimer::RunL() + { + if (iStatus == KErrNone) + { + iProgressIndicator->SetBrowserDownloadIndicatorStateOff(); + } + } + + +// ---------------------------------------------------------------------------- +// CBrowserDownloadIndicatorTimer::Start() +// ---------------------------------------------------------------------------- +void CBrowserDownloadIndicatorTimer::Start(TTimeIntervalMicroSeconds32 aPeriod) + { + CTimer::After( aPeriod ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserDownloadUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserDownloadUtil.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Download handling utilities. +* +*/ + + +// INCLUDE FILES + +#include "BrowserDownloadUtil.h" +#include "logger.h" +#include "ApiProvider.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CAsyncDownloadsListExecuter::CAsyncDownloadsListExecuter +// --------------------------------------------------------- +// +CAsyncDownloadsListExecuter::CAsyncDownloadsListExecuter( MApiProvider& aApiProvider ) +: CActive( EPriorityStandard ), + iApiProvider( aApiProvider ) + { +LOG_ENTERFN("CAsyncDownloadsListExecuter::CAsyncDownloadsListExecuter"); + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CAsyncDownloadsListExecuter::~CAsyncDownloadsListExecuter +// --------------------------------------------------------- +// +CAsyncDownloadsListExecuter::~CAsyncDownloadsListExecuter() + { +LOG_ENTERFN("CAsyncDownloadsListExecuter::~CAsyncDownloadsListExecuter"); + Cancel(); + } + +// --------------------------------------------------------- +// CAsyncDownloadsListExecuter::Start +// --------------------------------------------------------- +// +void CAsyncDownloadsListExecuter::Start() + { +LOG_ENTERFN("CAsyncDownloadsListExecuter::Start"); + if ( !IsActive() ) + { + BROWSER_LOG( ( _L( " Already active" ) ) ); + SetActive(); + TRequestStatus* s = &iStatus; + User::RequestComplete( s, KErrNone ); + } + } + +// --------------------------------------------------------- +// CAsyncDownloadsListExecuter::DoCancel +// --------------------------------------------------------- +// +void CAsyncDownloadsListExecuter::DoCancel() + { +LOG_ENTERFN("CAsyncDownloadsListExecuter::DoCancel"); + } + +// --------------------------------------------------------- +// CAsyncDownloadsListExecuter::RunL +// --------------------------------------------------------- +// +void CAsyncDownloadsListExecuter::RunL() + { +LOG_ENTERFN("CAsyncDownloadsListExecuter::RunL"); + // open the downloads list + iApiProvider.BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowDownloads + + (TInt)TBrCtlDefs::ECommandIdBase ); + // The list of downloads is now closed. + } + +// --------------------------------------------------------- +// CAsyncDownloadsListExecuter::RunError +// --------------------------------------------------------- +// +#ifdef I__BROWSER_LOG_ENABLED +TInt CAsyncDownloadsListExecuter::RunError( TInt aError ) + { +LOG_ENTERFN("CAsyncDownloadsListExecuter::RunError"); + BROWSER_LOG( ( _L( " aError: %d" ), aError ) ); + return 0; + } +#else +TInt CAsyncDownloadsListExecuter::RunError( TInt /*aError*/ ) + { + return 0; + } +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserGotoPane.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserGotoPane.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1394 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "CommonConstants.h" +#include "BrowserGotoPane.h" +#include "BrowserAppUi.h" +#include "BrowserUtil.h" +#include "browser.hrh" +#include +#include "BrowserAdaptiveListPopup.h" +#include "BrowserContentView.h" + +#include "eikon.hrh" + +#include + +const TInt KMaxTitleLength = 512; + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::NewL +// --------------------------------------------------------------------------- +// +CBrowserGotoPane* CBrowserGotoPane::NewL( + const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, + TBool aPopupListStatus, CBrowserContentView* aContentView, + TBool aFindKeywordMode ) + { + CBrowserGotoPane* gotoPane = new(ELeave) + CBrowserGotoPane( aContentView, aFindKeywordMode ); + + CleanupStack::PushL( gotoPane ); + gotoPane->ConstructL( aParent, aIconBitmapId, aIconMaskId, aPopupListStatus ); + gotoPane->MakeVisibleL( EFalse ); + gotoPane->SetFocus( EFalse ); + CleanupStack::Pop(); // gotoPane + + return gotoPane; + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::MakeVisibleL +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::MakeVisibleL( TBool aVisible ) + { + if ( aVisible ) + { + if ( iSearchEditor ) + { + ConstructSearchPaneL(); + } + HandleFindSizeChanged(); + if ( AUTOCOMP ) //ask the feature manager + { + //2.1 does not put http:// there + SetTextL( KNullDesC ); + } + else + { + //2.0 does put the http:// there + SetTextL( KHttpString ); + } + } + else + { + // Clear the search text if goto is cancelled ( hidden ). + if ( iSearchEditor ) + { + SetSearchTextL( KNullDesC ); + } + } + + SetPointerCapture(aVisible); + if (AknLayoutUtils::PenEnabled() && ( !iSearchEditor ) ) + { + if (aVisible) + { + ActivateVKB(); + } + } + + CCoeControl::MakeVisible( aVisible ); + + iGotoKeyHandled->Reset(); + iGotoKeyHandled->EnableL( aVisible ); + + + if ( iSearchEditor ) + { + SetTextModeItalicL(); + } + // To avoid Flickring Effect when SearchInputFrame is + // re-created with new search provider icon. + DrawNow( ); + + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::MakeVisible +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::MakeVisible( TBool aVisible ) + { + TRAP_IGNORE( MakeVisibleL( aVisible ) ); + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::~CBrowserGotoPane +// --------------------------------------------------------------------------- +// +CBrowserGotoPane::~CBrowserGotoPane() + { + if (iAvkonAppUi!=NULL) + { + iAvkonAppUi->RemoveFromStack( iGotoKeyHandled ); + } + delete iSearchEditor; + delete iSearchInputFrame; + + delete iGotoKeyHandled; + delete iEditor; + delete iInputFrame; + delete iPrevKeyword; + delete iBAdaptiveListPopup; + delete iDefaultSearchText; + iContentView = NULL; + CCoeEnv::Static()->RemoveFepObserver(static_cast(*this)); + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::CBrowserGotoPane +// --------------------------------------------------------------------------- +// +CBrowserGotoPane::CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode ) +: iContentView( aContentView), + iFindKeywordMode( aFindKeywordMode ), + iHandleFEPFind( ETrue ), + iBAdaptiveListPopup( NULL ), + iGotoPaneActive( ETrue ), + iSearchPaneActive( EFalse), + iSearchIconId( 0 ) + { + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::ConstructL +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::ConstructL ( const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, + TBool + aPopupListStatus + ) + { + CreateWindowL(); + + // remove 'const' modifier and set parent control + SetMopParent( CONST_CAST( CCoeControl*, aParent ) ); + + iEditor = new (ELeave) CEikGlobalTextEditor; + + iInputFrame = CAknInputFrame::NewL( + iEditor, + EFalse, + KAvkonBitmapFile, + aIconBitmapId, + aIconMaskId, + CAknInputFrame::EPopupLayout ); + + iInputFrame->SetContainerWindowL( *this ); + + AknEditUtils::ConstructEditingL ( iEditor, + KFavouritesMaxUrlGotoPaneDefine, + 1, + EAknEditorCharactersLowerCase, + EAknEditorAlignRight, + EFalse, + ETrue, + EFalse ); + + iEditor->SetContainerWindowL( *this ); + iEditor->SetObserver( this ); + iEditor->SetBorder( TGulBorder::ENone ); + iEditor->SetAknEditorCase( EAknEditorLowerCase ); + iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); + + if (AVKONAPAC) + { + // Disallow chinese input. + iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | + EAknEditorNumericInputMode ); + } + TInt editorFlags = ((iFindKeywordMode) ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) |EAknEditorFlagUseSCTNumericCharmap; + + // Always disable T9 input for goto url + editorFlags = (editorFlags | EAknEditorFlagNoT9); + + iEditor->SetAknEditorFlags( editorFlags ); + + iEditor->SetAknEditorPermittedCaseModes ( EAknEditorUpperCase | + EAknEditorLowerCase ); + + iGotoKeyHandled = new (ELeave) CBrowserKeyEventHandled( *this ); + iAvkonAppUi->AddToStackL( iGotoKeyHandled, + ECoeStackPriorityFep + 1, + ECoeStackFlagRefusesFocus ); + iEditor->SetEdwinObserver( iGotoKeyHandled ); + iEditor->SetSkinBackgroundControlContextL(NULL); + + TBool searchFeature = iContentView->ApiProvider().Preferences().SearchFeature(); + if ( searchFeature && !iFindKeywordMode ) + { + iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH ); + ConstructSearchPaneL(); + } + + //adaptive popuplist + if ( aPopupListStatus && AUTOCOMP ) + { + iBAdaptiveListPopup = + new (ELeave) CBrowserAdaptiveListPopup( iEditor, this, EGotoPane, searchFeature ); + iBAdaptiveListPopup->ConstructL(); + iEditor->SetObserver( iBAdaptiveListPopup ); + if (iContentView) + { + iBAdaptiveListPopup->SetUrlSuffixList(iContentView->ApiProvider().Preferences().URLSuffixList()); + iBAdaptiveListPopup->SetMaxRecentUrls(iContentView->ApiProvider().Preferences().MaxRecentUrls()); + } + } + + CCoeEnv::Static()->AddFepObserverL(static_cast(*this)); + iPrevKeyword = KNullDesC().AllocL(); + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::SetOrdinalPosition +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::SetOrdinalPosition( TInt aPos ) + { + Window().SetOrdinalPosition( aPos ); + if ( iBAdaptiveListPopup ) + { + iBAdaptiveListPopup->SetOrdinalPosition( aPos ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::HandleFindSizeChanged +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::HandleFindSizeChanged() + { + + if ( iSearchEditor && !iFindKeywordMode) + { + TRect clientRect = CBrowserAppUi::Static()->ClientRect(); + TAknWindowLineLayout findWindow = AknLayout::popup_find_window(); + + TRect findWindowRect = AknLayoutUtils::RectFromCoords( clientRect,findWindow.il, findWindow.it, + findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH); + + // Now Increase the height of rect to make room for two editors (Goto + search)// + findWindowRect.iTl.iY -= ( findWindow.iH ); + SetRect( findWindowRect ); + } + + else if ( !AknLayoutUtils::PenEnabled() ) + { + + TRect parentrect = iAvkonAppUi->ApplicationRect(); + + TAknLayoutRect lrect; + lrect.LayoutRect( parentrect, + AknLayout::main_pane( CBrowserAppUi::Static()->ApplicationRect(), 0, 1, 1 ) + ); + AknLayoutUtils::LayoutControl ( this, + lrect.Rect(), + AknLayout::popup_find_window() ); + } + else if( AknLayoutUtils::PenEnabled() ) + { + // The ClientRect() will be the application rectangle minus any + // toolbars/menu bars etc. + AknLayoutUtils::LayoutControl ( this, + CBrowserAppUi::Static()->ClientRect(), + AknLayout::popup_find_window() ); + } + + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::EnableKeyEventHandler +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::EnableKeyEventHandlerL( TBool aEnable ) + { + iGotoKeyHandled->EnableL( aEnable ); + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::HandleControlEventL +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::HandleControlEventL ( CCoeControl* /*aControl*/, + TCoeEvent aEventType ) + { + if ( iFindKeywordMode ) + { + if ( iEditor->AknEditorCurrentInputMode() == EAknEditorCalculatorNumberModeKeymap + // When the user copies and paste's content to the find dialog, the editor + // is in Text Input mode, The engine should still get the find keyword request + || iEditor->AknEditorCurrentInputMode() == EAknEditorTextInputMode + // Also Chinese and Japanese input modes should apply here + || iEditor->AknEditorCurrentInputMode() == EAknEditorFullWidthKatakanaInputMode + || iEditor->AknEditorCurrentInputMode() == EAknEditorHiraganaInputMode + ) + { + if ( aEventType == MCoeControlObserver::EEventStateChanged ) + { + HBufC* newText = GetTextL(); + if (!newText) + { + newText = KNullDesC().AllocL(); + } + + if ( iPrevKeyword->Compare( *newText ) ) + { + delete iPrevKeyword; + iPrevKeyword = NULL; + iPrevKeyword = newText; + // Find the typed keyword. + iContentView->FindKeywordL( GetTextL() ); + iHandleFEPFind = EFalse; + } + else + { + delete newText; + } + } + } + } + + switch (aEventType) + { + case EEventRequestFocus: + { + FocusChanged( EDrawNow ); + break; + } + + default: + break; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::OfferKeyEventL +// ---------------------------------------------------------------------------- +// +TKeyResponse CBrowserGotoPane::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse resp = EKeyWasNotConsumed; + + if ( AknLayoutUtils::PenEnabled() + && PopupList() + && PopupList()->DrawableWindow()->OrdinalPosition() > 0 ) + { + PopupList()->SetOrdinalPosition(0); + } + + if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) // Escape key event handling + { + CCoeEnv::Static()->AppUi()->RemoveFromStack( this ); + if ( PopupList() ) + { + PopupList()->SetDirectoryModeL( ETrue ); + PopupList()->HidePopupL(); + } + MakeVisible( EFalse ); // Hide Goto pane + SetFocus( EFalse ); + resp = EKeyWasConsumed; // should set the focus of container to ETrue...how? + } + + if ( iFindKeywordMode ) + { + if ( iContentView->MenuBar()->MenuPane()->IsVisible() ) + { + return iContentView->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType ); + } + else + { + if ( aType == EEventKey ) // Handle up and down arow keys to search for + { // next and previous keywords. + + if ( aKeyEvent.iCode == EKeyLeftUpArrow // Northwest + || aKeyEvent.iCode == EStdKeyDevice10 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyUpArrow // North + || aKeyEvent.iCode == EKeyRightUpArrow // Northeast + || aKeyEvent.iCode == EStdKeyDevice11 ) // : Extra KeyEvent supports diagonal event simulator wedge + { // Any of those? If so, then... + iContentView->FindKeywordL( NULL, EFalse ); // Find previous keyword + iHandleFEPFind = EFalse; // : + return EKeyWasConsumed; // And that consumes the key + } + + if ( aKeyEvent.iCode == EKeyLeftDownArrow // Southwest + || aKeyEvent.iCode == EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyDownArrow // South + || aKeyEvent.iCode == EKeyRightDownArrow // Southeast + || aKeyEvent.iCode == EStdKeyDevice12 ) // : Extra KeyEvent supports diagonal event simulator wedge + { // Any of those? If so, then... + iContentView->FindKeywordL( NULL, ETrue ); // Find next keyword + iHandleFEPFind = EFalse; // : + return EKeyWasConsumed; // And that consumes the key + } + + if ( aKeyEvent.iCode == EKeyDevice3 ) // Select key? + { // If so, then... + return EKeyWasConsumed; // Ignore select key + } + + } + return iEditor->OfferKeyEventL( aKeyEvent, aType ); // Otherwise, just pass the key on to the editor + } + } + + else // *NOT* iFindKeywordMode + { + + if ( aKeyEvent.iCode == EKeyRightUpArrow // Northeast + || aKeyEvent.iCode == EStdKeyDevice11 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyRightDownArrow // Southeast + || aKeyEvent.iCode == EStdKeyDevice12 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyLeftDownArrow // Southwest + || aKeyEvent.iCode == EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyLeftUpArrow // Northwest + || aKeyEvent.iCode == EStdKeyDevice10 ) // : Extra KeyEvent supports diagonal event simulator wedge + { // Any of those? If so, then... + return EKeyWasConsumed; // Ignore diagonal navigation events here + } + + // For touch UI, handle enter key from VKB as a "GOTO" + if (AknLayoutUtils::PenEnabled() && aKeyEvent.iCode == EKeyEnter) + { + CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo); + return EKeyWasConsumed; + } + else if ( ((aKeyEvent.iCode == EKeyOK ) || (aKeyEvent.iCode == EKeyEnter)) + && iGPObserver + && IsFocused() ) + { + if ( CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() ) + { + return CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType ); + } + else + { + // If there is an observer and we have the focus, enter key is + // consumed and observer is notified. + iGPObserver->HandleGotoPaneEventL + ( this, MGotoPaneObserver::EEventEnterKeyPressed ); + return EKeyWasConsumed; + } + } + + if ( iSearchEditor && iSearchPaneActive ) + { + resp = iSearchEditor->OfferKeyEventL( aKeyEvent, aType ); + } + else + { + resp = iEditor->OfferKeyEventL( aKeyEvent, aType ); + } + + if ((iBAdaptiveListPopup ) && (resp != EKeyWasConsumed)) + { + resp = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType ); + } + + + if ( iSearchEditor ) + { + if ( ( iGotoPaneActive || iSearchPaneActive) + && (resp != EKeyWasConsumed) ) + { + + if ( aKeyEvent.iCode == EKeyUpArrow ) + { + resp = EKeyWasConsumed; + if ( iSearchPaneActive ) + { + SetGotoPaneActiveL(); + +#if defined(BRDO_SEARCH_INTEGRATION_FF) + iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); +#endif + + } + } + if ( aKeyEvent.iCode == EKeyDownArrow ) + { + resp = EKeyWasConsumed; + if ( iGotoPaneActive ) + { + SetSearchPaneActiveL(); + +#if defined(BRDO_SEARCH_INTEGRATION_FF) + iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); +#endif + + } + } + } + } + + } + + return resp; + + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::HandlePointerEventL +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + if ( !AknLayoutUtils::PenEnabled() ) + { + return; + } + + // ponter is in goto pane + if (Rect().Contains(aPointerEvent.iPosition)) + { + iGotoKeyHandled->EnableL(ETrue); + + // If search feature exists, check and route to appropriate editor // + if ( iSearchEditor ) + { + if ( iSearchInputFrame->Rect().Contains(aPointerEvent.iPosition)) + { + if ( !iSearchPaneActive ) + { + SetSearchPaneActiveL(); + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + else + { +#endif + iSearchEditor->HandlePointerEventL(aPointerEvent); +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + } +#endif + +#if defined(BRDO_SEARCH_INTEGRATION_FF) + iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB); +#endif + } + else + { + if ( !iGotoPaneActive ) + { + SetGotoPaneActiveL(); + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + else + { +#endif + iEditor->HandlePointerEventL(aPointerEvent); +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + } +#endif + +#if defined(BRDO_SEARCH_INTEGRATION_FF) + iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB); +#endif + } + } + else + { + iEditor->HandlePointerEventL(aPointerEvent); + } + iGotoKeyHandled->SetFirstKeyEvent(EFalse); + } + else + { + // pointer outside of control + if ( iFindKeywordMode ) + { + CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdFindKeywordPaneClose); + ResetPrevText(); + } + else + { + CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneCancel); + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::CountComponentControls +// ---------------------------------------------------------------------------- +// +TInt CBrowserGotoPane::CountComponentControls() const + { + if ( iSearchEditor && !iFindKeywordMode ) + { + return 4; // iEditor, input frame, SearchEditor and Searchinput frame. + } + return 2; // iEditor and input frame + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::ComponentControl +// ---------------------------------------------------------------------------- +// +CCoeControl* CBrowserGotoPane::ComponentControl ( TInt aIndex ) const + { + switch(aIndex) + { + case 0: + { + return iInputFrame; + } + case 1: + { + return iEditor; + } + case 2: + { + return iSearchInputFrame; + } + case 3: + { + return iSearchEditor; + } + + default: + return NULL; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SizeChanged +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::SizeChanged() + { + if (iSearchEditor && !iFindKeywordMode ) + { + // We need height and width of FindWindow + TAknWindowLineLayout findWindow = AknLayout::popup_find_window(); + TRect findWindowRect = AknLayoutUtils::RectFromCoords( Rect(), findWindow.il, + findWindow.it, findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH); + + TSize gotoSize( findWindowRect.Size() ); + TRect gotoRect( TPoint( 0,0 ), gotoSize ); + iInputFrame->SetRect( gotoRect ); + + // Now set SearchPane right below GoTo pane // + TRect searchRect( TPoint( 0, gotoRect.iBr.iY ), gotoSize ); + iSearchInputFrame->SetRect( searchRect ); + } + else + { + iInputFrame->SetRect( Rect() ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::FocusChanged +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::FocusChanged( TDrawNow aDrawNow ) + { + // this is a workaround + TRAP_IGNORE( iGotoKeyHandled->EnableL( IsFocused() ) ); + CCoeControl::FocusChanged( aDrawNow ); + if ( iGotoPaneActive ) + { + iEditor->SetFocus( IsFocused() ); + } + else if ( iSearchEditor && !iFindKeywordMode && iSearchPaneActive ) + { + iSearchEditor->SetFocus( IsFocused() ); + } + } + + + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::TextLength +// ---------------------------------------------------------------------------- +// +TInt CBrowserGotoPane::SearchTextLength() const + { + TInt len = 0; + if ( iSearchEditor ) + { + len = iSearchEditor->TextLength(); + } + return len; + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::TextLength +// ---------------------------------------------------------------------------- +// +TInt CBrowserGotoPane::TextLength() const + { + return iEditor->TextLength(); + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::GetText +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserGotoPane::GetTextL() const + { + HBufC *retVal = NULL; + + if ( TextLength() + || SearchTextLength() + || iFindKeywordMode) + { + if ( iSearchEditor && iSearchPaneActive ) + { + retVal = HBufC::NewL( SearchTextLength() + 1 ); + } + else + { + retVal = HBufC::NewL( TextLength() + 1 ); + } + TPtr ptr = retVal->Des(); + if ( iSearchEditor && iSearchPaneActive ) + { + iSearchEditor->GetText( ptr ); + } + else + { + iEditor->GetText( ptr ); + } + ptr.ZeroTerminate(); + if ( !iFindKeywordMode && !iSearchPaneActive ) + { + Util::EncodeSpaces(retVal); + } + } + + return retVal; + } + + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SetSearchTextL +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::SetSearchTextL( const TDesC& aTxt ) + { + // for search pane, no default text + if ( aTxt == KHttpString || aTxt == KWWWString) + { + iSearchEditor->SetTextL( &KNullDesC ); + } + else + { + iSearchEditor->SetTextL( &aTxt ); + } + TInt curPos = SearchTextLength(); + // Cursor to end, no selection. + iSearchEditor->SetSelectionL( curPos, curPos ); + iSearchEditor->DrawNow(); + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SetTextL +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::SetTextL( const TDesC& aTxt ) + { + iEditor->SetTextL( &aTxt ); + TInt curPos = TextLength(); + // Cursor to end, no selection. + iEditor->SetSelectionL( curPos, curPos ); + iEditor->DrawNow(); + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SelectAllL +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::SelectAllL() + { + if ( iSearchEditor && iSearchPaneActive ) + { + iSearchEditor->SelectAllL(); + } + else + { + iEditor->SelectAllL(); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SetInfoTextL +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::SetInfoTextL( const TDesC& aText ) + { + iInputFrame->SetInfoTextL( aText ); + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::ClipboardL +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc ) + { + iEditor->ClipboardL( aClipboardFunc ); + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::Editor +// ---------------------------------------------------------------------------- +CEikEdwin* CBrowserGotoPane::Editor() const + { + return iEditor; + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SetGPObserver +// ---------------------------------------------------------------------------- +// +void CBrowserGotoPane::SetGPObserver( MGotoPaneObserver* aObserver ) + { + __ASSERT_DEBUG( !iGPObserver, \ + Util::Panic( Util::EGotoPaneObserverAlreadySet ) ); + iGPObserver = aObserver; + } + +// ---------------------------------------------------------------------------- +// CBrowserKeyEventHandled::CBrowserKeyEventHandled +// ---------------------------------------------------------------------------- +// +CBrowserKeyEventHandled::CBrowserKeyEventHandled( + CBrowserGotoPane& aGotoPane ) : + iEnabled( EFalse ) + ,iFirstKeyEvent( ETrue ) + ,iLeftRightEvent ( EFalse ) + ,iGotoPane( aGotoPane ) + { + } + + +// ---------------------------------------------------------------------------- +// CBrowserKeyEventHandled::OfferKeyEventL +// ---------------------------------------------------------------------------- +// +TKeyResponse + CBrowserKeyEventHandled::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType) + { + TKeyResponse response( EKeyWasNotConsumed ); + iLeftRightEvent = EFalse; + + if ( iEnabled && aType == EEventKey ) + { + switch( aKeyEvent.iCode ) + { + case EKeyUpArrow: + case EKeyDownArrow: + { + iFirstKeyEvent = EFalse; + break; + } + + case EKeyLeftArrow: + case EKeyRightArrow: + { + iFirstKeyEvent = EFalse; + iLeftRightEvent = ETrue; + + // Below added to compensate for a weird key event situation: + // For some reason the CBrowserGotoPane::OfferKeyEventL function + // is not being called for an EEventKey when you press the left/right + // arrows in the menupane produced to paste previously used special + // chars (this is brought up by pressing the pen button on the phone). + // This only happens when the cursor is in the first or last position in + // the goto pane with text in it. + // Therefore, in this particular scenario, we need to process the EEventKey + // here since we will not be able to in CBrowserGotoPane::OfferKeyEventL + if (CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsFocused()) + { + response = CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType ); + } + break; + } + + case EKeyBackspace: + case EKeyDelete: + { + if ( iFirstKeyEvent ) + { + iFirstKeyEvent = EFalse; + iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); + response = EKeyWasConsumed; + } + break; + } + + default: + { + if ( iFirstKeyEvent ) + { + if ( TChar( aKeyEvent.iCode ).IsPrint() ) + { + iFirstKeyEvent = EFalse; + response = EKeyWasConsumed; + iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); + } + } + break; + } + } +// CBrowserAppUi::Static()->UpdateCbaL(); + } + return response; + } + +// ---------------------------------------------------------------------------- +// CBrowserKeyEventHandled::HandleEdwinEventL +// ---------------------------------------------------------------------------- +// +void CBrowserKeyEventHandled::HandleEdwinEventL( CEikEdwin* /*aEdwin*/, + TEdwinEvent aEventType ) + { + // if text changed in the editor we don't have to handle clear key anymore + if ( aEventType == EEventTextUpdate ) + { + iFirstKeyEvent = EFalse; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserKeyEventHandled::EnableL +// ---------------------------------------------------------------------------- +// +void CBrowserKeyEventHandled::EnableL( TBool aEnable ) + { + iEnabled = aEnable; + } + +// ---------------------------------------------------------------------------- +// CBrowserKeyEventHandled::Reset +// ---------------------------------------------------------------------------- +// +void CBrowserKeyEventHandled::Reset() + { + iFirstKeyEvent = ETrue; + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::PopupList +// --------------------------------------------------------------------------- +// +CBrowserAdaptiveListPopup* CBrowserGotoPane::PopupList() + { + return iBAdaptiveListPopup; + } +// --------------------------------------------------------------------------- +// CBrowserGotoPane::HandleResourceChange +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::HandleResourceChange( + TInt + aType + ) + { + CCoeControl::HandleResourceChange( aType ); + + if ( iBAdaptiveListPopup ) + { + iBAdaptiveListPopup->HandleResourceChange( aType ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::HandleStartOfTransactionL() +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::HandleStartOfTransactionL() + { + } + +// --------------------------------------------------------------------------- +// CBrowserGotoPane::HandleCompletionOfTransactionL() +// --------------------------------------------------------------------------- +// +void CBrowserGotoPane::HandleCompletionOfTransactionL() + { + if ( iContentView && iFindKeywordMode && this->IsVisible() && + !iContentView->MenuBar()->MenuPane()->IsVisible() ) + { + if ( GetTextL() ) + { + // Find the typed keyword. + if ( iHandleFEPFind && iPrevKeyword->Compare(GetTextL()->Des()) ) + { + iContentView->FindKeywordL( GetTextL() ); + } + } + } + iHandleFEPFind = ETrue; + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::ActivateVKB +// ---------------------------------------------------------------------------- +void CBrowserGotoPane::ActivateVKB() + { + if ( ( iEditor && iEditor->TextView() ) + || ( iSearchEditor && iSearchEditor->TextView()) ) + { + // make sure observer is set + iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); + + // simulate pointer event to force VKB + + // first get point at cursor location + TInt pos = 0; + CTextView* textView = NULL; + if ( iSearchEditor && iSearchPaneActive ) + { + pos = iSearchEditor->CursorPos(); + textView = iSearchEditor->TextView(); + } + else + { + pos = iEditor->CursorPos(); + textView = iEditor->TextView(); + } + + TPoint curPos; + textView->DocPosToXyPosL(pos, curPos); + + TPointerEvent pe; + pe.iPosition = curPos; + + pe.iType = TPointerEvent::EButton1Down; + + TInt err(KErrNone); + if ( iSearchEditor && iSearchPaneActive ) + { + TRAP(err, iSearchEditor->HandlePointerEventL(pe)); + } + else + { + TRAP(err, iEditor->HandlePointerEventL(pe)); + } + + if (err != KErrNone) + { + return; + } + + pe.iType = TPointerEvent::EButton1Up; + + // VKB will only activate is nothing selected + if ( iSearchEditor && iSearchPaneActive ) + { + iSearchEditor->SetSelectionL(pos,pos); + TRAP_IGNORE(iSearchEditor->HandlePointerEventL(pe)); + } + else + { + iEditor->SetSelectionL(pos,pos); + TRAP_IGNORE(iEditor->HandlePointerEventL(pe)); + } +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + TRAP_IGNORE(SelectAllL()); +#endif + } + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::ConstructSearchPaneL +// ---------------------------------------------------------------------------- +void CBrowserGotoPane::ConstructSearchPaneL() + { + + TFileName iconFile; + TInt iconId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId ); + iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile ); + + // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane. + // Comparing Icon File path as well, because it may be possible that two different + // Icon files have same icon id. + if ( iconId != iSearchIconId + || iSearchIconFilePath.Compare( iconFile ) != 0 ) + { + + TInt iconMaskId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconMaskId ); + // Save IconId + iSearchIconId = iconId; + // Save Icon File + iSearchIconFilePath = iconFile; + + // No Icon file or IconId or IconMaskId set , then it means no search provider is still + // selected and set by search application, in that case we use the default icon for Search. + if ( ! iconFile.Length() + || iconId == -1 + || iconMaskId == -1 ) + { + iconId = EMbmAvkonQgn_indi_find_glass; + iconMaskId = EMbmAvkonQgn_indi_find_glass_mask; + iconFile = KAvkonBitmapFile; + } + + + if ( iSearchEditor ) + { + delete iSearchEditor; + iSearchEditor = NULL; + } + + if ( iSearchInputFrame ) + { + delete iSearchInputFrame; + iSearchInputFrame = NULL; + } + + + // iSearchEditor != NULL, implies presence of Search Feature, which can be + // used to validate search feature exsistence, avoiding unecessary feature + // check calls and need of separate variable. + iSearchEditor = new (ELeave) CEikGlobalTextEditor; + iSearchInputFrame = CAknInputFrame::NewL( + iSearchEditor, + EFalse, + iconFile, + iconId, + iconMaskId, + CAknInputFrame::EPopupLayout ); + + iSearchInputFrame->SetContainerWindowL( *this); + AknEditUtils::ConstructEditingL ( iSearchEditor, + KFavouritesMaxUrlGotoPaneDefine, + 1, + EAknEditorCharactersLowerCase, + EAknEditorAlignRight, + EFalse, + ETrue, + EFalse ); + + iSearchEditor->SetContainerWindowL( *this ); + iSearchEditor->SetObserver( this ); + iSearchEditor->SetBorder( TGulBorder::ENone ); + iSearchEditor->SetAknEditorCase( EAknEditorLowerCase ); + iSearchEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); + + if (AVKONAPAC) + { + // Disallow chinese input. + iSearchEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | + EAknEditorNumericInputMode ); + } + + //Search should use EAknEditorFlagDefault as search allows all types of input + iSearchEditor->SetAknEditorFlags + ( EAknEditorFlagDefault | EAknEditorFlagUseSCTNumericCharmap ); + + iSearchEditor->SetAknEditorPermittedCaseModes ( EAknEditorUpperCase | + EAknEditorLowerCase ); + + iSearchEditor->SetEdwinObserver( iGotoKeyHandled ); + iSearchEditor->SetSkinBackgroundControlContextL(NULL); + iSearchEditor->MakeVisible( ETrue ); + iSearchInputFrame->MakeVisible( ETrue ); + // Set the default text if not active// + if ( ! iSearchPaneActive ) + { + HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); + TPtr searchProviderPtr = searchProvider->Des(); + iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, + KMaxTitleLength , searchProviderPtr); + if( searchProvider->Length() == 0 ) + { + SetSearchTextL( *iDefaultSearchText ); + } + else + { + SetSearchTextL( *searchProvider ); + delete iDefaultSearchText; + iDefaultSearchText = NULL; + iDefaultSearchText = searchProvider->AllocL(); + } + CleanupStack::PopAndDestroy(searchProvider); + } + iSearchInputFrame->ActivateL(); + } + + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SetGotoPaneActive +// ---------------------------------------------------------------------------- +void CBrowserGotoPane::SetGotoPaneActiveL() + { + + iGotoPaneActive = ETrue; + iSearchPaneActive = EFalse; + + if ( iSearchEditor ) + { +#if defined(BRDO_SEARCH_INTEGRATION_FF) + iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); +#endif + // if searchpane is empty add default text + if ( !SearchTextLength() ) + { + HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); + TPtr searchProviderPtr = searchProvider->Des(); + iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, + KMaxTitleLength , searchProviderPtr); + if( searchProvider->Length() == 0 ) + { + SetSearchTextL( *iDefaultSearchText ); + } + else + { + SetSearchTextL( *searchProvider ); + } + CleanupStack::PopAndDestroy(searchProvider); + } + + // if gotopane is empty add default text + if ( !TextLength() ) + { + SetTextL( KWWWString ); + } + + iSearchEditor->SetFocus( EFalse); + } + + iEditor->SetFocus( ETrue ); + CBrowserAppUi::Static()->UpdateCbaL(); + SetTextModeItalicL(); + iEditor->SetCursorPosL(iEditor->TextLength(), EFalse); + DrawDeferred(); + } + +// ---------------------------------------------------------------------------- +// CBrowserGotoPane::SetSearchPaneActive +// ---------------------------------------------------------------------------- +void CBrowserGotoPane::SetSearchPaneActiveL() + { + + if ( iSearchEditor ) + { +#if defined(BRDO_SEARCH_INTEGRATION_FF) + iSearchEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); +#endif + // if gotopane is empty add default text + if ( !TextLength() ) + { + SetTextL( KWWWString ); + } + + // if searchpane has default text remove it + HBufC* text = iSearchEditor->GetTextInHBufL(); + if ( text ) + { + CleanupStack::PushL( text ); + if ( !text->Compare( iDefaultSearchText->Des() ) ) + { + SetSearchTextL( KNullDesC ); + } + + CleanupStack::PopAndDestroy( text ); + } + + iSearchPaneActive = ETrue; + iGotoPaneActive = EFalse; + iEditor->SetFocus( EFalse ); + if ( iBAdaptiveListPopup ) + iBAdaptiveListPopup->HidePopupL(); + iSearchEditor->SetFocus( ETrue ); + iSearchEditor->SetCursorPosL(iSearchEditor->TextLength(), EFalse); + CBrowserAppUi::Static()->UpdateCbaL(); + + SetTextModeItalicL(); + DrawDeferred(); + } + } + + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetTextModeItalic +// ---------------------------------------------------------------------------- +void CBrowserGotoPane::SetTextModeItalicL() + { + + // Editor Control is laid in a scalable way, so we need to get the correct font + // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips, + // as done above in SetTextL() but it does not provide correct fonts for editor. + // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it + // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by + // iInputFrame->SetRect(), which overwrites all the properties for Editor. + if ( iSearchEditor ) + { + TAknTextComponentLayout editorLayout; + TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) ); + editorLayout = AknLayoutScalable_Avkon::input_popup_find_pane_t1( apac ? 2 : 0 ); + TAknTextLineLayout lineLayout = editorLayout.LayoutLine(); + TInt fontid = lineLayout.FontId(); + const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid ); + + TCharFormat charFormat; + TCharFormatMask charFormatMask; + charFormat.iFontSpec = font->FontSpecInTwips(); + charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic ); + charFormatMask.SetAttrib(EAttFontTypeface); + charFormatMask.SetAttrib(EAttFontHeight); + charFormatMask.SetAttrib(EAttFontStrokeWeight); + charFormatMask.SetAttrib(EAttFontPosture); + + // Owner ship of charFormatLayer is taken by Editor + CCharFormatLayer* charFormatLayerItalics = NULL; + CCharFormatLayer* charFormatLayerUpright = NULL; + charFormatLayerItalics = CCharFormatLayer::NewL(charFormat,charFormatMask); + charFormat.iFontSpec.iFontStyle.SetPosture( EPostureUpright ); + charFormatLayerUpright = CCharFormatLayer::NewL(charFormat,charFormatMask); + if ( iSearchPaneActive ) + { + iSearchEditor->SetCharFormatLayer(charFormatLayerUpright); + iEditor->SetCharFormatLayer(charFormatLayerItalics); + } + else + { + iSearchEditor->SetCharFormatLayer(charFormatLayerItalics); + iEditor->SetCharFormatLayer(charFormatLayerUpright); + } + } + } + +void CBrowserGotoPane::ResetPrevText() + { + iPrevKeyword->Des().SetLength(0); + } + +// END OF FILE diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserInitialContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserInitialContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserInitialContainer. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include "BrowserInitialContainer.h" +#include "CommonConstants.h" +#include "BrowserInitialView.h" +#include "BrowserAppUi.h" +#include "BrowserUIVariant.hrh" +#include "Display.h" +#include "BrowserGotoPane.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserInitialContainer::CBrowserInitialContainer +// --------------------------------------------------------- +// +CBrowserInitialContainer::CBrowserInitialContainer( CBrowserInitialView *aView ) : iView( aView ) + { + // + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::ConstructL +// --------------------------------------------------------- +// +void CBrowserInitialContainer::ConstructL(const TRect& aRect) + { + CreateWindowL(); + + // Set view title + iView->ApiProvider().Display().SetTitleL( TitleResourceId() ); + + + // Create gotopane + iGotoPane = CBrowserGotoPane::NewL( this ); + + SetRect(aRect); + ActivateL(); + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::~CBrowserInitialContainer +// --------------------------------------------------------- +// +CBrowserInitialContainer::~CBrowserInitialContainer() + { + delete iGotoPane; + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::SizeChanged +// --------------------------------------------------------- +// +void CBrowserInitialContainer::SizeChanged() + { + + iGotoPane->HandleFindSizeChanged(); + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::CountComponentControls +// --------------------------------------------------------- +// +TInt CBrowserInitialContainer::CountComponentControls() const + { + return 1; // return number of controls inside this container + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::ComponentControl +// --------------------------------------------------------- +// +CCoeControl* CBrowserInitialContainer::ComponentControl( TInt aIndex ) const + { + switch ( aIndex ) + { + case 0: + return iGotoPane; + default: + return NULL; + } + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::Draw +// --------------------------------------------------------- +// +void CBrowserInitialContainer::Draw( const TRect& aRect ) const + { + CWindowGc& gc = SystemGc(); + + // example code... + gc.SetPenStyle( CGraphicsContext::ENullPen ); + gc.SetBrushColor( KRgbGray ); + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.DrawRect( aRect ); + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::HandleControlEventL +// --------------------------------------------------------- +// +void CBrowserInitialContainer::HandleControlEventL( CCoeControl* /*aControl*/, + TCoeEvent /*aEventType*/ ) + { + // control event handler code here + } + + + +// ---------------------------------------------------------------------------- +// CBrowserInitialContainer::OfferKeyEventL +// ---------------------------------------------------------------------------- +// +TKeyResponse CBrowserInitialContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + CBrowserAppUi* ui = CBrowserAppUi::Static(); + TKeyResponse result( EKeyWasNotConsumed ); + + if (ui->OfferApplicationSpecificKeyEventL(aKeyEvent, aType) == EKeyWasConsumed) + { + return EKeyWasConsumed; + } + + // If goto pane is visible, offer key events to it + if ( iGotoPane->IsVisible() ) + { + result = iGotoPane->OfferKeyEventL( aKeyEvent, aType ); + } + + return result; + } + +// --------------------------------------------------------- +// CBrowserInitialContainer::TitleResourceId +// --------------------------------------------------------- +// +TInt CBrowserInitialContainer::TitleResourceId() + { + return R_BROWSER_INITIAL_VIEW_TITLE; + } + +//--------------------------------------------------------------------------- +// CBrowserInitialContainer::ShutDownGotoURLEditorL +// --------------------------------------------------------------------------- +// +void CBrowserInitialContainer::ShutDownGotoURLEditorL() + { + iGotoPane->MakeVisible( EFalse ); + iGotoPane->SetFocus( EFalse ); + SetFocus( ETrue ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserInitialView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserInitialView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserInitialView. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include "BrowserInitialView.h" +#include "BrowserInitialContainer.h" +#include "BrowserBookmarksView.h" +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include "Browser.hrh" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------------------------- +// CBrowserInitialView::NewLC +// ---------------------------------------------------------------------------- +// +CBrowserInitialView* CBrowserInitialView::NewLC( MApiProvider& aApiProvider) + { + CBrowserInitialView* view = new (ELeave) CBrowserInitialView( aApiProvider ); + CleanupStack::PushL( view ); + view->ConstructL( ); + return view; + } + +// --------------------------------------------------------- +// CBrowserInitialView::ConstructL(const TRect& aRect) +// --------------------------------------------------------- +// +void CBrowserInitialView::ConstructL() + { + BaseConstructL( R_BROWSERINITIAL_VIEW ); + } + +// --------------------------------------------------------- +// CBrowserInitialView::CBrowserInitialView() +// --------------------------------------------------------- +// +CBrowserInitialView::CBrowserInitialView( MApiProvider& aApiProvider ): +CBrowserViewBase( aApiProvider ) + { + } + +// --------------------------------------------------------- +// CBrowserInitialView::~CBrowserInitialView() +// destructor +// --------------------------------------------------------- +// +CBrowserInitialView::~CBrowserInitialView() + { + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + delete iEnteredURL; + } + +// --------------------------------------------------------- +// TUid CBrowserInitialView::Id() +// --------------------------------------------------------- +// +TUid CBrowserInitialView::Id() const + { + return KUidBrowserInitialViewId; + } + +// --------------------------------------------------------- +// CBrowserInitialView::HandleCommandL +// --------------------------------------------------------- +// +void CBrowserInitialView::HandleCommandL(TInt aCommand) + { + AppUi()->HandleCommandL( aCommand ); + } + +// --------------------------------------------------------- +// CBrowserInitialView::HandleClientRectChange() +// --------------------------------------------------------- +// +void CBrowserInitialView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------------------------- +// CBrowserInitialView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CBrowserInitialView::CommandSetResourceIdL() + { + return R_BROWSERINITIAL_CBA_OPTIONS_EXIT; + } + +// --------------------------------------------------------- +// CBrowserInitialView::DoActivateL +// --------------------------------------------------------- +// +void CBrowserInitialView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + iPreviousViewID = ApiProvider().LastActiveViewId(); + ApiProvider().SetLastActiveViewId( Id() ); + if (!iContainer) + { + iContainer = new (ELeave) CBrowserInitialContainer( this ); + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect() ); + AppUi()->AddToViewStackL( *this, iContainer ); + iContainer->GotoPane()->SetGPObserver( this ); + } + UpdateCbaL(); + } + +// --------------------------------------------------------- +// CBrowserInitialView::DynInitMenuPaneL +// --------------------------------------------------------- +// +void CBrowserInitialView::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) + { + } + +// --------------------------------------------------------- +// CBrowserInitialView::DoDeactivate() +// --------------------------------------------------------- +// +void CBrowserInitialView::DoDeactivate() + { + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + iContainer = NULL; + } + +// --------------------------------------------------------- +// CBrowserInitialView::LaunchGotoAddressEditorL +// --------------------------------------------------------- +// +void CBrowserInitialView::LaunchGotoAddressEditorL() + { + } + +void CBrowserInitialView::HandleGotoPaneEventL( CBrowserGotoPane* /*aGotoPane*/, TEvent /*aEvent*/ ) + { + // + } + +// --------------------------------------------------------- +// CBrowserInitialView::GotoUrlInGotoPaneL +// --------------------------------------------------------- +// +void CBrowserInitialView::GotoUrlInGotoPaneL() + { + } + +// --------------------------------------------------------- +// CBrowserInitialView::UpdateGotoPaneL +// --------------------------------------------------------- +// +void CBrowserInitialView::UpdateGotoPaneL() + { + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserLauncherService.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserLauncherService.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of BrowserLauncherService +* +* +*/ + +// INCLUDES +#include "BrowserLauncherService.h" +#include +#include "LauncherServerCommands.hrh" +#include "BrowserAppDocument.h" +#include "BrowserAppUi.h" +#include "BrowserAsyncExit.h" +#include "logger.h" +#include +#include +#include "BrowserSpecialLoadObserver.h" +#include + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::~CBrowserLauncherService() +// ----------------------------------------------------------------------------- +// +CBrowserLauncherService::~CBrowserLauncherService() + { + LOG_ENTERFN( "CBrowserLauncherService::~CBrowserLauncherService" ); + // The base class has no destructor, thus resources must be freed up here! + delete iClientBuffer; iClientBuffer = 0; + // Cancel outstanding asynchronous request + if ( iMyAsyncMessage.Handle() !=0 ) + { + iMyAsyncMessage.Complete( KErrCancel ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::ProcessMessageSyncL() +// ----------------------------------------------------------------------------- +// +TInt CBrowserLauncherService::ProcessMessageSyncL( TUid /*aEmbeddingApplicationUid*/, + TBrowserOverriddenSettings /*aSettings*/, + TInt /*aFolderUid*/, + TPtrC /*aSeamlessParam*/, + TBool /*aIsContentHandlerRegistered*/ ) + { + LOG_ENTERFN( "CBrowserLauncherService::ProcessMessageSyncL" ); + + // Do stuff here... + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::ProcessMessageASyncL() +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherService::ProcessMessageASyncL( TUid aEmbeddingApplicationUid, + TBrowserOverriddenSettings aSettings, + TInt aFolderUid, + TPtrC aSeamlessParam, + TBool aIsContentHandlerRegistered, + TBool aIsOverridenSettings ) + { + LOG_ENTERFN( "CBrowserLauncherService::ProcessMessageASyncL" ); + + TBrowserOverriddenSettings* paSettings; + TInt seamlessParamLength = aSeamlessParam.Length(); + HBufC8* param8 = HBufC8::NewLC( seamlessParamLength ); + + // Set Browser`s document settings + if ( aIsOverridenSettings ) + { + paSettings = &aSettings; + iBrowserDocument->SetOverriddenSettings( paSettings ); + } + else + { + iBrowserDocument->SetOverriddenSettings( NULL ); + } + + // Set browser document + iBrowserDocument->SetFolderToOpen( aFolderUid ); + iBrowserDocument->SetIsContentHandlerRegistered( aIsContentHandlerRegistered ); + + // Initialize browser + iBrowserAppUi->SetEmbeddingAppliacationUid( aEmbeddingApplicationUid ); + iBrowserAppUi->InitBrowserL( ); + + // Load the specified URL + param8->Des().Copy( aSeamlessParam ); + + // If no command or URL was given open the browser with the specified bookmark + if ( seamlessParamLength ) + { + iBrowserAppUi->ParseAndProcessParametersL( *param8 ); + iBrowserAppUi->SetViewToBeActivatedIfNeededL( iBrowserAppUi->LastActiveViewId() ); + } + else + { + iBrowserAppUi->ParseAndProcessParametersL( *param8, EFalse ); + + // startup content view to initialize fep/vkb + iBrowserAppUi->SetLastActiveViewId( KUidBrowserContentViewId ); + iBrowserAppUi->SetViewToBeActivatedIfNeededL( iBrowserAppUi->LastActiveViewId() ); + iBrowserAppUi->ActivateLocalViewL( iBrowserAppUi->LastActiveViewId() ); + + // Now activate bookmarks view + iBrowserAppUi->SetLastActiveViewId( KUidBrowserBookmarksViewId ); + iBrowserAppUi->SetViewToBeActivatedIfNeededL( iBrowserAppUi->LastActiveViewId() ); + } + iBrowserAppUi->ActivateLocalViewL( iBrowserAppUi->LastActiveViewId() ); + iBrowserAppUi->HandleForegroundEventL( ETrue ); + + // perform special action for overridden context + // could later use as flag for LSK,RSK. + switch(aSettings.GetBrowserSetting(EBrowserOverSettingsContextId)) + { + case EBrowserContextIdFeeds: + iBrowserAppUi->SetOverriddenLaunchContextId(EBrowserContextIdFeeds); + iBrowserAppUi->LaunchIntoFeedsL(); + break; + default: + // do nothing + break; + + } + + CleanupStack::PopAndDestroy(); // param8 + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::ProcessMessageSyncBufferL() +// ----------------------------------------------------------------------------- +// +TInt CBrowserLauncherService::ProcessMessageSyncBufferL( ) + { + LOG_ENTERFN( "CBrowserLauncherService::ProcessMessageSyncBufferL" ); + + // Write iClientBuffer to client`s address space. + iMySyncMessage.WriteL( 0,iClientBuffer->Des() ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::ProcessBoolsL() +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherService::ProcessBoolsL + ( TBool aClientWantsToContinue, TBool aWasContentHandled ) + { + LOG_ENTERFN( "CBrowserLauncherService::ProcessBoolsL" ); + + iBrowserAppUi->SetContentHandlingResult( aClientWantsToContinue, aWasContentHandled ); + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::DoBrowserExit() +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherService::DoBrowserExit( ) + { + LOG_ENTERFN( "CBrowserLauncherService::DoBrowserExitL" ); + + if ( iBrowserAppUi ) + { + if ( !iBrowserAppUi->ExitInProgress() ) + { + if (iBrowserAppUi->SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing + { + iBrowserAppUi->Connection().Disconnect(); + } + else + { + iBrowserAppUi->iBrowserAsyncExit->Start(); + } + } + iBrowserAppUi->SetBrowserLauncherService( NULL ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::DownloadFinished() +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherService::DownloadFinishedL( TInt aReason, const CAiwGenericParamList& aParamList ) + { + LOG_ENTERFN( "CBrowserLauncherService::DownloadFinishedL" ); + + // This function is called by the Browser. If download is finished + // write the result to the clients buffer. + + // Get the size of the parameter list`s externalized size. + TInt parameterListExternalizedSize = aParamList.Size(); + + // Create the buffer to hold the externalized data. + HBufC8* newClientBuffer = HBufC8::NewL( parameterListExternalizedSize ); + delete iClientBuffer; // delete the old buffer + iClientBuffer = newClientBuffer; + + // Create Stream object, and write stream to descriptor iClientBuffer. + TPtr8 piClientBuffer = iClientBuffer->Des(); + RDesWriteStream writeStream( piClientBuffer ); + + // Externalize parameter list into descriptor iClientBuffer. + aParamList.ExternalizeL( writeStream ); + BROWSER_LOG( ( _L( " ExternalizeL OK" ) ) ); + + // Close stream object. + writeStream.CommitL(); + BROWSER_LOG( ( _L( " CommitL OK" ) ) ); + writeStream.Close(); + BROWSER_LOG( ( _L( " Close OK" ) ) ); + + // Complete the client with the created buffer`s size. + if ( aReason == KErrNone ) + { + TPckg bufferSize( iClientBuffer->Length() ); + TRAPD(err, iMyAsyncMessage.WriteL( 1, bufferSize )); + LOG_WRITE_FORMAT(" WriteL erro code : %d", err ); + User::LeaveIfError(err); + iMyAsyncMessage.Complete( KErrNone ); + } + else + { + iMyAsyncMessage.Complete( aReason ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherService::ConstructL() +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherService::ConstructL() + { + LOG_ENTERFN( "CBrowserLauncherService::ConstructL" ); + iBrowserAppUi->SetBrowserLauncherService( this ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserLoadObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserLoadObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,648 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle special load events such as network connection, +* deal with non-http or non-html requests +* +*/ + + + +// INCLUDE FILES +#include "BrowserLoadObserver.h" +#include "ApiProvider.h" +#include "Display.h" +#include "BrowserContentView.h" +#include "CommonConstants.h" +#include "BrowserAppUi.h" +#include "logger.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include "BrowserDialogsProviderProxy.h" + +#include +#include +#include + +#ifdef I__LOG_EVENT_TIME + // defines a local timer with name 'localTime' + #define START_TIMER( localTime ) TTime localTime; localTime.HomeTime(); + + // count the elapsed time based on timer 'localTime' + // and increment number of timers called ( numOfTimer ) + #define STOP_TIMER( localTime, numOfTimer ) \ + TTime locTime__a; locTime__a.HomeTime(); \ + TInt64 updateTime = locTime__a.MicroSecondsFrom( localTime ).Int64(); \ + LOG_WRITE_FORMAT( "Update time: %d", updateTime ); \ + ++numOfTimer; \ + CBrowserLoadObserver::iTotalUpdateTime += updateTime; +#else // I__LOG_EVENT_TIME + // empty macros + #define START_TIMER( a ) + #define STOP_TIMER( a, b ) +#endif // I__LOG_EVENT_TIME + +// --------------------------------------------------------- +// CBrowserLoadObserver::NewL() +// --------------------------------------------------------- +// +CBrowserLoadObserver* CBrowserLoadObserver::NewL( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + CBrowserWindow& aWindow ) + { + CBrowserLoadObserver* self = + new (ELeave) CBrowserLoadObserver( aApiProvider, aContentView, aWindow ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop(); // self + return self; + } + +// --------------------------------------------------------- +// CBrowserLoadObserver::~CBrowserLoadObserver() +// --------------------------------------------------------- +// +CBrowserLoadObserver::~CBrowserLoadObserver() + { + // iApiProvider, iContentView, iWindow not owned by CBRowserLoadObserver. + // invalidate pointer for a cleaner/clearer destruction + iApiProvider = NULL; + iContentView = NULL; + iWindow = NULL; + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::HandleBrowserLoadEventL() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::HandleBrowserLoadEventL( + TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, + TUint aSize, + TUint16 aTransactionId) + { +LOG_ENTERFN("CBrowserLoadObserver::HandleBrowserLoadEventL"); +LOG_WRITE_FORMAT(" LoadEvent: %d", aLoadEvent ); +LOG_WRITE_FORMAT(" Size: %d", aSize ); +LOG_WRITE_FORMAT(" TrId: %d", aTransactionId ); +LOG_WRITE_FORMAT(" LoadState: %d", iLoadState ); +LOG_WRITE_FORMAT(" LoadType: %d", iLoadUrlType ); + if( aLoadEvent == TBrCtlDefs::EEventNewContentDisplayed ) + { + iWindow->ResetPageOverviewLocalSettingL(); + iWindow->SetImagesLoaded(EFalse); + } + HandleLoadEventOtherL( aLoadEvent, aSize, aTransactionId ); + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::HandleLoadEventOtherL() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::HandleLoadEventOtherL( + TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, + TUint aSize, + TUint16 aTransactionId ) + { +#define STATECHECK( a ) { if( (iLoadState & a) == 0 ) break; } + + TInt err( KErrNone ); + switch( aLoadEvent ) + { + case TBrCtlDefs::EEventLoadError: + { + if(LoadStatus( ELoadStatusSecurePage )) + { + ClearStatus( ELoadStatusSecurePage ); + ClearStatus( ELoadStatusAllItemIsSecure ); + SetStatus ( ELoadStatusSecurePageVisited ); + UpdateSecureIndicatorL(); + } + ClearStatus(); + SetStatus( ELoadStatusMainError ); + break; + } + case TBrCtlDefs::EEventEnteringSecurePage: + { + SetStatus( ELoadStatusSecurePage ); + SetStatus( ELoadStatusAllItemIsSecure ); + UpdateSecureIndicatorL(); + break; + } + case TBrCtlDefs::EEventSomeItemsNotSecure: + { + ClearStatus( ELoadStatusAllItemIsSecure ); + UpdateSecureIndicatorL(); + break; + } + case TBrCtlDefs::EEventSecureItemInNonSecurePage: + { + SetStatus( ELoadStatusSecureItemNonSecurePage ); + UpdateSecureIndicatorL(); + break; + } + case TBrCtlDefs::EEventExitingSecurePage: + case TBrCtlDefs::EEventSubmittingToNonSecurePage: + { + ClearStatus( ELoadStatusSecurePage ); + ClearStatus( ELoadStatusAllItemIsSecure ); + SetStatus ( ELoadStatusSecurePageVisited ); + UpdateSecureIndicatorL(); + break; + } + case TBrCtlDefs::EEventTitleAvailable: + { + SetStatus( ELoadStatusTitleAvailable ); + NewTitleAvailableL(); + break; + } + case TBrCtlDefs::EEventNewContentStart: + { +#ifdef I__LOG_EVENT_TIME + iStartDownloadTime.HomeTime(); + iTotalUpdateTime = 0; + iNumberOfUpdates = 0; +#endif // I__LOG_EVENT_TIME + StateChange( ELoadStateResponseInProgress ); + iApiProvider->SetProgressShown( ETrue ); + iApiProvider->Display().StartProgressAnimationL(); + + // in case we're in bookmarks view and a background page load is in + // progress, don't update the softkeys + if( iApiProvider->IsForeGround() && InBrowserContentView() ) + { + if( CBrowserAppUi::Static()->ActiveView() ) + { + CBrowserAppUi::Static()->ActiveView()->UpdateCbaL(); + } + } + iApiProvider->WindowMgr().NotifyObserversL( EWindowLoadStart, iWindow->WindowId() ); + break; + } + case TBrCtlDefs::EEventUrlLoadingStart: + { + STATECHECK( ELoadStateResponseInProgress ) + iApiProvider->Display().StartProgressAnimationL(); + + // If the load is not initiated from the bookmarks view (ie. engine initiated + // via some timer on a page like cnn.com) then don't change view to content view + if (iBrowserInitLoad) + { + iApiProvider->SetViewToBeActivatedIfNeededL(KUidBrowserContentViewId); + iBrowserInitLoad = EFalse; + } + + // add transaction to ProgressBar + iApiProvider->Display().AddTransActIdL( aTransactionId ); + + // Display the status pane, while loading + if ( InBrowserContentView() && iContentView->FullScreenMode() ) + { + iContentView->ShowFsStatusPane(ETrue); + } + break; + } + // first content chunk arrived + case TBrCtlDefs::EEventNewUrlContentArrived: + { + STATECHECK( ELoadStateResponseInProgress ) + SetStatus( ELoadStatusFirstChunkArrived ); + // set MaxData for this transaction + iApiProvider->Display().AddProgressDataL( + aTransactionId, 0, aSize ); + break; + } + // additional content chunk arrived + case TBrCtlDefs::EEventMoreUrlContentArrived: + { + STATECHECK( ELoadStateResponseInProgress ) + START_TIMER( t1 ); + // set RecvdData for this transaction + iApiProvider->Display().AddProgressDataL( + aTransactionId, aSize, 0 ); + if( iApiProvider->IsForeGround() ) + { + iApiProvider->Display().NotifyProgress(); + } + STOP_TIMER( t1, iNumberOfUpdates ); + break; + } + // content is processed, new fetch is allowed. + // some more event may still remain + case TBrCtlDefs::EEventContentFinished: + { + StateChange( ELoadStateIdle ); + if( !ContentDisplayed() ) + { + SetContentDisplayed( ETrue ); + } + + if( !iApiProvider->ExitInProgress() && + iApiProvider->IsForeGround() ) + { + iApiProvider->Display().StopProgressAnimationL(); + } + User::ResetInactivityTime(); + + if( LoadUrlType() == ELoadUrlTypeEmbeddedBrowserWithUrl && + !LoadStatus( ELoadStatusFirstChunkArrived ) && + !iApiProvider->ExitInProgress() ) + { + // Don't do anything; let the embedder close the browser + } + // No content to be shown, go back to where we came from + else if ( !iRestoreContentFlag ) + { + CBrowserAppUi::Static()->ActivateLocalViewL( + iApiProvider->LastActiveViewId() ); + if( iApiProvider->IsForeGround() ) + { + if ( CBrowserAppUi::Static()->ActiveView() ) + { + CBrowserAppUi::Static()->ActiveView()->UpdateCbaL(); + } + } + } + else + { + ContentArrivedL(); + + // in case we're in bookmarks view and a background page load is in + // progress, don't update the softkeys + if( iApiProvider->IsForeGround() && InBrowserContentView() ) + { + if ( CBrowserAppUi::Static()->ActiveView() ) + { + CBrowserAppUi::Static()->ActiveView()->UpdateCbaL(); + } + } + } +#ifdef I__LOG_EVENT_TIME + TTime endDownloadTime; + endDownloadTime.HomeTime(); + TInt64 dlTime = endDownloadTime.MicroSecondsFrom(iStartDownloadTime).Int64(); + LOG_WRITE_FORMAT( "Total download time: %d", dlTime ); + LOG_WRITE_FORMAT( "Total update time: %d", iTotalUpdateTime ); + LOG_WRITE_FORMAT( "Total number of updates: %d", iNumberOfUpdates ); + if( iNumberOfUpdates ) + { + LOG_WRITE_FORMAT( "Average update time: %d", + iTotalUpdateTime / iNumberOfUpdates ); + } + if( dlTime ) + { + LOG_WRITE_FORMAT( "Total update time (%% of download time): %d", + iTotalUpdateTime / (dlTime / 100) ); + } +#endif // I__LOG_EVENT_TIME + break; + } + // first chunk displayed, no parameter + case TBrCtlDefs::EEventNewContentDisplayed: + { + iApiProvider->WindowMgr().SetContentExist( ETrue ); + SetStatus( ELoadStatusFirstChunkDisplayed ); + SetRestoreContentFlag( ETrue ); + ContentArrivedL(); + if( !ContentDisplayed() ) + { + SetContentDisplayed( ETrue ); + } + break; + } + // additional chunk displayed, no parameter + case TBrCtlDefs::EEventMoreContentDisplayed: + { + SetStatus( ELoadStatusContentDisplayed ); + SetRestoreContentFlag( ETrue ); + ContentArrivedL(); + break; + } + // last chunk arrived + case TBrCtlDefs::EEventUrlLoadingFinished: + { + iApiProvider->Display().TransActIdComplete( aTransactionId ); + SetRestoreContentFlag( ETrue ); + ContentArrivedL(); + TRAP( err, iApiProvider->LogAccessToRecentUrlL( iWindow->BrCtlInterface() ) ); + break; + } + case TBrCtlDefs::EEventLoadFinished: + { + if( !iApiProvider->ExitInProgress() && + iApiProvider->IsForeGround() ) + { + iApiProvider->Display().StopProgressAnimationL(); + + // Turn off status pane, SK, and Cba + // If in content view, set to fullscreen after download complete + if ( InBrowserContentView() && iContentView->FullScreenMode() ) + { + iContentView->ShowFsStatusPane(EFalse); + } + } + iApiProvider->WindowMgr().NotifyObserversL( EWindowLoadStop, iWindow->WindowId() ); + break; + } + case TBrCtlDefs::EEventAuthenticationFailed: + { + // don't add url to Adaptive Bookmarks + ClearStatus( ELoadStatusFirstChunkArrived ); + break; + } + // Large file upload events + case TBrCtlDefs::EEventUploadStart: + { + iMaxUploadContent = aSize; + iWindow->DialogsProviderProxy().UploadProgressNoteL( + iMaxUploadContent, 0, EFalse, this ); + break; + } + case TBrCtlDefs::EEventUploadIncrement: + { + iWindow->DialogsProviderProxy().UploadProgressNoteL( + iMaxUploadContent, aSize, EFalse, this ); + break; + } + case TBrCtlDefs::EEventUploadFinished: + { + iWindow->DialogsProviderProxy().UploadProgressNoteL( + iMaxUploadContent, aSize, ETrue, this ); + break; + } + default: + break; + } +#undef STATECHECK + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::CBrowserLoadObserver() +// ---------------------------------------------------------------------------- +// +CBrowserLoadObserver::CBrowserLoadObserver( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + CBrowserWindow& aWindow ) : + iApiProvider( &aApiProvider ), + iContentView( &aContentView ), + iWindow( &aWindow ), + iLoadState( ELoadStateIdle ), + iLoadUrlType( ELoadUrlTypeOther ), + iStatus( 0 ) + { + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::ConstructL() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::ConstructL() + { + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::DoStartLoad() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::DoStartLoad( + TBrowserLoadUrlType aLoadUrlType ) + { +/* +LOG_WRITE("-------------------") +LOG_WRITE_FORMAT(" UrlType: %d ", aLoadUrlType ) +*/ + // __ASSERT_DEBUG instead of condition? + if( iLoadState == ELoadStateIdle ) + { + if (LoadStatus(ELoadStatusSecurePageVisited)) + { + ClearStatus(); + SetStatus(ELoadStatusSecurePageVisited); + } + else + { + ClearStatus(); + } + + iLoadUrlType = aLoadUrlType; + iRestoreContentFlag = EFalse; + } + + iBrowserInitLoad = ETrue; + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::DoEndLoad() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::DoEndLoad( + TBool aIsUserInitiated ) + { +// LOG_WRITE( "Cancelling.") + if( aIsUserInitiated) + { + // wait for the remaining load events + StateChange( ELoadStateLoadDone ); + } + else // don't wait for anything + { + StateChange( ELoadStateIdle ); + } + + // first arrives ContentFinished and then UrlLoadingFinished! + // what to do with status? + // updatesoftkeys() done in appui + + CBrowserViewBase* view = CBrowserAppUi::Static()->ActiveView(); + if( view ) // just to be sure + { + TVwsViewId activeViewId = view->ViewId(); + if( activeViewId.iViewUid == KUidBrowserBookmarksViewId) + { + SetRestoreContentFlag( EFalse ); + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::NewTitleAvailableL() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::NewTitleAvailableL() + { + if( iWindow->IsWindowActive() ) + { + CBrowserViewBase* view = CBrowserAppUi::Static()->ActiveView(); + if( view ) // just to be sure + { + TVwsViewId activeViewId = view->ViewId(); + if( activeViewId.iViewUid == KUidBrowserContentViewId ) + { + iContentView->UpdateTitleL( *iApiProvider ); + } + } + } + SetRestoreContentFlag( ETrue ); + } + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::InBrowserContentView() +// ---------------------------------------------------------------------------- +// +TBool CBrowserLoadObserver::InBrowserContentView() + { + CBrowserViewBase* view = CBrowserAppUi::Static()->ActiveView(); + if( view ) // just to be sure + { + TVwsViewId activeViewId = view->ViewId(); + return ( activeViewId.iViewUid == KUidBrowserContentViewId ); + } + + return EFalse; + } + + +// ---------------------------------------------------------------------------- +// CBrowserLoadObserver::ContentArrivedL() +// ---------------------------------------------------------------------------- +// +void CBrowserLoadObserver::ContentArrivedL() + { + if( iApiProvider->Connection().Connected() + && iApiProvider->Preferences().HttpSecurityWarningsStatSupressed() ) + { + TInt secureUpdate = EAknIndicatorStateOff; + if( LoadStatus( ELoadStatusSecurePage ) ) + { + if( LoadStatus( ELoadStatusAllItemIsSecure ) ) + { + secureUpdate = EAknIndicatorStateOn; + } + } + iApiProvider->Display().UpdateSecureIndicatorL( secureUpdate ); + } + } + +//----------------------------------------------------------------------------- +// CBrowserLoadObserver::ReportDialogEvent +//----------------------------------------------------------------------------- +// Handles dialog provider events +void CBrowserLoadObserver::ReportDialogEventL( + TInt aType, + TInt aFlags ) + { + switch( aType ) + { + case MBrowserDialogsProviderObserver::ENotifyError: + // aFlags contains error code + { + // If card not in deck error, go to first card of deck + SetRestoreContentFlag( aFlags == KBrsrWmlbrowserCardNotInDeck ); + break; + } + case MBrowserDialogsProviderObserver::ENotifyHttpError: + // aFlags contains error code + { + SetRestoreContentFlag( EFalse ); + break; + } + case MBrowserDialogsProviderObserver::EUserAuthentication: + { + SetRestoreContentFlag( aFlags ); // False == Cancelled + break; + } + case MBrowserDialogsProviderObserver::EConfirm: + // aFlags contains Cancel status + { + // if confirmation query was cancelled, step back to idle + if( !aFlags ) + { + DoEndLoad( EFalse ); + } + SetRestoreContentFlag( !aFlags ); + break; + } + case MBrowserDialogsProviderObserver::EUploadProgress: + { + // Cancel fetching - dialog is cancelled + if ( aFlags == KErrCancel ) + { + iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandCancelFetch + + (TInt)TBrCtlDefs::ECommandIdBase ); + } + break; + } + default: + break; + } + } + +//----------------------------------------------------------------------------- +// CBrowserLoadObserver::UpdateSecureIndicatorL +//----------------------------------------------------------------------------- +// +void CBrowserLoadObserver::UpdateSecureIndicatorL() + { + TBool status = LoadStatus( ELoadStatusAllItemIsSecure ); + iApiProvider->Display().UpdateSecureIndicatorL( + status && + !iApiProvider->Preferences().HttpSecurityWarningsStatSupressed() ); + } + +//----------------------------------------------------------------------------- +// CBrowserLoadObserver::LoadUrlType +//----------------------------------------------------------------------------- +// +CBrowserLoadObserver::TBrowserLoadUrlType CBrowserLoadObserver::LoadUrlType() const + { + return iLoadUrlType; + } + +//----------------------------------------------------------------------------- +// CBrowserLoadObserver::LoadState +//----------------------------------------------------------------------------- +// +CBrowserLoadObserver::TBrowserLoadState CBrowserLoadObserver::LoadState() const + { + return iLoadState; + } +//----------------------------------------------------------------------------- +// CBrowserLoadObserver::StateChange +//----------------------------------------------------------------------------- +// +void CBrowserLoadObserver::StateChange( TBrowserLoadState aNextState ) + { + if( ELoadStateIdle == iLoadState && + iLoadState != aNextState ) + { + iNewContentDisplayed = EFalse; + iApiProvider->WindowMgr().NotifyObserversL( EWindowCntDisplayed, iWindow->WindowId() ); + } + iLoadState = aNextState; + } + +//----------------------------------------------------------------------------- +// CBrowserLoadObserver::SetContentDisplayed +//----------------------------------------------------------------------------- +// + +void CBrowserLoadObserver::SetContentDisplayed( TBool aValue ) + { + iNewContentDisplayed = aValue; + TRAP_IGNORE( iApiProvider->WindowMgr().NotifyObserversL( EWindowCntDisplayed, iWindow->WindowId())); + } + + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserPopupEngine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserPopupEngine.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,743 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of popupblocking +* +* +*/ + + +// INCLUDES +#include +#include "BrowserPopupEngine.h" +#include +#include "logger.h" +#include "BrowserUtil.h" + +// CONSTANTS +_LIT( KWhiteListFileName, "bpopupwl.db" ); +_LIT( KWhiteTmpFileName, "bpopwtmp.db" ); +_LIT( KWhiteBkpFileName, "bpopbbkp.db" ); +_LIT( KEndMark, "\n" ); +const TInt KArrayGranularity = 10; +const TInt KCacheSize = 32;//The maximum size of the memory cache +const TInt KMaxDbSize = 16384;// (255/max length of the domain/+1/\n/)*64 + +// ================= MEMBER FUNCTIONS ======================= + + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::CBrowserPopupEngine() +// ----------------------------------------------------------------------------- +// +CBrowserPopupEngine::CBrowserPopupEngine() + { + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::~CBrowserPopupEngine +// ----------------------------------------------------------------------------- +// +CBrowserPopupEngine::~CBrowserPopupEngine() + { + iWhiteListFile.Flush(); + iWhiteListFile.Close(); + iFs.Close(); + delete iCachedWhiteUrls; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::NewLC +// ----------------------------------------------------------------------------- +// +CBrowserPopupEngine* CBrowserPopupEngine::NewLC() + { + CBrowserPopupEngine* self = new (ELeave) CBrowserPopupEngine; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::NewL +// ----------------------------------------------------------------------------- +// +CBrowserPopupEngine* CBrowserPopupEngine::NewL() + { + CBrowserPopupEngine* self = new (ELeave) CBrowserPopupEngine; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::ConstructL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::ConstructL() + { +LOG_ENTERFN("CBrowserPopupEngine::ConstructL"); + User::LeaveIfError(iFs.Connect()); +//open databases + BROWSER_LOG( ( _L( "<-Popup engine-> RFs Connected." ) ) ); + OpenDatabaseL( &iWhiteListFile ); + BROWSER_LOG( ( _L( "<-Popup engine-> white file opened." ) ) ); +//Create memory cache + iCachedWhiteUrls = new(ELeave) CDesCArrayFlat(KArrayGranularity); + BROWSER_LOG( ( _L( "<-Popup engine-> Cache created." ) ) ); + iCachedWhiteUrls->Reset(); +//Load some to memory cache + LoadUrlsToCacheL( &iWhiteListFile, iCachedWhiteUrls, &iWhiteCacheNo); + BROWSER_LOG( ( _L( "<-Popup engine-> Urls loaded to cache." ) ) ); + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::OpenDatabaseL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::OpenDatabaseL(RFile* aFile) + { +LOG_ENTERFN("CBrowserPopupEngine::OpenDatabaseL"); + + __ASSERT_DEBUG( (aFile != NULL), Util::Panic( Util::EUninitializedData )); + + TInt err; + RFile tmpFile; + TPtrC fileNamePtr; + TPtrC bkpFileNamePtr; + TBuf privatePath; + TBuf listFileName; + TBuf bkpFileName; + TBuf tmpFileName; + iFs.PrivatePath( privatePath ); + listFileName.Copy( privatePath ); + listFileName.Append( KWhiteListFileName ); + bkpFileName.Copy( privatePath ); + bkpFileName.Append( KWhiteBkpFileName ); + tmpFileName.Copy( privatePath ); + tmpFileName.Append( KWhiteTmpFileName ); + err = aFile->Open( iFs, listFileName, EFileWrite | EFileStream | EFileShareExclusive ); + BROWSER_LOG( ( _L( "<-Popup engine-> File open error: %d" ), err ) ); + if ( err == KErrNotFound ) + { + err = tmpFile.Open( iFs, bkpFileName, EFileWrite | EFileShareExclusive ); + if( err != KErrNone ) + { + err = aFile->Create( iFs, listFileName, EFileWrite | EFileShareExclusive ); + BROWSER_LOG( ( _L( "<-Popup engine-> white file created." ) ) ); + } + else + { +//check validity of tmp file if the last char is \n it is probably OK + if( !CheckDbValidity( &tmpFile ) ) + { + User::LeaveIfError( + aFile->Create( iFs, listFileName, + EFileWrite | EFileShareExclusive ) ); + } + else + { +//rename tmp to origin + err = tmpFile.Rename( listFileName ); + if(err == KErrNone) + { + tmpFile.Close(); + User::LeaveIfError(aFile->Open( iFs, listFileName, EFileWrite | EFileStream | EFileShareExclusive ) ); + } + else + { + User::LeaveIfError( + aFile->Create( iFs, listFileName, + EFileWrite | EFileShareExclusive ) ); + } + } + } + } + else if ( err == KErrPathNotFound ) + { + User::LeaveIfError( iFs.CreatePrivatePath( EDriveC ) ); + User::LeaveIfError( + aFile->Create( iFs, listFileName, EFileWrite | EFileShareExclusive ) ); + } + else if((err != KErrInUse)&&( err != KErrNone )) + { + User::Leave(err); + } + else if( !CheckDbValidity( aFile ) ) + { +//if the file is not valid delete it and create a new one + aFile->Close(); + User::LeaveIfError( iFs.Delete( listFileName ) ); + User::LeaveIfError( + aFile->Create( iFs, listFileName, EFileWrite | EFileShareExclusive ) ); + } +//delete tmp and bkp files if they exist + iFs.Delete( tmpFileName ); + iFs.Delete( bkpFileName ); + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::AddUrlToWhiteListL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::AddUrlToWhiteListL(const TDesC& aUrl) + { +LOG_ENTERFN("CBrowserPopupEngine::AddUrlToWhiteListL"); + TUriParser16 urlParser; + BROWSER_LOG( ( _L( "<-Popup engine-> url to add to white list : %S" ), &aUrl ) ); +//check whether file allready exists in list + /*if( IsUrlOnWhiteListL( aUrl ) ) + { + RDebug::Print(_L("<-Popup engine-> url is in white cache allready.\n")); + return; + }*/ +//get the domain from the url + urlParser.Parse(aUrl); + if( urlParser.IsSchemeValid() ) + { +//write domain to file + HandleUrlOrderChangeL( &iWhiteListFile, urlParser.Extract( EUriHost), EFalse, ETrue ); +//add domain to memory cache + AddUrlToCacheL( iCachedWhiteUrls, urlParser.Extract( EUriHost) ); + } + else + { + User::Leave( KErrBadName ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::IsUrlOnWhiteListL +// ----------------------------------------------------------------------------- +// +TBool CBrowserPopupEngine::IsUrlOnWhiteListL(const TDesC& aUrl) + { +LOG_ENTERFN("CBrowserPopupEngine::IsUrlOnWhiteListL"); + TUriParser16 urlParser; + urlParser.Parse(aUrl); + if( !urlParser.IsSchemeValid() ) + { + User::Leave( KErrBadName ); + } +//look for URL in memory cache + if( IsUrlInWhiteCacheL( urlParser.Extract( EUriHost) ) ) + { + BROWSER_LOG( ( _L( "<-Popup engine-> url is in white cache." ) ) ); + HandleUrlOrderChangeL( &iWhiteListFile, urlParser.Extract( EUriHost), ETrue, ETrue ); + return ETrue; + } +//look for URL in file + if( IsUrlInWhiteFileL( urlParser.Extract( EUriHost) ) ) + { + HandleUrlOrderChangeL( &iWhiteListFile, urlParser.Extract( EUriHost), ETrue, ETrue ); +//if found and not in memory cache put it there + AddUrlToCacheL( iCachedWhiteUrls, urlParser.Extract( EUriHost) ); + BROWSER_LOG( ( _L( "<-Popup engine-> url is in white file." ) ) ); + return ETrue; + } + BROWSER_LOG( ( _L( "<-Popup engine-> url is not on white list." ) ) ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::IsUrlInWhiteCacheL +// ----------------------------------------------------------------------------- +// +TBool CBrowserPopupEngine::IsUrlInWhiteCacheL(const TDesC& aUrl) + { + return IsUrlInCacheL( iCachedWhiteUrls, aUrl, iWhiteCacheNo ); + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::IsUrlInWhiteFileL +// ----------------------------------------------------------------------------- +// +TBool CBrowserPopupEngine::IsUrlInWhiteFileL(const TDesC& aUrl) + { + return IsUrlInFileL( &iWhiteListFile , aUrl ); + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::IsUrlInFileL +// ----------------------------------------------------------------------------- +// +TBool CBrowserPopupEngine::IsUrlInFileL(const RFile* aFile, const TDesC& aUrl) + { + + __ASSERT_DEBUG( (aFile != NULL), Util::Panic( Util::EUninitializedData )); + + HBufC8* line = HBufC8::NewL( 256 ); + CleanupStack::PushL( line ); + HBufC8* parturl = HBufC8::NewL( 256 ); + CleanupStack::PushL( parturl ); + TInt match = 1; + TInt pos = 0; + TInt result; + TPtrC16 linePtr16; + HBufC8* url8 = TDesC16ToHBufC8LC( aUrl ); + User::LeaveIfError( aFile->Seek( ESeekStart, pos ) ); + TPtr8 linePtr = line->Des(); + result = aFile->Read( linePtr ); + parturl->Des().Zero(); + while ( ( line->Des().Length() > 0 ) && ( result == KErrNone ) ) + { + if(parturl->Des().Length() != 0 ) + { + pos = linePtr.Locate( '\n' ); + parturl->Des().Append( linePtr.Left( pos ) ); + match = url8->Des().Compare( parturl->Des() ); + if( match == 0 ) + { + CleanupStack::PopAndDestroy( 3 ); + return ETrue; + } + parturl->Des().Zero(); + } + match = linePtr.Find( url8->Des() ); + if( match == KErrNotFound ) + { + pos = linePtr.LocateReverse( '\n' ); + if(( linePtr.Length() != pos )&&( linePtr.Length() > 1 )) + { + parturl->Des().Append( linePtr.Mid( pos + 1, linePtr.Length() - pos - 1 )); + } + } + else + { + CleanupStack::PopAndDestroy( 3 ); + return ETrue; + } + result = aFile->Read( linePtr, 256 ); + } + CleanupStack::PopAndDestroy( 3 ); + User::LeaveIfError( result ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::LoadUrlsToCacheL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::LoadUrlsToCacheL(const RFile* aFile, CDesCArrayFlat* aCacheArray, TInt* aLoadedUrlNo) + { +LOG_ENTERFN( "PopupEngine::LoadUrlsToCacheL" ); + + __ASSERT_DEBUG( (aFile != NULL), Util::Panic( Util::EUninitializedData )); + __ASSERT_DEBUG( (aCacheArray != NULL), Util::Panic( Util::EUninitializedData )); + __ASSERT_DEBUG( (aLoadedUrlNo != NULL), Util::Panic( Util::EUninitializedData )); + + TPtrC8 test; + HBufC8* line = HBufC8::NewL( 256 ); + CleanupStack::PushL( line ); + HBufC8* parturl = HBufC8::NewL( 256 ); + CleanupStack::PushL( parturl ); + TInt result; + TInt itemno = 0; + TInt offset = 0; + TInt prevOffset = 0; + TPtr8 linePtr = line->Des(); + parturl->Des().Zero(); + User::LeaveIfError( aFile->Seek( ESeekStart, offset ) ); + result = aFile->Read( linePtr, 256 ); + while ( ( line->Des().Length() > 0 ) &&( result == KErrNone ) && ( itemno < KCacheSize )) + { + offset = linePtr.Locate('\n' ); + if( parturl->Length() != 0 ) + { + parturl->Des().Append( linePtr.Mid( prevOffset, offset ) ); + aCacheArray->AppendL( *TDesC8ToHBufC16LC( parturl->Des() ) ); + CleanupStack::PopAndDestroy( ); + prevOffset = prevOffset + offset +1; + itemno++; + if( itemno == KCacheSize ) + { + break; + } + offset = ( linePtr.Right( linePtr.Length() - prevOffset ) ).Locate('\n'); + } + while(( offset != KErrNotFound ) && ( itemno < KCacheSize )) + { + aCacheArray->AppendL( *TDesC8ToHBufC16LC( linePtr.Mid( prevOffset, offset ) ) ); + CleanupStack::PopAndDestroy( ); + prevOffset = prevOffset + offset +1; + itemno++; + offset = ( linePtr.Right( linePtr.Length() - prevOffset ) ).Locate('\n' ); + } + if( prevOffset != linePtr.Length() ) + { + parturl->Des().Zero(); + parturl->Des().Append( linePtr.Right( linePtr.Length() - prevOffset )); + } + prevOffset = 0; + result = aFile->Read( linePtr, 256 ); + } + *aLoadedUrlNo = itemno; + CleanupStack::PopAndDestroy( 2 ); + User::LeaveIfError( result ); + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::IsUrlInCacheL +// ----------------------------------------------------------------------------- +// +TBool CBrowserPopupEngine::IsUrlInCacheL( const CDesCArrayFlat* aCacheArray, const TDesC& aUrl, const TInt aLoadedurlno ) + { +LOG_ENTERFN("CBrowserPopupEngine::IsUrlInCacheL"); + + __ASSERT_DEBUG( (aCacheArray != NULL), Util::Panic( Util::EUninitializedData )); + + TInt itemno=0; + BROWSER_LOG( ( _L( "<-Popup engine-> url to find in cache : %S" ), &aUrl ) ); + while( ( itemno < aLoadedurlno ) && ( aUrl.Compare((*aCacheArray)[ itemno ]) != 0 ) ) + { + itemno++; + } + if( itemno != aLoadedurlno ) + { + BROWSER_LOG( ( _L( "<-Popup engine-> url found in cache" ) ) ); + return ETrue; + } + BROWSER_LOG( ( _L( "<-Popup engine-> url not found in cache" ) ) ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::AddUrlToCacheL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::AddUrlToCacheL( CDesCArrayFlat* aCacheArray, const TDesC& aUrl ) + { +LOG_ENTERFN("CBrowserPopupEngine::AddUrlToCacheL"); + + __ASSERT_DEBUG( (aCacheArray != NULL), Util::Panic( Util::EUninitializedData )); + + if( iWhiteCacheNo < KCacheSize ) + { + aCacheArray->AppendL( aUrl ); + iWhiteCacheNo++; + BROWSER_LOG( ( _L( "<-Popup engine-> url added to cache : %S" ), &aUrl ) ); + } + else + { + BROWSER_LOG( ( _L( "<-Popup engine-> url not added to cache : %S" ), &aUrl ) ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::TDesC16ToTPtrC8 +// ----------------------------------------------------------------------------- +// +TPtrC8 CBrowserPopupEngine::TDesC16ToTPtrC8(const TDesC16 &aString) + { + TPtrC8 ptr8(reinterpret_cast(aString.Ptr()),(aString.Length()*2)); + return ptr8; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::TDesC8ToTPtrC16 +// ----------------------------------------------------------------------------- +// +TPtrC16 CBrowserPopupEngine::TDesC8ToTPtrC16(const TDesC8 &aString) + { + TPtrC16 ptr16(reinterpret_cast(aString.Ptr()),(aString.Length()/2)); + return ptr16; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::HandleUrlOrderChange +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::HandleUrlOrderChangeL(RFile* aFile, const TDesC& aUrl, const TBool aExists,const TBool aToAdd ) + { +LOG_ENTERFN("CBrowserPopupEngine::HandleUrlOrderChangeL"); + + __ASSERT_DEBUG( (aFile != NULL), Util::Panic( Util::EUninitializedData )); + + RFile tmpFile; + TInt err, match; + HBufC8* line = HBufC8::NewL( 256 ); + CleanupStack::PushL( line ); + HBufC8* parturl = HBufC8::NewL( 256 ); + CleanupStack::PushL( parturl ); + HBufC8* url8; + parturl->Des().Zero(); + TPtr8 linePtr = line->Des(); + TPtrC8 linePtrOffset; + TPtrC8 tmpPtr; + TInt result; + TInt pos = 0; + TInt offset; + TInt writtenSize = 0; + TBuf privatePath; + TBuf listFileName; + TBuf bkpFileName; + TBuf tmpFileName; +//set the filenames + iFs.PrivatePath( privatePath ); + listFileName.Copy( privatePath ); + listFileName.Append( KWhiteListFileName ); + bkpFileName.Copy( privatePath ); + bkpFileName.Append( KWhiteBkpFileName ); + tmpFileName.Copy( privatePath ); + tmpFileName.Append( KWhiteTmpFileName ); +//create a tmp file + err = tmpFile.Create( iFs, tmpFileName, EFileWrite | EFileShareExclusive ); + if( err != KErrNone ) + { + RDebug::Print(_L("Creation of tmp file failed.\n")); + BROWSER_LOG( ( _L( "<-Popup engine-> Creation of tmp file failed." ) ) ); + User::LeaveIfError( err ); + } +//convert url to 8bit + url8 = TDesC16ToHBufC8LC( aUrl ); +//add url to tmp file + if( aToAdd ) + { +//by url removal it is not needed to write the url + tmpFile.Seek( ESeekStart, pos ); + tmpFile.Write( url8->Des() ); + tmpFile.Write( *TDesC16ToHBufC8LC( KEndMark ) ); + CleanupStack::PopAndDestroy(); + tmpFile.Flush(); + writtenSize = url8->Des().Size() + 1; + } +//write all urls to tmp file except the if needed + parturl->Des().Zero(); + User::LeaveIfError( aFile->Seek( ESeekStart, pos ) ); + result = aFile->Read( linePtr, 256 ); + linePtr.Set(line->Des()); + writtenSize += linePtr.Length(); + if ( aExists ) + { + while ( ( line->Des().Length() > 0 ) &&( result == KErrNone )) + { + offset=0; +//if there was a part of an url check it too + if( parturl->Length() != 0 ) + { + offset = linePtr.Locate('\n' ); + parturl->Des().Append( linePtr.Left( offset ) ); + match = url8->Des().Compare( parturl->Des() ); + if( match != 0 ) + { + tmpFile.Write( parturl->Des() ); + tmpFile.Write( *TDesC16ToHBufC8LC( KEndMark ) ); + CleanupStack::PopAndDestroy(); + } + offset++; + parturl->Des().Zero(); + } +//find the new url in the old file + linePtrOffset.Set( linePtr.Right( linePtr.Length() - offset )); + match = linePtrOffset.Find( url8->Des() ); + if( match == KErrNotFound ) + { + pos = linePtrOffset.LocateReverse('\n' ); +//store the remaining part of the last url + if( pos != KErrNotFound ) + { + if( pos == linePtrOffset.Length() -1 ) + { + tmpFile.Write( linePtrOffset ); + } + else + { + parturl->Des( ).Append( linePtrOffset.Mid( pos + 1, linePtrOffset.Length() - pos - 1 )); + tmpFile.Write( linePtrOffset.Left( pos+1 )); + } + } + else if( linePtrOffset.Length() > 0 ) + { + parturl->Des( ).Append( linePtrOffset ); + } + } + else + { + if( match == 0) + { + tmpFile.Write( linePtrOffset.Right( linePtrOffset.Length() - url8->Des().Length() - 1 ) ); + } + else + { + pos = linePtrOffset.LocateReverse('\n' ); + tmpFile.Write( linePtrOffset, match ); + if( pos < linePtrOffset.Length() - 1 ) + { + if( pos == linePtrOffset.Length() - url8->Des().Length() - 1 ) + { + parturl->Des( ).Append( linePtrOffset.Right( url8->Des().Length() ) ); + } + else//add to offset + { + tmpFile.Write( linePtrOffset.Right( linePtrOffset.Length() - match - url8->Des().Length() - 1 ) ); + } + } + } + } + result = aFile->Read( linePtr, 256 ); + linePtr.Set(line->Des()); + } + } + else + { +//copy the whole file + while ( ( line->Des().Length() > 0 ) &&( result == KErrNone )) + { + result = tmpFile.Write( linePtr ); + if ( result == KErrNone ) + { + result = aFile->Read( linePtr, 256 ); + linePtr.Set( line->Des() ); + writtenSize += linePtr.Length(); + if( writtenSize > KMaxDbSize ) + { + offset = linePtr.Length(); + while( writtenSize > KMaxDbSize ) + { + offset = linePtr.Left( offset ).LocateReverse('\n' ); + writtenSize -= linePtr.Length() - offset ; + } + tmpFile.Write( linePtr, offset ); + tmpFile.Write( *TDesC16ToHBufC8LC( KEndMark ) ); + CleanupStack::PopAndDestroy(); + break; + } + } + } + } + tmpFile.Flush(); +//rename original file to bkp + User::LeaveIfError( aFile->Rename( bkpFileName ) ); + aFile->Close(); +//rename temp file to original + User::LeaveIfError( tmpFile.Rename( listFileName ) ); + tmpFile.Close(); + User::LeaveIfError( aFile->Open( iFs, listFileName, EFileWrite | EFileStream | EFileShareExclusive ) ); +//delete bkp file + User::LeaveIfError( iFs.Delete( bkpFileName ) ); + CleanupStack::PopAndDestroy( 3 ); + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::RemoveUrlFromWhiteListL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::RemoveUrlFromWhiteListL(const TDesC& aUrl) + { +LOG_ENTERFN("CBrowserPopupEngine::RemoveUrlFromWhiteListL"); + TUriParser16 urlParser; + urlParser.Parse(aUrl); + if( !urlParser.IsSchemeValid() ) + { + BROWSER_LOG( ( _L( "<-Popup engine-> Url is not valid." ) ) ); + User::Leave( KErrBadName ); + } + HandleUrlOrderChangeL( &iWhiteListFile, urlParser.Extract( EUriHost), ETrue, EFalse ); + BROWSER_LOG( ( _L( "<-Popup engine-> Url removed from database." ) ) ); + if( iWhiteCacheNo > 0) + { + RemoveUrlFromCacheL( iCachedWhiteUrls, urlParser.Extract( EUriHost), iWhiteCacheNo ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::RemoveUrlFromCacheL +// ----------------------------------------------------------------------------- +// +void CBrowserPopupEngine::RemoveUrlFromCacheL( CDesCArrayFlat* aCacheArray, const TDesC& aUrl, TInt &aCacheNo ) + { +LOG_ENTERFN("CBrowserPopupEngine::RemoveUrlFromCacheL"); + + __ASSERT_DEBUG( (aCacheArray != NULL), Util::Panic( Util::EUninitializedData )); + + TInt pos; + TInt ret; + ret = aCacheArray->Find( aUrl, pos ); + if( ret == 0 ) + { + aCacheArray->Delete( pos ); + aCacheArray->Compress(); + aCacheNo--; + BROWSER_LOG( ( _L( "<-Popup engine-> Url is found in cache and removed." ) ) ); + } + else + { + BROWSER_LOG( ( _L( "<-Popup engine-> Url is not in cache." ) ) ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::CheckDbValidity +// ----------------------------------------------------------------------------- +// +TBool CBrowserPopupEngine::CheckDbValidity(RFile* aFile) +{ +LOG_ENTERFN("CBrowserPopupEngine::CheckDbValidity"); + + __ASSERT_DEBUG( (aFile != NULL), Util::Panic( Util::EUninitializedData )); + + TInt size; + TBuf8<1> tmp; + aFile->Size( size ); + if( size == 0) + { +//empty file is ok + BROWSER_LOG( ( _L( "<-Popup engine-> File is valid." ) ) ); + return ETrue; + } + else + { +//check whether the last char is \n + size = -1; + aFile->Seek( ESeekEnd, size ); + aFile->Read( tmp, 1 ); + if( tmp.Compare( *TDesC16ToHBufC8LC( KEndMark ) ) == 0 ) + { + CleanupStack::PopAndDestroy( ); + BROWSER_LOG( ( _L( "<-Popup engine-> File is valid." ) ) ); + return ETrue; + } + else + { + CleanupStack::PopAndDestroy( ); + BROWSER_LOG( ( _L( "<-Popup engine-> File is not valid." ) ) ); + return EFalse; + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::ConvertTDesC16ToHBufC8LC +// ----------------------------------------------------------------------------- +// +HBufC8 *CBrowserPopupEngine::TDesC16ToHBufC8LC(const TDesC16 &string) + { + HBufC8 *buff = HBufC8::NewLC(string.Length()); + buff->Des().Copy(string); + return buff; + } + +// ----------------------------------------------------------------------------- +// CBrowserPopupEngine::TDesC8ToHBufC16LC +// ----------------------------------------------------------------------------- +// +HBufC16 *CBrowserPopupEngine::TDesC8ToHBufC16LC(const TDesC8 &aString) + { + HBufC16 *buff = HBufC16::NewLC(aString.Length()); + buff->Des().Copy(aString); + return buff; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserPreferences.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserPreferences.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,2295 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* It manages WmlBrowser's preferences +* +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "CommsModel.h" +#include "ApiProvider.h" +#include "BrowserApplication.h" +#include "BrowserPreferences.h" +#include "Browser.hrh" +#include "BrowserUiVariant.hrh" +#include +#include "commonconstants.h" +#include "BrowserAppUi.h" +#include +#include "SettingsContainer.h" // for TEncoding +#include "BrowserUtil.h" // for Util::AllocateUrlWithSchemeL +#include "logger.h" + +#include "CmApplicationSettingsUi.h" +#include +#include + +// CONSTANTS +#define KSearchAppUid 0x2001f3a9 +//Shared data values for Full Screen setting +const TInt KBrowserFullScreenSettingDataSoftkeysOff = 0; //full screen +const TInt KBrowserFullScreenSettingDataSoftkeysOn = 1; //softkeys displayed + +//Shared data values for Adaptive Bookmarks setting +const TInt KBrowserAdaptiveBookmarksSettingDataOn = 0; +const TInt KBrowserAdaptiveBookmarksSettingDataHideFolder = 1; +const TInt KBrowserAdaptiveBookmarksSettingDataOff = 2; + +// ========================= MEMBER FUNCTIONS ================================ + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::ConstructL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::ConstructL( TBrowserOverriddenSettings* aSettings ) + { + LOG_ENTERFN("CBrowserPreferences::ConstructL"); + iObservers = new ( ELeave ) CArrayPtrFlat< MPreferencesObserver >( 1 ); + iCommsModel.ApDb().AddObserverL( this ); + + iApDH = CApDataHandler::NewLC( iCommsModel.CommsDb() ); + CleanupStack::Pop(); + + iVpnEngine = CVpnApEngine::NewLC( &(iCommsModel.CommsDb()) ); + CleanupStack::Pop(); + + CRepository* repository = CRepository::NewL( KCRUidBrowserUiLV ); + + if ( repository->Get( + KBrowserUiCommonFlags, iEngineLocalFeaturesBitmask ) != KErrNone ) + { + // in case of problems, assume everything is off + iEngineLocalFeaturesBitmask = 0; + } + if ( repository->Get( + KBrowserUiCommonFlags, iUiLocalFeaturesBitmask ) != KErrNone ) + { + // in case of problems, assume everything is off + iUiLocalFeaturesBitmask = 0; + } + if ( repository->Get( + KBrowserUiCdmaFlags, iCdmaUiLocalFeaturesBitmask ) != KErrNone ) + { + // in case of problems, assume everything is off + iCdmaUiLocalFeaturesBitmask = 0; + } + + delete repository; + + iRepository = CRepository::NewL( KCRUidBrowser ); + + iEmbeddedMode = ApiProvider().IsEmbeddedModeOn(); // EFalse; + if( iEmbeddedMode ) + { + // embedded mode doesn't allow multiple windows feature + iUiLocalFeaturesBitmask &= ~KBrowserMultipleWindows; + } + iOverriden = EFalse; + + SetIntValueL( KBrowserConfirmedDTMFOnce, EFalse ); + + //Read ini values to local variables. + TRAP_IGNORE( RestoreSettingsL() ); + + // and overwrite some of them if needed + if ( aSettings ) + { + SetOverriddenSettingsL( aSettings ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::EngineLocalFeatureSupported +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::EngineLocalFeatureSupported( const TInt aFeature ) const + { +LOG_ENTERFN("CBrowserPreferences::EngineLocalFeatureSupported"); +BROWSER_LOG( ( _L( "EnginLocalFeatureSupported returns %d" ), + (iEngineLocalFeaturesBitmask & aFeature) ) ); + return (iEngineLocalFeaturesBitmask & aFeature); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::UiLocalFeatureSupported +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::UiLocalFeatureSupported( const TInt aFeature ) const + { +LOG_ENTERFN("CBrowserPreferences::UiLocalFeatureSupported"); +BROWSER_LOG( ( _L( "UiLocalFeatureSupported returns %d" ), + (iUiLocalFeaturesBitmask & aFeature) ) ); + return (iUiLocalFeaturesBitmask & aFeature); + } + + + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::NewLC +// ---------------------------------------------------------------------------- +// +CBrowserPreferences* CBrowserPreferences::NewLC + ( MCommsModel& aCommsModel, MApiProvider& aApiProvider , TBrowserOverriddenSettings* aSettings) + { +LOG_ENTERFN("CBrowserPreferences::NewLC"); + CBrowserPreferences* result; + result = new ( ELeave ) CBrowserPreferences( aCommsModel, aApiProvider ); + CleanupStack::PushL( result ); + result->ConstructL( aSettings ); + return result; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::NewL +// ---------------------------------------------------------------------------- +// +CBrowserPreferences* CBrowserPreferences::NewL + ( MCommsModel& aCommsModel, MApiProvider& aApiProvider, TBrowserOverriddenSettings* aSettings ) + { +LOG_ENTERFN("CBrowserPreferences::NewL"); + CBrowserPreferences* result; + result = CBrowserPreferences::NewLC( aCommsModel, aApiProvider, aSettings ); + CleanupStack::Pop(); + return result; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::CBrowserPreferences +// ---------------------------------------------------------------------------- +// +CBrowserPreferences::CBrowserPreferences( MCommsModel& aCommsModel, + MApiProvider& aApiProvider) : + iApiProvider( aApiProvider ), + iCommsModel( aCommsModel ), + iEmbeddedMode( EFalse ) + { + LOG_ENTERFN("CBrowserPreferences::CBrowserPreferences"); + iAllPreferences.iCookies = EWmlSettingsCookieAllow; + iAllPreferences.iHttpSecurityWarnings = ETrue; + iAllPreferences.iDownloadsOpen = ETrue; + iAllPreferences.iConnDialogs = ETrue; + iAllPreferences.iHomePgURL = NULL; + iAllPreferences.iSearchPgURL = NULL; + iAllPreferences.iQueryOnExit = EFalse; + iAllPreferences.iSendReferrer = EFalse; + iAllPreferences.iAssocVpn = KWmlNoDefaultAccessPoint; + iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint; + iAllPreferences.iDefaultSnapId = KWmlNoDefaultSnapId; + iAllPreferences.iDefaultAPDetails = NULL; + iAllPreferences.iShortCutFuncHomePg = NULL; + iAllPreferences.iShortCutFuncBkMark = NULL; + iAllPreferences.iShortCutFuncFindKeyWord = NULL; + iAllPreferences.iShortCutFuncPrePage = NULL; + iAllPreferences.iShortCutFuncSwitchWin = NULL; + iAllPreferences.iShortCutFuncMiniImage = NULL; + iAllPreferences.iShortCutFuncFullScreen = NULL; + iAllPreferences.iShortCutFuncGoAddr = NULL; + iAllPreferences.iShortCutFuncZoomIn = NULL; + iAllPreferences.iShortCutFuncZoomOut = NULL; + iAllPreferences.iShortCutFuncZoomMode = NULL; + iAllPreferences.iSearch = EFalse; + iAllPreferences.iService = EFalse; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::~CBrowserPreferences +// ---------------------------------------------------------------------------- +// +CBrowserPreferences::~CBrowserPreferences() + { + LOG_ENTERFN("CBrowserPreferences::~CBrowserPreferences"); + delete iObservers; + delete iApDH; + delete iVpnEngine; + delete iVpnItem; + iCommsModel.ApDb().RemoveObserver( this ); + delete iSelfDownloadContentTypes; + iSelfDownloadContentTypes = 0; + + // All Settings struct - for observers + delete iAllPreferences.iSearchPgURL; + iAllPreferences.iSearchPgURL = NULL; + delete iAllPreferences.iHomePgURL; + iAllPreferences.iHomePgURL = NULL; + delete iAllPreferences.iDefaultAPDetails; + delete iRepository; + + // For short cut functions + delete iAllPreferences.iShortCutFuncHomePg; + iAllPreferences.iShortCutFuncHomePg = NULL; + + delete iAllPreferences.iShortCutFuncBkMark; + iAllPreferences.iShortCutFuncBkMark = NULL; + + delete iAllPreferences.iShortCutFuncFindKeyWord; + iAllPreferences.iShortCutFuncFindKeyWord = NULL; + + delete iAllPreferences.iShortCutFuncPrePage; + iAllPreferences.iShortCutFuncPrePage = NULL; + + delete iAllPreferences.iShortCutFuncSwitchWin; + iAllPreferences.iShortCutFuncSwitchWin = NULL; + + delete iAllPreferences.iShortCutFuncMiniImage; + iAllPreferences.iShortCutFuncMiniImage = NULL; + + delete iAllPreferences.iShortCutFuncFullScreen; + iAllPreferences.iShortCutFuncFullScreen = NULL; + + delete iAllPreferences.iShortCutFuncGoAddr; + iAllPreferences.iShortCutFuncGoAddr = NULL; + + delete iAllPreferences.iShortCutFuncZoomIn; + iAllPreferences.iShortCutFuncZoomIn = NULL; + + delete iAllPreferences.iShortCutFuncZoomOut; + iAllPreferences.iShortCutFuncZoomOut = NULL; + + delete iAllPreferences.iShortCutFuncZoomMode; + iAllPreferences.iShortCutFuncZoomMode = NULL; + + delete iAllPreferences.iUrlSuffixList; + iAllPreferences.iUrlSuffixList = NULL; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::AddObserverL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::AddObserverL( MPreferencesObserver* anObserver ) + { + LOG_ENTERFN("CBrowserPreferences::AddObserverL"); + iObservers->AppendL( anObserver ); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::RemoveObserver +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::RemoveObserver( MPreferencesObserver* anObserver ) + { + LOG_ENTERFN("CBrowserPreferences::RemoveObserver"); + TInt i( 0 ); + TInt count = iObservers->Count(); + for ( i = 0; i < count; i++ ) + { + if ( iObservers->At( i ) == anObserver ) + { + iObservers->Delete( i ); + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::NotifyObserversL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::NotifyObserversL( TPreferencesEvent aEvent, + TBrCtlDefs::TBrCtlSettings aSettingType = TBrCtlDefs::ESettingsUnknown ) + { + LOG_ENTERFN("CBrowserPreferences::NotifyObserversL"); + TInt i; + TInt count = iObservers->Count(); + + // Passed struct of all preferences to observers + for ( i = 0; i < count; i++ ) + { + iObservers->At( i )->HandlePreferencesChangeL( + aEvent, + iAllPreferences, + aSettingType ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::RestoreSettingsL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::RestoreSettingsL() + { + LOG_ENTERFN("CBrowserPreferences::RestoreSettingsL"); +// +// READ USER VARIATED SETTINGS +// + + //Read auto load content setting + iAllPreferences.iAutoLoadContent = GetIntValue( KBrowserNGImagesEnabled ); + + //Read font size + iAllPreferences.iFontSize = GetIntValue( KBrowserNGFontSize ); + + // Read Allow Cookies setting + if ( GetIntValue( KBrowserNGCookiesEnabled ) ) + { + iAllPreferences.iCookies = EWmlSettingsCookieAllow; + } + else + { + iAllPreferences.iCookies = EWmlSettingsCookieReject; + } + + // Read ECMA Setting + if ( GetIntValue( KBrowserNGECMAScriptSupport ) ) + { + iAllPreferences.iEcma = EWmlSettingsECMAEnable; + } + else + { + iAllPreferences.iEcma = EWmlSettingsECMADisable; + } + + // Read IMEI Setting + if ( IMEI_NOTIFICATION ) + { + if ( GetIntValue( KBrowserIMEINotification ) ) + { + iAllPreferences.iIMEINotification = EWmlSettingsIMEIEnable; + } + else + { + iAllPreferences.iIMEINotification = EWmlSettingsIMEIDisable; + } + } + + TInt encoding; + iRepository->Get( KBrowserNGEncoding, encoding ); + iAllPreferences.iEncoding = ( TUint32 ) encoding; + + iAllPreferences.iScriptLog = GetIntValue( KBrowserNGScriptLog ) ; + + //Read Fullscreen setting + TInt value; + value = GetIntValue ( KBrowserNGFullScreen ); + + switch ( value ) + { + case KBrowserFullScreenSettingDataSoftkeysOff: + { + iAllPreferences.iFullScreen = EWmlSettingsFullScreenFullScreen; + break; + } + + case KBrowserFullScreenSettingDataSoftkeysOn: + { + iAllPreferences.iFullScreen = EWmlSettingsFullScreenSoftkeysOnly; + break; + } + + default: + { + break; + } + } + + iAllPreferences.iSendReferrer = (TBool) GetIntValue( KBrowserSendReferrerHeader ); + + + //Read adaptive bookmarks setting + if (ADAPTIVEBOOKMARKS) + { + TInt adBm; + adBm = GetIntValue ( KBrowserNGAdaptiveBookmarks ); + + switch(adBm) + { + case (KBrowserAdaptiveBookmarksSettingDataOn): + { + iAllPreferences.iAdaptiveBookmarks = + EWmlSettingsAdaptiveBookmarksOn; + break; + } + case (KBrowserAdaptiveBookmarksSettingDataHideFolder): + { + iAllPreferences.iAdaptiveBookmarks = + EWmlSettingsAdaptiveBookmarksHideFolder; + break; + } + case (KBrowserAdaptiveBookmarksSettingDataOff): + { + iAllPreferences.iAdaptiveBookmarks = + EWmlSettingsAdaptiveBookmarksOff; + break; + } + default: + { + break; + } + } + } + +// +// READ OPERATOR VARIATED SETTINGS +// + + iAllPreferences.iHomePgType = + ( TWmlSettingsHomePage ) GetIntValue( KBrowserNGHomepageType ); + iAllPreferences.iPageOverview = GetIntValue ( + KBrowserNGPageOverview ); + iAllPreferences.iBackList = GetIntValue ( + KBrowserNGBackList ); + iAllPreferences.iAutoRefresh = GetIntValue ( + KBrowserNGAutoRefresh ); + + if(PROGRESSIVE_DOWNLOAD) + { + iAllPreferences.iDownloadsOpen = GetIntValue ( KBrowserNGOpenDownloads ); + } + else + { + iAllPreferences.iDownloadsOpen = EFalse; + } + + //Read suppress security UI setting + iAllPreferences.iHTTPSecuritySupressed = GetIntValue ( KBrowserSecurityUI ); + + //Read show connection queries setting + iAllPreferences.iConnDialogs = GetIntValue( KBrowserConnectionDialogs ); + + // Read HTTP security warnings setting + // value 0 :we don't want to see sec warning because they're supressed + // value 1 : want to see sec warning and warnings are enabled + iAllPreferences.iHttpSecurityWarnings = GetIntValue ( + KBrowserNGShowSecurityWarnings ); + + // Media Volume uses different SD ini. Revert to Browser SD ini after use + iAllPreferences.iMediaVolume = GetIntValue( KBrowserMediaVolumeControl ); + + // Pop up Blocking + iAllPreferences.iPopupBlocking = GetIntValue( KBrowserNGPopupBlocking ); + + // Form Data Saving + iAllPreferences.iFormDataSaving = (TWmlSettingsFormData) GetIntValue( KBrowserFormDataSaving ); + + // Access Keys + iAllPreferences.iAccessKeys = (TBool) GetIntValue( KBrowserNGAccessKeys ); + + // The leaving functions come at the end + + // Search Page + if ( iAllPreferences.iSearchPgURL ) + { + delete iAllPreferences.iSearchPgURL; + iAllPreferences.iSearchPgURL = NULL; + } + + // Web reed feeds settings - begin + iAllPreferences.iAutomaticUpdatingAP = GetIntValue( KBrowserNGAutomaticUpdatingAccessPoint ); + + iAllPreferences.iAutomaticUpdatingWhileRoaming = GetIntValue( KBrowserNGAutomaticUpdatingWhileRoaming ); + + // Web reed feeds settings - end + if (CBrowserAppUi::Static()->OrientationCanBeChanged() ) + { + iAllPreferences.iRotateDisplay = GetIntValue( KBrowserNGRotateDisplay ); + } + else + { + iAllPreferences.iRotateDisplay = 0; + } + if ( iAllPreferences.iUrlSuffixList ) + { + delete iAllPreferences.iUrlSuffixList; + iAllPreferences.iUrlSuffixList = NULL; + } + iAllPreferences.iUrlSuffixList = HBufC::NewL( KUrlSuffixMaxLength ); + TPtr suffix = iAllPreferences.iUrlSuffixList->Des(); + GetStringValueL( KBrowserUrlSuffix, KBrowserUrlSuffix, suffix ); + + // If something fails for an option, the default value will be used + TInt ap; + + // Read Accesss point selection mode for advanced settings +#ifdef BRDO_OCC_ENABLED_FF + const TInt selectionMode = GetIntValue( KBrowserOccAccessPointSelectionMode ); //2 Destination + BROWSER_LOG( ( _L( " OCC Ap Selection mode : %d" ), selectionMode ) ); +#else + const TInt selectionMode = GetIntValue( KBrowserAccessPointSelectionMode ); +#endif + + switch ( selectionMode ) + { + case EBrowserCenRepApSelModeUserDefined: + { + iAllPreferences.iAccessPointSelectionMode = EConnectionMethod; + break; + } + case EBrowserCenRepApSelModeAlwaysAsk: + { + iAllPreferences.iAccessPointSelectionMode = EAlwaysAsk; + break; + } + case EBrowserCenRepApSelModeDestination: + { + iAllPreferences.iAccessPointSelectionMode = EDestination; + break; + } + default: // Default to Always ask. + { + iAllPreferences.iAccessPointSelectionMode = EAlwaysAsk; + break; + } + } + + //we differentiate by connecting with a Snap or an access point + if (iAllPreferences.iAccessPointSelectionMode == EConnectionMethod) + { + //Read default AP setting + ap = GetIntValue( KBrowserDefaultAccessPoint ); + + SetDefaultAccessPointL( ap ); + } + else if (iAllPreferences.iAccessPointSelectionMode == EDestination) + { +#ifdef BRDO_OCC_ENABLED_FF + iAllPreferences.iDefaultSnapId = GetIntValue( KBrowserOccNGDefaultSnapId ); + if ( iAllPreferences.iDefaultSnapId == 0) + { + BROWSER_LOG( ( _L( " Cenrep OCC Default Snap id is : %d" ), iAllPreferences.iDefaultSnapId ) ); + TUint32 snapId(0); + RCmManager manager; + manager.OpenLC(); + RArray destIdArray; + CleanupClosePushL(destIdArray); + manager.AllDestinationsL( destIdArray ); + const TInt count = destIdArray.Count(); + for ( TInt i = 0; i < count && !snapId; i++ ) + { + RCmDestination dests = manager.DestinationL( destIdArray[i] ); + CleanupClosePushL( dests ); + if ( CMManager::TSnapPurpose( dests.MetadataL( CMManager::ESnapMetadataPurpose ) ) + == CMManager::ESnapPurposeInternet ) + { + BROWSER_LOG( ( _L( " Using Internet snap for connection" ) ) ); + snapId = destIdArray[i]; + SetDefaultSnapId(snapId); + } + CleanupStack::PopAndDestroy( 1 ); //dests + } + CleanupStack::PopAndDestroy( 2 ); // destIdArray, manager + } +#else + iAllPreferences.iDefaultSnapId = GetIntValue( KBrowserNGDefaultSnapId ); +#endif + } + + // For Short Cut keys + if ( iAllPreferences.iShortCutFuncHomePg ) + { + delete iAllPreferences.iShortCutFuncHomePg; + iAllPreferences.iShortCutFuncHomePg = NULL; + } + iAllPreferences.iShortCutFuncHomePg = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func1 = iAllPreferences.iShortCutFuncHomePg->Des(); + GetStringValueL( KBrowserNGShortCutFuncHomePg, KShortCutFuncStringLength, func1 ); + + if ( iAllPreferences.iShortCutFuncBkMark ) + { + delete iAllPreferences.iShortCutFuncBkMark; + iAllPreferences.iShortCutFuncBkMark = NULL; + } + iAllPreferences.iShortCutFuncBkMark = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func2 = iAllPreferences.iShortCutFuncBkMark->Des(); + GetStringValueL( KBrowserNGShortCutFuncBkMark, KShortCutFuncStringLength, func2 ); + + if ( iAllPreferences.iShortCutFuncFindKeyWord ) + { + delete iAllPreferences.iShortCutFuncFindKeyWord; + iAllPreferences.iShortCutFuncFindKeyWord = NULL; + } + iAllPreferences.iShortCutFuncFindKeyWord = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func3 = iAllPreferences.iShortCutFuncFindKeyWord->Des(); + GetStringValueL( KBrowserNGShortCutFuncFindKeyWord, KShortCutFuncStringLength, func3 ); + + if ( iAllPreferences.iShortCutFuncPrePage ) + { + delete iAllPreferences.iShortCutFuncPrePage; + iAllPreferences.iShortCutFuncPrePage = NULL; + } + iAllPreferences.iShortCutFuncPrePage = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func4 = iAllPreferences.iShortCutFuncPrePage->Des(); + GetStringValueL( KBrowserNGShortCutFuncPrePage, KShortCutFuncStringLength, func4 ); + + if ( iAllPreferences.iShortCutFuncSwitchWin ) + { + delete iAllPreferences.iShortCutFuncSwitchWin; + iAllPreferences.iShortCutFuncSwitchWin = NULL; + } + iAllPreferences.iShortCutFuncSwitchWin = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func5 = iAllPreferences.iShortCutFuncSwitchWin->Des(); + GetStringValueL( KBrowserNGShortCutFuncSwitchWin, KShortCutFuncStringLength, func5 ); + + if ( iAllPreferences.iShortCutFuncMiniImage ) + { + delete iAllPreferences.iShortCutFuncMiniImage; + iAllPreferences.iShortCutFuncMiniImage = NULL; + } + iAllPreferences.iShortCutFuncMiniImage = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func6 = iAllPreferences.iShortCutFuncMiniImage->Des(); + GetStringValueL( KBrowserNGShortCutFuncMiniImage, KShortCutFuncStringLength, func6 ); + + if ( iAllPreferences.iShortCutFuncGoAddr ) + { + delete iAllPreferences.iShortCutFuncGoAddr; + iAllPreferences.iShortCutFuncGoAddr = NULL; + } + iAllPreferences.iShortCutFuncGoAddr = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func7 = iAllPreferences.iShortCutFuncGoAddr->Des(); + GetStringValueL( KBrowserNGShortCutFuncGoAddr, KShortCutFuncStringLength, func7 ); + + if ( iAllPreferences.iShortCutFuncZoomIn ) + { + delete iAllPreferences.iShortCutFuncZoomIn; + iAllPreferences.iShortCutFuncZoomIn = NULL; + } + iAllPreferences.iShortCutFuncZoomIn = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func8 = iAllPreferences.iShortCutFuncZoomIn->Des(); + GetStringValueL( KBrowserNGShortCutFuncZoomIn, KShortCutFuncStringLength, func8 ); + + if ( iAllPreferences.iShortCutFuncZoomOut ) + { + delete iAllPreferences.iShortCutFuncZoomOut; + iAllPreferences.iShortCutFuncZoomOut = NULL; + } + iAllPreferences.iShortCutFuncZoomOut = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func9 = iAllPreferences.iShortCutFuncZoomOut->Des(); + GetStringValueL( KBrowserNGShortCutFuncZoomOut, KShortCutFuncStringLength, func9 ); + +/* + if ( iAllPreferences.iShortCutFuncZoomMode ) + { + delete iAllPreferences.iShortCutFuncZoomMode; + iAllPreferences.iShortCutFuncZoomMode = NULL; + } + iAllPreferences.iShortCutFuncZoomMode = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func11 = iAllPreferences.iShortCutFuncZoomMode->Des(); + GetStringValueL( KBrowserNGShortCutFuncZoomMode, KShortCutFuncStringLength, func11 ); +*/ + + if ( iAllPreferences.iShortCutFuncFullScreen ) + { + delete iAllPreferences.iShortCutFuncFullScreen; + iAllPreferences.iShortCutFuncFullScreen = NULL; + } + iAllPreferences.iShortCutFuncFullScreen = HBufC::NewL( KShortCutFuncStringLength ); + TPtr func10 = iAllPreferences.iShortCutFuncFullScreen->Des(); + GetStringValueL( KBrowserNGShortCutFuncFullScreen, KShortCutFuncStringLength, func10 ); + + // For Configuring Toolbar Buttons + iAllPreferences.iToolbarOnOff = GetIntValue( KToolbarOnOff ); + + iAllPreferences.iToolbarButton1Cmd = GetIntValue( KToolbarButton1Cmd ); + iAllPreferences.iToolbarButton2Cmd = GetIntValue( KToolbarButton2Cmd ); + iAllPreferences.iToolbarButton3Cmd = GetIntValue( KToolbarButton3Cmd ); + iAllPreferences.iToolbarButton4Cmd = GetIntValue( KToolbarButton4Cmd ); + iAllPreferences.iToolbarButton5Cmd = GetIntValue( KToolbarButton5Cmd ); + iAllPreferences.iToolbarButton6Cmd = GetIntValue( KToolbarButton6Cmd ); + iAllPreferences.iToolbarButton7Cmd = GetIntValue( KToolbarButton7Cmd ); + + // For configuring Shortcut Keys + iAllPreferences.iShortcutKeysForQwerty = GetIntValue( KShortcutKeysForQwerty ); + + iAllPreferences.iShortcutKey1Cmd = GetIntValue( KShortcutKey1Cmd ); + iAllPreferences.iShortcutKey2Cmd = GetIntValue( KShortcutKey2Cmd ); + iAllPreferences.iShortcutKey3Cmd = GetIntValue( KShortcutKey3Cmd ); + iAllPreferences.iShortcutKey4Cmd = GetIntValue( KShortcutKey4Cmd ); + iAllPreferences.iShortcutKey5Cmd = GetIntValue( KShortcutKey5Cmd ); + iAllPreferences.iShortcutKey6Cmd = GetIntValue( KShortcutKey6Cmd ); + iAllPreferences.iShortcutKey7Cmd = GetIntValue( KShortcutKey7Cmd ); + iAllPreferences.iShortcutKey8Cmd = GetIntValue( KShortcutKey8Cmd ); + iAllPreferences.iShortcutKey9Cmd = GetIntValue( KShortcutKey9Cmd ); + iAllPreferences.iShortcutKey0Cmd = GetIntValue( KShortcutKey0Cmd ); + iAllPreferences.iShortcutKeyStarCmd = GetIntValue( KShortcutKeyStarCmd ); + iAllPreferences.iShortcutKeyHashCmd = GetIntValue( KShortcutKeyHashCmd ); + + + iAllPreferences.iZoomLevelMin = GetIntValue( KBrowserNGZoomMin ); + iAllPreferences.iZoomLevelMax = GetIntValue( KBrowserNGZoomMax ); + iAllPreferences.iZoomLevelDefault = GetIntValue( KBrowserNGZoomDefault ); + + iAllPreferences.iMaxRecentUrlsToShow = GetIntValue( KBrowserNGMaxRecentUrls ); + + RApaLsSession aLs; + User::LeaveIfError(aLs.Connect()); + CleanupClosePushL(aLs); + iAllPreferences.iSearch = GetSearchFeatureStatusL( KBrowserSearch, aLs ); + iAllPreferences.iService = GetSearchFeatureStatusL( KBrowserServices, aLs ); + CleanupStack::PopAndDestroy(&aLs); + + iAllPreferences.iCursorShowMode = (TBrCtlDefs::TCursorSettings)GetIntValue( KBrowserCursorShowMode ); + iAllPreferences.iEnterKeyMode = (TBrCtlDefs::TEnterKeySettings)GetIntValue( KBrowserEnterKeyMode ); + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::AllPreferencesL +// ---------------------------------------------------------------------------- +// +const TPreferencesValues& CBrowserPreferences::AllPreferencesL() + { + return iAllPreferences; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::VpnDataL +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::VpnDataL( TUint aDefaultAccessPoint, CVpnApItem& aVpnItem ) + { + TBool ret( EFalse ); + + if( iVpnEngine->IsVpnApL( aDefaultAccessPoint ) ) + { + iVpnEngine->VpnDataL( aDefaultAccessPoint, aVpnItem ); + ret = ETrue; + } + + return ret; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetDefaultAccessPointL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetDefaultAccessPointL( TUint aDefaultAccessPoint, TUint aAssocVpn ) + { + LOG_ENTERFN("CBrowserPreferences::SetDefaultAccessPointL"); + BROWSER_LOG( ( _L( " aDefaultAccessPoint: %u" ), aDefaultAccessPoint ) ); + + //get the connection identifier based on the connection type + switch ( AccessPointSelectionMode() ) + { + //get the destination identifyer based on the snap Id + case EDestination: + { + BROWSER_LOG( ( _L( "CBrowserPreferences::SetDefaultAccessPointL EDestination" ) ) ); + RCmManager cmManager; + cmManager.OpenL(); + + // if user-defined destination then check that destination still exists. + // if it doesn't, reset access point to always ask and homepage to blank access point home page. + TUint snapId = iAllPreferences.iDefaultSnapId; + if (snapId != KWmlNoDefaultSnapId) + { + TRAPD(err, RCmDestination dest = cmManager.DestinationL( snapId )); + if (err != KErrNone) + { + aDefaultAccessPoint = KWmlNoDefaultAccessPoint; + aAssocVpn = KWmlNoDefaultAccessPoint; + + SetAccessPointSelectionModeL(EAlwaysAsk ); + if (iAllPreferences.iHomePgType == EWmlSettingsHomePageAccessPoint) + { + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr ptr( buf->Des() ); + // read user defined home page from SD shouldn't get any error + HomePageUrlL( ptr, ETrue ); + SetHomePageUrlL(ptr); + CleanupStack::PopAndDestroy( buf ); + } + } + } + cmManager.Close(); + + break; + } + + //if connecting with Iap Id + case EConnectionMethod: + { + BROWSER_LOG( ( _L( "CBrowserPreferences::SetDefaultAccessPointL EConnectionMethod" ) ) ); + // if user-defined access point then check that access point still exists. + // if it doesn't, reset access point to always ask and homepage to blank access point home page. + CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( aDefaultAccessPoint ); + if (apItem == NULL) + { + TBool isVpn = EFalse; + TRAPD(leaveCode, isVpn = iVpnEngine->IsVpnApL( aDefaultAccessPoint )) + if ( leaveCode == KErrNone ) + { + if ( isVpn ) + { + BROWSER_LOG( ( _L( " This is VPN AP which has a snap in it" ) ) ); + break; + } + } + BROWSER_LOG( ( _L( "CBrowserPreferences::SetDefaultAccessPointL Ap is not exist, Setting to Always Ask" ) ) ); + aDefaultAccessPoint = KWmlNoDefaultAccessPoint; + aAssocVpn = KWmlNoDefaultAccessPoint; + delete iAllPreferences.iDefaultAPDetails; + iAllPreferences.iDefaultAPDetails = NULL; + SetAccessPointSelectionModeL(EAlwaysAsk ); + if (iAllPreferences.iHomePgType == EWmlSettingsHomePageAccessPoint) + { + HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength ); // cleanupstack + TPtr ptr( buf->Des() ); + // read user defined home page from SD shouldn't get any error + HomePageUrlL( ptr, ETrue ); + SetHomePageUrlL(ptr); + CleanupStack::PopAndDestroy( buf ); + } + } + + break; + } + + default: + { + break; + } + } + + + // check web feeds for deleted access point + CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( iAllPreferences.iAutomaticUpdatingAP ); + if (apItem == NULL) + { + SetAutomaticUpdatingApL( KWmlNoDefaultAccessPoint ); + } + bool checkAPMode = ( (iAllPreferences.iAccessPointSelectionMode != EDestination) && (iAllPreferences.iAccessPointSelectionMode != EAlwaysAsk) ); + if( ( KWmlNoDefaultAccessPoint != aDefaultAccessPoint ) && ( checkAPMode ) && iVpnEngine->IsVpnApL( aDefaultAccessPoint ) ) + { + delete iVpnItem; + iVpnItem = NULL; + + iVpnItem = CVpnApItem::NewLC(); + CleanupStack::Pop(); + + iVpnEngine->VpnDataL( aDefaultAccessPoint, *iVpnItem ); + + TUint32 ass( aDefaultAccessPoint ); + iVpnItem->ReadUint( EApVpnWapAccessPointID, ass ); + aAssocVpn = ass; + + // get real WAP id + TUint32 ap( aDefaultAccessPoint ); + iVpnItem->ReadUint( EApVpnRealWapID, ap ); + aDefaultAccessPoint = ap; + } + BROWSER_LOG( ( _L( "VPN OK" ) ) ); + iAllPreferences.iDefaultAccessPoint = aDefaultAccessPoint; + iAllPreferences.iAssocVpn = aAssocVpn; + + CApAccessPointItem* api = CApAccessPointItem::NewLC();//maybe we can optimise this too + BROWSER_LOG( ( _L( "CApAccessPointItem OK" ) ) ); + TInt err; + if ( iOverridenSettings ) + { + iCustomAp = iOverridenSettings->GetBrowserSetting( + EBrowserOverSettingsCustomAp ); + } + if ( ( iOverridenSettings ) && iCustomAp ) + { + TRAP( err, iApDH->AccessPointDataL( iCustomAp, *api ) ); + if ( err != KErrNone ) + { + iCustomAp = 0; + TRAP( err, iApDH->AccessPointDataL( iAllPreferences.iDefaultAccessPoint, *api ) ); + } + } + else + { + TRAP( err, iApDH->AccessPointDataL( + iAllPreferences.iDefaultAccessPoint, *api ) ); + } + BROWSER_LOG( ( _L( " AccessPointDataL: %d" ), err ) ); + //Reset default AP pointer and delete the data + delete iAllPreferences.iDefaultAPDetails; + iAllPreferences.iDefaultAPDetails = NULL; + if ( err != KErrNone )// Set it to always ask + { + iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint; + iAllPreferences.iDefaultAPDetails = NULL; + CleanupStack::PopAndDestroy( api ); + } + else + { + iAllPreferences.iDefaultAPDetails = api;//store new default accesspoint details + CleanupStack::Pop( ); // api + } + /* + * If VPN set VPN AP ID to default access point! + */ + if( KWmlNoDefaultAccessPoint != iAllPreferences.iAssocVpn ) + { + iAllPreferences.iDefaultAccessPoint = iAllPreferences.iAssocVpn; + } + if( !iEmbeddedMode ) + { + //Store ini value / gateway + SetIntValueL ( KBrowserDefaultAccessPoint, + iAllPreferences.iDefaultAccessPoint ); + } + NotifyObserversL( EPreferencesItemChange ); + + // LOG_LEAVEFN("CBrowserPreferences::SetDefaultAccessPointL"); + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetDefaultSnapId: DestNetChange +// ---------------------------------------------------------------------------- +// + void CBrowserPreferences::SetDefaultSnapId (TUint aSnapId) + { + LOG_ENTERFN("CBrowserPreferences::SetDefaultSnapId"); + //storing the value of the default snap ID + iAllPreferences.iDefaultSnapId = aSnapId; +#ifdef BRDO_OCC_ENABLED_FF + SetIntValueL ( KBrowserOccNGDefaultSnapId, iAllPreferences.iDefaultSnapId ); + BROWSER_LOG( ( _L( " Setting OCC Snap id : %d" ), iAllPreferences.iDefaultSnapId ) ); +#else + SetIntValueL ( KBrowserNGDefaultSnapId, + iAllPreferences.iDefaultSnapId ); +#endif + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetAutoLoadContentL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetAutoLoadContentL( TInt aAutoLoadContent ) + { + LOG_ENTERFN("CBrowserPreferences::SetAutoLoadContentL"); + if ( aAutoLoadContent != iAllPreferences.iAutoLoadContent ) + { + iAllPreferences.iAutoLoadContent = aAutoLoadContent; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGImagesEnabled, + iAllPreferences.iAutoLoadContent ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsAutoLoadImages ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetPageOverviewL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetPageOverviewL( TBool aPageOverview ) + { + LOG_ENTERFN("CBrowserPreferences::SetPageOverviewL"); + if ( aPageOverview != iAllPreferences.iPageOverview ) + { + iAllPreferences.iPageOverview = aPageOverview; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGPageOverview, + iAllPreferences.iPageOverview ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsPageOverview); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetBackListL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetBackListL( TBool aBackList ) + { + LOG_ENTERFN("CBrowserPreferences::SetBackListL"); + if ( aBackList != iAllPreferences.iBackList ) + { + iAllPreferences.iBackList = aBackList; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGBackList, + iAllPreferences.iBackList ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsBackList); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetAutoRefreshL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetAutoRefreshL( TBool aAutoRefresh ) + { + LOG_ENTERFN("CBrowserPreferences::SetAutoRefreshL"); + if ( aAutoRefresh != iAllPreferences.iAutoRefresh ) + { + iAllPreferences.iAutoRefresh = aAutoRefresh; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGAutoRefresh, + iAllPreferences.iAutoRefresh ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsAutoRefresh); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetTextWrapL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetTextWrapL( TBool aTextWrap ) + { + LOG_ENTERFN("CBrowserPreferences::SetTextWrapL"); + if ( aTextWrap != iAllPreferences.iTextWrap ) + { + iAllPreferences.iTextWrap = aTextWrap; + + // Store value in Shared Data and forward new setting to BrCtl + if ( !iEmbeddedMode ) + { + SetIntValueL( KBrowserTextWrapEnabled, iAllPreferences.iTextWrap ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsTextWrapEnabled ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetFontSizeL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetFontSizeL( TInt aFontSize ) + { + LOG_ENTERFN("CBrowserPreferences::SetFontSizeL"); + if ( aFontSize != iAllPreferences.iFontSize ) + { + iAllPreferences.iFontSize = aFontSize; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGFontSize, iAllPreferences.iFontSize ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsFontSize ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetEncodingL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetEncodingL( TUint32 aEncoding ) + { + LOG_ENTERFN("CBrowserPreferences::SetEncodingL"); + if ( aEncoding != iAllPreferences.iEncoding ) + { + iAllPreferences.iEncoding = aEncoding; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL ( KBrowserNGEncoding, + ( TInt ) iAllPreferences.iEncoding ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsCharacterset ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetScriptLogL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetScriptLogL( TUint32 aScriptLog ) + { + LOG_ENTERFN("CBrowserPreferences::SetScriptLogL"); + if ( aScriptLog != iAllPreferences.iScriptLog ) + { + iAllPreferences.iScriptLog = aScriptLog; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + TBool ret = SetIntValueL ( KBrowserNGScriptLog, + ( TInt ) iAllPreferences.iScriptLog ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsScriptLog ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetAdaptiveBookmarksL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetAdaptiveBookmarksL( + TWmlSettingsAdaptiveBookmarks aAdaptiveBookmarks ) + { + LOG_ENTERFN( "CBrowserPreferences::SetAdaptiveBookmarksL" ); + + if ( ADAPTIVEBOOKMARKS ) + { + if ( aAdaptiveBookmarks != iAllPreferences.iAdaptiveBookmarks ) + { + iAllPreferences.iAdaptiveBookmarks = aAdaptiveBookmarks; + + if( !iEmbeddedMode ) + { + + switch( iAllPreferences.iAdaptiveBookmarks ) + { + case (EWmlSettingsAdaptiveBookmarksOn): + { + + SetIntValueL ( KBrowserNGAdaptiveBookmarks, + KBrowserAdaptiveBookmarksSettingDataOn ); + break; + } + case (EWmlSettingsAdaptiveBookmarksHideFolder): + { + SetIntValueL ( KBrowserNGAdaptiveBookmarks, + KBrowserAdaptiveBookmarksSettingDataHideFolder ); + break; + } + case (EWmlSettingsAdaptiveBookmarksOff): + { + SetIntValueL ( KBrowserNGAdaptiveBookmarks, + KBrowserAdaptiveBookmarksSettingDataOff ); + break; + } + default: + { + break; + } + } + } + NotifyObserversL( EPreferencesItemChange ); // Bookmarks View is interested + } + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetFullScreenL +// --------------------------------------------------------- +// +void CBrowserPreferences::SetFullScreenL( TWmlSettingsFullScreen aFullScreen ) + { + LOG_ENTERFN("CBrowserPreferences::SetFullScreenL"); + + if ( aFullScreen != iAllPreferences.iFullScreen ) + { + iAllPreferences.iFullScreen = aFullScreen; + if( !iEmbeddedMode ) + { + switch ( iAllPreferences.iFullScreen ) + { + case EWmlSettingsFullScreenSoftkeysOnly: + { + SetIntValueL ( KBrowserNGFullScreen, + KBrowserFullScreenSettingDataSoftkeysOn ); + break; + } + case EWmlSettingsFullScreenFullScreen: + { + SetIntValueL ( KBrowserNGFullScreen, + KBrowserFullScreenSettingDataSoftkeysOff ); + break; + } + default: + { + break; + } + } + } + NotifyObserversL( EPreferencesItemChange ); // ContentView is interested + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetCookiesL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetCookiesL( TWmlSettingsCookies aCookies ) + { + LOG_ENTERFN("CBrowserPreferences::SetCookiesL"); + if ( aCookies != iAllPreferences.iCookies ) + { + iAllPreferences.iCookies = aCookies; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGCookiesEnabled, + iAllPreferences.iCookies ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsCookiesEnabled ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetEcmaL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetEcmaL( TWmlSettingsECMA aEcma ) + { + LOG_ENTERFN("CBrowserPreferences::SetEcmaL"); + if ( aEcma != iAllPreferences.iEcma ) + { + iAllPreferences.iEcma = aEcma; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserNGECMAScriptSupport, + iAllPreferences.iEcma ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsECMAScriptEnabled ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetDownloadsOpen +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetDownloadsOpenL( TBool aOpen ) + { + LOG_ENTERFN("CBrowserPreferences::SetDownloadsOpenL"); + if ( aOpen != iAllPreferences.iDownloadsOpen ) + { + iAllPreferences.iDownloadsOpen = aOpen; + if( !iEmbeddedMode ) + { + SetIntValueL ( KBrowserNGOpenDownloads, + (TInt) iAllPreferences.iDownloadsOpen ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsAutoOpenDownloads ); + } + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetHttpSecurityWarningsL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetHttpSecurityWarningsL( TBool aWarningsOn ) + { + LOG_ENTERFN("CBrowserPreferences::SetHttpSecurityWarningsL"); + if ( aWarningsOn != iAllPreferences.iHttpSecurityWarnings ) + { + iAllPreferences.iHttpSecurityWarnings = aWarningsOn; + if( !iEmbeddedMode ) + { + SetIntValueL ( KBrowserNGShowSecurityWarnings, + (TInt) iAllPreferences.iHttpSecurityWarnings ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsSecurityWarnings ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetIMEINotification +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetIMEINotificationL( + TWmlSettingsIMEI aIMEINotification ) + { + LOG_ENTERFN("CBrowserPreferences::SetIMEINotificationL"); + if ( IMEI_NOTIFICATION ) + { + if ( aIMEINotification != iAllPreferences.iIMEINotification ) + { + iAllPreferences.iIMEINotification = aIMEINotification; + + // Store value in Shared Data and forward new setting to BrCtl + if( !iEmbeddedMode ) + { + SetIntValueL( KBrowserIMEINotification, + iAllPreferences.iIMEINotification ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsIMEINotifyEnabled ); + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::HandleApDbEventL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::HandleApDbEventL( TEvent anEvent ) + { + LOG_ENTERFN("CBrowserPreferences::HandleApDbEventL"); + if ( anEvent == EDbChanged )//maybe somebody has modified the AP (not very likely though) + { + SetDefaultAccessPointL( iAllPreferences.iDefaultAccessPoint ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::HomePageUrlL +// Get the user defined home page URL from shared data file. +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::HomePageUrlL( TDes& aUrl, TBool aForceLoadFromSD ) const + { +LOG_ENTERFN("CBrowserPreferences::HomePageUrlL"); + TInt homePgFound( KErrNotFound ); + TBool homepage = UiLocalFeatureSupported( KBrowserUiHomePageSetting ); + TWmlSettingsHomePage pgtype = HomePageType(); +BROWSER_LOG( ( _L( " pgtype: %d" ), pgtype ) ); + + if (homepage) + { + if (aForceLoadFromSD || (pgtype != EWmlSettingsHomePageAccessPoint)) + { + // if we are requiring a force load from the shared data, or our homepage + // is set to be something other than the access point's home page, get + // the value of the home page from the shared data + homePgFound = GetStringValueL( KBrowserNGHomepageURL, KMaxHomePgUrlLength, aUrl ); + } + else if ((iAllPreferences.iAccessPointSelectionMode == EConnectionMethod) && + (pgtype == EWmlSettingsHomePageAccessPoint)) + { + // The user has a defined access point, and wants to use the access point's + // home page +BROWSER_LOG( ( _L( "HomePageUrl, Access Point" ) ) ); + + TUint defaultAp = DefaultAccessPoint(); + if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is an access point defined + { + CApAccessPointItem* apItem = iAllPreferences.iDefaultAPDetails; + if ( apItem ) + { + const HBufC* defaultHP = apItem->ReadConstLongTextL( EApWapStartPage ); + if ( defaultHP->Length() ) + { + aUrl.Zero(); + aUrl.Append( *defaultHP ); + homePgFound = KErrNone; + } + } + else + { +BROWSER_LOG( ( _L( "HomePageUrl, Read from Central Repository" ) ) ); + homePgFound = GetStringValueL( KBrowserNGHomepageURL, KMaxHomePgUrlLength, aUrl ); + } + } + } + } +BROWSER_LOG( ( _L( "CBrowserPreferences::HomePageUrlL returns %d" ), homePgFound ) ); + return homePgFound; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::HomePageFromIapL +// Get the home page URL from belongs to the access point. +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::HomePageFromIapL( TDes& aUrl, TUint aIap ) const + { +LOG_ENTERFN("CBrowserPreferences::HomePageFromIapL"); + TInt homePgFound( KErrNotFound ); + + CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( aIap ); + if ( apItem ) + { + TPtrC defaultHP( apItem->StartPage() ); + if ( defaultHP.Length() ) + { + aUrl.Zero(); + aUrl.Append( defaultHP ); + homePgFound = KErrNone; + } + } +BROWSER_LOG( ( _L( "CBrowserPreferences::HomePageFromIapL returns %d" ), homePgFound ) ); + return homePgFound; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SearchPageUrlL +// Get the user defined search page URL from shared data file. +// ---------------------------------------------------------------------------- +// +TPtrC CBrowserPreferences::SearchPageUrlL() + { +LOG_ENTERFN("CBrowserPreferences::SearchPageUrlL"); + TBool urlTooBig = EFalse; + TInt error = KErrTooBig; + TInt length = 512; + + do + { + HBufC* temp = HBufC::NewL( length ); + if ( iAllPreferences.iSearchPgURL ) + { + delete iAllPreferences.iSearchPgURL; + iAllPreferences.iSearchPgURL = NULL; + } + + iAllPreferences.iSearchPgURL = temp; + TPtr ptr = iAllPreferences.iSearchPgURL->Des(); + // Here should handle the error variable, but its still not clear + // how big can a CenRep string be.( KMaxUnicodeStringLength ) + error = iRepository->Get( KBrowserNGSearchPageURL, ptr); + + if ( error == KErrTooBig ) + { + if ( length >= KMaxSearchPgUrlLength ) + { + urlTooBig = ETrue; + break; + } + else + length = length * 2; + } + } while ( error == KErrTooBig ); + + // If the URL exceeds the limit, return NULL. + if ( urlTooBig ) + { + delete iAllPreferences.iSearchPgURL; + iAllPreferences.iSearchPgURL = NULL; + iAllPreferences.iSearchPgURL = KNullDesC().AllocL(); + } + + NotifyObserversL( EPreferencesItemChange ); + +#ifdef _DEBUG + TPtrC logString = *iAllPreferences.iSearchPgURL; + BROWSER_LOG( ( _L( "CBrowserPreferences::SearchPageUrlL returns %S" ), &logString ) ); +#endif // _DEBUG + return iAllPreferences.iSearchPgURL->Des(); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetPopupBlockingL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetPopupBlockingL( TBool aPopupBlocking ) + { + LOG_ENTERFN("CBrowserPreferences::SetPopupBlockingL"); + if ( aPopupBlocking != iAllPreferences.iPopupBlocking ) + { + iAllPreferences.iPopupBlocking = aPopupBlocking; + SetIntValueL( KBrowserNGPopupBlocking, iAllPreferences.iPopupBlocking ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetFormDataSavingL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetFormDataSavingL( TWmlSettingsFormData aFormDataSaving ) + { + LOG_ENTERFN("CBrowserPreferences::SetFormDataSavingL"); + if ( aFormDataSaving != iAllPreferences.iFormDataSaving ) + { + iAllPreferences.iFormDataSaving = aFormDataSaving; + + + // TO DO: Add to cenrep + SetIntValueL( KBrowserFormDataSaving, + iAllPreferences.iFormDataSaving ); + } + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsAutoFormFillEnabled ); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::GetIntValue +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::GetIntValue( TUint32 aKey) const + { +LOG_ENTERFN("CBrowserPreferences::GetIntValue"); + TInt retVal = 0; + + if ( iRepository ) + { + iRepository->Get(aKey, retVal); + } + +BROWSER_LOG( ( _L( "CBrowserPreferences::GetIntValue returns %d" ), retVal ) ); + return retVal; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetIntValueL +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::SetIntValueL ( TUint32 aKey, const TInt& aValue ) + { +LOG_ENTERFN("CBrowserPreferences::SetIntValueL"); +BROWSER_LOG( ( _L( "aValue: %d" ), aValue ) ); + + // Log setting value BEFORE the change + #ifdef I__BROWSER_LOG_ENABLED + TInt preValue; + iRepository->Get( aKey, preValue ); + BROWSER_LOG( ( _L( "Prechange CenRep setting value: %d" ), preValue ) ); + #endif // I__BROWSER_LOG_ENABLED + + TBool retVal=EFalse; + if ( iRepository && ( KErrNone == iRepository->Set( aKey, aValue ) ) ) + { + retVal = ETrue; + } + + // Log setting value AFTER the change + #ifdef I__BROWSER_LOG_ENABLED + TInt postValue; + iRepository->Get( aKey, postValue ); + BROWSER_LOG( ( _L( "Postchange CenRep setting value: %d" ), postValue ) ); + #endif // I__BROWSER_LOG_ENABLED + + BROWSER_LOG( ( _L( "CBrowserPreferences::SetIntValueL returns %d" ), retVal ) ); + return retVal; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::GetStringValueL +// ---------------------------------------------------------------------------- +// +HBufC* CBrowserPreferences::GetStringValueL ( TUint32 aKey ) const + { +LOG_ENTERFN("CBrowserPreferences::GetStringValueL(TUint32)"); + HBufC* retVal = NULL; + TFileName value; + TInt err( KErrNotFound ); + + + if( iRepository ) + { + err = iRepository->Get( aKey, value ); + } + + if ( err == KErrNone ) + { + retVal = HBufC::NewL( value.Length() ); + TPtr ptr = retVal->Des(); + ptr.Copy ( value ); + } + + #ifdef _DEBUG + TPtrC logString = *retVal; + BROWSER_LOG( ( _L( "CBrowserPreferences::GetStringValueL returns %S" ), &logString ) ); + #endif // _DEBUG + + return retVal; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::GetStringValueL +// ---------------------------------------------------------------------------- +// +TInt CBrowserPreferences::GetStringValueL( + TUint32 aKey, TInt aMaxBufSize, + TDes& aBuf) const + { +LOG_ENTERFN("CBrowserPreferences::GetStringValueL(TUint32,TInt,TDes&)"); + // Not sure this works, but CRepository has no information about the return + // values of the methods. + // So dont know if iRepository->Get returns with an errorid on error,therefore + // error = iRepository->Get( aKey, ptr ) may not work. + TInt length( 256 ); + HBufC* value = HBufC::NewL( length ); + TPtr ptr = value->Des(); + TInt error; + + error = iRepository->Get( aKey, ptr ); + + for( length=length*2; (error==KErrTooBig) && (lengthDes(); + + error = iRepository->Get( aKey, ptr ); + } + if( error == KErrNone ) + { + aBuf.Zero(); + aBuf.Append( ptr ); + } + delete value; + + BROWSER_LOG( ( _L( "CBrowserPreferences::GetStringValueL(TUint32,TInt,TDes&) returns %d" ), + error ) ); + return error; + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetStringValueL +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::SetStringValueL( TUint32 aKey, const TDesC& aValue ) + { +LOG_ENTERFN("CBrowserPreferences::SetStringValueL"); + + // Log setting value BEFORE the change + #ifdef _DEBUG + TPtrC paramVal = aValue; + BROWSER_LOG( ( _L( "aValue %S" ), ¶mVal ) ); + HBufC* doNothing = HBufC::NewL( 512 ); + TPtr preChange = doNothing->Des(); + iRepository->Get( aKey, preChange ); + BROWSER_LOG( ( _L( "Prechange CenRep setting value: %S" ), &preChange ) ); + delete doNothing; + #endif // _DEBUG + + TBool retVal=EFalse; + + if ( iRepository && ( KErrNone == iRepository->Set( aKey, aValue ) ) ) + { + retVal = ETrue; + } + // Log setting value AFTER the change + #ifdef _DEBUG + HBufC* doNothing2 = HBufC::NewL( 512 ); + TPtr postChange = doNothing2->Des(); + iRepository->Get( aKey, postChange ); + + BROWSER_LOG( ( _L( "Postchange CenRep setting value: %S" ), &postChange ) ); + delete doNothing2; + #endif // _DEBUG + + BROWSER_LOG( ( _L( "CBrowserPreferences::SetStringValueL returns %d" ), retVal) ); + return retVal; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetOverridenSettingsL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetOverriddenSettingsL(TBrowserOverriddenSettings* aSettings) + { +LOG_ENTERFN("CBrowserPreferences::SetOverriddenSettingsL"); + + if( aSettings != NULL ) + { + TUint tempValue; + iOverriden = ETrue; + iOverridenSettings = aSettings; + + // Check overridden settings by looking at their default values + // (see how Launcher2 sets them in the OverriddenSettings constructor) + tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsCustomAp ); + if( tempValue != 0 ) + { + iAllPreferences.iAccessPointSelectionMode = EConnectionMethod; + iCustomAp = tempValue; + SetDefaultAccessPointL( iCustomAp ); + } + tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsAutoLoadImages ); + if( tempValue != KMaxTUint ) + { + iAllPreferences.iAutoLoadContent = tempValue; + } + + tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsFontSize ); + if( tempValue != EBrowserOverFontSizeLevelUndefined ) + { + iAllPreferences.iFontSize = tempValue; + } + tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsFullScreen ); + switch( tempValue ) + { + case KBrowserFullScreenSettingDataSoftkeysOff: + { + iAllPreferences.iFullScreen = EWmlSettingsFullScreenFullScreen; + break; + } + case KBrowserFullScreenSettingDataSoftkeysOn: + default: + { + iAllPreferences.iFullScreen = EWmlSettingsFullScreenSoftkeysOnly; + break; + } + } + } + return; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetEmbeddedModeL(TBool aEmbeddedMode) +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetEmbeddedModeL(TBool aEmbeddedMode) + { + LOG_ENTERFN("CBrowserPreferences::SetEmbeddedModeL"); + + iEmbeddedMode = aEmbeddedMode; + if( iEmbeddedMode /* && ApiProvider().StartedUp()*/ ) + { + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsEmbedded ); + } + return; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetMediaVolumeL( TInt aMediaVolume ) +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetMediaVolumeL( TInt aMediaVolume ) + { + LOG_ENTERFN("CBrowserPreferences::SetMediaVolumeL"); + + // Media Volume uses different SD ini. Revert to Browser SD ini after use + iAllPreferences.iMediaVolume = aMediaVolume; + SetIntValueL ( KBrowserMediaVolumeControl, iAllPreferences.iMediaVolume ); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetHomePageTypeL( TWmlSettingsHomePage aHomePageType ) +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetHomePageTypeL( TWmlSettingsHomePage aHomePageType ) + { + LOG_ENTERFN("CBrowserPreferences::SetHomePageTypeL"); + SetIntValueL( KBrowserNGHomepageType, aHomePageType ); + iAllPreferences.iHomePgType = aHomePageType; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetHomePageUrlL( TDesC& aHomePageURL ) +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetHomePageUrlL( const TDesC& aHomePageURL ) + { + LOG_ENTERFN("CBrowserPreferences::SetHomePageUrlL"); + + if( aHomePageURL.Length() ) + { + // Save the homepage with a scheme (default is http if not specified). + HBufC* temp = Util::AllocateUrlWithSchemeL( aHomePageURL ); + delete iAllPreferences.iHomePgURL; + iAllPreferences.iHomePgURL = temp; + SetStringValueL( KBrowserNGHomepageURL, + iAllPreferences.iHomePgURL->Des() ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetSearchPageUrlL( TDesC& aSearchPageURL ) +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetSearchPageUrlL( const TDesC& aSearchPageURL ) + { + LOG_ENTERFN("CBrowserPreferences::SetSearchPageUrlL"); + + // Save the searchpage with a scheme (default is http if not specified). + HBufC* temp = Util::AllocateUrlWithSchemeL( aSearchPageURL ); + delete iAllPreferences.iSearchPgURL; + iAllPreferences.iSearchPgURL = temp; + SetStringValueL( KBrowserNGSearchPageURL, + iAllPreferences.iSearchPgURL->Des() ); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::FlushSD() +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::FlushSD() + { + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::CustomAccessPointDefined() +// ---------------------------------------------------------------------------- +// +TBool CBrowserPreferences::CustomAccessPointDefined() + { +LOG_ENTERFN("CBrowserPreferences::CustomAccessPointDefined"); + TBool retval( iOverridenSettings && iCustomAp ); + BROWSER_LOG( ( _L( "CBrowserPreferences::CustomAccessPointDefined returns %d" ), + (TInt)retval ) ); + return retval; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SelfDownloadContentTypesL +// ---------------------------------------------------------------------------- +// +TPtrC CBrowserPreferences::SelfDownloadContentTypesL() + { +LOG_ENTERFN("CBrowserPreferences::SelfDownloadContentTypesL"); + + TInt error = KErrNone; + const TInt KLengthIncrement = 32; // 32 characters + TInt length = KLengthIncrement; // Initially KLengthIncrement + + do + { + HBufC* temp = HBufC::NewL( length ); + delete iSelfDownloadContentTypes; + iSelfDownloadContentTypes = temp; + TPtr ptr = iSelfDownloadContentTypes->Des(); + error = iRepository->Get( KBrowserSelfDownloadContentTypes, ptr ); + + if ( error == KErrOverflow ) + { + // Increase the size of the placeholder + length += KLengthIncrement; + } + } while ( error == KErrOverflow ); + + #ifdef _DEBUG + TPtrC logString = *iSelfDownloadContentTypes; + BROWSER_LOG( ( _L( "CBrowserPreferences::SelfDownloadContentTypesL returns %S" ), + &logString ) ); + #endif // _DEBUG + + return (*iSelfDownloadContentTypes); + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::AccessPointAlwaysAsk() +// ---------------------------------------------------------------------------- +// +TCmSettingSelectionMode CBrowserPreferences::AccessPointSelectionMode() + { +LOG_ENTERFN("CBrowserPreferences::AccessPointSelectionMode"); +BROWSER_LOG( ( _L( "CBrowserPreferences::AccessPointSelectionMode returns %d" ), + iAllPreferences.iAccessPointSelectionMode ) ); + return iAllPreferences.iAccessPointSelectionMode; + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetAccessPointSelectionModeL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetAccessPointSelectionModeL( + TCmSettingSelectionMode aAccessPointSelectionMode ) + { + LOG_ENTERFN("CBrowserPreferences::SetAccessPointSelectionModeL"); + + if ( aAccessPointSelectionMode != iAllPreferences.iAccessPointSelectionMode ) + { + iAllPreferences.iAccessPointSelectionMode = aAccessPointSelectionMode; + TUint32 cenrepKey; +#ifdef BRDO_OCC_ENABLED_FF + BROWSER_LOG( ( _L( " Setting OCC parameter " )) ); + cenrepKey= KBrowserOccAccessPointSelectionMode; +#else + cenrepKey = KBrowserAccessPointSelectionMode; +#endif + switch ( aAccessPointSelectionMode ) + { + case EAlwaysAsk: + { + SetIntValueL ( cenrepKey, EBrowserCenRepApSelModeAlwaysAsk ); + break; + } + case EDestination: + { + SetIntValueL ( cenrepKey, EBrowserCenRepApSelModeDestination ); + break; + } + case EConnectionMethod: + { + SetIntValueL ( cenrepKey, EBrowserCenRepApSelModeUserDefined ); + break; + } + default: + { + SetIntValueL ( cenrepKey, EBrowserCenRepApSelModeAlwaysAsk ); + break; + } + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetAutomaticUpdatingApL +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetAutomaticUpdatingApL( TUint aSetting ) + { + LOG_ENTERFN("CBrowserPreferences::SetAutomaticUpdatingApL"); + + iAllPreferences.iAutomaticUpdatingAP = aSetting; + SetIntValueL ( KBrowserNGAutomaticUpdatingAccessPoint, aSetting ); + } + + +void CBrowserPreferences::SetAutomaticUpdatingWhileRoamingL( TBool aAutoUpdateRoaming ) + { + LOG_ENTERFN("CBrowserPreferences::SetAutomaticUpdatingWhileRoamingL"); + if ( aAutoUpdateRoaming != iAllPreferences.iAutomaticUpdatingWhileRoaming ) + { + iAllPreferences.iAutomaticUpdatingWhileRoaming = aAutoUpdateRoaming; + SetIntValueL( KBrowserNGAutomaticUpdatingWhileRoaming, + iAllPreferences.iAutomaticUpdatingWhileRoaming ); + } + + } + + + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarOnOffL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarOnOffL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarOnOff ) + { + iAllPreferences.iToolbarOnOff = aCommand; + SetIntValueL( KToolbarOnOff, iAllPreferences.iToolbarOnOff ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarOnOff ); + } + } + + + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton1CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton1CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton1Cmd ) + { + iAllPreferences.iToolbarButton1Cmd = aCommand; + SetIntValueL( KToolbarButton1Cmd, iAllPreferences.iToolbarButton1Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton1Cmd ); + } + } + + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton2CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton2CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton2Cmd ) + { + iAllPreferences.iToolbarButton2Cmd = aCommand; + SetIntValueL( KToolbarButton2Cmd, iAllPreferences.iToolbarButton2Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton2Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton3CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton3CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton3Cmd ) + { + iAllPreferences.iToolbarButton3Cmd = aCommand; + SetIntValueL( KToolbarButton3Cmd, iAllPreferences.iToolbarButton3Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton3Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton4CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton4CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton4Cmd ) + { + iAllPreferences.iToolbarButton4Cmd = aCommand; + SetIntValueL( KToolbarButton4Cmd, iAllPreferences.iToolbarButton4Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton4Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton5CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton5CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton5Cmd ) + { + iAllPreferences.iToolbarButton5Cmd = aCommand; + SetIntValueL( KToolbarButton5Cmd, iAllPreferences.iToolbarButton5Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton5Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton6CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton6CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton6Cmd ) + { + iAllPreferences.iToolbarButton6Cmd = aCommand; + SetIntValueL( KToolbarButton6Cmd, iAllPreferences.iToolbarButton6Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton6Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetToolbarButton7CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetToolbarButton7CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iToolbarButton7Cmd ) + { + iAllPreferences.iToolbarButton7Cmd = aCommand; + SetIntValueL( KToolbarButton7Cmd, iAllPreferences.iToolbarButton7Cmd ); + + NotifyObserversL( EPreferencesItemChange, + TBrCtlDefs::ESettingsToolbarButton7Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey1CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey1CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey1Cmd ) + { + iAllPreferences.iShortcutKey1Cmd = aCommand; + SetIntValueL( KShortcutKey1Cmd, iAllPreferences.iShortcutKey1Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey2CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey2CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey2Cmd ) + { + iAllPreferences.iShortcutKey2Cmd = aCommand; + SetIntValueL( KShortcutKey2Cmd, iAllPreferences.iShortcutKey2Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey3CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey3CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey3Cmd ) + { + iAllPreferences.iShortcutKey3Cmd = aCommand; + SetIntValueL( KShortcutKey3Cmd, iAllPreferences.iShortcutKey3Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey4CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey4CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey4Cmd ) + { + iAllPreferences.iShortcutKey4Cmd = aCommand; + SetIntValueL( KShortcutKey4Cmd, iAllPreferences.iShortcutKey4Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey5CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey5CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey5Cmd ) + { + iAllPreferences.iShortcutKey5Cmd = aCommand; + SetIntValueL( KShortcutKey5Cmd, iAllPreferences.iShortcutKey5Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey6CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey6CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey6Cmd ) + { + iAllPreferences.iShortcutKey6Cmd = aCommand; + SetIntValueL( KShortcutKey6Cmd, iAllPreferences.iShortcutKey6Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey7CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey7CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey7Cmd ) + { + iAllPreferences.iShortcutKey7Cmd = aCommand; + SetIntValueL( KShortcutKey7Cmd, iAllPreferences.iShortcutKey7Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey8CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey8CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey8Cmd ) + { + iAllPreferences.iShortcutKey8Cmd = aCommand; + SetIntValueL( KShortcutKey8Cmd, iAllPreferences.iShortcutKey8Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey9CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey9CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey9Cmd ) + { + iAllPreferences.iShortcutKey9Cmd = aCommand; + SetIntValueL( KShortcutKey9Cmd, iAllPreferences.iShortcutKey9Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKey0CmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKey0CmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKey0Cmd ) + { + iAllPreferences.iShortcutKey0Cmd = aCommand; + SetIntValueL( KShortcutKey0Cmd, iAllPreferences.iShortcutKey0Cmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKeyStarCmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKeyStarCmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKeyStarCmd ) + { + iAllPreferences.iShortcutKeyStarCmd = aCommand; + SetIntValueL( KShortcutKeyStarCmd, iAllPreferences.iShortcutKeyStarCmd ); + } + } + +// --------------------------------------------------------- +// CBrowserPreferences::SetShortcutKeyHashCmdL() +// --------------------------------------------------------- +// +void CBrowserPreferences::SetShortcutKeyHashCmdL(TInt aCommand) + { + if ( aCommand != iAllPreferences.iShortcutKeyHashCmd ) + { + iAllPreferences.iShortcutKeyHashCmd = aCommand; + SetIntValueL( KShortcutKeyHashCmd, iAllPreferences.iShortcutKeyHashCmd ); + } + } + + +// ---------------------------------------------------------------------------- +// CBrowserPreferences::SetURLSuffixList +// ---------------------------------------------------------------------------- +// +void CBrowserPreferences::SetURLSuffixList( HBufC* aSetting ) + { + LOG_ENTERFN("CBrowserPreferences::SetUpdateHoursDefined"); + + SetStringValueL ( KBrowserUrlSuffix, aSetting->Des() ); + + TPtr ptr = iAllPreferences.iUrlSuffixList->Des(); + ptr.Copy( aSetting->Des() ); + } + +//Following function is specific for Search application. +//It will check if search application present in device and will turn the feature ON. +TInt CBrowserPreferences::GetSearchFeatureStatusL( TUint32 aKey, RApaLsSession& aLs) +{ + TInt aVal = EFalse; + //Search for 'Search' application. If its there then only enable feature, otherwise disable. + TApaAppInfo aInfo; + aLs.GetAppInfo(aInfo, TUid::Uid( KSearchAppUid )); + if(aInfo.iUid == TUid::Uid( KSearchAppUid )) + { + //Now, Turn on the Search feature. + aVal = ETrue; + } + //Set value to key; + SetIntValueL(aKey, aVal); + //Again Read if feature is enabled. + return GetIntValue(aKey); +} +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserProgressIndicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserProgressIndicator.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,493 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +// USER INCLUDES + +#include "Display.h" +#include "ApiProvider.h" +#include "CommonConstants.h" // for View Ids +#include "BrowserProgressIndicator.h" +#include "Logger.h" +#include "AknUtils.h" + +// CONSTANTS + +const TInt KGranularity = 4; +const TUint KkBLimit = 999; +const TUint KOnekB = 1024; +const TUint KOneMB = 1024 * 1024; +const TInt KMaxPercentage = 100; +const TInt KMBLimit = 10; +const TInt KMaxMBLimit = 100; +_LIT(text,"(%S) %S "); +_LIT(twoDecimals,"%2.2lf"); +_LIT(oneDecimal, "%2.1lf"); +_LIT(noDecimals, "%d"); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserProgressIndicator::NewL +// --------------------------------------------------------- +// +CBrowserProgressIndicator* CBrowserProgressIndicator::NewL( + MApiProvider& aApiProvider ) + { + CBrowserProgressIndicator* self = new (ELeave) + CBrowserProgressIndicator( aApiProvider ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::ConstructL +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::ConstructL() + { + iProgressData = new(ELeave) CArrayFixFlat( KGranularity ); + iInitialDownloadIndicatorState = EFalse; + + HBufC* myKb = StringLoader::LoadL( R_WML_UNIT_KB ); + iMyKb = myKb->Alloc(); + delete myKb; + + HBufC* myMb = StringLoader::LoadL( R_WML_UNIT_MB ); + iMyMb = myMb->Alloc(); + delete myMb; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::CBrowserProgressIndicator +// --------------------------------------------------------- +// +CBrowserProgressIndicator::CBrowserProgressIndicator( + MApiProvider& aApiProvider ) : + iIsRunning( EFalse ), + iApiProvider( aApiProvider ), + iLastMaxEstimate( 0 ), + iLastReceivedData( 0 ) + { + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::~CBrowserProgressIndicator +// --------------------------------------------------------- +// +CBrowserProgressIndicator::~CBrowserProgressIndicator() + { + delete iProgressData; + delete iMyKb; + delete iMyMb; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::AddTransActIdL +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::AddTransActIdL( TUint16 aId ) + { + //Format each id at start point. + AddProgressDataL(aId, 0, 0); + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::DeleteProgressDataItem +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::DeleteProgressDataItem( TUint16 aId ) + { + TKeyArrayFix key(0, ECmpTUint16); + TInt pos = 0; + TProgressData data; + data.iId = aId; + TInt retVal = iProgressData->Find( data,key,pos ); + if ( retVal == KErrNone ) + { + iProgressData->Delete( pos ); + } + + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::TransActIdAmount() +// --------------------------------------------------------- +// +TInt CBrowserProgressIndicator::TransActIdAmount() const + { + return iProgressData->Count(); + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::TransActIdAmountCompleted() +// --------------------------------------------------------- +// +TInt CBrowserProgressIndicator::TransActIdAmountCompleted() const + { + TInt numOfCompleted( 0 ); + TInt i; + for( i=0; iAt( i ).iComplete ) + ++numOfCompleted; + } + return numOfCompleted; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::ResetValues() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::ResetValues() + { + iProgressData->Reset(); + iProgressEstimate = 0; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::ReceivedData() +// --------------------------------------------------------- +// +TUint32 CBrowserProgressIndicator::ReceivedData() + { + TUint32 recvdData = 0; + for (TInt i = 0; i < iProgressData->Count();i++) + { + TProgressData data = iProgressData->At( i ); + recvdData += data.iRecvdData; + } + return recvdData; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::EstimateMaxData() +// --------------------------------------------------------- +// +TUint32 CBrowserProgressIndicator::EstimateMaxData() + { + TUint32 maxData = 0; + TInt count = 0; + TUint32 estimation = 0; + for ( TInt i = 0; i < iProgressData->Count();i++ ) + { + TProgressData data = iProgressData->At( i ); + if( data.iMaxData ) + { + maxData += data.iMaxData; + count++; + } + } + // estimate maximum data what will be received + if ( count ) + { + return estimation = ((maxData/count)* iProgressData->Count()); + } + + return estimation; + + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::TransActId() +// --------------------------------------------------------- +// +TUint16 CBrowserProgressIndicator::TransActId( TInt aIndex ) + { + return iProgressData->At( aIndex ).iId; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::AddProgressDataL() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::AddProgressDataL( + TUint16 aId, TUint32 aRecvdData, TUint32 aMaxData ) + { + //Try to seek if current id exist in array + TKeyArrayFix key(0, ECmpTUint16); + TInt pos = 0; + TProgressData data; + data.iId = aId; + TInt retVal = iProgressData->Find( data,key,pos ); + if ( retVal!=KErrNone ) //id was NOT found + { + //Add id, recvdData and maxData to array + TProgressData data; + data.iId = aId; + data.iRecvdData = aRecvdData; + data.iMaxData = aMaxData; + data.iComplete = EFalse; + iProgressData->AppendL( data ); + } + else + { + + data = iProgressData->At( pos ); + if( ((data.iRecvdData != aRecvdData) && aRecvdData!=0 ) ) + { + data.iRecvdData = aRecvdData; + } + if ( aMaxData!=0 ) + { + data.iMaxData = aMaxData; + } + + iProgressData->Delete( pos ); + iProgressData->InsertL( pos,data ); + } + } + + +// --------------------------------------------------------- +// CBrowserProgressIndicator::TransActIdCompleteL() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::TransActIdCompleteL( TUint16 aId ) + { + TKeyArrayFix key( 0, ECmpTUint16 ); + TInt pos = 0; + TProgressData data; + data.iId = aId; + TInt retVal = iProgressData->Find( data,key,pos ); + if ( retVal == KErrNone && ! iProgressData->At(pos).iComplete ) + { + data = iProgressData->At( pos ); + // we don't need this id anymore if both data values are empty + if ( !data.iMaxData && !data.iRecvdData ) + { + iProgressData->Delete( pos ); + } + else + { + data.iComplete = ETrue; + if ( data.iMaxData > data.iRecvdData ) + { + data.iRecvdData = data.iMaxData; + } + iProgressData->Delete( pos ); + iProgressData->InsertL( pos,data ); + } + } + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::EnquireStatusL() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::EnquireStatusL() + { +LOG_ENTERFN("EnquireStatusL"); + // Reset string storage. + iPercentText.SetLength( 0 ); + iDataText.SetLength( 0 ); + iMBvalue.SetLength( 0 ); + + TUint32 receivedData = ReceivedData(); + TUint32 maxEstimate = EstimateMaxData(); + + if (receivedData == 0 || maxEstimate == 0) + { + // fake initial progress to reflect 5% downloaded and 0 kb received. + receivedData = 5; + maxEstimate = 100; + } + + //Calculate either kB-text or MB-text + if ( ((receivedData)/KOnekB ) <= KkBLimit ) + { + HBufC* kbUnit = HBufC::NewL( iMyKb->Length()+5 ); + TPtr ptr1( kbUnit->Des() ); + StringLoader::Format( ptr1, *iMyKb, -1, (receivedData)/KOnekB ); + AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr1); + iDataText.Copy( ptr1 ); + delete kbUnit; + } + else + { + + TReal received( receivedData ); + TReal oneMB( KOneMB ); + TReal result( received / oneMB ); + // TUint32 result( receivedData / KOneMB ); + if ( result < KMBLimit ) + { + // TUint32 res2( ( ( receivedData * 100 ) / KOneMB ) % 100 ); + // need to modify the format string too + iMBvalue.Format( twoDecimals, result ); + } + else if ( result < KMaxMBLimit ) + { + // TUint32 res2( ( ( receivedData * 10 ) / KOneMB ) % 10 ); + // need to modify the format string too + iMBvalue.Format( oneDecimal, result ); + } + else if ( result > KMaxMBLimit) + { + TInt16 resultInt( 0 ); + Math::Int( resultInt, result ); + iMBvalue.Format( noDecimals, resultInt ); + } + HBufC* mbUnit = HBufC::NewL( iMyMb->Length() + iMBvalue.Length() + 1 ); + TPtr ptr1( mbUnit->Des() ); + StringLoader::Format( ptr1, *iMyMb, -1, iMBvalue ); + AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr1); + iDataText.Copy( ptr1 ); + delete mbUnit; + } + + // progress animation should be shown only in content view (not in bookmarks) + if( iApiProvider.LastActiveViewId() == KUidBrowserContentViewId ) + { + // Check all possible states. + if ( !iInitialDownloadIndicatorState && maxEstimate <= 0 ) + { + iInitialDownloadIndicatorState = ETrue; + // The initial indicator state changed from EFalse to ETrue. Update it. + iApiProvider.Display().UpdateFSDownloadInitialIndicator( ETrue ); + } + else if ( !iInitialDownloadIndicatorState && 0 < maxEstimate ) + { + //iInitialDownloadIndicatorState = EFalse; // Unnecessary statement. + } + else if ( iInitialDownloadIndicatorState && maxEstimate <= 0 ) + { + //iInitialDownloadIndicatorState = ETrue; // Unnecessary statement. + } + else if ( iInitialDownloadIndicatorState && 0 < maxEstimate ) + { + iInitialDownloadIndicatorState = EFalse; + // The initial indicator state changed from ETrue to EFalse. Update it. + iApiProvider.Display().UpdateFSDownloadInitialIndicator( EFalse ); + } + + iApiProvider.Display().UpdateFSProgressIndicator( maxEstimate, receivedData ); + + // Render the downloaded data size. + iApiProvider.Display().UpdateFSProgressDataL( iDataText ); + } + else + { + // is this section really run? + + // Show how many percentage has been dowloaded + if ( maxEstimate ) + { + TReal received( receivedData ); + TReal maxEst( maxEstimate ); + TReal factor( 100 ); + TReal percentage( (received / maxEst) * factor ); + TInt16 percentInt( 0 ); + Math::Int( percentInt, percentage ); + if ( percentInt > KMaxPercentage ) + { + percentInt = KMaxPercentage; + } + HBufC* percentUnit = + StringLoader::LoadLC( R_WML_UNIT_PERCENT, percentInt ); + iPercentText.Format( text, percentUnit, &iDataText ); + CleanupStack::PopAndDestroy( percentUnit ); //percentUnit + + //Update navi pane + iApiProvider.UpdateNaviPaneL( iPercentText ); + } + //Show amount of downloaded data (recvd data) + //(if maximum data is not available) + else + { + iApiProvider.UpdateNaviPaneL( iDataText ); + } + } + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::StartL() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::StartL() + { + if ( !iIsRunning ) + { + // clear progress bar data + iLastMaxEstimate = 0; + iLastReceivedData = 0; + + // progress animation should be shown + // only in content view (not in bookmarks) + if( iApiProvider.LastActiveViewId() == KUidBrowserContentViewId ) + { + //Start progress bar + NotifyProgress(); + + iInitialDownloadIndicatorState = ETrue; + iApiProvider.Display().UpdateFSDownloadInitialIndicator( ETrue ); + // Show initially 0 kB as downloaded size. + HBufC* kbUnit = HBufC::NewL( iMyKb->Length()+5 ); + TPtr ptr1( kbUnit->Des() ); + StringLoader::Format( ptr1, *iMyKb, -1, 0 ); + iDataText.Copy( ptr1 ); + delete kbUnit; + iApiProvider.Display().UpdateFSProgressDataL( iDataText ); + } + + iIsRunning = ETrue; + } + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::StopL() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::StopL() + { + if( iApiProvider.LastActiveViewId() == KUidBrowserContentViewId ) + { + ResetValues(); + if( iInitialDownloadIndicatorState ) + { + iInitialDownloadIndicatorState = EFalse; + iApiProvider.Display(). + UpdateFSDownloadInitialIndicator( EFalse ); + } + iApiProvider.Display().RestoreTitleL(); + } + iIsRunning = EFalse; + } + +// --------------------------------------------------------- +// CBrowserProgressIndicator::NotifyProgress() +// --------------------------------------------------------- +// +void CBrowserProgressIndicator::NotifyProgress() + { + // Unfortunately we could not eliminate TRAP. The Engine cannot + // support a leavable NotifyProgressL() function. + TRAP_IGNORE( EnquireStatusL() ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserPushMtmObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserPushMtmObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CBrowserPushMtmObserver +* +*/ + + +// INCLUDE FILES +#include "BrowserPushMtmObserver.h" +#include "ApiProvider.h" +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include "Logger.h" + + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS +// file monitored by browser +_LIT( KPushMtmUrl, "c:\\system\\temp\\PushMtmUrl.txt" ); + +// MACROS + +// LOCAL CONSTANTS AND MACROS + +// MODULE DATA STRUCTURES + +// LOCAL FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::CBrowserPushMtmObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBrowserPushMtmObserver::CBrowserPushMtmObserver(MApiProvider* aApiProvider) : CActive( CActive::EPriorityIdle ), +iApiProvider(aApiProvider) + { + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBrowserPushMtmObserver::ConstructL() + { + LOG_ENTERFN("CBrowserPushMtmObserver::ConstructL"); + User::LeaveIfError(iFsSession.Connect()); + } + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBrowserPushMtmObserver* CBrowserPushMtmObserver::NewL( MApiProvider* aApiProvider ) + { + CBrowserPushMtmObserver* self = new( ELeave ) CBrowserPushMtmObserver(aApiProvider); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// Destructor +CBrowserPushMtmObserver::~CBrowserPushMtmObserver() + { + Cancel(); + iFsSession.Close(); + } + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::RunL +// +// ----------------------------------------------------------------------------- +// +void CBrowserPushMtmObserver::RunL() + { + LOG_ENTERFN("CBrowserPushMtmObserver::RunL"); + HBufC8* url8 = NULL; + TRAP_IGNORE( url8 = ReadMsgFileL() ); + StartObserver(); + if( url8 != NULL ) + { + CleanupStack::PushL( url8 ); + CBrowserAppUi* appUi = STATIC_CAST(CBrowserAppUi*, iApiProvider); + appUi->ParseAndProcessParametersL( url8->Des() ); + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::RunL appUi->ParseAndProcessParametersL with url8: %S" ), url8 )); + appUi->SetLastActiveViewId( KUidBrowserContentViewId ); + appUi->SetViewToBeActivatedIfNeededL( appUi->LastActiveViewId() ); + // view activation and bringing the browser to foreground are two + // distinct actions. + appUi->ActivateLocalViewL( KUidBrowserContentViewId ); + appUi->HandleForegroundEventL( ETrue ); + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::RunL appUi->HandleForegroundEventL") )); + CleanupStack::PopAndDestroy(/*url8*/); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::RunError +// +// ----------------------------------------------------------------------------- +// +TInt CBrowserPushMtmObserver::RunError(TInt /*aError*/) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::DoCancel +// +// ----------------------------------------------------------------------------- +// +void CBrowserPushMtmObserver::DoCancel() + { + iFsSession.NotifyChangeCancel(iStatus); + } + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::StartObserver +// +// ----------------------------------------------------------------------------- +// +void CBrowserPushMtmObserver::StartObserver() + { + LOG_ENTERFN("CBrowserPushMtmObserver::StartObserver"); + if (!IsActive()) + { + iFsSession.NotifyChange( ENotifyWrite, iStatus, KPushMtmUrl() ); + SetActive(); + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::StartObserver iFsSession.NotifyChange") )); + } + } + + +// ----------------------------------------------------------------------------- +// CBrowserPushMtmObserver::ReadMsgFileL +// +// ----------------------------------------------------------------------------- +// +HBufC8* CBrowserPushMtmObserver::ReadMsgFileL() + { + LOG_ENTERFN("CBrowserPushMtmObserver::ReadMsgFileL"); + + RFs rfs; + RFile file; + TInt size; + HBufC8* buffer = NULL; + TPtr8 bufferPtr(NULL, 0); + TInt err = KErrNone; + + // Open the file. + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + + TInt tryCount = 0; + for (tryCount = 0; tryCount < 5; tryCount++) + { + err = file.Open( rfs, KPushMtmUrl, EFileRead | EFileShareExclusive ); + if (err == KErrInUse) + { + // wait 50 miliseconds and try again + User::After(50000); + } + else + { + break; + } + } + + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::ReadMsgFileL file.Open return: %d" ), err )); + User::LeaveIfError( err ); + CleanupClosePushL(file); + + // Read file + err = file.Size(size); + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::ReadMsgFileL file.Size: %d, err: %d" ), size, err )); + User::LeaveIfError( err ); + + buffer = HBufC8::NewLC(size); + bufferPtr.Set(buffer->Des()); + + err = file.Read( bufferPtr, size ); + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::ReadMsgFileL file.Read: %d" ), err )); + User::LeaveIfError( err ); + + // Clean up. + CleanupStack::Pop(/*buffer*/); + CleanupStack::PopAndDestroy(/*file*/); + + // don't need to leave due to this error + err = rfs.Delete( KPushMtmUrl ); + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::ReadMsgFileL rfs.Delete: %d" ), err )); + CleanupStack::PopAndDestroy(/*rfs*/); + + BROWSER_LOG( (_L( "CBrowserPushMtmObserver::ReadMsgFileL return: %S" ), buffer )); + return buffer; + } + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserShortcutKeyMap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserShortcutKeyMap.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,855 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Browser View +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "BrowserShortcutKeyMap.h" +#include "BrowserContentViewContainer.h" +#include "BrowserPreferences.h" +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include "ApiProvider.h" +#include "BrowserUIVariant.hrh" +#include "BrowserAppUi.h" +#include + +// CONSTANTS +_LIT( KKeyMapSvgFile, "browser.mif" ); + +// Value table for 70% Transparency +const TInt KTransparency[256] = + { + 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, + 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, + 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, + 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, + 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, + 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, + 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, + 41, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, + 46, 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, + 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, + 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, + 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, + 68, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 73, + 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77 + }; + + +// keymap is 3x4 +#define KNumCellsX 3 +#define KNumCellsY 4 +#define KNumCells 12 + +// spacing in pixels for scroll bars +#define KKeymapHScrollbarSize 4 +#define KKeymapVScrollbarSize 4 + +// sizing for entire keymap (not counting scrollbar) +// as a percentage of vertical and horizontal screen size +#define KKeymapVSize 0.90 +#define KKeymapHSize 0.90 + +// margins for each cell +#define KCellTopMargin 2 +#define KCellRightMargin 5 +#define KCellBotMargin 2 +#define KCellLeftMargin 5 + +// Create constant icon assignments for each command +// note that this follows TShortcutsCommandDecodeEntry in BrowserPreferences.h + +typedef const TInt TShortcutsIconAndTextDecodeEntry[2]; + +#define KShortcutsIconAndTextAssignmentSize 22 +#define KShortcutsIconAndTextDecodeMatrixText 0 // First entry is the Text +#define KShortcutsIconAndTextDecodeMatrixIcon 1 // Second entry is the Icon + +static const TShortcutsIconAndTextDecodeEntry KShortcutsIconAndTextAssignmentMatrix[] = +{ + /* 0 EWmlNoCmd, */ { R_BROWSER_KEYMAP_TEXT_NONE, EMbmBrowserQgn_indi_browser_tb_key_map }, + /* 1 EWmlCmdHelp, */ { R_BROWSER_KEYMAP_TEXT_SHOW_HELP, EMbmBrowserQgn_indi_browser_tb_help }, + /* 2 EWmlCmdSwitchWindow, */ { R_BROWSER_KEYMAP_TEXT_SWITCH_WINDOW, EMbmBrowserQgn_indi_browser_tb_switch_win }, + /* 3 EWmlCmdSavePage, */ { R_BROWSER_KEYMAP_TEXT_SAVE_PAGE, EMbmBrowserQgn_indi_browser_tb_save_page }, + /* 4 EWmlCmdShowImages, */ { R_BROWSER_KEYMAP_TEXT_VIEW_IMAGES, EMbmBrowserQgn_indi_browser_tb_view_images }, + /* 5 EWmlCmdHistory, */ { R_BROWSER_KEYMAP_TEXT_VISUAL_HISTORY, EMbmBrowserQgn_indi_browser_tb_view_pages }, + /* 6 EWmlCmdFavourites, */ { R_BROWSER_KEYMAP_TEXT_MANAGE_BOOKMARKS, EMbmBrowserQgn_indi_browser_tb_bm }, + /* 7 EWmlCmdShowSubscribeList, */ { R_BROWSER_KEYMAP_TEXT_SUBSCRIBE_TO_FEEDS, EMbmBrowserQgn_indi_browser_tb_rss }, + /* 8 EWmlCmdRotateDisplay, */ { R_BROWSER_KEYMAP_TEXT_ROTATE_SCREEN, EMbmBrowserQgn_indi_browser_tb_rotate }, + /* 9 EWmlCmdPreferences, */ { R_BROWSER_KEYMAP_TEXT_SETTINGS, EMbmBrowserQgn_indi_browser_tb_settings }, + /* 10 EWmlCmdZoomOut, */ { R_BROWSER_KEYMAP_TEXT_ZOOM_OUT, EMbmBrowserQgn_indi_browser_tb_zoom_out }, + /* 11 EWmlCmdZoomIn, */ { R_BROWSER_KEYMAP_TEXT_ZOOM_IN, EMbmBrowserQgn_indi_browser_tb_zoom_in }, + /* 12 EWmlCmdLaunchHomePage, */ { R_BROWSER_KEYMAP_TEXT_GO_TO_HOMEPAGE, EMbmBrowserQgn_indi_browser_tb_home }, + /* 13 EWmlCmdOneStepBack, */ { R_BROWSER_KEYMAP_TEXT_PREVIOUS_PAGE, EMbmBrowserQgn_indi_browser_tb_back }, + /* 14 EWmlCmdShowMiniature, */ { R_BROWSER_KEYMAP_TEXT_MINIATURE_SHOW, EMbmBrowserQgn_indi_browser_tb_page }, + /* 15 EWmlCmdReload, */ { R_BROWSER_KEYMAP_TEXT_RELOAD, EMbmBrowserQgn_indi_browser_tb_reload }, + /* 16 EWmlCmdFindKeyword, */ { R_BROWSER_KEYMAP_TEXT_FIND_KEYWORD, EMbmBrowserQgn_indi_browser_tb_find_kw }, + /* 17 EWmlCmdSaveAsBookmark, */ { R_BROWSER_KEYMAP_TEXT_SAVE_AS_BOOKMARK, EMbmBrowserQgn_indi_browser_tb_save_bm }, + /* 18 EWmlCmdGoToAddress, */ { R_BROWSER_KEYMAP_TEXT_GO_TO_WEB_ADDRESS, EMbmBrowserQgn_indi_browser_tb_goto }, + /* 19 EWmlCmdShowToolBar, */ { R_BROWSER_KEYMAP_TEXT_SHOW_TOOLBAR, EMbmBrowserQgn_indi_browser_tb_tb }, + /* 20 EWmlCmdShowShortcutKeymap, */ { R_BROWSER_KEYMAP_TEXT_SHOW_KEYMAP, EMbmBrowserQgn_indi_browser_tb_key_map }, + /* 21 EWmlCmdEnterFullScreenBrowsing, */ { R_BROWSER_KEYMAP_TEXT_FULL_SCREEN, EMbmBrowserQgn_indi_button_exit_fs }, +}; + +// key assignments +static const TInt KDialpadAssignments[] = +{ + /* 0 */ R_BROWSER_KEYMAP_KEY0, + /* 1 */ R_BROWSER_KEYMAP_KEY1, + /* 2 */ R_BROWSER_KEYMAP_KEY2, + /* 3 */ R_BROWSER_KEYMAP_KEY3, + /* 4 */ R_BROWSER_KEYMAP_KEY4, + /* 5 */ R_BROWSER_KEYMAP_KEY5, + /* 6 */ R_BROWSER_KEYMAP_KEY6, + /* 7 */ R_BROWSER_KEYMAP_KEY7, + /* 8 */ R_BROWSER_KEYMAP_KEY8, + /* 9 */ R_BROWSER_KEYMAP_KEY9, + /* 10 */ R_BROWSER_KEYMAP_KEY10, + /* 11 */ R_BROWSER_KEYMAP_KEY11 +}; + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TKeymapCellData::TKeymapCellData +// TKeymapCellData Utility Class constructor +// ----------------------------------------------------------------------------- + +TKeymapCellData::TKeymapCellData() : + keyText(NULL), + lineText(NULL), + cmdRscId(NULL), + keyBitmapImage(NULL), + keyBitmapMask(NULL) + { + } + + +// ----------------------------------------------------------------------------- +// TKeymapCellData::TKeymapCellData +// TKeymapCellData Utility Class destructor +// ----------------------------------------------------------------------------- +TKeymapCellData::~TKeymapCellData() + { + if(keyText) delete keyText; + if(lineText) delete lineText; + if(keyBitmapImage) delete keyBitmapImage; + if(keyBitmapMask) delete keyBitmapMask; + } + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::NewL +// The two-phase Symbian constructor +// ----------------------------------------------------------------------------- +// +CBrowserShortcutKeyMap* CBrowserShortcutKeyMap::NewL( CBrowserContentViewContainer* aContentViewContainer, MApiProvider& aApiProvider ) + { + CBrowserShortcutKeyMap* self = new (ELeave) CBrowserShortcutKeyMap( aContentViewContainer, aApiProvider ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; + } + + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CBrowserShortcutKeyMap::~CBrowserShortcutKeyMap() + { + // Close out array and delete data members + iCellData.Close(); + + // cleanup svg mbm file name + if(iSvgMbmFile) + { + delete iSvgMbmFile; + iSvgMbmFile = NULL; + } + + // Cleanup Sprite data + iSprite.Close(); + if(iSpriteBitmapDevice) + { + delete iSpriteBitmapDevice; + iSpriteBitmapDevice = NULL; + } + if(iSpriteBitmapContext) + { + delete iSpriteBitmapContext; + iSpriteBitmapContext = NULL; + } + if(iSpriteBitmap) + { + delete iSpriteBitmap; + iSpriteBitmap = NULL; + } + + if(iSpriteMaskBitmapDevice) + { + delete iSpriteMaskBitmapDevice; + iSpriteMaskBitmapDevice = NULL; + } + if(iSpriteMaskBitmapContext) + { + delete iSpriteMaskBitmapContext; + iSpriteMaskBitmapContext = NULL; + } + if(iSpriteMaskBitmap) + { + delete iSpriteMaskBitmap; + iSpriteMaskBitmap = NULL; + } + + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::CBrowserShortcutKeyMap +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBrowserShortcutKeyMap::CBrowserShortcutKeyMap( CBrowserContentViewContainer* aContentViewContainer, MApiProvider& aApiProvider ) + : iContentViewContainer( aContentViewContainer ), iApiProvider( aApiProvider ) + { + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::ConstructL +// The constructor that can contain code that might leave. +// ----------------------------------------------------------------------------- +// +void CBrowserShortcutKeyMap::ConstructL() + { + //LoadResourceFileL(); + iSvgMbmFile = GetCannedImageDirL(); + iSvgMbmFile->Des().Append( KKeyMapSvgFile ); + + InitKeymap(); + CreateBitmapAndContextL(); + ConstructSprite(); + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::InitKeymap +// Initialize Keymap properties +// ----------------------------------------------------------------------------- +// +void CBrowserShortcutKeyMap::InitKeymap() + { + // derive keymap's size from the container's size + iTargetRect = iContentViewContainer->Rect(); + + // resize it to account for scrollbar width/height + iTargetRect.Resize(-TSize(KKeymapHScrollbarSize,KKeymapVScrollbarSize)); + + TBool landscape = iTargetRect.Size().iWidth > iTargetRect.Size().iHeight ; + + // + // derive shrink amounts based on keymap size constants and shrink the rect + // + TInt newHeight = (KKeymapVSize * iTargetRect.Size().iHeight); + TInt newWidth = (KKeymapHSize * iTargetRect.Size().iWidth); + + if(newWidth > KKeymapHSize * iTargetRect.Size().iWidth) + { + newWidth = (KKeymapHSize * iTargetRect.Size().iWidth); + } + + // shrink the height and width slightly + // as necessary to be evenly divisible by the rows/cols later on + TReal remainder; + TInt result; + result = Math::Mod(remainder,newWidth,KNumCellsX); + if((result == KErrNone) && (remainder != 0)) + { + newWidth -= remainder; + } + result = Math::Mod(remainder,newHeight,KNumCellsY); + if((result == KErrNone) && (remainder != 0)) + { + newHeight -= remainder; + } + TInt hShrink = (iTargetRect.Size().iWidth - newWidth)/2; + TInt vShrink = (iTargetRect.Size().iHeight - newHeight)/2; + iTargetRect.Shrink(TSize(hShrink,vShrink)); + + // Set font types + iLineFont = LatinPlain12(); + + if (landscape) + { // in landscape need to shrink the font or else it gets clipped + iKeyFont = LatinBold13(); + } + else + { + iKeyFont = LatinBold16(); + } + + // init cell data + InitCellDataL(); + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::InitCellDataL +// Initialize Keymap data kept for each cell of the map +// ----------------------------------------------------------------------------- + +void CBrowserShortcutKeyMap::InitCellDataL() + { + for(TInt i = 0; i < KNumCells; i++) + { + TKeymapCellData* cellData = new (ELeave) TKeymapCellData(); + CleanupStack::PushL(cellData); + + TInt shortcutAssign; + + // get the shortcut assignment from Browser Prefs + switch(i) + { + case 0: + shortcutAssign = iApiProvider.Preferences().ShortcutKey1Cmd(); + break; + case 1: + shortcutAssign = iApiProvider.Preferences().ShortcutKey2Cmd(); + break; + case 2: + shortcutAssign = iApiProvider.Preferences().ShortcutKey3Cmd(); + break; + case 3: + shortcutAssign = iApiProvider.Preferences().ShortcutKey4Cmd(); + break; + case 4: + shortcutAssign = iApiProvider.Preferences().ShortcutKey5Cmd(); + break; + case 5: + shortcutAssign = iApiProvider.Preferences().ShortcutKey6Cmd(); + break; + case 6: + shortcutAssign = iApiProvider.Preferences().ShortcutKey7Cmd(); + break; + case 7: + shortcutAssign = iApiProvider.Preferences().ShortcutKey8Cmd(); + break; + case 8: + shortcutAssign = iApiProvider.Preferences().ShortcutKey9Cmd(); + break; + case 9: + shortcutAssign = iApiProvider.Preferences().ShortcutKeyStarCmd(); + break; + case 10: + shortcutAssign = iApiProvider.Preferences().ShortcutKey0Cmd(); + break; + case 11: + shortcutAssign = iApiProvider.Preferences().ShortcutKeyHashCmd(); + break; + default: + shortcutAssign = iApiProvider.Preferences().ShortcutKey1Cmd(); + break; + } + + cellData->cmdRscId = KShortcutsIconAndTextAssignmentMatrix[shortcutAssign][KShortcutsIconAndTextDecodeMatrixText]; + cellData->lineText = StringLoader::LoadLC(cellData->cmdRscId); + + // get shortcut key assignments and set dialpad assignments + cellData->keyText = StringLoader::LoadLC(KDialpadAssignments[i]); + + // load the icon its mask (use a default if we're out of range) + TInt iconId = EMbmBrowserQgn_indi_browser_tb_key_map; + if(shortcutAssign < KShortcutsIconAndTextAssignmentSize) + { + iconId = KShortcutsIconAndTextAssignmentMatrix[shortcutAssign][KShortcutsIconAndTextDecodeMatrixIcon]; + } + + if(shortcutAssign == NULL) + { + cellData->keyBitmapImage = NULL; + cellData->keyBitmapMask = NULL; + } + else + { + LoadSvg(iconId, + *iSvgMbmFile, + cellData->keyBitmapImage, + cellData->keyBitmapMask); + } + + // add to the data array + iCellData.Append(cellData); + + // remove cellData, keytext, linetext from stack + CleanupStack::Pop(3); + } + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::CreateBitmapAndContextL +// Create the bitmap and context that will be used for the sprite +// ----------------------------------------------------------------------------- +// +void CBrowserShortcutKeyMap::CreateBitmapAndContextL() + { + // Create Sprite Bitmap + iSpriteBitmap = new (ELeave) CFbsBitmap; + User::LeaveIfError( iSpriteBitmap->Create( iTargetRect.Size(), EColor16MA ) ); + + iSpriteBitmapDevice = CFbsBitmapDevice::NewL( iSpriteBitmap ); + User::LeaveIfError( iSpriteBitmapDevice->CreateContext( iSpriteBitmapContext ) ); + + // Create Mask Bitmap + iSpriteMaskBitmap = new (ELeave) CFbsBitmap; + User::LeaveIfError( iSpriteMaskBitmap->Create( iTargetRect.Size(), EColor16MA ) ); + iSpriteMaskBitmapDevice = CFbsBitmapDevice::NewL( iSpriteMaskBitmap ); + User::LeaveIfError( iSpriteMaskBitmapDevice->CreateContext( iSpriteMaskBitmapContext ) ); + + TRect r( TPoint( 0, 0 ), iSpriteMaskBitmap->SizeInPixels()); + + iSpriteMaskBitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush ); + iSpriteMaskBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen ); + iSpriteMaskBitmapContext->SetBrushColor( TRgb( 0, 0, 0) ); + iSpriteMaskBitmapContext->SetPenColor( TRgb( 0, 0, 0) ); + iSpriteMaskBitmapContext->DrawRect(r); + + // Draw the rectangular outline + iSpriteBitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush ); + iSpriteBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen ); + iSpriteBitmapContext->SetBrushColor( TRgb( 242, 244, 242) ); + iSpriteBitmapContext->SetPenColor( TRgb( 100, 100, 0) ); + iSpriteBitmapContext->SetPenSize( TSize(2,2) ); + iSpriteBitmapContext->DrawRect(r); + + TSize cellSize(r.Width()/KNumCellsX,r.Height()/KNumCellsY); + + for(TInt i = 0; i < KNumCellsY; i++) + { + for(TInt j = 0; j < KNumCellsX; j++) + { + TInt cellIndex(i*KNumCellsX + j); + CreateCellLayout( cellIndex, TPoint(j*cellSize.iWidth,i*cellSize.iHeight),cellSize); + CreateSpriteCellL( cellIndex ); + } + } + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::CreateCellLayout +// Calculate the layout of the sprite rects for a given cell +// ----------------------------------------------------------------------------- + +void CBrowserShortcutKeyMap::CreateCellLayout(const TInt& aCellIndex, const TPoint& aUpperL, const TSize& aSize) + { + // Create pointer for easy access curr Cell + TKeymapCellData* pCurrCell = iCellData[aCellIndex]; + + // Create rect for Cell + pCurrCell->r.SetRect(aUpperL, aSize); + + // Internally, Our Cell is sized accounting for margin + // Setup this + TPoint marginOffset(KCellLeftMargin, KCellTopMargin); + TSize marginSize(KCellLeftMargin + KCellRightMargin, KCellTopMargin + KCellBotMargin); + pCurrCell->rCell.SetRect( aUpperL + marginOffset, aSize - marginSize ); + + // Upper LH key indicator + TInt keyFontHeight = iKeyFont->HeightInPixels() + iKeyFont->DescentInPixels(); + pCurrCell->rKey.SetRect( pCurrCell->rCell.iTl, TSize(keyFontHeight, iKeyFont->MaxCharWidthInPixels()) ); + + // Prep the line rects, calculating the position based upon the font size + TInt lineFontHeight = iLineFont->HeightInPixels() + iLineFont->DescentInPixels(); + TSize lineSize(pCurrCell->rCell.Width(),lineFontHeight); + TPoint lineAreaUpperLH(pCurrCell->rCell.iTl.iX, pCurrCell->rCell.iBr.iY - (2*lineSize.iHeight)); + + // Set this point to be the upper left of the line(s) of text. + // If we have two lines, this will be the upperLH of Line1 + // If we have one line, this will be the upperLH of Line2 + // This, we will use to set the rect size of the icon later + pCurrCell->rLine1.SetRect(lineAreaUpperLH,lineSize); + pCurrCell->rLine2.SetRect(lineAreaUpperLH + TPoint(0,lineSize.iHeight),lineSize); + TPoint linesUpperLH = pCurrCell->rLine1.iTl; + + // CREATE the icon area from what is left over + TPoint iconUpperLH(pCurrCell->rCell.iTl + TPoint(pCurrCell->rKey.Size().iWidth,0)); + TPoint iconLowerRH(pCurrCell->rCell.iBr.iX,linesUpperLH.iY); + pCurrCell->rIcon.SetRect(iconUpperLH,iconLowerRH); + + // resize the icon rect to be square if its not already... according to its smallest dimension + if(pCurrCell->rIcon.Height() > pCurrCell->rIcon.Width()) + { + TSize sizeChange(0,pCurrCell->rIcon.Width() - pCurrCell->rIcon.Height()); + pCurrCell->rIcon.Resize(sizeChange); + pCurrCell->rIcon.Move(TPoint(0,-sizeChange.iHeight/2)); + } + else if(pCurrCell->rIcon.Width() > pCurrCell->rIcon.Height()) + { + TSize sizeChange(pCurrCell->rIcon.Height() - pCurrCell->rIcon.Width(),0); + pCurrCell->rIcon.Resize(sizeChange); + pCurrCell->rIcon.Move(TPoint(-sizeChange.iWidth/2,0)); + } + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::CreateSpriteCellL +// Draw the sprite rects to the sprite bitmap +// ---------------------------------------------------------------------------- + +void CBrowserShortcutKeyMap::CreateSpriteCellL(const TInt& aCellIndex) + { + // Create pointer for easy access curr Cell + TKeymapCellData* pCurrCell = iCellData[aCellIndex]; + + TBool ShowDim = EFalse; + + + // Draw rect for Cell + iSpriteBitmapContext->SetPenSize( TSize(1,1) ); + iSpriteBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen ); + iSpriteBitmapContext->SetPenColor( TRgb( 0, 0, 0) ); + iSpriteBitmapContext->DrawRect(pCurrCell->r); + + + + // DRAW TEXT + iSpriteBitmapContext->SetPenColor( TRgb( 0, 0, 0) ); + + // Draw key text + if(pCurrCell->keyText) + { + iSpriteBitmapContext->UseFont( iKeyFont ); + iSpriteBitmapContext->DrawText(pCurrCell->keyText->Des(), + pCurrCell->rKey, iKeyFont->FontMaxHeight(), CGraphicsContext::ECenter, 0); + } + + // For line1, line2 text, we need to first wrap them + // based upon the width of their enclosing rectangles + if(pCurrCell->lineText) + { + CArrayFixFlat *lineWidthArray = new( ELeave ) CArrayFixFlat(2); + lineWidthArray->AppendL(pCurrCell->rLine1.Width()); + lineWidthArray->AppendL(pCurrCell->rLine2.Width()); + + CArrayFixFlat *WrappedArray = new( ELeave ) CArrayFixFlat(3); + pCurrCell->lineText = pCurrCell->lineText->ReAllocL(pCurrCell->lineText->Length() + lineWidthArray->Count() * KAknBidiExtraSpacePerLine); + TPtr ptr(pCurrCell->lineText->Des()); + AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( ptr,*lineWidthArray, *iLineFont, *WrappedArray, EFalse ); + iSpriteBitmapContext->UseFont( iLineFont ); + iSpriteBitmapContext->DrawText(WrappedArray->At(0), + pCurrCell->rLine2, iLineFont->FontMaxHeight(), CGraphicsContext::ECenter, 0); + + if(WrappedArray->Count() >= 2) + { + iSpriteBitmapContext->DrawText(WrappedArray->At(0), + pCurrCell->rLine1, iLineFont->FontMaxHeight(), CGraphicsContext::ECenter, 0); + iSpriteBitmapContext->DrawText(WrappedArray->At(1), + pCurrCell->rLine2, iLineFont->FontMaxHeight(), CGraphicsContext::ECenter, 0); + } + + + // Set dim flag if needed + switch (pCurrCell->cmdRscId) + { + case R_BROWSER_KEYMAP_TEXT_SWITCH_WINDOW: + { //EWmlCmdSwitchWindow; + ShowDim = ( !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) || + iApiProvider.IsEmbeddedModeOn() || + iApiProvider.WindowMgr().WindowCount() < 2); + break; + } + + case R_BROWSER_KEYMAP_TEXT_VIEW_IMAGES: + { //EWmlCmdShowImages; + ShowDim = ( !iApiProvider.BrCtlInterface().ImageCountL() ); + break; + } + + case R_BROWSER_KEYMAP_TEXT_SUBSCRIBE_TO_FEEDS: + { // EWmlCmdShowSubscribeList + CBrCtlInterface& brctl = iApiProvider.BrCtlInterface(); + TBool subscribeToItems(EFalse); + TRAPD(err, const RPointerArray& items = brctl.SubscribeToMenuItemsL(); + subscribeToItems = (err == KErrNone && items.Count() > 0)); + ShowDim = !subscribeToItems; + break; + } + + case R_BROWSER_KEYMAP_TEXT_GO_TO_HOMEPAGE: + { // EWmlCmdLaunchHomePage + ShowDim = iApiProvider.IsLaunchHomePageDimmedL(); + break; + } + + case R_BROWSER_KEYMAP_TEXT_PREVIOUS_PAGE: + { // EWmlCmdOneStepBack + ShowDim = (!iApiProvider.BrCtlInterface().NavigationAvailable(TBrCtlDefs::ENavigationBack ) ); + break; + } + + case R_BROWSER_KEYMAP_TEXT_MINIATURE_SHOW: + { //EWmlCmdShowMiniature; + ShowDim = ( !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) || + iApiProvider.WindowMgr().CurrentWindow()->HasWMLContent(ETrue) ); + break; + } + + case R_BROWSER_KEYMAP_TEXT_SHOW_TOOLBAR: + { //EWmlCmdShowToolBar; + if ( !AknLayoutUtils::PenEnabled() && iApiProvider.Preferences().ShowToolbarOnOff() ) + { + ShowDim = iApiProvider.WindowMgr().CurrentWindow()->WMLMode(); + } + else + { + ShowDim = ETrue; + } + break; + } + + case R_BROWSER_KEYMAP_TEXT_SAVE_AS_BOOKMARK: + { //EWmlCmdSaveAsBookmark; + if ( iApiProvider.IsEmbeddedModeOn() && CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu() ) + { + ShowDim = ETrue; + } + else + { + HBufC *pageUrl = iApiProvider.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( ( pageUrl == NULL ) || ( pageUrl->Length() == 0 ) ) + { + ShowDim = ETrue; + } + CleanupStack::PopAndDestroy( pageUrl ); + } + break; + } + + /* Zoom Mode currently disabled + case R_BROWSER_KEYMAP_TEXT_ZOOM_MODE: + { //EWmlCmdZoomMode; + + ShowDim = ( iApiProvider.WindowMgr().CurrentWindow()->WMLMode() || + !iApiProvider.ContentDisplayed() || + AknLayoutUtils::PenEnabled() ); + break; + } + */ + + default: + break; + } + } + + // DRAW the icon, + // setting the icon size according to iconRect + if(pCurrCell->keyBitmapImage != NULL && pCurrCell->keyBitmapMask != NULL) + { + AknIconUtils::SetSize(pCurrCell->keyBitmapImage, pCurrCell->rIcon.Size() ); + AknIconUtils::SetSize(pCurrCell->keyBitmapMask, pCurrCell->rIcon.Size() ); + + if (ShowDim) + { + CFbsBitmap* keyBitmapDimImage; + CFbsBitmap* keyBitmapDimMask; + + CreateDimBitmapL(pCurrCell->keyBitmapImage, + pCurrCell->keyBitmapMask, + keyBitmapDimImage, + keyBitmapDimMask); + + iSpriteBitmapContext->BitBltMasked(pCurrCell->rIcon.iTl, + keyBitmapDimImage, + TRect(TPoint(0, 0),pCurrCell->rIcon.Size() ), + keyBitmapDimMask, + ETrue); + + delete keyBitmapDimImage; + delete keyBitmapDimMask; + } + else + { + iSpriteBitmapContext->BitBltMasked(pCurrCell->rIcon.iTl, + pCurrCell->keyBitmapImage, + TRect(TPoint(0, 0),pCurrCell->rIcon.Size() ), + pCurrCell->keyBitmapMask, + ETrue); + } + } + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::ConstructSprite +// Construct the Sprite from the bitmap and context +// ----------------------------------------------------------------------------- +// +void CBrowserShortcutKeyMap::ConstructSprite() + { + iSprite = RWsSprite( CEikonEnv::Static()->WsSession() ); + RWindowTreeNode *window = iContentViewContainer->DrawableWindow(); + iSprite.Construct(*window,iTargetRect.iTl,ESpriteNoChildClip); + + TSpriteMember spriteMem; + spriteMem.iBitmap = iSpriteBitmap; + spriteMem.iMaskBitmap = iSpriteMaskBitmap; + spriteMem.iInvertMask = ETrue; + iSprite.AppendMember(spriteMem); + + iSprite.SetPosition(iTargetRect.iTl); + iSprite.Activate(); + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::GetCannedImageDirL +// Utility: Get the folder where the canned image is located +// ----------------------------------------------------------------------------- +// +HBufC* CBrowserShortcutKeyMap::GetCannedImageDirL( ) + { + HBufC* mbmFile = NULL; + TParse parse; + + // Get the drive letter where mbm resides.. it will be the same + // as this AppUi (browser ng) + CEikAppUi* pAppUI = (CEikAppUi*)(CCoeEnv::Static()->AppUi()); + TFileName mbmDrive = pAppUI->Application()->DllName(); + + parse.Set( mbmDrive, NULL, NULL ); + mbmDrive = parse.Drive(); + + // allocate memory for MBM file name + mbmFile = HBufC::NewL( KMaxFileName ); + + // assemble the MBM file name + TPtr ptr( mbmFile->Des() ); + ptr.SetLength( 0 ); + ptr.Append( mbmDrive ); + ptr.Append( KDC_APP_BITMAP_DIR ); + return mbmFile; + } + + + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::LoadSvg +// Utility: get the SVG bitmaps, etc, given its filename +// ----------------------------------------------------------------------------- +// +void CBrowserShortcutKeyMap::LoadSvg( + TInt aImageId, + const TDesC& aFileName, + CFbsBitmap*& aImage , + CFbsBitmap*& aImageMask ) + { + // Don't skin icons--at least for now. + TRAPD(error, AknIconUtils::CreateIconL( aImage, + aImageMask, + aFileName, + aImageId, + aImageId+1)); + + if (error!=KErrNone) + { + return; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserShortcutKeyMap::CreateDimBitmap +// Utility: Create Dimmed version of Bitmap +// ----------------------------------------------------------------------------- +// +void CBrowserShortcutKeyMap::CreateDimBitmapL( + CFbsBitmap* aImage, + CFbsBitmap* aImageMask, + CFbsBitmap*& aDimImage, + CFbsBitmap*& aDimImageMask) + { + + aDimImage = new ( ELeave ) CFbsBitmap; + CleanupStack::PushL( aDimImage ); + + aDimImage->Duplicate( aImage->Handle() ); + + aDimImageMask = new ( ELeave ) CFbsBitmap; + + User::LeaveIfError( aDimImageMask->Create(aDimImage->SizeInPixels(), + EGray256 ) ); + + CleanupStack::PushL( aDimImageMask ); + + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( aDimImageMask ); + CleanupStack::PushL( bitmapDevice ); + + CFbsBitGc* bitGc( NULL ); + User::LeaveIfError( bitmapDevice->CreateContext( bitGc ) ); + CleanupStack::PushL( bitGc ); + + bitGc->SetPenStyle( CGraphicsContext::ESolidPen ); + bitGc->BitBlt( TPoint( 0, 0 ), aImageMask ); + + + aDimImageMask->LockHeap(); + TInt w = aImageMask->SizeInPixels().iWidth; + TInt h = aImageMask->SizeInPixels().iHeight; + TInt dataStride = aImageMask->DataStride() - w; + unsigned char* address = (unsigned char *)aDimImageMask->DataAddress(); + + for ( TInt i = 0; i < h; ++i ) + { + for ( TInt j = 0; j < w; ++j ) + { + *address = KTransparency[*address]; + ++address; + } + address += dataStride; + } + + aDimImageMask->UnlockHeap(); + + CleanupStack::PopAndDestroy( 2 ); // bitmapDevice, bitGc + CleanupStack::Pop( 2 ); // aDimImage, aDimImageMask + + + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserSoftkeysObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserSoftkeysObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle special load events such as network connection, deal with non-http or non-html requests +* +*/ + + + +// INCLUDE FILES + +#include "BrowserSoftkeysObserver.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include "BrowserContentView.h" + +// --------------------------------------------------------- +// CBrowserSoftkeysObserver::NewL() +// --------------------------------------------------------- +// +CBrowserSoftkeysObserver* CBrowserSoftkeysObserver::NewL( + CBrowserWindow& aWindow ) + { + CBrowserSoftkeysObserver* self = new (ELeave) + CBrowserSoftkeysObserver( aWindow ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; + } + +// --------------------------------------------------------- +// CBrowserSoftkeysObserver::~CBrowserSoftkeysObserver() +// --------------------------------------------------------- +// +CBrowserSoftkeysObserver::~CBrowserSoftkeysObserver() + { + } + +// --------------------------------------------------------- +// CBrowserSoftkeysObserver::UpdateSoftkeyL() +// --------------------------------------------------------- +// +void CBrowserSoftkeysObserver::UpdateSoftkeyL( + TBrCtlKeySoftkey /* aKeySoftkey */, + const TDesC& /* aLabel */, + TUint32 /* aCommandId */, + TBrCtlSoftkeyChangeReason /* aReason */ ) + { + // update only the active window's softkeys + if( iWindow->IsWindowActive() ) + { + CBrowserContentView* cv = iWindow->WindowMgr().ContentView(); + if( cv ) + { + cv->UpdateCbaL(); + } + } + } + +// --------------------------------------------------------- +// CBrowserSoftkeysObserver::CBrowserSoftkeysObserver() +// --------------------------------------------------------- +// +CBrowserSoftkeysObserver::CBrowserSoftkeysObserver( + CBrowserWindow& aWindow ) : + iWindow( &aWindow ) + { + } + +// --------------------------------------------------------- +// CBrowserSoftkeysObserver::ConstructL() +// --------------------------------------------------------- +// +void CBrowserSoftkeysObserver::ConstructL() + { + } + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserSpecialLoadObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserSpecialLoadObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1102 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle special load events such as network connection, +* deal with non-http or non-html requests +* +*/ + + +// INCLUDE FILES +#include +#include "BrowserContentView.h" // not used, to be removed +#include "BrowserSpecialLoadObserver.h" +#include "BrowserLoadObserver.h" +#include "logger.h" +#include "BrowserAppDocument.h" +#include "ApiProvider.h" +#include "Preferences.h" +#include "BrowserUIVariant.hrh" +#include "Display.h" +#include "BrowserAppUi.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include "CommonConstants.h" +#ifdef __WINS__ + #include + #include + #include +#endif // __WINS__ +#include +#include // for MConnection +#include +#include +#include +#include +#include + +//CONSTANTS +const TInt KMaxDocHandlerUrlLen = 255; +//DestNetChange +#include + + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::NewL() +// --------------------------------------------------------- +// +CBrowserSpecialLoadObserver* CBrowserSpecialLoadObserver::NewL( + MApiProvider& aApiProvider, + CBrowserWindow* aWindow, + CEikDocument* aDocument, + CBrowserContentView* aContentView ) + { + CBrowserSpecialLoadObserver* self = + new (ELeave) CBrowserSpecialLoadObserver( + aApiProvider, aWindow, aDocument, aContentView ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop(); // self + return self; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::~CBrowserSpecialLoadObserver() +// --------------------------------------------------------- +// +CBrowserSpecialLoadObserver::~CBrowserSpecialLoadObserver() + { + delete iSchemeHandler; + delete iDocHandler; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::CBrowserSpecialLoadObserver() +// --------------------------------------------------------- +// +CBrowserSpecialLoadObserver::CBrowserSpecialLoadObserver( + MApiProvider& aApiProvider, + CBrowserWindow* aWindow, + CEikDocument* aDocument, + CBrowserContentView* aContentView ) : + iApiProvider( &aApiProvider ), + iWindow( aWindow ), + iDocument( aDocument ), + iSchemeHandler( NULL ), + iContentView( aContentView ), + iSchemeProcessing( EFalse ), + iLongZeroStartup( EFalse ), + iConnectionStarted( EFalse ) + { + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::ConstructL() +// --------------------------------------------------------- +// +void CBrowserSpecialLoadObserver::ConstructL() + { + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::NetworkConnectionNeededL() +// --------------------------------------------------------- +// +void CBrowserSpecialLoadObserver::NetworkConnectionNeededL( + TInt* aConnectionPtr, + TInt* aSockSvrHandle, + TBool* aNewConn, + TApBearerType* aBearerType ) + { +LOG_ENTERFN("CBrowserSpecialLoadObserver::NetworkConnectionNeededL"); + + __ASSERT_DEBUG( (aConnectionPtr != NULL), Util::Panic( Util::EUninitializedData ) ); + __ASSERT_DEBUG( (aSockSvrHandle != NULL), Util::Panic( Util::EUninitializedData ) ); + __ASSERT_DEBUG( (aNewConn != NULL), Util::Panic( Util::EUninitializedData ) ); + __ASSERT_DEBUG( (aBearerType != NULL), Util::Panic( Util::EUninitializedData ) ); + +#ifdef BRDO_OCC_ENABLED_FF + TBool retryFlag = CBrowserAppUi::Static()->GetRetryFlag(); + if( retryFlag ) + { + BROWSER_LOG((_L("Retry is in progress"))); + return; + } +#endif + + iApiProvider->SetProgressShown( ETrue ); + TBool query( EFalse ); + if( iApiProvider->Connection().Connected() ) + { + TInt a( iWindow->WindowId() ); + BROWSER_LOG( ( _L( "already connected, WindowId: %d" ), a ) ); + *aConnectionPtr = (TInt) &iApiProvider->Connection().Connection(); + *aSockSvrHandle = iApiProvider->Connection().SocketServer().Handle(); + *aNewConn = EFalse; + *aBearerType = iApiProvider->Connection().CurrentBearerTypeL(); + } + else + { + BROWSER_LOG((_L("not connected."))); + *aNewConn = ETrue; + TBool isValid( EFalse ); + TUint32 ap( 0 ); + TInt err( KErrNone ); + + BROWSER_LOG((_L("AP selectionMode: %d."), + iApiProvider->Preferences().AccessPointSelectionMode() )); + + //determine the type of connection + switch (iApiProvider->Preferences().AccessPointSelectionMode() ) + { + case EAlwaysAsk: + { + BROWSER_LOG((_L("always ask."))); + // Always ask + isValid = ETrue; + break; + } + + case EDestination: + { + isValid = ETrue; // force to show LAN connection dialog + +#ifdef __WINS__ + query = ETrue; // disable connection query dialog +#endif // __WINS__ + + // for bug fix MLAN-7EKFV4, if bookmark has defined its AP, use it + if ( iApiProvider->RequestedAp() != KWmlNoDefaultAccessPoint ) + { + #ifndef __WINS__ + ap = Util::IapIdFromWapIdL( + *iApiProvider, iApiProvider->RequestedAp() ); + BROWSER_LOG((_L("ap: %d"), ap)); + #else // __WINS__ + // On WINS no need to convert the AP ID + ap = iApiProvider->RequestedAp(); + #endif // __WINS__ + + iApiProvider->Connection().SetRequestedAP( ap ); + iApiProvider->Connection().SetConnectionType( EConnectionMethod ); + } + else + { + TUint32 snapId = iApiProvider->Preferences().DefaultSnapId(); + //connection type is destination nw + iApiProvider->Connection().SetConnectionType( EDestination ); + //set snap id + iApiProvider->Connection().SetRequestedSnap( snapId ); + } + break; + } + + case EConnectionMethod: + { + BROWSER_LOG((_L("user defined."))); + // User defined + + TRAP( err, isValid = Util::CheckApValidityL( *iApiProvider, + iApiProvider->RequestedAp() )); + BROWSER_LOG((_L("isValid 1: %d"), isValid)); + BROWSER_LOG((_L("err: %d"), err)); + if( isValid ) + { // valid AP, get it +#ifndef __WINS__ + ap = Util::IapIdFromWapIdL( + *iApiProvider, iApiProvider->RequestedAp() ); + BROWSER_LOG((_L("ap: %d"), ap)); +#else // __WINS__ + // On WINS no need to convert the AP ID + ap = iApiProvider->RequestedAp(); +#endif // __WINS__ + } + else if( err == KErrNone ) + { // still try to get AP + TUint apUid = iApiProvider->Preferences().DefaultAccessPoint(); + + BROWSER_LOG((_L("apUid: %d"), apUid)); + + if ( apUid == KWmlNoDefaultAccessPoint ) + { +#ifdef __WINS__ + query = ETrue; // disable connection query dialog + isValid = ETrue; // force to show LAN connection dialog +#else // __WINS__ + BROWSER_LOG((_L("StartPrefView."))); + // there are no AP, show preferences view without always ask + isValid = iApiProvider->StartPreferencesViewL( EShowDestinations | EShowConnectionMethods ); + if( isValid ) + { + if( iApiProvider->Preferences().AccessPointSelectionMode() == EConnectionMethod ) + { + ap = iApiProvider->Preferences().DefaultAccessPoint(); + } + // else if EDestination, user choosed SNAP in preference view + } +#endif // __WINS__ + } + } + + //set connection type and AP or SNAP Id + if( iApiProvider->Preferences().AccessPointSelectionMode() == EDestination ) + { + TUint32 snapId = iApiProvider->Preferences().DefaultSnapId(); + iApiProvider->Connection().SetConnectionType( EDestination ); + iApiProvider->Connection().SetRequestedSnap( snapId ); + } + else // EConnectionMethod + { + iApiProvider->Connection().SetRequestedAP( ap ); + iApiProvider->Connection().SetConnectionType( EConnectionMethod ); + } + break; + } + + default: + { + BROWSER_LOG((_L("wrong type of connection"))); + } + } //switch + + BROWSER_LOG((_L("isValid 2: %d"), isValid)); + if( isValid ) + { + iConnectionCancelled = EFalse; + if( !iApiProvider->Connection().Connected() ) + { + iApiProvider->Connection().SetRequestedAP( ap ); + + TBool startPage = iWindow->LoadObserver().LoadUrlType() == + CBrowserLoadObserver::ELoadUrlTypeStartPage; + TBool noConnDlgs = !iApiProvider->Preferences().ShowConnectionDialogs(); + + // Disable connection dialogs if... + TBool disableConnDlgs = + query || + startPage || // ...the load type is StartPage + noConnDlgs || // ...connection dialogs setting = OFF + LongZeroStartup(); // ...Browser started with long zero keypress + SetLongZeroStartup( EFalse ); + + BROWSER_LOG((_L("StartConnection params, query: %d, temp: %d"), query, disableConnDlgs)); + iConnectionStarted = ETrue; // is true when connection request submited. +#ifndef __WINS__ + TUint32 bookmarkIap( 0 ); + //If bookmark has defined its AP, use it + if ( iApiProvider->RequestedAp() != KWmlNoDefaultAccessPoint ) + { + bookmarkIap = Util::IapIdFromWapIdL( *iApiProvider, iApiProvider->RequestedAp() ); + BROWSER_LOG((_L("Bookmark Iap: %d"), bookmarkIap)); + iApiProvider->Connection().SetRequestedAP( bookmarkIap ); + iApiProvider->Connection().SetConnectionType( EConnectionMethod ); + } + else + { + iApiProvider->Connection().SetRequestedAP( bookmarkIap ); + BROWSER_LOG((_L("Setting Bookmark Iap: %d"), bookmarkIap)); + } +#endif + // might leave, don't TRAP. OK. + err = iApiProvider->Connection().StartConnectionL( disableConnDlgs ); + iConnectionStarted = EFalse; // is false when connection response completed. + } + + // during StartConnectionL user pressing "Stop" can cancel + if (iConnectionCancelled) + { + err = KErrCancel; + } + BROWSER_LOG((_L("err after StartConnection: %d"), err)); + + if( err == KErrNone ) + { + *aConnectionPtr = (TInt) &iApiProvider->Connection().Connection(); + *aSockSvrHandle = iApiProvider->Connection().SocketServer().Handle(); + *aBearerType = iApiProvider->Connection().CurrentBearerTypeL(); + } + + CBrowserAppUi::Static()->ConnNeededStatusL( err ); + if (( err == KErrCancel ) && !iApiProvider->IsPageLoaded()) + { + // Close Browser's Content View window if connection setup is cancelled to avoid a blank white screen + // ** Don't do this is page was previously loaded and is visible to user. + // ALSO, if feeds are enabled, don't close the window if coming from feeds folder view + // or in topic or feed views + + // *** Changing back to CloseContentView as a part of the new Browser exit functionality +#ifdef __RSS_FEEDS + TUid previousViewID = iApiProvider->LastActiveViewId(); + if( (previousViewID != KUidBrowserFeedsFolderViewId) && + (previousViewID != KUidBrowserFeedsTopicViewId) && + (previousViewID != KUidBrowserFeedsFeedViewId) ) + { + iApiProvider->Display().NaviPaneL()->Pop(); + CBrowserAppUi::Static()->CloseContentViewL(); + } +#else //__RSS_FEEDS + CBrowserAppUi::Static()->CloseContentViewL(); +#endif //__RSS_FEEDS + } + else if( err == KErrGeneral ) + { + if( !iApiProvider->Preferences().HttpSecurityWarningsStatSupressed() ) + { + iWindow->Display().UpdateSecureIndicatorL( + EAknIndicatorStateOff ); + } + } + // user might cancel, pass result to BrowserEngine + User::LeaveIfError( err ); + iApiProvider->Display().StartProgressAnimationL(); + } + else + { + User::LeaveIfError( err ); + } + } + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::DoHandleRequestL() +// --------------------------------------------------------- +// +TBool CBrowserSpecialLoadObserver::DoHandleRequestL + ( RArray* aTypeArray, CDesCArrayFlat* aDesArray ) + { + LOG_ENTERFN("CBrowserSpecialLoadObserver::HandleRequestL"); + + if( !iSchemeProcessing ) + { + iSchemeProcessing = ETrue; + TBool paramFound( EFalse ); + TPtrC requestUrl = ExtractBrCtlParam( + EParamRequestUrl, + aTypeArray, + aDesArray, + paramFound ); + __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); + BROWSER_LOG( ( _L( " EParamRequestUrl: %S" ), &requestUrl ) ); + + // pass to the CSchemaHandler + CSchemeHandler* newSH = CSchemeHandler::NewL( requestUrl ); + delete iSchemeHandler; + iSchemeHandler = newSH; + BROWSER_LOG( ( _L( " iSchemeHandler OK" ) ) ); + + // construct the current accesspoint + // if it's connected, always add it + if ( iApiProvider->Connection().Connected() ) + { + CAiwGenericParamList* paramsList = CAiwGenericParamList::NewL(); + CleanupStack::PushL(paramsList); + TInt32 ap = iApiProvider->Connection().CurrentAPId(); + TAiwVariant paramVariant (ap); + TAiwGenericParam genericParam( EGenericParamAccessPoint, paramVariant ); + paramsList->AppendL (genericParam ); + + + // set the parameter + iSchemeHandler->SetParameterList( paramsList ); + + CleanupStack::Pop(); + } + + iSchemeHandler->Observer( this ); + iSchemeHandler->HandleUrlEmbeddedL(); + } + return ETrue; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::HandleRequestL() +// --------------------------------------------------------- +// +TBool CBrowserSpecialLoadObserver::HandleRequestL + ( RArray* aTypeArray, CDesCArrayFlat* aDesArray ) + { + TBool ret( ETrue ); + TRAPD( err, DoHandleRequestL( aTypeArray, aDesArray ) ); + if( KErrNone != err ) + { + iSchemeProcessing = EFalse; + User::Leave( err ); + } + return ret; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::HandleDownloadL() +// --------------------------------------------------------- +// +TBool CBrowserSpecialLoadObserver::HandleDownloadL + ( RArray* aTypeArray, CDesCArrayFlat* aDesArray ) + { + LOG_ENTERFN("CBrowserSpecialLoadObserver::HandleDownloadL"); + + TBool downloadHandled = EFalse; + +#ifdef __RSS_FEEDS + // Check to see if this is content to be handled by UI (rss or opml) + // + if (HandleUiContentL(aTypeArray, aDesArray)) + { + return ETrue; + } +#endif // __RSS_FEEDS + + CBrowserAppDocument* appDoc = STATIC_CAST( CBrowserAppDocument*, iDocument ); + + __ASSERT_DEBUG( (appDoc != NULL), Util::Panic( Util::EUninitializedData ) ); + + if ( appDoc->IsContentHandlerRegistered() ) + { + BROWSER_LOG( ( _L( "Calling file handler." ) ) ); + + TBool paramFound( EFalse ); + TPtrC fileName = ExtractBrCtlParam( + EParamLocalFileName, + aTypeArray, + aDesArray, + paramFound ); + __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); + + if ( fileName.Length() == 0 ) + { + // May be a Rights Object download - + // no downloaded file, nothing to open/handle/pass to BrowserLauncher client. + BROWSER_LOG( ( _L( " Empty fileName" ) ) ); + } + else + { + CAiwGenericParamList* genericParamList = + BrCtlParamList2GenericParamListL( aTypeArray, aDesArray ); + CleanupStack::PushL( genericParamList ); + + // Forward the file to the registered handler. + TBool continueBrowsing( EFalse ); + downloadHandled = CBrowserAppUi::Static()->HandleContentL + ( fileName, *genericParamList, continueBrowsing ); + BROWSER_LOG( ( _L( " downloadHandled: %d, continueBrowsing: %d" ), + downloadHandled, continueBrowsing ) ); + + CleanupStack::PopAndDestroy( genericParamList ); // genericParamList + + if ( downloadHandled ) + { + // We can delete the file now. + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + fs.Delete( fileName ); // Return value is ignored. + CleanupStack::PopAndDestroy( &fs ); // fs + } + + if ( !continueBrowsing ) + { + iApiProvider->SetExitFromEmbeddedMode( ETrue ); + } + } + } + else + { + // No handler registered. + BROWSER_LOG( ( _L( " No handler registered." ) ) ); + } + + // If the download (file) was not handled, + // the BrowserUI handles it with Document Handler. + if ( !downloadHandled ) + { + // This content must be handled by BrowserUI - Browser Control cannot handle it. + OpenFileEmbeddedL( aTypeArray, aDesArray ); + downloadHandled = ETrue; + } + + BROWSER_LOG( ( _L( " downloadHandled: [%d]" ), (TInt)downloadHandled ) ); + return downloadHandled; + } + +#ifdef __RSS_FEEDS +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::HandleUiContentL() +// --------------------------------------------------------- +// +TBool CBrowserSpecialLoadObserver::HandleUiContentL( + RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) const + { + TDataType dataType; + + TBool contentTypeFound( EFalse ); + TBool urlFound( EFalse ); + TBool fileFound( EFalse ); + TBool result( EFalse ); + + TPtrC receivedContentType = ExtractBrCtlParam( + EParamReceivedContentType, + aTypeArray, + aDesArray, + contentTypeFound ); + + TPtrC url = ExtractBrCtlParam( + EParamRequestUrl, + aTypeArray, + aDesArray, + urlFound ); + + + TPtrC fileName = ExtractBrCtlParam( + EParamLocalFileName, + aTypeArray, + aDesArray, + fileFound ); + + // Compare returns 0 if the strings are the same + if ((receivedContentType.Compare(KMimeTypeAppXML) == 0) || + (receivedContentType.Compare(KMimeTypeTextXML) == 0) || + (receivedContentType.Compare(KMimeTypeRSS) == 0) || + (receivedContentType.Compare(KMimeTypeAtom) == 0) || + (receivedContentType.Compare(KMimeTypeRDF) == 0) || + (receivedContentType.Compare(KOPMLMimeType) == 0) || + //++PK added check for Text/xml content-type, only T is in caps, should make string check case insensitive + (receivedContentType.Compare(KMimeTypeCapsTextXML) == 0) + //++PK + ) + { + if (fileFound) + { + RFs rfs; + RFile rfile; + + // Open the file. + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + + TInt fileResult( rfile.Open( rfs, fileName, EFileRead ) ); + // file open doesn't succeeded + User::LeaveIfError( fileResult ); + if( fileResult == KErrNone ) + { + CleanupClosePushL( rfile ); + + TBuf dataTypeDes; + TBool deleteOpml = EFalse; + + if(CBrowserAppUi::Static()->RecognizeUiFileL(rfile, dataTypeDes)) + { + TFileName fileNameBuf = TFileName(fileName); + TFileName truncFileName; + User::LeaveIfError( rfile.Name(truncFileName) ); + + // Confirm with user that we want to handle it + if(CBrowserAppUi::Static()->ConfirmUiHandlingL(truncFileName, dataTypeDes)) + { + // Have AppUI decide what to do with it, what view, etc. + CBrowserAppUi::Static()->HandleUiDownloadL(fileNameBuf, dataTypeDes); + } + else + { + deleteOpml = ETrue; + } + result = ETrue; + } + + + // delete the downloaded file if it is not handled + if(deleteOpml && (dataTypeDes.Compare(KOPMLMimeType) == 0 )) + { + rfs.Delete(fileName); + } + } + + // If open file was handled, skip sending to feeds engine + // otherwise, pass it on + if(!result) + { + TInt fileSize; + // Read the file from the beginning into a buffer + User::LeaveIfError(rfile.Size(fileSize)); + HBufC8* buffer = HBufC8::NewLC(fileSize); + TPtr8 bufferPtr(buffer->Des()); + TInt startPos = 0; + User::LeaveIfError(rfile.Read(startPos, bufferPtr, fileSize)); + + _LIT8( searchTag1, "HandleSubscribeToWithUrlL(url); + } + else + { + //Delete the file, if it is not fwd to Feeds Engine, As displaying of xml files is not supported. + rfs.Delete(fileName); + } + result = ETrue; + CleanupStack::PopAndDestroy(); //buffer + } + + CleanupStack::PopAndDestroy(); //rfile + CleanupStack::PopAndDestroy(); //rfs + } + } + + return result; + } + +#endif // __RSS_FEEDS + + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::BrCtlParamList2GenericParamListL() +// --------------------------------------------------------- +// +CAiwGenericParamList* CBrowserSpecialLoadObserver::BrCtlParamList2GenericParamListL( + RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) const + { + LOG_ENTERFN("CBrowserSpecialLoadObserver::BrCtlParamList2GenericParamListL"); + + __ASSERT_DEBUG( (aTypeArray != NULL), Util::Panic( Util::EUninitializedData ) ); + __ASSERT_DEBUG( (aDesArray != NULL), Util::Panic( Util::EUninitializedData ) ); + + + //Creating generic param list + CAiwGenericParamList* genericParamList = CAiwGenericParamList::NewLC(); + + for( TInt j = 0; j < aTypeArray->Count(); j++ ) + { + BROWSER_LOG( ( _L( " iter: %d" ), j ) ); + TBool paramFound( EFalse ); + const TUint paramType = (*aTypeArray)[j]; + TPtrC param = ExtractBrCtlParam( + paramType, + aTypeArray, + aDesArray, + paramFound ); + __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); + + BROWSER_LOG( ( _L( " Type: %d, Value: %S" ), paramType, ¶m ) ); + + switch( paramType ) + { + case EParamRequestUrl: + { + BROWSER_LOG( ( _L( " EParamRequestUrl" ) ) ); + // limit url to 255 char's or DocHandler panics! + TAiwVariant paramVariant( param.Left( KMaxDocHandlerUrlLen ) ); + TAiwGenericParam genericParam( EGenericParamURL, + paramVariant ); + genericParamList->AppendL( genericParam ); + break; + } + case EParamRealm: + { + BROWSER_LOG( ( _L( " EParamRealm" ) ) ); + // No corresponding generic param! + break; + } + case EParamUsername: + { + BROWSER_LOG( ( _L( " EParamUsername" ) ) ); + // No corresponding generic param! + break; + } + case EParamPassword: + { + BROWSER_LOG( ( _L( " EParamPassword" ) ) ); + // No corresponding generic param! + break; + } + case EParamProxyUsername: + { + BROWSER_LOG( ( _L( " EParamProxyUsername" ) ) ); + // No corresponding generic param! + break; + } + case EParamProxyPassword: + { + BROWSER_LOG( ( _L( " EParamProxyPassword" ) ) ); + // No corresponding generic param! + break; + } + case EParamRawRequestHeader: + { + BROWSER_LOG( ( _L( " EParamRawRequestHeader" ) ) ); + // No corresponding generic param! + break; + } + case EParamReceivedContentType: + { + BROWSER_LOG( ( _L( " EParamReceivedContentType" ) ) ); + // The expected content type should override the response header's + // content type => don't use EParamReceivedContentType if + // EParamExpectedContentType is set! + TBool expectedContentTypeFound( EFalse ); + ExtractBrCtlParam( + EParamExpectedContentType, + aTypeArray, + aDesArray, + expectedContentTypeFound ); + if ( !expectedContentTypeFound ) + { + // Using EParamReceivedContentType + BROWSER_LOG( ( _L( " EParamExpectedContentType not found" ) ) ); + TAiwVariant paramVariant( param ); + TAiwGenericParam genericParam( EGenericParamMIMEType, + paramVariant ); + genericParamList->AppendL( genericParam ); + } + break; + } + case EParamExpectedContentType: + { + // Overrides EParamReceivedContentType! + BROWSER_LOG( ( _L( " EParamExpectedContentType" ) ) ); + TAiwVariant paramVariant( param ); + TAiwGenericParam genericParam( EGenericParamMIMEType, + paramVariant ); + genericParamList->AppendL( genericParam ); + break; + } + case EParamTotalContentLength: + { + BROWSER_LOG( ( _L( " EParamTotalContentLength" ) ) ); + // No corresponding generic param! + break; + } + case EParamReceivedContent: + { + BROWSER_LOG( ( _L( " EParamReceivedContent" ) ) ); + // No corresponding generic param! + break; + } + case EParamRawResponseHeader: + { + BROWSER_LOG( ( _L( " EParamRawResponseHeader" ) ) ); + // No corresponding generic param! + break; + } + case EParamLocalFileName: + { + BROWSER_LOG( ( _L( " EParamLocalFileName" ) ) ); + TAiwVariant paramVariant( param ); + TAiwGenericParam genericParam( EGenericParamFile, + paramVariant ); + genericParamList->AppendL( genericParam ); + break; + } + case EParamCharset: + { + BROWSER_LOG( ( _L( " EParamCharset" ) ) ); + TAiwVariant paramVariant( param ); + TAiwGenericParam genericParam( EGenericParamCharSet, + paramVariant ); + genericParamList->AppendL( genericParam ); + break; + } + case EParamRefererHeader: + { + BROWSER_LOG( ( _L( " EParamRefererHeader" ) ) ); + TAiwVariant paramVariant( param ); + TAiwGenericParam genericParam( EGenericParamReferringURI, + paramVariant ); + genericParamList->AppendL( genericParam ); + break; + } + default: + { + BROWSER_LOG( ( _L( " Unexpected argument" ) ) ); + break; + } + } + } + + // Always add the access point, if currently connected + if( iApiProvider->Connection().Connected() ) + { + TInt32 ap = iApiProvider->Connection().CurrentAPId(); + BROWSER_LOG( ( _L( " IAP: %d" ), ap ) ); + TAiwVariant paramVariant( ap ); + TAiwGenericParam genericParam( EGenericParamAccessPoint, + paramVariant ); + genericParamList->AppendL( genericParam ); + } + + CleanupStack::Pop( genericParamList ); // genericParamList + return genericParamList; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::ExtractBrCtlParam() +// --------------------------------------------------------- +// +TPtrC CBrowserSpecialLoadObserver::ExtractBrCtlParam + ( TUint aParamTypeToFind, + RArray* aTypeArray, + CDesCArrayFlat* aDesArray, + TBool& aParamFound ) const + { + LOG_ENTERFN("CBrowserSpecialLoadObserver::ExtractBrCtlParam"); + + __ASSERT_DEBUG( (aTypeArray != NULL), Util::Panic( Util::EUninitializedData ) ); + __ASSERT_DEBUG( (aDesArray != NULL), Util::Panic( Util::EUninitializedData ) ); + + // initialize output parameter + aParamFound = EFalse; + TPtrC16 retParamValue; + + for( TInt j = 0; j < aTypeArray->Count(); j++ ) + { + BROWSER_LOG( ( _L( " iter: %d" ), j ) ); + const TUint paramType = (*aTypeArray)[j]; + if ( aParamTypeToFind == paramType ) + { + // That's we need + retParamValue.Set( aDesArray->MdcaPoint(j) ); + aParamFound = ETrue; // Indicate it in the out param + BROWSER_LOG( ( _L( " Type: %d, Value: %S" ), paramType, &retParamValue ) ); + break; // break the loop - we found it + } + } + + return retParamValue; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::IsSelfDownloadContentTypeL() +// --------------------------------------------------------- +// +TBool CBrowserSpecialLoadObserver::IsSelfDownloadContentTypeL + ( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) const + { + LOG_ENTERFN("CBrowserSpecialLoadObserver::IsSelfDownloadContentTypeL"); + + TBool isSelfDownloadContentType = EFalse; + + // First get the download's content type (mime type) + TBool paramFound( EFalse ); + TPtrC contentType = ExtractBrCtlParam( + EParamReceivedContentType, + aTypeArray, + aDesArray, + paramFound ); + + if ( !paramFound ) + { + isSelfDownloadContentType = EFalse; + } + else + { + BROWSER_LOG( ( _L( " contentType: [%S]" ), &contentType ) ); + // Then check, if it is in SelfDownloadContentTypes + TInt cTLength = contentType.Length(); + TPtrC selfDownloadCTs = iApiProvider->Preferences().SelfDownloadContentTypesL(); + TInt idx = KErrNotFound; + idx = selfDownloadCTs.FindF( contentType ); + const TChar KBrowserSpecLoadObsSemicolon = ';'; + while( idx != KErrNotFound ) + { + // check for ';' on the left KSemicolon + if ( idx == 0 || selfDownloadCTs[ idx - 1 ] == KBrowserSpecLoadObsSemicolon ) + { + // check for ';' on the right + idx += cTLength; + if ( idx == selfDownloadCTs.Length() || selfDownloadCTs[ idx ] == KBrowserSpecLoadObsSemicolon ) + { + isSelfDownloadContentType = ETrue; + break; + } + } + selfDownloadCTs.Set( selfDownloadCTs.Mid( idx ) ); + idx = selfDownloadCTs.FindF( contentType ); + } + } + + BROWSER_LOG( ( _L( " isSelfDownloadContentType: %d" ), isSelfDownloadContentType ) ); + return isSelfDownloadContentType; + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::OpenFileEmbeddedL() +// --------------------------------------------------------- +// +void CBrowserSpecialLoadObserver::OpenFileEmbeddedL + ( RArray* aTypeArray, + CDesCArrayFlat* aDesArray ) + { + LOG_ENTERFN("CBrowserSpecialLoadObserver::OpenFileEmbeddedL"); + + CDocumentHandler* newDocHandler = CDocumentHandler::NewL(); + delete iDocHandler; + iDocHandler = newDocHandler; + iDocHandler->SetExitObserver( this ); + + TBool paramFound( EFalse ); + TPtrC fileName = ExtractBrCtlParam( + EParamLocalFileName, + aTypeArray, + aDesArray, + paramFound ); + __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); + + TPtrC contentType = ExtractBrCtlParam( + EParamReceivedContentType, + aTypeArray, + aDesArray, + paramFound ); + HBufC8* contentType8 = 0; + if ( !paramFound ) + { + contentType8 = KNullDesC8().AllocLC(); + } + else + { + BROWSER_LOG( ( _L( " contentType: [%S]" ), &contentType ) ); + contentType8 = HBufC8::NewLC( contentType.Length() ); + // 16 bit buffer copied into 8 bit buffer. + contentType8->Des().Copy( contentType ); + } + TDataType dataType( *contentType8 ); + + CAiwGenericParamList* genericParamList = + BrCtlParamList2GenericParamListL( aTypeArray, aDesArray ); + CleanupStack::PushL( genericParamList ); + + // File is not yet saved to target folder. + TBool allowSave( ETrue ); + TAiwVariant allowSaveVariant( allowSave ); + TAiwGenericParam genericParamAllowSave + ( EGenericParamAllowSave, allowSaveVariant ); + genericParamList->AppendL( genericParamAllowSave ); + + // Set EGenericParamAllowMove - we encourage handlers to apply + // move instead of copy for the file. + TBool allowMove( ETrue ); + TAiwVariant allowMoveVariant( allowMove ); + TAiwGenericParam genericParamAllowMove + ( EGenericParamAllowMove, allowMoveVariant ); + genericParamList->AppendL( genericParamAllowMove ); + + RFile tempFile; + iDocHandler->OpenTempFileL( fileName, tempFile ); + CleanupClosePushL( tempFile ); + /*TInt err = */iDocHandler->OpenFileEmbeddedL( tempFile, + dataType, + *genericParamList ); + //BROWSER_LOG( ( _L( " err: %d" ), err ) ); + CleanupStack::PopAndDestroy( &tempFile ); // tempFile + + CleanupStack::PopAndDestroy( genericParamList ); // genericParamList + CleanupStack::PopAndDestroy( contentType8 ); // contentType8 + } + +// --------------------------------------------------------- +// CBrowserSpecialLoadObserver::HandleServerAppExit() +// --------------------------------------------------------- +// +void CBrowserSpecialLoadObserver::HandleServerAppExit( TInt /*aReason*/ ) + { + iSchemeProcessing = EFalse; + } + +#ifdef __WINS__ +// ---------------------------------------------------------------------------- +// CBrowserSpecialLoadObserver::AskIapIdL(TUint32& aId) +// Ask IAP id from the user +// ---------------------------------------------------------------------------- +// +TInt CBrowserSpecialLoadObserver::AskIapIdL( TUint32& aId ) + { + CCommsDatabase* TheDb; + TInt res; + TBuf<40> name; + TUint32 id; + RArray idArray; + CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(16); + CleanupStack::PushL( items ); // 1 + + // Get IAP names and ids from the database + TheDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); + CleanupStack::PushL( TheDb ); // 2 + + TheDb->ShowHiddenRecords(); + + CCommsDbTableView* view = TheDb->OpenTableLC( TPtrC( IAP ) ); // 3 + res = view->GotoFirstRecord(); + + while( !res ) + { + view->ReadTextL( TPtrC( COMMDB_NAME ), name ); + view->ReadUintL( TPtrC( COMMDB_ID ), id ); + + idArray.Insert( id, 0 ); + items->InsertL( 0, name ); + + res = view->GotoNextRecord(); + RDebug::Print(_L("IAP name, id: %S, %d"), &name, id ); + } + + // Create listbox and PUSH it. + CEikTextListBox* list = new (ELeave) CAknSinglePopupMenuStyleListBox; + CleanupStack::PushL( list ); // 4 + + // Create popup list and PUSH it. + CAknPopupList* popupList = CAknPopupList::NewL( + list, R_AVKON_SOFTKEYS_OK_EMPTY__OK, + AknPopupLayouts::EMenuWindow); + CleanupStack::PushL( popupList ); // 5 + + // initialize listbox. + list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); + list->CreateScrollBarFrameL(ETrue); + list->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto); + + // Set listitems. + CTextListBoxModel* model = list->Model(); + model->SetItemTextArray( items ); + model->SetOwnershipType( ELbmOwnsItemArray ); + + // Set title + popupList->SetTitleL( _L( "Select IAP:" ) ); + + // Show popup list. + TInt popupOk = popupList->ExecuteLD(); + if( popupOk ) + { + TInt index = list->CurrentItemIndex(); + aId = idArray[index]; + } + + CleanupStack::Pop( popupList ); // popuplist + CleanupStack::PopAndDestroy( list ); // list + CleanupStack::PopAndDestroy( view ); // view + CleanupStack::PopAndDestroy( TheDb ); // TheDb + CleanupStack::Pop( items ); // items CTextListBoxModel* model owns it + + idArray.Close(); + items = NULL; + return popupOk; + } + +#endif // __WINS__ + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserUtil.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,407 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Utilities. +* +* +*/ + + +// INCLUDE FILES + +#include "logger.h" + +#include +#include +#include +#include +#include +#include + +#include "BrowserUtil.h" +#include "Browser.hrh" + +#include "CommonConstants.h" +#include "ApiProvider.h" +#include +#include +#include "commsmodel.h" +#include "preferences.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Util::Panic +// --------------------------------------------------------- +// +void Util::Panic( Util::TPanicReason aReason ) + { + _LIT( KAppName, "WmlBrowser" ); + User::Panic( KAppName, aReason ); + } + +// --------------------------------------------------------- +// Util::SanityCheckL +// --------------------------------------------------------- +// +void Util::SanityCheckL() + { +#ifdef _DEBUG + + // Check if the Engine limits for bookmarks match editing control sizes. + // Cannot do this compile time, because Engine limits are TInts instead of + // #define-s, so we must do run-time check (debug build only). Naturally, + // the conditional expression here is constant. Avoid warnings by using + // dummy variables (maxEngine...). + TInt maxEngineUrl = KFavouritesMaxUrl; + TInt maxEngineUsername = KFavouritesMaxUserName; + TInt maxEnginePassword = KFavouritesMaxPassword; + TInt maxEngineBookmarkName = KFavouritesMaxName; + + if ( + KFavouritesMaxUrlDefine != maxEngineUrl || + KFavouritesMaxUsernameDefine != maxEngineUsername || + KFavouritesMaxPasswordDefine != maxEnginePassword || + KFavouritesMaxBookmarkNameDefine != maxEngineBookmarkName + ) + { + Panic( ELimitMismatch ); + } + +#endif + } + +// --------------------------------------------------------- +// Util::RetreiveUsernameAndPasswordFromUrlL +// --------------------------------------------------------- +// +void Util::RetreiveUsernameAndPasswordFromUrlL + ( const TDesC& aUrl, CFavouritesItem& aItem ) + { + /// Empty string. + _LIT( KEmptyBuf, "" ); +/* CUrl* url = NULL; + TRAPD( error, url = CUrl::NewL( aUrl ) ); + if( error == KErrNone ) + { + CleanupStack::PushL( url ); +*/ + TUriParser16 url; + url.Parse(aUrl); + TPtrC userInfo = url.Extract( EUriUserinfo ); + TPtrC userName ; + TPtrC pass ; + userName.Set( KEmptyBuf ); + pass.Set( KEmptyBuf ); + if( userInfo.Length() ) + { + TInt position = userInfo.LocateF( ':' ); + if( ( position != KErrNotFound ) ) + { + userName.Set( userInfo.Left( position ) ); + aItem.SetUserNameL( userName ); + pass.Set( userInfo.Right( userInfo.Length()-position-1 ) ); + aItem.SetPasswordL( pass ); + } + } + + + HBufC* parsedUrl = HBufC::NewLC( url.UriDes().Length() ); + // get the pure Url (without username & password) + TInt position = url.UriDes().LocateF( '@' ); + if( ( position != KErrNotFound ) && ( userName.Length() ) + && ( url.UriDes().Find(userInfo) != KErrNotFound) ) + { + parsedUrl->Des().Copy( url.Extract( EUriScheme ) ); + _LIT( KDoubleSlash, "://" ); + parsedUrl->Des().Append( KDoubleSlash ); + parsedUrl->Des().Append( url.UriDes().Right + ( url.UriDes().Length() - position - 1 ) ); + } + else + { + parsedUrl->Des().Copy( url.UriDes() ); + } + if( parsedUrl->Length() ) + { + aItem.SetUrlL( *parsedUrl ); + } + CleanupStack::PopAndDestroy( 1 ); // parsedUrl + } + + +// --------------------------------------------------------- +// Util::StripUrl +// --------------------------------------------------------- +// +TPtrC Util::StripUrl( const TDesC& aUrl ) + { + TUriParser url; + TInt startPos; + TInt endPos; + + url.Parse ( aUrl ); + + //Return parsed url only if we have a scheme. Otherwise return full url + if ( url.IsPresent ( EUriScheme ) ) + { + startPos = url.Extract ( EUriScheme ).Length(); + //jump over the :// chars (or a mistyped version like :/ or :) + while ( startPos < url.UriDes().Length() && + ( aUrl.Mid( startPos, 1) == _L("/") || + aUrl.Mid( startPos, 1) == _L(":") ) ) + { + startPos++; + } + endPos = url.UriDes().Length() - url.Extract ( EUriFragment ).Length(); + } + else + { + startPos = 0; + endPos = url.UriDes().Length(); + } + + return aUrl.Mid( startPos, endPos - startPos ); + } + +// --------------------------------------------------------- +// Util::UrlFromFileNameLC +// --------------------------------------------------------- +// +HBufC* Util::UrlFromFileNameLC( const TDesC& aFileName ) + { + HBufC* buf = HBufC::NewLC + ( aFileName.Length() + KWmlValueFileSlashSlashSlashStr().Length() ); + + HBufC* url = HBufC::NewLC + ( aFileName.Length() + KWmlValueFileSlashSlashSlashStr().Length() ); + url->Des().Append( KWmlValueFileSlashSlashSlashStr ); + url->Des().Append( aFileName ); + + for ( TInt i = 0; i < url->Length(); i++ ) + { + if ( !url->Mid( i, 1 ).Compare( KWmlBackSlash ) ) + { + buf->Des().Append( TChar('/') ); + } + else + { + buf->Des().Append( url->Mid( i, 1 ) ); + } + } + CleanupStack::PopAndDestroy(); // url + return buf; + } + +// --------------------------------------------------------- +// Util::FFSSpaceBelowCriticalLevelL +// --------------------------------------------------------- +// +TBool Util::FFSSpaceBelowCriticalLevelL + ( TBool aShowErrorNote, TInt aBytesToWrite /*=0*/ ) + { + TBool ret( EFalse ); + if ( SysUtil::FFSSpaceBelowCriticalLevelL + ( &(CCoeEnv::Static()->FsSession()), aBytesToWrite ) ) + { + ret = ETrue; + if ( aShowErrorNote ) + { + CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) ); + errorUi->ShowGlobalErrorNoteL( KErrDiskFull ); + CleanupStack::PopAndDestroy(); // errorUi + } + } + return ret; + } + +// --------------------------------------------------------- +// Util::CheckBookmarkApL +// --------------------------------------------------------- +// +TBool Util::CheckBookmarkApL( + const MApiProvider& aApiProvider, + const TFavouritesWapAp& aItem ) + { + TBool apValid( EFalse ); + + if ( !aItem.IsNull() && !aItem.IsDefault() ) + { + CCommsDatabase& db = aApiProvider.CommsModel().CommsDb(); + + CApUtils* apUtils = CApUtils::NewLC( db ); + // if error, wapId is not found. + TRAPD( err, apValid = apUtils->WapApExistsL( aItem.ApId() ) ); + if ( /* !apValid || */ err ) + { + apValid = EFalse; + } + CleanupStack::PopAndDestroy(); // apUtils + } + else + { + apValid = ETrue; + } + return apValid; + } + +// --------------------------------------------------------- +// Util::IsValidAPFromParamL +// --------------------------------------------------------- +// +TBool Util::IsValidAPFromParamL( + const MApiProvider& aApiProvider, + TUint32 aIAPid ) + { + CCommsDatabase& db = aApiProvider.CommsModel().CommsDb(); + CApUtils* apUtils = CApUtils::NewLC( db ); + TBool retVal = apUtils->WapApExistsL( aIAPid ); + CleanupStack::PopAndDestroy(); // apUtils + return retVal; + } + +// --------------------------------------------------------- +// Util::CheckApValidityL +// --------------------------------------------------------- +// +TBool Util::CheckApValidityL( + const MApiProvider& aApiProvider, + const TUint32 aItem ) + { + CCommsDatabase& db = aApiProvider.CommsModel().CommsDb(); + CApUtils* apUtils = CApUtils::NewLC( db ); + TBool apValid( EFalse ); + + // if error, IapId is not found. + TRAPD( err, apUtils->IapIdFromWapIdL( aItem ) ); + if( err == KErrNone ) + { + apValid = ETrue; + } + CleanupStack::PopAndDestroy(); // apUtils + + return apValid; + } + +// --------------------------------------------------------- +// Util::IapIdFromWapIdL +// --------------------------------------------------------- +// +TUint32 Util::IapIdFromWapIdL( const MApiProvider& aApiProvider, const TUint32 aItem ) +{ + CCommsDatabase& db = aApiProvider.CommsModel().CommsDb(); + CApUtils* apUtils = CApUtils::NewLC( db ); + TUint32 ap = apUtils->IapIdFromWapIdL( aItem ); + CleanupStack::PopAndDestroy(); // apUtil + return ap; +} + +// --------------------------------------------------------- +// Util::WapIdFromIapIdL +// --------------------------------------------------------- +// +TUint32 Util::WapIdFromIapIdL( const MApiProvider& aApiProvider, const TUint32 aItem ) +{ + CCommsDatabase& db = aApiProvider.CommsModel().CommsDb(); + CApUtils* apUtils = CApUtils::NewLC( db ); + TUint32 ap = apUtils->WapIdFromIapIdL( aItem ); + CleanupStack::PopAndDestroy(); // apUtil + return ap; +} + +// --------------------------------------------------------- +// Util::EncodeSpaces +// --------------------------------------------------------- +// +void Util::EncodeSpaces(HBufC*& aString) + { + _LIT(KSpace," "); + _LIT(KSpaceEncoded,"%20"); + + TInt space(KErrNotFound); + TInt spaces(0); + TPtr ptr = aString->Des(); + + //Trim leading and trailing spaces in URL before encoding spaces inside URL + ptr.Trim(); + + for (TInt i = ptr.Length()-1; i > 0 ; i--) + { + if (ptr[i] == ' ') + { + spaces++; + space = i; + } + } + + if (spaces) + { + TInt newLen = aString->Length() + (spaces * KSpaceEncoded().Length()); + TRAPD(err,aString = aString->ReAllocL(newLen)); + if (err != KErrNone) + { + return; // aString was not changed + } + ptr.Set( aString->Des() ); + + } + + while (space != KErrNotFound) + { + ptr.Replace(space,1,KSpaceEncoded); + space = ptr.Find(KSpace); + } + + } + +// --------------------------------------------------------- +// Util::AllocateUrlWithSchemeL +// --------------------------------------------------------- +// +HBufC* Util::AllocateUrlWithSchemeL( const TDesC& aUrl ) + { + _LIT( KBrowserDefaultScheme, "http://" ); + TBool addDefaultScheme( EFalse ); + TInt len = aUrl.Length(); + + // Do not check return value from parse. If the caller wants to allocate a + // badly formed url then let them do so. + TUriParser url; + url.Parse( aUrl ); + + if( !url.IsPresent( EUriScheme ) ) + { + addDefaultScheme = ETrue; + len = len + KBrowserDefaultScheme().Length(); + } + + HBufC* urlBuffer = HBufC::NewL( len ); + TPtr ptr = urlBuffer->Des(); + + if ( addDefaultScheme ) + { + ptr.Copy( KBrowserDefaultScheme ); + } + ptr.Append( aUrl ); + + // Handle rare case that the url needs escape encoding. + // Below function will realloc enough space for encoded urlBuffer. + Util::EncodeSpaces( urlBuffer ); + + return urlBuffer; + } + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserWindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserWindow.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1532 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser content view +* +* +*/ + + +// INCLUDE FILES + +#include +#include + +#include "BrowserWindow.h" +#include "BrowserContentView.h" +#include "BrowserContentViewContainer.h" +#include +#include "BrowserDialogsProviderProxy.h" +#include "BrowserSoftkeysObserver.h" +#include "BrowserSpecialLoadObserver.h" +#include "BrowserWindowManager.h" + +#include "ApiProvider.h" +#include "BrowserAppUi.h" +#include "BrowserUIVariant.hrh" +#include "Logger.h" +#include "BrowserDisplay.h" +#include "BrowserPopupEngine.h" +#include +#include + +// for instantiating BrCtlInterface +#include "CommonConstants.h" +#include "BrowserApplication.h" +#include "BrowserAppDocument.h" + +#include "Preferences.h" + +// for dialog notes +#include +#include +#include "BrowserDialogs.h" + + +#define CALL_ORIG iWindowManager->ApiProvider()-> + +TBool CBrowserWindow::iIsPageOverviewSupportQueried = EFalse; +TBool CBrowserWindow::iIsPageOverviewSupported = EFalse; + +// ----------------------------------------------------------------------------- +// CBrowserWindow::NewLC() +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::CompleteDelayedInit() + { + return EFalse; + } + +CBrowserWindow* CBrowserWindow::NewLC( + TInt aWindowId, + const TDesC* aTargetName, + CBrowserWindowManager* aWindowMgr ) + { + CBrowserWindow* self = new (ELeave) + CBrowserWindow( aWindowId, aTargetName, aWindowMgr ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::NewL() +// ----------------------------------------------------------------------------- +// +CBrowserWindow* CBrowserWindow::NewL( + TInt aWindowId, + const TDesC* aTargetName, + CBrowserWindowManager* aWindowMgr ) + { + CBrowserWindow* self = + CBrowserWindow::NewLC( aWindowId, aTargetName, aWindowMgr ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::~CBrowserWindow() +// ----------------------------------------------------------------------------- +// +CBrowserWindow::~CBrowserWindow() + { + iClosing = ETrue; + +LOG_ENTERFN("CBrowserWindow::~CBrowserWindow"); +BROWSER_LOG( ( _L( "window id: %d" ), WindowId() ) ); + + if( iBrCtlInterface ) + { + iBrCtlInterface->RemoveLoadEventObserver( iLoadObserver ); + BROWSER_LOG( ( _L( " RemoveLoadEventObserver" ) ) ); + + CBrowserContentView* cv = iWindowManager->ContentView(); + iBrCtlInterface->RemoveStateChangeObserver( cv ); + BROWSER_LOG( ( _L( " RemoveStateChangeObserver" ) ) ); + iBrCtlInterface->RemoveCommandObserver( cv ); + BROWSER_LOG( ( _L( " RemoveCommandObserver" ) ) ); + + + // TRAP_IGNORE( iBrCtlInterface->HandleCommandL( + // (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); + BROWSER_LOG( ( _L( " HandleCommandL" ) ) ); + } + + // security indicator must be set off. + if( iDisplay && !iWindowManager->ApiProvider()-> + Preferences().HttpSecurityWarningsStatSupressed() ) + { + BROWSER_LOG( ( _L( " UpdateSecureIndicatorL 1" ) ) ); + TRAP_IGNORE( iDisplay->UpdateSecureIndicatorL( EAknIndicatorStateOff ) ); + BROWSER_LOG( ( _L( " UpdateSecureIndicatorL 2" ) ) ); + // we cannot do much here if error occurs... application is closing anyway + } + delete iDisplay; + BROWSER_LOG( ( _L( " Display deleted.") ) ); + + //Delete iBrCtlInterface before observers. If this is not + //done then browser crashes on exit when page is being loaded. + delete iBrCtlInterface; + BROWSER_LOG( ( _L( " BrCtlInterface deleted.") ) ); + + delete iLoadObserver; + BROWSER_LOG( ( _L( " LoadObserver deleted.") ) ); + + delete iDialogsProviderProxy; + BROWSER_LOG( ( _L( " DialogsProviderProxy deleted.") ) ); + + delete iSpecialLoadObserver; + BROWSER_LOG( ( _L( " SpecialLoadObserver deleted.") ) ); + + delete iSoftkeysObserver; + BROWSER_LOG( ( _L( " SoftkeysObserver deleted.") ) ); + // + delete iTargetName; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::CBrowserWindow() +// ----------------------------------------------------------------------------- +// +CBrowserWindow::CBrowserWindow( + TInt aWindowId, + const TDesC* aTargetName, + CBrowserWindowManager* aWindowMgr ) : + iWindowId( aWindowId ), + iActive( EFalse ), + iFirstPage(ETrue), + iBrCtlInterface( NULL ), + iDialogsProviderProxy( NULL ), + iDisplay( NULL ), + iLoadObserver( NULL ), + iSoftkeysObserver( NULL ), + iSpecialLoadObserver( NULL ), + iWindowManager( aWindowMgr ) + { + __ASSERT_DEBUG( (aTargetName != NULL), Util::Panic( Util::EUninitializedData )); + iTargetName = aTargetName->Alloc(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::ConstructL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::ConstructL() + { +PERFLOG_LOCAL_INIT +LOG_ENTERFN("CBrowserWindow::ConstructL"); + MApiProvider* api = iWindowManager->ApiProvider(); + CleanupStack::PushL( api ); +PERFLOG_STOPWATCH_START + iDisplay = CBrowserDisplay::NewL( *this, *this ); +PERFLOG_STOP_WRITE("*BrowserDisplay*") + BROWSER_LOG( ( _L( " Multiple Display up" ) ) ); + + CBrowserContentView* cv = iWindowManager->ContentView(); + TRect rect = cv->Container()->Rect(); + +PERFLOG_STOPWATCH_START + iLoadObserver = CBrowserLoadObserver::NewL( *this, *cv, *this ); + BROWSER_LOG( ( _L( " Multiple LoadObserver up" ) ) ); +PERFLOG_STOP_WRITE("*LoadObs*") +PERFLOG_STOPWATCH_START + iDialogsProviderProxy = CBrowserDialogsProviderProxy::NewL( + api->DialogsProvider(), iLoadObserver, *this ); +PERFLOG_STOP_WRITE("*DlgProxy*") + BROWSER_LOG( ( _L( " Multiple CBrowserDialogsProviderProxy UP" ) ) ); +PERFLOG_STOPWATCH_START + iSoftkeysObserver = CBrowserSoftkeysObserver::NewL( *this ); + BROWSER_LOG( ( _L( " Multiple SoftkeyObserver up" ) ) ); +PERFLOG_STOP_WRITE("*SoftKeyObs*") +PERFLOG_STOPWATCH_START + iSpecialLoadObserver = CBrowserSpecialLoadObserver::NewL( + *this, this, CBrowserAppUi::Static()->Document(), cv ); +PERFLOG_STOP_WRITE("*SoftKeyObs*") + BROWSER_LOG( ( _L( " Multiple SpecialLoadObserver up" ) ) ); + + TInt autoLaunch( TBrCtlDefs::ECapabilityLaunchViewer ); + CBrowserAppDocument* doc = STATIC_CAST( CBrowserAppDocument*, + CBrowserAppUi::Static()->Document() ); + + if( doc->IsContentHandlerRegistered() ) + { + autoLaunch = 0; + } + +PERFLOG_STOPWATCH_START + TUint capabilityFlags = ( TBrCtlDefs::ECapabilityLoadHttpFw | + TBrCtlDefs::ECapabilityDisplayScrollBar | + TBrCtlDefs::ECapabilityConfirmDownloads | + TBrCtlDefs::ECapabilitySavedPage | + TBrCtlDefs::ECapabilityUseDlMgr | + TBrCtlDefs::ECapabilityCursorNavigation | + TBrCtlDefs::ECapabilityFavicon | + TBrCtlDefs::ECapabilityToolBar | + TBrCtlDefs::ECapabilityFitToScreen | + TBrCtlDefs::ECapabilityPinchZoom | + autoLaunch ); + + if ( Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage )) + { + capabilityFlags = capabilityFlags | TBrCtlDefs::ECapabilityGraphicalPage; + } +#ifdef BRDO_MULTITOUCH_ENABLED_FF + if (Preferences().UiLocalFeatureSupported( KBrowserGraphicalHistory )) +#else + if ( Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) && + Preferences().UiLocalFeatureSupported( KBrowserGraphicalHistory )) +#endif + { + capabilityFlags = capabilityFlags | TBrCtlDefs::ECapabilityGraphicalHistory; + } + if ( Preferences().UiLocalFeatureSupported( KBrowserAutoFormFill ) ) + { + capabilityFlags = capabilityFlags | TBrCtlDefs::ECapabilityAutoFormFill; + } + if (Preferences().AccessKeys()) + { + capabilityFlags = capabilityFlags | TBrCtlDefs::ECapabilityAccessKeys; + } + + iBrCtlInterface = CreateBrowserControlL( + (CCoeControl*)cv->Container(), // parent control + rect, // client rect + capabilityFlags, // capabilities + (TUint)TBrCtlDefs::ECommandIdBase, // command base + iSoftkeysObserver, + (MBrCtlLinkResolver*)NULL, // LinkResolver + iSpecialLoadObserver, + (MBrCtlLayoutObserver*)NULL, // Layout Observer + iDialogsProviderProxy, + this // Window Observer + ); + BROWSER_LOG( ( _L( " Multiple Plugin Br Control up, Kimono." ) ) ); + + iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsLaunchAppUid, KUidBrowserApplication.iUid); + iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsLaunchViewId, KUidBrowserBookmarksViewId.iUid); + iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsLaunchCustomMessageId, KUidCustomMsgDownloadsList.iUid ); + BROWSER_LOG( ( _L( " LaunchSettings are passed." ) ) ); + +#if defined( __RSS_FEEDS ) + TPtrC rssMimeTypes = api->FeedsClientUtilities().SupportedMimeTypesL(); + BROWSER_LOG( ( _L( " rss SupportedMimeTypes OK" ) ) ); + TPtrC selfDownloadContentTypes = api->Preferences().SelfDownloadContentTypesL(); + BROWSER_LOG( ( _L( " SelfDownloadContentTypesL OK" ) ) ); + + HBufC* buf = HBufC::NewLC( + rssMimeTypes.Length() + selfDownloadContentTypes.Length() + 2 ); + TPtr ptr( buf->Des() ); + ptr.Append( rssMimeTypes ); + ptr.Append( TChar(';') ); + ptr.Append( selfDownloadContentTypes ); + ptr.ZeroTerminate(); + + iBrCtlInterface->SetSelfDownloadContentTypesL( ptr ); + CleanupStack::PopAndDestroy(); // buf +#else // __RSS_FEEDS + TPtrC selfDownloadContentTypes = api->Preferences().SelfDownloadContentTypesL(); + BROWSER_LOG( ( _L( " SelfDownloadContentTypesL OK" ) ) ); + iBrCtlInterface->SetSelfDownloadContentTypesL( selfDownloadContentTypes ); +#endif // __RSS_FEEDS + BROWSER_LOG( ( _L( " SetSelfDownloadContentTypesL") ) ); + + iBrCtlInterface->AddLoadEventObserverL( iLoadObserver ); + BROWSER_LOG( ( _L( " AddLoadEventObserverL") ) ); + iBrCtlInterface->AddStateChangeObserverL( cv ); + BROWSER_LOG( ( _L( " AddStateChangeObserverL") ) ); + iBrCtlInterface->AddCommandObserverL( cv ); + BROWSER_LOG( ( _L( " AddCommandObserverL") ) ); + + // Window is not added as PreferencesObserver, + // this message flow is controlled by the WindowManager. + + // Each window needs to notify its Browser Control of the settings +PERFLOG_STOP_WRITE("***BctlItem creation***") +PERFLOG_STOPWATCH_START + InitialiseLocalPreferencesL(); + UpdateBrCtlSettingsL(); +PERFLOG_STOP_WRITE("***BrowserCtl Settings update***") + CleanupStack::Pop( api ); + + iIsPageOverviewOn = iWindowManager->ApiProvider()->Preferences().PageOverview(); + + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::OpenWindowL() +// ----------------------------------------------------------------------------- +// +CBrCtlInterface* CBrowserWindow::OpenWindowL( + TDesC& /* aUrl */, TDesC* aTargetName, + TBool aUserInitiated, TAny* /* aReserved */ ) + { + // do not create new window when the browser is being closed + if( iClosing ) + { + return NULL; + } +LOG_ENTERFN("CBrowserWindow::OpenWindowL, OSS"); + // Do not exceed the maximum number of windows allowed + if ( iWindowManager->WindowCount() == + iWindowManager->MaxWindowCount() ) + { + + // Show warning to user + TBrowserDialogs::ErrorNoteL( R_BROWSER_NOTE_MAX_WINDOWS ); + + return NULL; + } + + CBrCtlInterface* retVal( NULL ); + TBool loadUrl( EFalse ); // allow fetching of url + + CBrowserPopupEngine* popup = &( iWindowManager->ApiProvider()->PopupEngine() ); + // embedded mode doesn't allow multiple windows feature, hence popup object is NULL + if (!popup) { + return retVal; + } + + HBufC* url = BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if(!url) + { + //The url is already pushed on to the cleanup stack and we have the ownership of it. Pop it. + CleanupStack::Pop(url); + return NULL; + } + + TPtrC ptr( url->Des() ); + + // Check if on the whitelist, if not a user initiated open + // or if pop-up blocking has been disabled + if ( !( iWindowManager->ApiProvider()->Preferences().PopupBlocking() ) || + popup->IsUrlOnWhiteListL( ptr ) || + aUserInitiated ) + { + loadUrl = ETrue; // OK to fetch the URL + } + else + { + // Notify user that popup was blocked + HBufC* popupBlocked = StringLoader::LoadLC( + R_BROWSER_NOTE_POPUP_BLOCKED ); + iWindowManager->ApiProvider()-> + DialogsProvider().ShowTooltipL( *popupBlocked ); + + CleanupStack::PopAndDestroy( popupBlocked ); + } + + CleanupStack::PopAndDestroy( url ); + + if ( loadUrl ) + { + // Open a new popup window + CBrowserWindow* window = iWindowManager->CreateWindowL( + WindowId(), aTargetName ); + if (window == NULL) + { + return retVal; + } + + retVal = & ( window->BrCtlInterface() ); + + // do not initiate load, it does by the engine automatically + // aUrl is empty / NULL + + + // Indicate to the user that a new window is being opened + HBufC* newWindow = StringLoader::LoadLC( R_BROWSER_NEW_WINDOW_OPENED ); + iWindowManager->ApiProvider()->DialogsProvider(). + ShowTooltipL( *newWindow ); + CleanupStack::PopAndDestroy( newWindow ); + } + + return retVal; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FindWindowL() +// ----------------------------------------------------------------------------- +// +CBrCtlInterface* CBrowserWindow::FindWindowL( const TDesC& aTargetName ) const + { + CBrowserWindow* window = iWindowManager->FindWindowL( aTargetName ); + if( window ) + return & ( window->BrCtlInterface() ); + else + return NULL; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::HandleWindowCommandL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::HandleWindowCommandL( + const TDesC& aTargetName, + TBrCtlWindowCommand aCommand ) + { +LOG_ENTERFN("CBrowserWindow::HandleWindowCommandL"); +BROWSER_LOG( ( _L( "window Id: %d, aCommand: %d" ), WindowId(), aCommand ) ); + + // KNullDesC() refers to the current window + + // I am NOT that targetwindow + if( aTargetName != KNullDesC() && iTargetName->Compare( aTargetName ) != 0 ) + { + // try to find that window + CBrowserWindow* window = iWindowManager->FindWindowL( aTargetName ); + if( window ) + { + window->HandleWindowCommandL( aTargetName, aCommand ); + } + else + { + // no window with that name + } + } + else // I am that targetwindow + { + switch( aCommand ) + { + case EShowWindow: // to activate a window after creating it + case EFocusWindow: // window.focus or reload + // focusing this window + { + // Changes were made to ClearHistory that cause it to keep one (current) page + // In order to reuse a window we need to clear the history again after the first new page + // is loaded + if (iFirstPage) + { + BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandClearHistory + (TInt)TBrCtlDefs::ECommandIdBase); + iFirstPage = EFalse; + } + iWindowManager->SwitchWindowL( WindowId() ); + break; + } + case EUnfocusWindow: // focusing the last active window + { + // iWindowManager->SwitchWindowL( ); + break; + } + case ECloseWindow: + { + CBrowserAppUi::Static()->CloseWindowL( WindowId() ); + break; + } +// case EDisableScriptLog: +// iWindowManager->ApiProvider()->Preferences().SetScriptLogL( TBrCtlDefs::EScriptLogDisable ); +// break; + default: + { + break; + } + } + } + } + +// --------------------------------------------------------- +// CBrowserWindow::IsPageOverviewSupported +// --------------------------------------------------------- +// +TBool CBrowserWindow::IsPageOverviewSupportedL() + { + if(!iIsPageOverviewSupportQueried) + { + iIsPageOverviewSupported = iBrCtlInterface->BrowserSettingL( + TBrCtlDefs::ESettingsPageOverview ); + iIsPageOverviewSupportQueried = ETrue; + } + + return iIsPageOverviewSupported; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::ResetPageOverviewLocalSettingL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::ResetPageOverviewLocalSettingL() + { + iIsPageOverviewOn = + iWindowManager->ApiProvider()->Preferences().PageOverview(); + BrCtlInterface().SetBrowserSettingL(TBrCtlDefs::ESettingsPageOverview, + iIsPageOverviewOn ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::ChangeTitlePaneTextUntilL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::ChangeTitlePaneTextUntilL( + const TDesC& aTitle, TInt /* aInterval */ ) + { + iWindowManager->ApiProvider()->DialogsProvider().ShowTooltipL( aTitle ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FlipPageOverviewLocalSettingL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::FlipPageOverviewLocalSettingL() + { + iIsPageOverviewOn = !iIsPageOverviewOn; + BrCtlInterface().SetBrowserSettingL( TBrCtlDefs::ESettingsPageOverview, + iIsPageOverviewOn ); + TInt tooltipResource = iIsPageOverviewOn ? + R_BROWSER_TOOLTIP_PAGE_OVERVIEW_ON : R_BROWSER_TOOLTIP_PAGE_OVERVIEW_OFF; + HBufC* overviewTooltip = StringLoader::LoadLC( tooltipResource ); + + iWindowManager->ApiProvider()->DialogsProvider().ShowTooltipL( *overviewTooltip ); + CleanupStack::PopAndDestroy( overviewTooltip ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::BrCtlInterface() +// ----------------------------------------------------------------------------- +// +CBrCtlInterface& CBrowserWindow::BrCtlInterface() const + { + return *iBrCtlInterface; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::Display() +// ----------------------------------------------------------------------------- +// +MDisplay& CBrowserWindow::Display() const + { + return *iDisplay; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::LoadObserver() +// ----------------------------------------------------------------------------- +// +CBrowserLoadObserver& CBrowserWindow::LoadObserver() const + { + return *iLoadObserver; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SoftkeysObserver() +// ----------------------------------------------------------------------------- +// +CBrowserSoftkeysObserver& CBrowserWindow::SoftkeysObserver() const + { + return *iSoftkeysObserver; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SpecialLoadObserver() +// ----------------------------------------------------------------------------- +// +CBrowserSpecialLoadObserver& CBrowserWindow::SpecialLoadObserver() const + { + return *iSpecialLoadObserver; + } + +// ---------------------------------------------------------------------------- +// CBrowserWindow::HandlePreferencesChangeL() +// ---------------------------------------------------------------------------- +// +void CBrowserWindow::HandlePreferencesChangeL( + TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ) + { + switch ( aEvent ) + { + case EPreferencesActivate: + { + // Provide local settings + aValues.iFontSize = iFontSize; + aValues.iTextWrap = iTextWrap; + aValues.iEncoding = iEncoding; + break; + } + case EPreferencesDeactivate: + { + // Save local preferences and notify Browser Control + if ( iActive ) // Topmost window only + { + UpdateLocalPreferencesL( aValues ); + } + break; + } + case EPreferencesItemChange: + { + // All preferences changes should notify the + // Browser Control + UpdateGlobalPreferencesL( aSettingType ); + + if ( iActive ) // Topmost window only + { + UpdateLocalPreferencesL( aValues ); + // Change the local setting to the changed setting. + iIsPageOverviewOn = iWindowManager->ApiProvider()->Preferences().PageOverview(); + } + break; + } + default: + // Do nothing + break; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::UpdateGlobalPreferencesL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::UpdateGlobalPreferencesL( + TBrCtlDefs::TBrCtlSettings aSettingType ) + { + // Local Settings should be ignored + switch ( aSettingType ) + { + case TBrCtlDefs::ESettingsAutoLoadImages: + { + // WebEngine has two different settings for Content Autoload enable/disable: + // AutoLoad Images - True/False and Disable flash - True/False + // Here is how the Load Content setting in UI maps to the Image and + // Flash settings in Webengine in case flash Plugin is present + // Load Content = 0, AutoLoadImages = 0, DisableFlash = 1 + // Load Content = 1, AutoLoadImages = 1, DisableFlash = 1 + // Load Content = 2, AutoLoadImages = 1, DisableFlash = 0 + // In case flash plugin is not present + // Load Content = 0, AutoLoadImages = 0, DisableFlash = 1 + // Load Content = 1, AutoLoadImages = 1, DisableFlash = 1 + + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsAutoLoadImages, + ((Preferences().AutoLoadContent() == EWmlSettingsAutoloadText) + ?EFalse:ETrue)); + + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsDisableFlash, + ((Preferences().AutoLoadContent() == EWmlSettingsAutoloadAll) + ?EFalse:ETrue)); + break; + } + case TBrCtlDefs::ESettingsEmbedded: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsEmbedded, + Preferences().EmbeddedMode() ); + break; + } + case TBrCtlDefs::ESettingsCookiesEnabled: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsCookiesEnabled, + Preferences().Cookies() ); + break; + } + case TBrCtlDefs::ESettingsECMAScriptEnabled: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsECMAScriptEnabled, + Preferences().Ecma() ); + break; + } + case TBrCtlDefs::ESettingsScriptLog: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsScriptLog, + Preferences().ScriptLog() ); + break; + } + case TBrCtlDefs::ESettingsIMEINotifyEnabled: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsIMEINotifyEnabled, + Preferences().IMEINotification() ); + break; + } + case TBrCtlDefs::ESettingsSendRefererHeader: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsSendRefererHeader, + Preferences().SendReferrer() ); + break; + } + case TBrCtlDefs::ESettingsSecurityWarnings: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsSecurityWarnings, + Preferences().HttpSecurityWarnings() ); + break; + } + + case TBrCtlDefs::ESettingsAutoOpenDownloads: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsAutoOpenDownloads, + Preferences().DownloadsOpen() ); + break; + } + + case TBrCtlDefs::ESettingsPageOverview: + { + if( IsPageOverviewSupportedL() ) + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsPageOverview, + Preferences().PageOverview() ); + } + break; + } + case TBrCtlDefs::ESettingsBackList: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsBackList, + Preferences().BackList() ); + break; + } + case TBrCtlDefs::ESettingsAutoRefresh: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsAutoRefresh, + Preferences().AutoRefresh() ); + break; + } + case TBrCtlDefs::ESettingsAutoFormFillEnabled: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsAutoFormFillEnabled, + Preferences().FormDataSaving() ); + break; + } + case TBrCtlDefs::ESettingsToolbarOnOff: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarOnOff, + Preferences().ShowToolbarOnOff() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton1Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton1Cmd, + Preferences().ShowToolbarButton1Cmd() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton2Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton2Cmd, + Preferences().ShowToolbarButton2Cmd() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton3Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton3Cmd, + Preferences().ShowToolbarButton3Cmd() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton4Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton4Cmd, + Preferences().ShowToolbarButton4Cmd() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton5Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton5Cmd, + Preferences().ShowToolbarButton5Cmd() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton6Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton6Cmd, + Preferences().ShowToolbarButton6Cmd() ); + break; + } + case TBrCtlDefs::ESettingsToolbarButton7Cmd: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsToolbarButton7Cmd, + Preferences().ShowToolbarButton7Cmd() ); + break; + } + case TBrCtlDefs::ESettingsZoomLevelMin: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsZoomLevelMin, + Preferences().ZoomLevelMinimum() ); + break; + } + case TBrCtlDefs::ESettingsZoomLevelMax: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsZoomLevelMax, + Preferences().ZoomLevelMaximum() ); + break; + } + case TBrCtlDefs::ESettingsZoomLevelDefault: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsZoomLevelDefault, + Preferences().ZoomLevelDefault() ); + break; + } + case TBrCtlDefs::ESettingsCursorShowMode: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsCursorShowMode, + Preferences().CursorShowMode() ); + break; + } + + case TBrCtlDefs::ESettingsEnterKeyMode: + { + iBrCtlInterface->SetBrowserSettingL( + TBrCtlDefs::ESettingsEnterKeyMode, + Preferences().EnterKeyMode() ); + break; + } + + // LOCAL SETTINGS should be ignored + case TBrCtlDefs::ESettingsTextWrapEnabled: + case TBrCtlDefs::ESettingsFontSize: + case TBrCtlDefs::ESettingsCharacterset: + { + break; + } + case TBrCtlDefs::ESettingsUnknown: // ignore + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::UpdateLocalPreferencesL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::UpdateLocalPreferencesL( TPreferencesValues& aValues ) + { + if ( iFontSize != aValues.iFontSize ) + { + iFontSize = aValues.iFontSize; + iBrCtlInterface->SetBrowserSettingL( + ( TUint ) TBrCtlDefs::ESettingsFontSize, iFontSize ); + } + + if ( iTextWrap != aValues.iTextWrap ) + { + iTextWrap = aValues.iTextWrap; + iBrCtlInterface->SetBrowserSettingL( + ( TUint ) TBrCtlDefs::ESettingsTextWrapEnabled, iTextWrap ); + } + if ( iEncoding != aValues.iEncoding ) + { + iEncoding = aValues.iEncoding; + iBrCtlInterface->SetBrowserSettingL( + ( TUint ) TBrCtlDefs::ESettingsCharacterset, iEncoding ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::InitialiseLocalPreferencesL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::InitialiseLocalPreferencesL() + { + // Initialise local settings from Central Repository + const TPreferencesValues& pref = Preferences().AllPreferencesL(); + iFontSize = pref.iFontSize; + iTextWrap = pref.iTextWrap; + iEncoding = pref.iEncoding; + } + +// ---------------------------------------------------------------------------- +// CBrowserWindow::UpdateBrCtlSettingsL() +// ---------------------------------------------------------------------------- +// +void CBrowserWindow::UpdateBrCtlSettingsL() + { + LOG_ENTERFN("CBrowserPreferences::UpdateBrCtlSettingsL"); + + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsSmallScreen ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsAutoLoadImages ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsEmbedded ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsCookiesEnabled ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsCSSFetchEnabled ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsECMAScriptEnabled ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsScriptLog ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsIMEINotifyEnabled ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsSendRefererHeader ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsSecurityWarnings ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsAutoOpenDownloads ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsPageOverview ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsBackList ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsAutoRefresh ); + + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsAutoFormFillEnabled ); + + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarOnOff ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton1Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton2Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton3Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton4Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton5Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton6Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsToolbarButton7Cmd ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsZoomLevelMin ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsZoomLevelMax ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsZoomLevelDefault ); + + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsCursorShowMode ); + UpdateGlobalPreferencesL( TBrCtlDefs::ESettingsEnterKeyMode ); + + // Font Size - LOCAL Setting + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsFontSize, + iWindowManager->ApiProvider()->Preferences().FontSize() ); + + // Text Wrap - LOCAL Setting + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsTextWrapEnabled, + iWindowManager->ApiProvider()->Preferences().TextWrap() ); + + // Encoding - LOCAL Setting + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCharacterset, + iWindowManager->ApiProvider()->Preferences().Encoding() ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::ActivateL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::ActivateL( TBool aDraw ) + { +LOG_ENTERFN("CBrowserWindow::ActivateL"); +BROWSER_LOG( ( _L( "Activating window no. %d" ), WindowId() ) ); + iDialogsProviderProxy->WindowActivated(); + iBrCtlInterface->MakeVisible( ETrue ); // notify the engine + iActive = ETrue; + if( aDraw ) + { + iBrCtlInterface->DrawNow(); + CBrowserContentView* cv = iWindowManager->ContentView(); + cv->UpdateFullScreenL(); + TRAP_IGNORE(Display().StopProgressAnimationL());//also updates title + } + WindowMgr().NotifyObserversL( EWindowActivate, WindowId() ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::DeactivateL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::DeactivateL() + { +LOG_ENTERFN("CBrowserWindow::DeactivateL"); +BROWSER_LOG( ( _L( "Deactivating window no. %d" ), WindowId() ) ); + iActive = EFalse; + iBrCtlInterface->MakeVisible( EFalse ); // notify the engine + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::Connection +// ----------------------------------------------------------------------------- +// +MConnection& CBrowserWindow::Connection() const + { + return CALL_ORIG Connection(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::Preferences() +// ----------------------------------------------------------------------------- +// +MPreferences& CBrowserWindow::Preferences() const + { + return CALL_ORIG Preferences(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::CommsModel +// ----------------------------------------------------------------------------- +// +MCommsModel& CBrowserWindow::CommsModel() const + { + return CALL_ORIG CommsModel(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::DialogsProvider() +// ----------------------------------------------------------------------------- +// +CBrowserDialogsProvider& CBrowserWindow::DialogsProvider() const + { + __ASSERT_DEBUG( (iDialogsProviderProxy != NULL), Util::Panic( Util::EUninitializedData )); + return *( (CBrowserDialogsProvider*)iDialogsProviderProxy ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::BmOTABinSender +// ----------------------------------------------------------------------------- +// +MBmOTABinSender& CBrowserWindow::BmOTABinSenderL() + { + return CALL_ORIG BmOTABinSenderL(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::PopupEngine +// ----------------------------------------------------------------------------- +// +CBrowserPopupEngine& CBrowserWindow::PopupEngine() const + { + return CALL_ORIG PopupEngine(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetViewToBeActivatedIfNeededL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetViewToBeActivatedIfNeededL( + TUid aUid, + TInt aMessageId ) + { + CALL_ORIG SetViewToBeActivatedIfNeededL( aUid, aMessageId ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsCancelFetchAllowed +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsCancelFetchAllowed() const + { + return CALL_ORIG IsCancelFetchAllowed(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::LastActiveViewId +// ----------------------------------------------------------------------------- +// +TUid CBrowserWindow::LastActiveViewId() const + { + return CALL_ORIG LastActiveViewId(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetLastActiveViewId +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetLastActiveViewId( TUid aUid ) + { + CALL_ORIG SetLastActiveViewId( aUid ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::ExitInProgress +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::ExitInProgress() const + { + return CALL_ORIG ExitInProgress(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetExitInProgress +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetExitInProgress( TBool aValue ) + { + CALL_ORIG SetExitInProgress( aValue ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsConnecting +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsConnecting() const + { + return CALL_ORIG IsConnecting(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::UpdateNaviPaneL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::UpdateNaviPaneL( TDesC& aStatusMsg ) + { + CALL_ORIG UpdateNaviPaneL( aStatusMsg ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetViewToReturnOnClose +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetViewToReturnOnClose( TUid const &aUid ) + { + CALL_ORIG SetViewToReturnOnClose( aUid ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::CloseContentViewL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::CloseContentViewL() + { + CALL_ORIG CloseContentViewL(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsEmbeddedModeOn +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsEmbeddedModeOn() const + { + return CALL_ORIG IsEmbeddedModeOn(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsShutdownRequested +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsShutdownRequested() const + { + return CALL_ORIG IsShutdownRequested(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::ExitBrowser +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::ExitBrowser( TBool aUserShutdown ) + { + CALL_ORIG ExitBrowser( aUserShutdown ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsAppShutterActive +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsAppShutterActive() const + { + return CALL_ORIG IsAppShutterActive(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::StartPreferencesViewL +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::StartPreferencesViewL( TUint aListItems ) + { + return CALL_ORIG StartPreferencesViewL( aListItems ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsPageLoaded +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsPageLoaded() + { + return CALL_ORIG IsPageLoaded(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsForeGround +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsForeGround() const + { + return CALL_ORIG IsForeGround(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::Fetching +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::Fetching() const + { + return CALL_ORIG Fetching(); + } +// ----------------------------------------------------------------------------- +// CBrowserWindow::ContentDisplayed +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::ContentDisplayed() const + { + return CALL_ORIG ContentDisplayed(); + } +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetContentDisplayed +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetContentDisplayed(TBool aValue) + { + return CALL_ORIG SetContentDisplayed( aValue ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FetchBookmarkL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::FetchBookmarkL( TInt aBookmarkUid ) + { + CALL_ORIG FetchBookmarkL( aBookmarkUid ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FetchBookmarkL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::FetchBookmarkL( const CFavouritesItem& aBookmarkItem ) + { + CALL_ORIG FetchBookmarkL( aBookmarkItem ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FetchL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::FetchL( + const TDesC& aUrl, + const TDesC& aUserName, + const TDesC& aPassword, + const TFavouritesWapAp& aAccessPoint, + CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ) + { + CALL_ORIG FetchL( aUrl, aUserName, aPassword, aAccessPoint, aUrlType ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FetchL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::FetchL( + const TDesC& aUrl, + CBrowserLoadObserver::TBrowserLoadUrlType aUrlType ) + { + CALL_ORIG FetchL( aUrl, aUrlType ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::CancelFetch +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::CancelFetch( TBool aIsUserInitiated ) + { + CALL_ORIG CancelFetch( aIsUserInitiated ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetRequestedAP +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetRequestedAP( TInt aAp ) + { + CALL_ORIG SetRequestedAP( aAp ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetExitFromEmbeddedMode +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetExitFromEmbeddedMode( TBool aFlag ) + { + CALL_ORIG SetExitFromEmbeddedMode( aFlag ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsProgressShown +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsProgressShown() const + { + return CALL_ORIG IsProgressShown(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetProgressShown +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetProgressShown( TBool aProgressShown ) + { + CALL_ORIG SetProgressShown( aProgressShown ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::StartedUp +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::StartedUp() const + { + return CALL_ORIG StartedUp(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::RequestedAp +// ----------------------------------------------------------------------------- +// +TUint32 CBrowserWindow::RequestedAp() const + { + return CALL_ORIG RequestedAp(); + } +// ----------------------------------------------------------------------------- +// CBrowserWindow::LogAccessToRecentUrlL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::LogAccessToRecentUrlL( CBrCtlInterface& aBrCtlInterface) + { + CALL_ORIG LogAccessToRecentUrlL( aBrCtlInterface ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::LogRequestedPageToRecentUrlL +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::LogRequestedPageToRecentUrlL( const TDesC& aUrl) + { + CALL_ORIG LogRequestedPageToRecentUrlL( aUrl ); + } + +// --------------------------------------------------------- +// CBrowserWindow::StartProgressAnimationL +// --------------------------------------------------------- +// +void CBrowserWindow::StartProgressAnimationL() + { + CALL_ORIG StartProgressAnimationL(); + } + +// --------------------------------------------------------- +// CBrowserWindow::StopProgressAnimationL +// --------------------------------------------------------- +// +void CBrowserWindow::StopProgressAnimationL() + { + CALL_ORIG StopProgressAnimationL(); + } + +#ifdef __RSS_FEEDS +// --------------------------------------------------------- +// CBrowserWindow::FeedsClientUtilities +// --------------------------------------------------------- +// +CFeedsClientUtilities& CBrowserWindow::FeedsClientUtilities() const + { + return CALL_ORIG FeedsClientUtilities(); + } +#endif // __RSS_FEEDS + +// --------------------------------------------------------- +// CBrowserWindow::BrowserWasLaunchedIntoFeeds +// --------------------------------------------------------- +// +TBool CBrowserWindow::BrowserWasLaunchedIntoFeeds() +{ + return CALL_ORIG BrowserWasLaunchedIntoFeeds(); +} + +// --------------------------------------------------------- +// CBrowserWindow::SetHasWMLContent +// --------------------------------------------------------- +// +void CBrowserWindow::SetHasWMLContent(TBool aHasWMLContent) + { + iHasWMLContent = aHasWMLContent; + } + +// --------------------------------------------------------- +// CBrowserWindow::SetCurrWinHasWMLContent +// --------------------------------------------------------- +// +void CBrowserWindow::SetCurrWinHasWMLContent(TBool aCurrWinHasWMLContent) + { + iCurrWinHasWMLContent = aCurrWinHasWMLContent; + } + +// --------------------------------------------------------- +// CBrowserWindow::HasWMLContent +// --------------------------------------------------------- +// +TBool CBrowserWindow::HasWMLContent (TBool aCurrWinOnly) + { + if (aCurrWinOnly) + { + return iCurrWinHasWMLContent; + } + else + { + return iHasWMLContent; + } + } + + +// --------------------------------------------------------- +// CBrowserWindow::SetWMLMode +// --------------------------------------------------------- +// +void CBrowserWindow::SetWMLMode(TBool aWMLMode) + { + iWMLMode = aWMLMode; + } + +// --------------------------------------------------------- +// CBrowserWindow::SetFirstPage +// --------------------------------------------------------- +// +void CBrowserWindow::SetFirstPage(TBool aFirstPage) + { + iFirstPage = aFirstPage; + } + +// --------------------------------------------------------- +// CBrowserWindow::SetHasFeedsContent +// --------------------------------------------------------- +// +void CBrowserWindow::SetHasFeedsContent(TBool aHasFeedsContent) + { + iHasFeedsContent = aHasFeedsContent; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetLastCBAUpdateView +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetLastCBAUpdateView( TUid aView ) + { + CALL_ORIG SetLastCBAUpdateView( aView ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::GetLastCBAUpdateView +// ----------------------------------------------------------------------------- +// +TUid CBrowserWindow::GetLastCBAUpdateView() + { + return CALL_ORIG GetLastCBAUpdateView(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::GetPreviousViewFromViewHistory +// ----------------------------------------------------------------------------- +// +TUid CBrowserWindow::GetPreviousViewFromViewHistory() + { + return CALL_ORIG GetPreviousViewFromViewHistory(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::CalledFromAnotherApp +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::CalledFromAnotherApp() + { + return CALL_ORIG CalledFromAnotherApp(); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::SetCalledFromAnotherApp +// ----------------------------------------------------------------------------- +// +void CBrowserWindow::SetCalledFromAnotherApp( TBool aValue ) + { + return CALL_ORIG SetCalledFromAnotherApp( aValue ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindow::FlashPresent +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::FlashPresent() + { + return CALL_ORIG FlashPresent(); + } + + +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsLaunchHomePageDimmedL +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsLaunchHomePageDimmedL() + { + return CALL_ORIG IsLaunchHomePageDimmedL(); + } +// ----------------------------------------------------------------------------- +// CBrowserWindow::IsDisplayingMenuOrDialog +// ----------------------------------------------------------------------------- +// +TBool CBrowserWindow::IsDisplayingMenuOrDialog() + { + return CALL_ORIG IsDisplayingMenuOrDialog(); + } + +#undef CALL_ORIG + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserWindowFocusNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserWindowFocusNotifier.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE Files + +// User includes +#include "BrowserWindowFocusNotifier.h" // Class header +#include "logger.h" + +// System includes +#include + +// CONSTANTS + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier::CBrowserWindowFocusNotifier +//----------------------------------------------------------------------------- +CBrowserWindowFocusNotifier::CBrowserWindowFocusNotifier() + { + } + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier::~CBrowserWindowFocusNotifier +//----------------------------------------------------------------------------- +CBrowserWindowFocusNotifier::~CBrowserWindowFocusNotifier() + { +LOG_ENTERFN("~CBrowserWindowFocusNotifier"); + FlushAOStatusArray(); + } + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier* CBrowserWindowFocusNotifier::NewL +//----------------------------------------------------------------------------- +CBrowserWindowFocusNotifier* CBrowserWindowFocusNotifier::NewL() + { + CBrowserWindowFocusNotifier* self = new (ELeave) + CBrowserWindowFocusNotifier(); + + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); // self + return self; + } + + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier::ConstructL +// +//----------------------------------------------------------------------------- +void CBrowserWindowFocusNotifier::ConstructL() + { + } + + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier::Add() +//----------------------------------------------------------------------------- +TInt CBrowserWindowFocusNotifier::Add( TRequestStatus* aStatus ) + { + return iAOStatusArray.Append( aStatus ); + } + + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier::OnFocusGained() +//----------------------------------------------------------------------------- +void CBrowserWindowFocusNotifier::OnFocusGained() + { + FlushAOStatusArray(); + } + + +//----------------------------------------------------------------------------- +// CBrowserWindowFocusNotifier::FlushAOStatusArray() +//----------------------------------------------------------------------------- +void CBrowserWindowFocusNotifier::FlushAOStatusArray() + { +LOG_ENTERFN("CBrowserWindowFocusNotifier::FlushAOStatusArray"); + TInt count = iAOStatusArray.Count(); +BROWSER_LOG( ( _L( "Flush count: %d" ), count ) ); + + // Clear all status requests and then clear array - in order + for ( TInt i = 0; i < count; i++ ) + { +BROWSER_LOG( ( _L( "Flushing: %d" ), i ) ); + TRequestStatus* status = iAOStatusArray[i]; + User::RequestComplete( status, KErrNone ); + } + + iAOStatusArray.Reset(); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserWindowManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserWindowManager.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,833 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Multiple Windows' WindowManager. +* +* +*/ + + +// INCLUDE FILES +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include "BrowserWindowQueue.h" +#include "BrowserContentView.h" +#include "WindowInfoProvider.h" +#include "Logger.h" +#include "Preferences.h" +#include "Display.h" +#include "ApiProvider.h" +#include +#include "BrowserUtil.h" +#include +#include +#include + + +// ----------------------------------------------------------------------------- +// CBrowserWindowQue::LastItem() +// ----------------------------------------------------------------------------- +// +CBrowserWindowQue* CBrowserWindowQue::LastItem() const + { + // remove 'const' modifier from 'this' in a const member function + CBrowserWindowQue* a = CONST_CAST( CBrowserWindowQue*, this ); + for( ; a->iNext; a=a->iNext) + ; + return a; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowQue::~CBrowserWindowQue() +// ----------------------------------------------------------------------------- +// +CBrowserWindowQue::~CBrowserWindowQue() + { +LOG_ENTERFN("WindowQue::~WindowQue"); + if( this->iPrev ) + { + BROWSER_LOG( ( _L( "iPrev" ) ) ); + this->iPrev->iNext = this->iNext; + } + if( this->iNext ) + { + BROWSER_LOG( ( _L( "iNext" ) ) ); + this->iNext->iPrev = this->iPrev; + } + delete iWindow; + iWindow = NULL; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowQue::AppendL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindowQue::AppendL( CBrowserWindowQue* aItem ) + { + __ASSERT_DEBUG( (aItem != NULL), Util::Panic( Util::EUninitializedData )); + aItem->iPrev = LastItem(); + aItem->iPrev->iNext = aItem; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowQue::Next() +// ----------------------------------------------------------------------------- +// +CBrowserWindowQue* CBrowserWindowQue::Next() const + { + CBrowserWindowQue* b = this->iNext; + while( b && (b->iStatus & CBrowserWindowQue::EWindowDeleted ) ) + { + b = b->iNext; + } + return b; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowQue::Prev() +// ----------------------------------------------------------------------------- +// +CBrowserWindowQue* CBrowserWindowQue::Prev() const + { + CBrowserWindowQue* b = this->iPrev; + while( b && (b->iStatus & CBrowserWindowQue::EWindowDeleted ) ) + { + b = b->iPrev; + } + return b; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager:: +// ----------------------------------------------------------------------------- +// initialization of static member variable +TInt CBrowserWindowManager::iWindowIdGenerator( 0 ); + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::NewLC() +// ----------------------------------------------------------------------------- +// +CBrowserWindowManager* CBrowserWindowManager::NewLC( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + TInt aMaxWindowCount ) + { + CBrowserWindowManager* self = new (ELeave) + CBrowserWindowManager( aApiProvider, aContentView, aMaxWindowCount ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::NewL() +// ----------------------------------------------------------------------------- +// +CBrowserWindowManager* CBrowserWindowManager::NewL( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + TInt aMaxWindowCount ) + { + CBrowserWindowManager* self = CBrowserWindowManager::NewLC( + aApiProvider, aContentView, aMaxWindowCount ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::~CBrowserWindowManager() +// ----------------------------------------------------------------------------- +// +CBrowserWindowManager::~CBrowserWindowManager( ) + { +LOG_ENTERFN("WindowManager::~WindowManager"); + // Preferences must exist! + if(iApiProvider!=NULL) + { + iApiProvider->Preferences().RemoveObserver( this ); + } + RemoveObserver(iContentView); + CBrowserWindowQue *window = iWindowQueue; + CBrowserWindowQue *temp = NULL; + + + TBool isStandAlone( !iApiProvider->IsEmbeddedModeOn() ); + if ( ( isStandAlone && !iUserExit ) || ( !isStandAlone ) ) + { + TRAP_IGNORE( window->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandSaveLaunchParams + (TInt)TBrCtlDefs::ECommandIdBase ) ); + } + + for(; window; ) + { + temp = window; + window = window->iNext; + DeleteOneWindowL( temp->iWindow->WindowId() ); + /*delete temp; + temp = NULL;*/ + } + RemoveDeletedWindowsL(); + delete iObservers; + iObservers = NULL; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::WindowCount() +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowManager::WindowCount() const + { + return iWindowCount - iDeletedWindowCount; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::CBrowserWindowManager() +// ----------------------------------------------------------------------------- +// +CBrowserWindowManager::CBrowserWindowManager( + MApiProvider& aApiProvider, + CBrowserContentView& aContentView, + TInt aMaxWindowCount ) : + iApiProvider( &aApiProvider ), + iContentView( &aContentView), + iMaxWindowCount( aMaxWindowCount ), + iWindowCount( 0 ), + iDeletedWindowCount( 0 ), + iWindowQueue( NULL ), + iCurrentWindow( NULL ), + iUserExit( EFalse ), + iIsContentExist( EFalse ) + { + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::ConstructL() +// ----------------------------------------------------------------------------- +// +void CBrowserWindowManager::ConstructL( ) + { + iApiProvider->Preferences().AddObserverL( this ); + CreateWindowL( 0, &KNullDesC ); + iCurrentWindow = iWindowQueue; + // don't draw anything, just activate it + iCurrentWindow->iWindow->ActivateL( EFalse ); + iObservers = new ( ELeave ) CArrayPtrFlat< MWindowObserver >( 1 ); + AddObserverL(iContentView); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::Window() +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowManager::Window( + TInt aWindowId, + CBrowserWindow*& aWindow ) + { + RemoveDeletedWindowsL(); + CBrowserWindowQue *windowQue = NULL; + TInt error( Window( aWindowId, windowQue, iWindowQueue ) ); + if( windowQue ) + { + aWindow = windowQue->iWindow; + } + return error; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::FindWindowL() +// ----------------------------------------------------------------------------- +// +CBrowserWindow* CBrowserWindowManager::FindWindowL( + const TDesC& aTargetName ) + { +LOG_ENTERFN("WindowManager::FindWindowL( Target )"); + RemoveDeletedWindowsL(); + CBrowserWindow* result = NULL; + CBrowserWindow* window = NULL; + CBrowserWindowQue *windowQue = iWindowQueue; + for( ; windowQue; windowQue = windowQue->Next() ) + { + window = windowQue->iWindow; + if( window->TargetName()->Compare( aTargetName ) == 0 ) + { + result = window; + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::CurrentWindow() +// ----------------------------------------------------------------------------- +// +CBrowserWindow* CBrowserWindowManager::CurrentWindow() const + { + if( iCurrentWindow ) + { + return iCurrentWindow->iWindow; + } + else + { + return NULL; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::CurrentWindowQue() +// ----------------------------------------------------------------------------- +// +CBrowserWindowQue* CBrowserWindowManager::CurrentWindowQue() const + { + if( iCurrentWindow ) + { + return iCurrentWindow; + } + else + { + return NULL; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::GetWindowInfoL() +// ----------------------------------------------------------------------------- +// +CArrayFixFlat* CBrowserWindowManager::GetWindowInfoL( + MWindowInfoProvider* aWindowInfo ) + { + __ASSERT_DEBUG( (aWindowInfo != NULL), Util::Panic( Util::EUninitializedData )); + + RemoveDeletedWindowsL(); + CBrowserWindowQue* window = iWindowQueue; + CArrayFixFlat* windowInfoList = new (ELeave) + CArrayFixFlat( 3 /* KGranularityMedium */ ); + CleanupStack::PushL( windowInfoList ); + for( ; window; window = window->Next() ) + { + // create window info text by client + HBufC* buf = aWindowInfo->CreateWindowInfoLC( *( window->iWindow ) ); + + if (!buf) + { + CleanupStack::PopAndDestroy( buf ); + buf = KNullDesC().AllocLC(); + } + + // create window info( text, id, current ) + CWindowInfo* windowInfo = new ( ELeave ) CWindowInfo( + buf, window->iWindow->WindowId(), iCurrentWindow == window ); + + CleanupStack::Pop( buf ); + + // append to list + windowInfoList->AppendL( windowInfo ); + + } + + CleanupStack::Pop( windowInfoList ); + return windowInfoList; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::AddObserver() +// ----------------------------------------------------------------------------- +// +void CBrowserWindowManager::AddObserverL( MWindowObserver* aObserver ) + { + LOG_ENTERFN("CBrowserWindowManager::AddObserver"); + if ( iObservers ) + { + iObservers->AppendL( aObserver ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::RemoveObserver() +// ----------------------------------------------------------------------------- +// +void CBrowserWindowManager::RemoveObserver( MWindowObserver* aObserver ) + { + LOG_ENTERFN("CBrowserWindowManager::RemoveObserver"); + TInt i( 0 ); + TInt count = iObservers->Count(); + for ( i = 0; i < count; i++ ) + { + if ( iObservers->At( i ) == aObserver ) + { + iObservers->Delete( i ); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::NotifyObservers() +// ----------------------------------------------------------------------------- +// +void CBrowserWindowManager::NotifyObserversL( TWindowEvent aEvent, TInt aWindowId ) + { + LOG_ENTERFN("CBrowserWindowManager::NotifyObservers"); + if ( iObservers ) + { + TInt i; + TInt count = iObservers->Count(); + + if ( count ) + { + for ( i = 0; i < count; i++ ) + { + iObservers->At( i )->WindowEventHandlerL( aEvent, aWindowId ); + } + } + } + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::CreateWindowL() +// ----------------------------------------------------------------------------- +// +CBrowserWindow* CBrowserWindowManager::CreateWindowL( + TInt aParentId, + const TDesC* aTargetName ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START +LOG_ENTERFN("WindowManager::CreateWindowL"); + RemoveDeletedWindowsL(); + if( WindowCount() >= iMaxWindowCount ) + { + HBufC* maxWinsReached = StringLoader::LoadLC(R_BROWSER_NOTE_MAX_WINDOWS); + ApiProvider()->DialogsProvider().DialogNoteL( *maxWinsReached ); + CleanupStack::PopAndDestroy( maxWinsReached ); + return NULL; + } + CBrowserWindow* window = NULL; + // search for already existing window + Window( aParentId, aTargetName, window, iWindowQueue ); // error is ignored + if( window ) + { + + return window; + } + window = CBrowserWindow::NewLC( ++iWindowIdGenerator, aTargetName, this ); +BROWSER_LOG( ( _L( "Window is created, ID: %d, windowCount: %d" ), + window->WindowId(), WindowCount ) ); + // create a WindowQue instance initiated by the new window + CBrowserWindowQue *windowQue = new (ELeave) CBrowserWindowQue( window ); + CleanupStack::PushL( windowQue ); + // and set window's parent + TInt error2( Window( aParentId, windowQue->iParent, iWindowQueue ) ); +BROWSER_LOG( ( _L( "error2: %d" ), error2 ) ); + // append window to the list + if( iWindowQueue ) + { + BROWSER_LOG( ( _L( "window queue not empty" ) ) ); + iWindowQueue->AppendL( windowQue ); + } + else + { + BROWSER_LOG( ( _L( "window queue empty" ) ) ); + iWindowQueue = windowQue; + } + CleanupStack::Pop( windowQue ); + + // window is created and append to the list successfully + ++iWindowCount; + + CleanupStack::Pop( window ); + NotifyObserversL( EWindowOpen, window->WindowId() ); + + // window is activated by the client +PERFLOG_STOP_WRITE("****CreateWindowL***") + return window; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::DeleteWindowL() +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowManager::DeleteWindowL( + TInt aWindowId, + TBool aUserInitiated ) + { +LOG_ENTERFN("WindowManager::DeleteWindowL"); + TInt windowToBeActivated( KErrNotFound ); + // find the window + CBrowserWindowQue* windowQue = NULL; + Window( aWindowId, windowQue, iWindowQueue ); + if( windowQue ) + { + // make the old window absolutely inactive + windowQue->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandClearHistory + (TInt)TBrCtlDefs::ECommandIdBase ); + // Changes were made to ClearHistory that cause it to keep one (current) page + // In order to reuse a window we need to clear the history again after the first new page + // is loaded. + windowQue->iWindow->SetFirstPage(ETrue); + + + windowQue->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandLoseFocus + (TInt)TBrCtlDefs::ECommandIdBase ); + + if(windowQue->iWindow->HasWMLContent(EFalse)) + { + windowQue->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandUnloadWMLEngine + (TInt)TBrCtlDefs::ECommandIdBase ); + } + + // On 3.1 CancelFetch activates the content view for some reason + // this section is temporarily flagged out until further + // investigation. + windowQue->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ); + + // if the topmost window is deleted + // try to find a new one to be activated + if( iCurrentWindow == windowQue ) + { + CBrowserWindowQue* next = windowQue->Next(); + CBrowserWindowQue* prev = windowQue->Prev(); + if( next ) + { + windowToBeActivated = next->iWindow->WindowId(); + iCurrentWindow = next; + } + else if( prev ) + { + windowToBeActivated = prev->iWindow->WindowId(); + iCurrentWindow = prev; + } + else + { + windowToBeActivated = 0; + } + } + // else a background window was deleted + + // last window handling + if( WindowCount() == 1 ) + { + // here we already set the windowToBeActivated to 0 + // means CloseContentView or Exit in AppUi + + // clear all content of Window (images, scripts) + +// windowQue->iWindow->BrCtlInterface().HandleCommandL( +// (TInt)TBrCtlDefs::ECommand + (TInt)TBrCtlDefs::ECommandIdBase ); + windowQue->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandUnloadWMLEngine + (TInt)TBrCtlDefs::ECommandIdBase ); + + //Remove the plugins windows. This is a fix for plugins still plays in the background + //while the page is closed. + windowQue->iWindow->BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandUnLoadPluginWindows + (TInt)TBrCtlDefs::ECommandIdBase ); + + iIsContentExist = EFalse; + windowQue->iWindow->SetHasWMLContent(EFalse); + windowQue->iWindow->SetCurrWinHasWMLContent(EFalse); + + + } + // Update MW Indicator + else if ( WindowCount() == 2 ) + { + // sets the window status + windowQue->iStatus |= CBrowserWindowQue::EWindowDeleted; + windowQue->iWindow->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandNotifyPluginFocusChangeEvent + (TInt)TBrCtlDefs::ECommandIdBase); + windowQue->iWindow->DeactivateL(); + // maintain deleted windows' count + ++iDeletedWindowCount; + + if( aUserInitiated ) + { + DeleteOneWindowL( aWindowId ); + } + } + else + { + // sets the window status + windowQue->iStatus |= CBrowserWindowQue::EWindowDeleted; + windowQue->iWindow->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandNotifyPluginFocusChangeEvent + (TInt)TBrCtlDefs::ECommandIdBase); + windowQue->iWindow->DeactivateL(); + // maintain deleted windows' count + ++iDeletedWindowCount; + + if( aUserInitiated ) + { + DeleteOneWindowL( aWindowId ); + } + } + } + NotifyObserversL( EWindowClose, aWindowId ); + + return windowToBeActivated; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::SwitchWindowL() +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowManager::SwitchWindowL( TInt aWindowId, TBool aDraw ) + { +LOG_ENTERFN("WindowManager::SwitchWindowL"); + CBrowserWindowQue* windowQue = NULL; + TBool wdnSwitching = EFalse; + TInt error( Window( aWindowId, windowQue, iWindowQueue ) ); +BROWSER_LOG( ( _L( "error: %d" ), error ) ); + if( windowQue ) + { + BROWSER_LOG( ( _L( "Switching..." ) ) ); + if( windowQue != iCurrentWindow ) + { + wdnSwitching = ETrue; + iCurrentWindow->iWindow->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandNotifyPluginFocusChangeEvent + (TInt)TBrCtlDefs::ECommandIdBase); + iCurrentWindow->iWindow->DeactivateL(); + iCurrentWindow = windowQue; + } + //If the history view is up, don't activate the content view unless it is switching the window. Otherwise, + //it will overdraw the history view and it will cause serious problems when there + //is a background redirection + if(!iCurrentWindow->iWindow->IsWindowActive() && (!iContentView->IsHistoryViewUp() || wdnSwitching)) + { + iCurrentWindow->iWindow->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandNotifyPluginFocusChangeEvent + (TInt)TBrCtlDefs::ECommandIdBase); + iCurrentWindow->iWindow->ActivateL( aDraw ); + iContentView->UpdateCbaL(); + } + } + return error; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::Window() +// ----------------------------------------------------------------------------- +// search for a window identified by its Id +TInt CBrowserWindowManager::Window( + TInt aWindowId, + CBrowserWindowQue*& aWindowQue, + CBrowserWindowQue* aStartingItem ) const + { +LOG_ENTERFN("WindowManager::Window( Id )"); + TInt error( KErrNotFound ); + CBrowserWindowQue *windowQue = aStartingItem; + for( ; (error != KErrNone) && (windowQue); windowQue = windowQue->iNext ) + { + if( windowQue->iWindow->WindowId() == aWindowId ) + { + error = KErrNone; + aWindowQue = windowQue; + } + } + return error; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::Window() +// ----------------------------------------------------------------------------- +// search for a window identified by TargetName and its Parent +TInt CBrowserWindowManager::Window( + TInt aParentId, + const TDesC* aTargetName, + CBrowserWindow*& aWindow, + CBrowserWindowQue* aStartingItem ) const + { +LOG_ENTERFN("WindowManager::Window( Parent, Target )"); + TInt error( KErrNotFound ); + if( aTargetName && aTargetName->Length() ) // sanity check + { + CBrowserWindow* window = NULL; + CBrowserWindowQue *windowQue = aStartingItem; + CBrowserWindowQue* parent = NULL; + for( ; (error != KErrNone) && (windowQue); windowQue = windowQue->iNext ) + { + window = windowQue->iWindow; + parent = windowQue->iParent; + if( parent && + ( parent->iWindow->WindowId() == aParentId ) && + ( window->TargetName()->Compare( *aTargetName ) == 0 ) ) + { + error = KErrNone; + aWindow = window; + } + } + } + return error; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowManager::DeleteOneWindowL() +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowManager::DeleteOneWindowL( TInt aWindowId ) + { + // Last window cannot be deleted, this is not called then. +LOG_ENTERFN("WindowManager::DeleteOneWindowL"); + CBrowserWindowQue* windowQue = NULL; + // find window, error ignored + Window( aWindowId, windowQue, iWindowQueue ); + if( windowQue ) + { + // set WindowQueue's first item if required + if( iWindowQueue == windowQue ) + { + iWindowQueue = windowQue->iNext; + } + + // clear children's parent pointer + CBrowserWindowQue* queue = iWindowQueue; + for( ; queue; queue = queue->iNext ) + { + if( queue->iParent == windowQue ) + { + queue->iParent = NULL; + } + } + + // decrease WindowCount + --iWindowCount; + + // maintain deleted status + if ( windowQue->iStatus & CBrowserWindowQue::EWindowDeleted ) + { + __ASSERT_DEBUG( iDeletedWindowCount, + Util::Panic( Util::EUnExpected )); + --iDeletedWindowCount; + } + // delete window via its windowQue container + delete windowQue; + } + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CBrowserWindowManager::RemoveDeletedWindowsL() +// ---------------------------------------------------------------------------- +// +void CBrowserWindowManager::RemoveDeletedWindowsL() + { + CBrowserWindowQue *window = iWindowQueue; + CBrowserWindowQue *temp = NULL; + // walk through all the windows + for( ; window; ) + { + temp = window; + window = window->iNext; + // if it is set as deleted + if( temp->iStatus & CBrowserWindowQue::EWindowDeleted ) + { + DeleteOneWindowL( temp->iWindow->WindowId() ); + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserWindowManager::HandlePreferencesChangeL() +// ---------------------------------------------------------------------------- +// +void CBrowserWindowManager::HandlePreferencesChangeL( + const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ) + { +LOG_ENTERFN("WindowManager::HandlePreferencesChangeL"); +BROWSER_LOG( ( _L( "Preferences event: %d" ), aEvent ) ); + switch( aEvent ) + { + case EPreferencesActivate: + { + // Topmost Window ONLY + if ( iCurrentWindow ) + { + iCurrentWindow->iWindow->HandlePreferencesChangeL( + aEvent, aValues, aSettingType ); + } + break; + } + case EPreferencesDeactivate: + case EPreferencesItemChange: + { + // All windows + CBrowserWindowQue *windowQue = iWindowQueue; + for( ; windowQue; windowQue = windowQue->Next() ) + { + windowQue->iWindow->HandlePreferencesChangeL( + aEvent, aValues, aSettingType ); + } + break; + } + default: + // don't do anything + break; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserWindowManager::SendCommandToAllWindowsL() +// ---------------------------------------------------------------------------- +// +void CBrowserWindowManager::SendCommandToAllWindowsL( + TInt aCommand ) + { +LOG_ENTERFN("WindowManager::SendCommandToAllWindowsL"); +BROWSER_LOG( ( _L( "Command: %d" ), aCommand ) ); + + CBrowserWindowQue *windowQue = iWindowQueue; + for( ; windowQue; windowQue = windowQue->Next() ) + { + windowQue->iWindow->BrCtlInterface().HandleCommandL(aCommand); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserWindowManager::SetCurrentWindowViewState() +// ---------------------------------------------------------------------------- +// +void CBrowserWindowManager::SetCurrentWindowViewState(TBrCtlDefs::TBrCtlState aViewState, TInt aValue) + { +LOG_ENTERFN("WindowManager::SetCurrentWindowViewState"); +BROWSER_LOG( ( _L( "State: %d" ), aViewState ) ); + + TBool val(aValue > 0); + if (aViewState == TBrCtlDefs::EStateWmlView) + { + CurrentWindow()->SetWMLMode(val); // set current page has wml (true or false) + if (val) + { + CurrentWindow()->SetHasWMLContent(ETrue); // at least 1 page in window has/had wml + CurrentWindow()->SetCurrWinHasWMLContent(ETrue); // current page has wml content + + } + else + { + CurrentWindow()->SetCurrWinHasWMLContent(EFalse);// current page isn't wml + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserWindowManager::CloseAllWindowsExceptCurrent() +// ---------------------------------------------------------------------------- +// +void CBrowserWindowManager::CloseAllWindowsExceptCurrent() + { + LOG_ENTERFN("WindowManager::CloseAllWindowsExceptCurrent"); + CBrowserWindowQue* window = iWindowQueue; + for( ; window; window = window->Next() ) + { + if(iCurrentWindow != window) + { + DeleteWindowL(window->iWindow->WindowId(), EFalse); + } + } + } +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserWindowSelectionContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserWindowSelectionContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserWindowSelectionContainer. +* +* +*/ + + + +// INCLUDE FILES +#include "BrowserWindowSelectionContainer.h" +#include "BrowserWindowSelectionView.h" +#include "BrowserAppUi.h" +#include "Display.h" +#include "WindowInfoProvider.h" +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::ConstructL +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::ConstructL(const TRect& aRect) + { + CreateWindowL(); + // Tabgroup has been read from resource and it were pushed to the navi pane. + // Get pointer to the navigation decorator with the ResourceDecorator() function. + // Application owns the decorator and it has responsibility to delete the object. + iNaviDecorator = iView->ApiProvider().Display().NaviPaneL()->CreateTabGroupL(); + iTabGroup = (CAknTabGroup*)iNaviDecorator->DecoratedControl(); + iTabGroup->SetObserver(this); + + /* + // Create tab icon + iTabIcon = new (ELeave) CEikImage; + TResourceReader rr; + iCoeEnv->CreateResourceReaderLC( rr, R_BROWSER_ICON_PROP_FOLDER ); + iTabIcon->ConstructFromResourceL( rr ); + CleanupStack::PopAndDestroy(); // rr + */ + + SetRect(aRect); + ActivateL(); + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::CBrowserWindowSelectionContainer +// --------------------------------------------------------- +// +CBrowserWindowSelectionContainer::CBrowserWindowSelectionContainer( CBrowserWindowSelectionView *aView ) : iView( aView ) + { + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::~CBrowserWindowSelectionContainer +// --------------------------------------------------------- +// +CBrowserWindowSelectionContainer::~CBrowserWindowSelectionContainer() + { + delete iNaviDecorator; + delete iThumbnail; + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::ChangeTabL +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::ChangeTabL( CArrayFixFlat* aTabTexts, TInt aActivateTab ) + { + // If there are any tabs + if ( iTabGroup->TabCount() ) + { + TInt tabCount = iTabGroup->TabCount(); + // Delete all tabs + for ( TInt tabIndex = 0; tabIndex < tabCount; tabIndex++ ) + { + // Delete the first tab until there is no more tab... + iTabGroup->DeleteTabL( iTabGroup->TabIdFromIndex( 0 ) ); + } + } + // If only two tabs are needed, dont show more tabs. + if ( aTabTexts->Count() == 2 ) + { + GetTabGroup()->SetTabFixedWidthL( EAknTabWidthWithTwoLongTabs ); + } + // If more than two tabs are needed, maximum 3 tabs are visible + else + { + GetTabGroup()->SetTabFixedWidthL( EAknTabWidthWithThreeLongTabs ); + } + // Add create the tabs + for ( TInt tabIndex = 0; tabIndex < aTabTexts->Count(); tabIndex++ ) + { + iTabGroup->AddTabL( tabIndex, (*aTabTexts)[tabIndex]->Des() /*, iTabIcon->Bitmap(), iTabIcon->Mask()*/ ); + } + // Set focus of the specified tab + iTabGroup->SetActiveTabByIndex( aActivateTab ); + // Handle tab changes. + iView->ApiProvider().Display().NaviPaneL()->PushL( *iNaviDecorator ); + + // Draw the thumbnail by the window id. + GetWindowThumbnailL( iView->GetWindowIdFromTabIndex( GetTabGroup()->ActiveTabIndex() ) ); + DrawNow(); + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::SizeChanged +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::SizeChanged() + { + // TODO: Add here control resize code etc. + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::CountComponentControls +// --------------------------------------------------------- +// +TInt CBrowserWindowSelectionContainer::CountComponentControls() const + { + return 0; // return nbr of controls inside this container + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::ComponentControl +// --------------------------------------------------------- +// +CCoeControl* CBrowserWindowSelectionContainer::ComponentControl(TInt aIndex) const + { + switch ( aIndex ) + { + default: + return NULL; + } + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::Draw +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + + // Create a gray background... + gc.SetPenColor(TRgb(45,44,50)); + gc.SetPenStyle(CGraphicsContext::ESolidPen); + gc.SetBrushColor( KRgbDarkGray ); + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.DrawRect( aRect ); + + if ( iThumbnail ) + { +#ifdef BRDO_MULTITOUCH_ENABLED_FF + TSize viewSize(aRect.Width(), aRect.Height()); + int centerImageWidth(viewSize.iWidth*60/100); + int centerImageHeight(viewSize.iHeight*75/100); + int centerImageX(viewSize.iWidth*20/100); + int centerImageY(viewSize.iHeight*(100-75)/(2*100)); + TPoint centerImageOrigin(centerImageX, centerImageY); +#endif + // Put in center + // release + TSize bitmapSize = iThumbnail->Bitmap()->SizeInPixels(); + // test + //TSize bitmapSize = iThumbnail->SizeInPixels(); + TInt x = ( aRect.Width()-bitmapSize.iWidth ) / 2; + TInt y = ( aRect.Height()-bitmapSize.iHeight ) / 2; + // Draw thumbnail + // release +#ifdef BRDO_MULTITOUCH_ENABLED_FF + gc.BitBlt( centerImageOrigin, iThumbnail->Bitmap(), TRect(0, 0, centerImageWidth, centerImageHeight) ); +#else + gc.BitBlt( TPoint(x,y), iThumbnail->Bitmap() ); +#endif + // test + // gc.BitBlt( TPoint(x,y), iThumbnail ); + } + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CBrowserWindowSelectionContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + // Handle if Ok key was pressed. + if ( aType == EEventKey && aKeyEvent.iCode == EKeyOK ) + { + TInt windowId = iView->GetWindowIdFromTabIndex( GetTabGroup()->ActiveTabIndex() ); + iView->ApiProvider().WindowMgr().SwitchWindowL( windowId ); + //If the user switches window we reset the CalledFromAnotherApp status + if(iView->ApiProvider().CalledFromAnotherApp()) + { + iView->ApiProvider().SetCalledFromAnotherApp(EFalse); + } + iView->ApiProvider().SetViewToBeActivatedIfNeededL( iView->GetPreviousViewID() ); + return EKeyWasConsumed; + } + + // Check if navipane has valid parameters. + if ( !iTabGroup ) + { + return EKeyWasNotConsumed; + } + if ( !iTabGroup->TabCount() ) + { + return EKeyWasNotConsumed; + } + if ( !iNaviDecorator ) + { + return EKeyWasNotConsumed; + } + // Get tab group + CAknTabGroup* tabGroup = STATIC_CAST( CAknTabGroup*, iNaviDecorator->DecoratedControl() ); + // If tab group was not created succesfully. + if ( !tabGroup ) + { + return EKeyWasNotConsumed; + } + // If tab group has no tabs. + if ( !tabGroup->TabCount() ) + { + return EKeyWasNotConsumed; + } + // Forward events to tabgroup. + const TKeyResponse result = tabGroup->OfferKeyEventL( aKeyEvent, aType ); + + return result; + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::HandleControlEventL +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::HandleControlEventL( + CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) + { + // TODO: Add your control event handler code here + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::GetWindowThumbnail +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::GetWindowThumbnailL( TInt aWindowId ) + { + // Get window url + CBrowserWindow* window; + iView->ApiProvider().WindowMgr().Window( aWindowId, window ); + HBufC* windowUrl = window->BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + + // Get thumbnail + // release + delete iThumbnail; + if (windowUrl) + { + iThumbnail = window->BrCtlInterface().GetBitmapData( windowUrl->Des(), TBrCtlDefs::EBitmapThumbnail ); + } + else + { + iThumbnail = NULL; + } + // eof release + + + CleanupStack::PopAndDestroy(); // windowUrl + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::HandlePointerEventL +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + if (aPointerEvent.iType == TPointerEvent::EButton1Down) + { + iView->HandleCommandL(EAknCmdOpen); + } + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionContainer::TabChangedL +// --------------------------------------------------------- +// +void CBrowserWindowSelectionContainer::TabChangedL(TInt /*aIndex*/) + { + iView->UpdateTitleL(); + iView->UpdateTumbnailL(); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/BrowserWindowSelectionView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/BrowserWindowSelectionView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,370 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserWindowSelectionView. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include "BrowserWindowSelectionView.h" +#include "BrowserWindowSelectionContainer.h" +#include "Preferences.h" +#include "Display.h" +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------------------------- +// CBrowserWindowSelectionView::NewLC +// ---------------------------------------------------------------------------- +// +CBrowserWindowSelectionView* CBrowserWindowSelectionView::NewLC( MApiProvider& aApiProvider ) + { + CBrowserWindowSelectionView* view = new (ELeave) CBrowserWindowSelectionView( aApiProvider ); + CleanupStack::PushL( view ); + view->ConstructL( ); + return view; + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::CBrowserWindowSelectionView +// --------------------------------------------------------- +// +CBrowserWindowSelectionView::CBrowserWindowSelectionView( MApiProvider& aApiProvider ): +CBrowserViewBase( aApiProvider ) + { + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::ConstructL() + { + BaseConstructL( R_BROWSERWINDOWSELECTION_VIEW ); + iTitles = new (ELeave) CArrayFixFlat( 2 ); + iWindowIds = new (ELeave) CArrayFixFlat( 2 ); + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::~CBrowserWindowSelectionView() +// destructor +// --------------------------------------------------------- +// +CBrowserWindowSelectionView::~CBrowserWindowSelectionView() + { + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + delete iWindowInfo; + delete iTitles; + delete iWindowIds; + } + +// --------------------------------------------------------- +// TUid CBrowserWindowSelectionView::Id() +// +// --------------------------------------------------------- +// +TUid CBrowserWindowSelectionView::Id() const + { + return KUidBrowserWindowSelectionViewId; + } + +// --------------------------------------------------------------------------- +// CBrowserWindowSelectionView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CBrowserWindowSelectionView::CommandSetResourceIdL() + { + TInt commandSet = 0; // R_AVKON_SOFTKEYS_EMPTY; + return commandSet; + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::HandleCommandL() +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::HandleCommandL(TInt aCommand) + { + switch ( aCommand ) + { + case EAknCmdOpen: + { + TInt windowId = GetWindowIdFromTabIndex( iContainer->GetTabGroup()->ActiveTabIndex() ); + ApiProvider().WindowMgr().SwitchWindowL( windowId ); + //If the user switches window we reset the CalledFromAnotherApp status + if(ApiProvider().CalledFromAnotherApp()) + { + ApiProvider().SetCalledFromAnotherApp(EFalse); + } + ApiProvider().SetViewToBeActivatedIfNeededL( GetPreviousViewID() ); + break; + } + case EWmlCmdCloseWindow: + { + TInt windowId = GetWindowIdFromTabIndex( iContainer->GetTabGroup()->ActiveTabIndex() ); + TInt newWindowId = ApiProvider().WindowMgr().DeleteWindowL( windowId, EFalse ); + + // Check if there is only one remaining window, + // after closing the window. + delete iWindowInfo; + iWindowInfo = NULL; + iWindowInfo = ApiProvider().WindowMgr().GetWindowInfoL( this ); + if ( iWindowInfo->Count() < 2 ) + { + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + ApiProvider().WindowMgr().SwitchWindowL( newWindowId ); + } + break; + } + case EWmlCmdCloseAllWindowButThis: + { + iWindowEventsDisabled = ETrue; + // Get current window id. + TInt windowId = GetWindowIdFromTabIndex( iContainer->GetTabGroup()->ActiveTabIndex() ); + // Get all windows id. + delete iWindowInfo; + iWindowInfo = NULL; + iWindowInfo = ApiProvider().WindowMgr().GetWindowInfoL( this ); + + // Delete all windows except this. + for ( TInt i = 0; i < iWindowInfo->Count(); i++ ) + { + if ( (*iWindowInfo)[i]->iWindowId != windowId ) + { + ApiProvider().WindowMgr().DeleteWindowL( (*iWindowInfo)[i]->iWindowId, ETrue ); + } + } + // Activate curent window. + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + ApiProvider().WindowMgr().SwitchWindowL( windowId ); + iWindowEventsDisabled = EFalse; + break; + } + case EWmlCmdWindowSelectionCancel: + { + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + break; + } + default: + { + break; + } + } + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::HandleClientRectChange() +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::DoActivateL(...) +// +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::DoActivateL( const TVwsViewId& aPrevViewId,TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); + StatusPane()->MakeVisible( ETrue ); + + iPreviousViewID = ApiProvider().LastActiveViewId( ); + ApiProvider().SetLastActiveViewId( Id() ); + iLastViewId = aPrevViewId; + if (!iContainer) + { + iContainer = new (ELeave) CBrowserWindowSelectionContainer( this ); + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect() ); + AppUi()->AddToStackL( *this, iContainer ); + UpdateTabsL(); + } + ApiProvider().WindowMgr().AddObserverL( this ); + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::DoDeactivate() +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::DoDeactivate() + { + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + iContainer = NULL; + ApiProvider().WindowMgr().RemoveObserver( this ); + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::CreateWindowInfoLC() +// --------------------------------------------------------- +// +HBufC* CBrowserWindowSelectionView::CreateWindowInfoLC( const CBrowserWindow& aWindow ) + { + HBufC* buf = aWindow.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoTitle ); + if( !buf || !buf->Length() ) + { + CleanupStack::PopAndDestroy( buf ); + buf = aWindow.BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + } + return buf; + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::UpdateTabs() +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::UpdateTabsL() + { + delete iWindowInfo; + iWindowInfo = NULL; + iWindowInfo = ApiProvider().WindowMgr().GetWindowInfoL( this ); + + iTitles->Reset(); + iWindowIds->Reset(); + TInt activeTab = 0; + for ( TInt i = 0; i < iWindowInfo->Count(); i++ ) + { + iTitles->AppendL( CONST_CAST( HBufC*, (*iWindowInfo)[i]->iWindowText ) ); + iWindowIds->AppendL( (*iWindowInfo)[i]->iWindowId ); + if ( (*iWindowInfo)[i]->iCurrent ) + { + activeTab = i; + HBufC* title = CONST_CAST( HBufC*, (*iWindowInfo)[i]->iWindowText ); + if ( title ) + { + ApiProvider().Display().SetTitleL( title->Des() ); + } + } + } + iContainer->ChangeTabL( iTitles, activeTab ); + } + + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::UpdateTabs() +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::UpdateTumbnailL() + { + TInt windowId = GetWindowIdFromTabIndex( iContainer->GetTabGroup()->ActiveTabIndex() ); + iContainer->GetWindowThumbnailL( windowId ); + iContainer->DrawNow(); + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::UpdateTitleL() +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::UpdateTitleL( ) + { + HBufC* title = GetWindowTitleFromTabIndex( iContainer->GetTabGroup()->ActiveTabIndex() ); + ApiProvider().Display().SetTitleL( (*title).Des( ) ); + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowSelectionView::GetWindowIdFromTabIndex +// ----------------------------------------------------------------------------- +// +TInt CBrowserWindowSelectionView::GetWindowIdFromTabIndex( TInt aActiveTabIndex ) + { + TInt windowId = 0; + for ( TInt i = 0; i < iWindowIds->Count(); i++ ) + { + if ( i == aActiveTabIndex ) + { + windowId = (*iWindowInfo)[i]->iWindowId; + } + } + return windowId; + } + +// ----------------------------------------------------------------------------- +// CBrowserWindowSelectionView::GetWindowIdFromTabIndex +// ----------------------------------------------------------------------------- +// +HBufC* CBrowserWindowSelectionView::GetWindowTitleFromTabIndex( TInt aActiveTabIndex ) + { + HBufC* windowText = NULL; + for ( TInt i = 0; i < iWindowInfo->Count(); i++ ) + { + if ( i == aActiveTabIndex ) + { + windowText = CONST_CAST( HBufC*, (*iWindowInfo)[i]->iWindowText ); + } + } + return windowText; + } + +// --------------------------------------------------------- +// CBrowserWindowSelectionView::WindowEventHandlerL +// --------------------------------------------------------- +// +void CBrowserWindowSelectionView::WindowEventHandlerL( TWindowEvent aEvent, TInt /*aWindowId*/ ) + { + if ( !iWindowEventsDisabled ) + { + if ( aEvent == EWindowClose || aEvent == EWindowOpen ) + { + delete iWindowInfo; + iWindowInfo = NULL; + iWindowInfo = ApiProvider().WindowMgr().GetWindowInfoL( this ); + // Update tabs when there are more than one windows open. + if ( iWindowInfo->Count() > 1 ) + { + UpdateTabsL(); + } + } + if ( aEvent == EWindowLoadStart ) + { + iEikonEnv->InfoMsg( _L("load start") ); + } + if ( aEvent == EWindowLoadStop ) + { + iEikonEnv->InfoMsg( _L("load stop") ); + } + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/Logger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/Logger.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implemented logger functionality of the module +* +*/ + + +#if defined( I__BROWSER_LOG_ENABLED ) + +// INCLUDES + +#include "Logger.h" + +// CONSTANTS + +// the indentation value used in every function entry and exit points +// use value 0 to switch indentation off +const TInt KBrowserIndentValue = 0; + +// the left x character of this string is used to indent +// function entry and exit points. DO NOT cut is smaller! +// it has to be synched with the call stack level and KBrowserIndentValue: +// .Length() / KBrowserIndentValue >= max size of callstack +_LIT( KBrowserLoggerIndentString, +" " ); +_LIT( KDebugLogEnterFn, "Browser: %S-> %S" ); +_LIT( KDebugLogLeaveFn, "Browser: %S<- %S" ); + +// --------------------------------------------------------------------------- + +// initialize static member variable +#if defined ( I__BROWSER_LOG_INDENT ) +TInt CBrowserLogger::iIndent( 0 ); +#endif + +// --------------------------------------------------------------------------- + +CBrowserLogger::CBrowserLogger( const TDesC& aFunc ) + : iFunc( aFunc ) +#if ! defined ( I__BROWSER_LOG_INDENT ) + , iIndent( 0 ) +#endif + { + TPtrC a = KBrowserLoggerIndentString().Left( iIndent ); + iIndent += KBrowserIndentValue; + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, + EFileLoggingModeAppend, KDebugLogEnterFn, &a, &iFunc ); + } + +// --------------------------------------------------------------------------- + +CBrowserLogger::~CBrowserLogger() + { + iIndent -= KBrowserIndentValue; + TPtrC a = KBrowserLoggerIndentString().Left( iIndent ); + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, + EFileLoggingModeAppend, KDebugLogLeaveFn, &a, &iFunc ); + } + +// --------------------------------------------------------------------------- + +void CBrowserLogger::Write( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, + EFileLoggingModeAppend, aFmt, list ); + VA_END( list ); + } + +// --------------------------------------------------------------------------- + +void CBrowserLogger::Write( TRefByValue aFmt, VA_LIST& aList ) + { + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, + EFileLoggingModeAppend, aFmt, aList ); + } + +// --------------------------------------------------------------------------- + +void CBrowserLogger::Write(TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, + EFileLoggingModeAppend, aFmt, list ); + VA_END( list ); + } + +// --------------------------------------------------------------------------- + +void CBrowserLogger::Write( TRefByValue aFmt, VA_LIST& aList ) + { + RFileLogger::WriteFormat( KDebugLogDir, KDebugLogFile, + EFileLoggingModeAppend, aFmt, aList ); + } + + +// Code segment for displaying an info note dialog box. Can be used later as a debug aid. + + /* + TInt width, height; + HBufC* header; + TBuf<100> message; + + message.Format(_L("width: %d ; height: %d"), width, height ); + + header = StringLoader::LoadLC( R_WML_SECURITY_VIEW_TITLE ); + + CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( message ); + + dlg->PrepareLC( R_BROWSER_SECURITY_INFO ); + CAknPopupHeadingPane* hPane = dlg->QueryHeading(); + if ( hPane ) + { + hPane->SetTextL( *header ); + } + dlg->RunLD(); + CleanupStack::PopAndDestroy( 1 ); // header + */ + + +#endif // I__BROWSER_LOG_ENABLED + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/SessionAndSecurity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/SessionAndSecurity.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,496 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CSessionAndSecurity +* +* +*/ + + +// INCLUDE FILES + +#include "Browser.hrh" +#include +#include "SessionAndSecurity.h" +#include +#include +#include +#include +#include +#include + +#include "BrowserUtil.h" +#include "ApiProvider.h" +#include // for TCertInfo +#include + +// CONSTANTS +const TInt KWmlSessionInfoMaxLength = 1000; +const TInt KWmlSecurityInfoMaxLength = 1000; +const TInt KMaxLengthTextDateString = 16; +_LIT( KWmlConnSpeed9600, "9600" ); +_LIT( KWmlConnSpeed14400, "14400" ); +_LIT( KWmlConnSpeed19200, "19200" ); +_LIT( KWmlConnSpeed28800, "28800" ); +_LIT( KWmlConnSpeed38400, "38400" ); +_LIT( KWmlConnSpeed43200, "43200" ); +_LIT( KWmlNewLine, "\n" ); +_LIT( KWmlSeparatorComma, "," ); + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------- +// CSessionAndSecurity::CSessionAndSecurity +// ---------------------------------------------------- +// +CSessionAndSecurity::CSessionAndSecurity(MApiProvider& aApiProvider) +: iApiProvider(aApiProvider) + { + } + +//----------------------------------------------------------------------------- +// CSessionAndSecurity::NewL +//----------------------------------------------------------------------------- +// +CSessionAndSecurity* CSessionAndSecurity::NewL(MApiProvider& aApiProvider) + { + CSessionAndSecurity* self = CSessionAndSecurity::NewLC(aApiProvider); + CleanupStack::Pop(); + return self; + } + +//----------------------------------------------------------------------------- +// CSessionAndSecurity::NewLC +//----------------------------------------------------------------------------- +// +CSessionAndSecurity* CSessionAndSecurity::NewLC(MApiProvider& aApiProvider) + { + CSessionAndSecurity* self = new(ELeave) CSessionAndSecurity(aApiProvider); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +//----------------------------------------------------------------------------- +// CSessionAndSecurity::~CSessionAndSecurity +//----------------------------------------------------------------------------- +// +CSessionAndSecurity::~CSessionAndSecurity() + { + } + +// ---------------------------------------------------- +// CSessionAndSecurity::ConstructL +// ---------------------------------------------------- +// +void CSessionAndSecurity::ConstructL() + { + } + +// ---------------------------------------------------- +// CSessionAndSecurity::ShowPageInfoL +// ---------------------------------------------------- +// +void CSessionAndSecurity::ShowPageInfoL() + { + HBufC* messagebody = NULL; + HBufC* header = StringLoader::LoadLC( R_BROWSER_QUERY_CURRENT_PAGE ); + HBufC* urltxt = StringLoader::LoadLC( R_BROWSER_QUERY_CURRENT_PAGE_URL ); + HBufC* currentUrl = ApiProvider().BrCtlInterface(). + PageInfoLC( TBrCtlDefs::EPageInfoUrl ); + if( currentUrl == NULL ) + { + CleanupStack::PopAndDestroy( currentUrl ); + currentUrl = KNullDesC().AllocLC(); + } + TInt length = currentUrl->Length(); + messagebody = HBufC::NewLC( length + urltxt->Length()+2 + KWmlSecurityInfoMaxLength); + messagebody->Des().Append( *urltxt ); + messagebody->Des().Append( KWmlNewLine() ); + messagebody->Des().Append( *currentUrl ); + + + // append security info + const TCertInfo* certInfo = ApiProvider().BrCtlInterface().CertInfo(); + HBufC* message = HBufC::NewLC( KWmlSecurityInfoMaxLength ); + HttpSecurityInfoL( certInfo, *message); + messagebody->Des().Append( KWmlNewLine() ); + messagebody->Des().Append( KWmlNewLine() ); + messagebody->Des().Append( *message ); + + + // output page and security info to dialog + CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *messagebody ); + dlg->PrepareLC( R_BROWSER_PAGE_INFO ); + CAknPopupHeadingPane* hPane = dlg->QueryHeading(); + if ( hPane ) + { + hPane->SetTextL( *header ); + } + dlg->RunLD(); + CleanupStack::PopAndDestroy( 5 ); // header, urltxt, currentUrl, messagebody, message + } + +// ---------------------------------------------------- +// CSessionAndSecurity::ShowSessionInfoL +// ---------------------------------------------------- +// +void CSessionAndSecurity::ShowSessionInfoL() + { + HBufC* header = StringLoader::LoadLC( R_WML_SESSION_VIEW_TITLE ); + HBufC* message = HBufC::NewLC( KWmlSessionInfoMaxLength ); + + HBufC* value = StringLoader::LoadLC( R_WML_SESSION_VIEW_AP ); + message->Des().Append( *value ); + message->Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); // value + + value = ApiProvider().Connection().CurrentApNameLC(); + message->Des().Append( value->Des() ); + message->Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); // value + + // + // Bearer type + // + value = StringLoader::LoadLC( R_WML_SESSION_VIEW_BT ); + message->Des().Append( *value ); + message->Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); // value + + TApBearerType bt = ApiProvider().Connection().CurrentBearerTypeL(); + switch ( bt ) + { + case EApBearerTypeCSD: + { + value = StringLoader::LoadLC( R_WML_BEARER_DATA_CALL ); + break; + } + case EApBearerTypeGPRS: + { + value = StringLoader::LoadLC( R_WML_BEARER_PACKET_DATA ); + break; + } + case EApBearerTypeHSCSD: + { + value = StringLoader::LoadLC( R_WML_BEARER_HSCSD ); + break; + } + default: + value = HBufC::NewLC( 1 ); + break; + } + + message->Des().Append( value->Des() ); + message->Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); // value + + // + // Max conn. speed + // + value = StringLoader::LoadLC( R_WML_SESSION_VIEW_CS ); + message->Des().Append( *value ); + message->Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); // value + TApCallSpeed speed = ApiProvider().Connection().CurrentConnectionSpeed(); + value = HBufC::NewLC( sizeof( KWmlConnSpeed43200 ) ); + switch ( speed ) + { + case KSpeed9600: + { + *value = KWmlConnSpeed9600(); + break; + } + case KSpeed14400: + { + *value = KWmlConnSpeed14400(); + break; + } + case KSpeed19200: + { + *value = KWmlConnSpeed19200(); + break; + } + case KSpeed28800: + { + *value = KWmlConnSpeed28800(); + break; + } + case KSpeed38400: + { + *value = KWmlConnSpeed38400(); + break; + } + case KSpeed43200: + { + *value = KWmlConnSpeed43200(); + break; + } + case KSpeedAutobaud: // default value + default: + { + CleanupStack::PopAndDestroy(); // value + value = StringLoader::LoadLC( R_WML_CONN_SPEED_AD ); + break; + } + } + + message->Des().Append( value->Des() ); + message->Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); // value + + CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *message ); + dlg->PrepareLC( R_BROWSER_SESSION_INFO ); + CAknPopupHeadingPane* hPane = dlg->QueryHeading(); + if ( hPane ) + { + hPane->SetTextL( *header ); + } + dlg->RunLD(); + CleanupStack::PopAndDestroy( 2 ); // header, message + } + +// ---------------------------------------------------------------------------- +// CSessionAndSecurity::HttpSecurityInfoL +// ---------------------------------------------------------------------------- +// +void CSessionAndSecurity::HttpSecurityInfoL( const TCertInfo* aCertInfo, + HBufC& aMessage ) + { + HBufC* value; + HBufC* prompt; + + if ( !aCertInfo ) + { + // Connection: Unsecure + value = StringLoader::LoadLC( R_WML_SECURITY_CONN_UNSECURE ); + prompt = StringLoader::LoadLC( R_WML_SECURITY_CONN_TYPE, *value ); + aMessage.Des().Append( *prompt ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(2); // value, prompt + } + else + { + // Connection: Secure + value = StringLoader::LoadLC( R_WML_SECURITY_CONN_SECURE ); + prompt = StringLoader::LoadLC( R_WML_SECURITY_CONN_TYPE, *value ); + aMessage.Des().Append( *prompt ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(2); // value, prompt + + HBufC* buf2 = HBufC::NewMaxLC(256); + + // Server authentication + value = StringLoader::LoadLC( R_WML_SECURITY_SERVER_AUT, KNullDesC ); + aMessage.Des().Append( *value ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); //value + + // Subject + FillDNinfoL( aCertInfo->iSubjectDNInfo, buf2 ); + value = StringLoader::LoadLC( R_WML_SECURITY_CERT_OWNER, buf2->Des() ); + aMessage.Des().Append( *value ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(2); //value, buf2 + + //Issuer + buf2 = HBufC::NewMaxLC(256); + FillDNinfoL( aCertInfo->iIssuerDNInfo, buf2 ); + value = StringLoader::LoadLC( R_WML_SECURITY_INFO_ISSUER, buf2->Des() ); + aMessage.Des().Append( *value ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(2); //value, buf2 + + // Valid from + TBuf< KMaxLengthTextDateString > validFromString; + HBufC* dateFormatString = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); + aCertInfo->iStartValDate.FormatL( validFromString, *dateFormatString ); + CleanupStack::PopAndDestroy(); //dateFormatString + value = StringLoader::LoadLC( R_WML_SECURITY_VALID_FROM, validFromString ); + aMessage.Des().Append( *value ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); //value + + // Valid to + dateFormatString = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); + aCertInfo->iEndValDate.FormatL( validFromString, *dateFormatString ); + CleanupStack::PopAndDestroy(); //dateFormatString + value = StringLoader::LoadLC( R_WML_SECURITY_VALID_TO, validFromString ); + aMessage.Des().Append( *value ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy(); //value + + // hex formatting + TBuf<2> buf; + _LIT( KHexFormat, "%02X"); + + // Serial number + HBufC* buffer = HBufC::NewLC( aCertInfo->iSerialNo.Length()*2 ); + for (TInt i = 0; i < aCertInfo->iSerialNo.Length(); i++) + { + buf.Format( KHexFormat, aCertInfo->iSerialNo[i] ); + buffer->Des().Append( buf ); + } + value = StringLoader::LoadLC( R_WML_SECURITY_SERIALNO, *buffer ); + aMessage.Des().Append( *value ); + aMessage.Des().Append( TChar( '\n' ) ); + aMessage.Des().Append( TChar( '\n' ) ); + CleanupStack::PopAndDestroy( 2 ); // value, buffer + + // Fingerprint + { + TInt emptyChars = aCertInfo->iFingerprint.Length()/2; + emptyChars++; + HBufC* buffer = HBufC::NewLC( aCertInfo->iFingerprint.Length()*2 + emptyChars ); + TInt ind = 1; + for (TInt i = 0; i < aCertInfo->iFingerprint.Length(); i++) + { + buf.Format( KHexFormat, aCertInfo->iFingerprint[i] ); + buffer->Des().Append( buf ); + if ( ind == 2 ) + { + buffer->Des().Append( TChar( ' ' ) ); + ind = 0; + } + ind++; + } + value = StringLoader::LoadLC( R_WML_SECURITY_FINGERPRINT, *buffer ); + aMessage.Des().Append( *value ); + CleanupStack::PopAndDestroy( 2 ); // value, buffer + } + } + + } + +// ---------------------------------------------------- +// CSessionAndSecurity::ConvertTDesC8ToHBufC16LC +// ---------------------------------------------------- +// +void CSessionAndSecurity::ConvertTDesC8ToHBufC16LC( TDesC8& aSource, + HBufC16*& aDestination) + { + const TInt length = aSource.Length(); // length of name + TPtrC8 ptr ( aSource.Ptr(), aSource.Length() ); + aDestination = HBufC::NewLC( length ); + aDestination->Des().Copy( ptr ); + } + +// ---------------------------------------------------- +// CSessionAndSecurity::FillDNinfoL +// ---------------------------------------------------- +// +void CSessionAndSecurity::FillDNinfoL( TDNInfo aDNInfo, HBufC* aBuf ) + { + HBufC16* buf2 = NULL; + TInt num = 0; + if ( aDNInfo.iCommonName.Length() ) + { + aBuf->Des().Copy( aDNInfo.iCommonName ); + num++; + } + if ( aDNInfo.iOrganization.Length() ) + { + if ( !num ) + { + aBuf->Des().Copy( aDNInfo.iOrganization ); + } + else + { + aBuf->Des().Append( KWmlSeparatorComma() ); + ConvertTDesC8ToHBufC16LC( aDNInfo.iOrganization, buf2 ); + aBuf->Des().Append( buf2->Ptr(),aDNInfo.iOrganization.Length() ); + CleanupStack::PopAndDestroy(); //buf2 + } + num++; + } + if ( aDNInfo.iOrganizationUnit.Length() && num < 2 ) + { + if ( !num ) + { + aBuf->Des().Copy( aDNInfo.iOrganizationUnit ); + } + else + { + aBuf->Des().Append( KWmlSeparatorComma() ); + ConvertTDesC8ToHBufC16LC( aDNInfo.iOrganizationUnit, buf2 ); + aBuf->Des().Append( buf2->Ptr(),aDNInfo.iOrganizationUnit.Length() ); + CleanupStack::PopAndDestroy(); //buf2 + } + num++; + } + if ( aDNInfo.iLocality.Length() && num < 2 ) + { + if ( !num ) + { + aBuf->Des().Copy( aDNInfo.iLocality ); + } + else + { + aBuf->Des().Append( KWmlSeparatorComma() ); + ConvertTDesC8ToHBufC16LC( aDNInfo.iLocality, buf2 ); + aBuf->Des().Append( buf2->Ptr(),aDNInfo.iLocality.Length() ); + CleanupStack::PopAndDestroy(); //buf2 + } + num++; + } + if ( aDNInfo.iCountry.Length() && num < 2 ) + { + if ( !num ) + { + aBuf->Des().Copy( aDNInfo.iCountry ); + } + else + { + aBuf->Des().Append( KWmlSeparatorComma() ); + ConvertTDesC8ToHBufC16LC( aDNInfo.iCountry, buf2 ); + aBuf->Des().Append( buf2->Ptr(),aDNInfo.iCountry.Length() ); + CleanupStack::PopAndDestroy(); //buf2 + } + } + } + +// ---------------------------------------------------- +// CSessionAndSecurity::ShowSecurityInfoL +// ---------------------------------------------------- +// +void CSessionAndSecurity::ShowSecurityInfoL() + { + const TCertInfo* certInfo = ApiProvider().BrCtlInterface().CertInfo(); + + HBufC* header; + HBufC* message = HBufC::NewLC( KWmlSecurityInfoMaxLength ); + + header = StringLoader::LoadLC( R_WML_SECURITY_VIEW_TITLE ); + HttpSecurityInfoL( certInfo, *message); + + CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *message ); + + dlg->PrepareLC( R_BROWSER_SECURITY_INFO ); + CAknPopupHeadingPane* hPane = dlg->QueryHeading(); + if ( hPane ) + { + hPane->SetTextL( *header ); + } + + dlg->RunLD(); + CleanupStack::PopAndDestroy( 2 ); // header, message, + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/BrowserAppSrc/WlanObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/BrowserAppSrc/WlanObserver.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include // For WLAN state checking + + +#include "ApiProvider.h" +#include "WlanObserver.h" +#include "Display.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWlanObserver::CWlanObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CWlanObserver::CWlanObserver(MApiProvider& aApiProvider) + : CActive( EPriorityStandard ), + iApiProvider( aApiProvider ) + { + CActiveScheduler::Add( this ); + iWlanProperty.Attach( KPSUidWlan, KPSWlanIndicator ); + iWlanProperty.Subscribe( iStatus ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CWlanObserver::~CWlanObserver() +// Destructor +// ----------------------------------------------------------------------------- +CWlanObserver::~CWlanObserver() + { + Cancel(); + iWlanProperty.Close(); + } + + +// ----------------------------------------------------------------------------- +// CWlanObserver::GetCurrentState +// +// Retrieves current state of wireless lan connection +// @param aWlanStateValue reference to current Wlan state value which is updated here +// @return: EFalse if error condition (ignore aWlanStateValue in this case) +// Etrue if no error (get updated value from aWlanStateValue) +// ----------------------------------------------------------------------------- +TBool CWlanObserver::GetCurrentState(TInt &aWlanStateValue) + { + TInt value; + TInt errorval = iWlanProperty.Get( value ); + if (!errorval ) + { + aWlanStateValue = value; + return( ETrue ); + } + else + { + return( EFalse ); + } + } + +// ----------------------------------------------------------------------------- +// CWlanObserver::RunL +// ----------------------------------------------------------------------------- +void CWlanObserver::RunL() + { + if( iStatus==KErrNone ) + { + iWlanProperty.Subscribe( iStatus ); + SetActive(); + + TInt value; + if ( GetCurrentState(value) ) + { + iApiProvider.Display().UpdateWlanIndicator( value ); + } + } + } + +// ----------------------------------------------------------------------------- +// CWlanObserver::RunError +// ----------------------------------------------------------------------------- +TInt CWlanObserver::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWlanObserver::DoCancel +// ----------------------------------------------------------------------------- +void CWlanObserver::DoCancel() + { + iWlanProperty.Cancel(); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserAdaptiveListPopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserAdaptiveListPopup.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CBrowserPopupList and CBrowserAdaptiveListPopup +* +* +*/ + +#ifndef BROWSERADAPTIVELISTPOPUP_H +#define BROWSERADAPTIVELISTPOPUP_H + +// INCLUDES +#include +#include + +//for testing purposes you can define fake ahle engine +//wich will provide random results +// CONSTANTS +// UID of view +const TUid KViewId = {1}; + +enum TParentType + { + EGotoPane, + EBookmarksGotoPane + }; + +class CRecentUrlStore; + + +class CAknsListBoxBackgroundControlContext; + +// CLASS DECLARATION +class CBrowserPopupList : public CAknSingleGraphicPopupMenuStyleListBox +{ +public : + CBrowserPopupList(TParentType aParentType); + ~CBrowserPopupList(); + + void SetHighLight(TBool aHighLight); + + TBool HighLightEnabled(); + + void ConstructL(const CCoeControl* aParent, TInt aFlags); + + void SizeChanged(); + void Draw(const TRect& /*aRect*/) const; + +protected : + TParentType iParentType; + TBool iOnePartFrameBitmapUsed; +}; + + + +/** +* CBrowserAdaptiveListPopup view class. +* +*/ +class CBrowserAdaptiveListPopup : + public CCoeControl, + public MCoeControlObserver, public MEikListBoxObserver + + { + public: // Constructors and destructor + + /** + *C++ Constructor + */ + CBrowserAdaptiveListPopup( CEikEdwin* aGotoPaneEdit, + CCoeControl* aParent, + TParentType aParentType, + TBool aSearchFeature = EFalse ); + + /** + * default constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CBrowserAdaptiveListPopup(); + + + public: // Functions from base classes + + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + void HidePopupL(); + + TBool IsInDirectoryMode(); + + void SetDirectoryModeL(TBool aDirMode); + + TBool IsOpenDirToShow(); + + TBool IsPoppedUp(); + + void HandleResourceChange( TInt aType ); + + void HandleResourceChangeL( TInt aType ); + + void SetUrlSuffixList(HBufC* urlSuffixList); + + void SetMaxRecentUrls (TInt maxRecentUrls); + + /** + * Sets the OrdinalPosition of GotoPane + * @param aPos The OrdinalPosition + */ + void SetOrdinalPosition( TInt aPos ); + /** + * From CCoeControl. + * Handles pointer events + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType); + private: // Functions from base classes + + void HandleControlEventL(CCoeControl* aControl,enum MCoeControlObserver::TCoeEvent aEventType); + + TInt CountComponentControls() const; + + CCoeControl* ComponentControl( TInt aIndex ) const; + + void SetIconsL(); + + void CreateURLCompletionListL(); + + private: + + /** + * ShowPopupList handles displaying the adaptive list box + * @since + * @param aRelayout Whether or not this popup list is being displayed as the result + * of a layout changed event (in which case we need to make sure that the popup + * is redrawn in the correct position) Set to EFalse by default. + * @return void + */ + void ShowPopupListL(TBool aRelayout = EFalse); + void UpdateScrollBarPositionL(const TInt aPosition); + void HandleItemClickedL(CEikListBox* aListBox ); + + static TInt ListScrollTimerCallBack(TAny* aAny); + void DoListScrolling(); + + + private: // from CCoeControl + + HBufC* iPrevGotoContent;//to compare if there were really any changes! + + private: // private members + + CBrowserPopupList* iList;//owned + CDesCArrayFlat* iItems;//owned + CDesCArrayFlat* iItemNames;//owned + CDesCArrayFlat* iItemNamesToShow;//owned + CEikEdwin* iEditor;//Editor of the GotoPane + TInt iItemNo; + TInt iPrevItem; + TBool iPoppedUp;//it shows wheter it is popped up + TAknPopupWindowLayoutDef iLayout; + HBufC* iFirstGotoContent; + CRecentUrlStore* iRecentUrlStore; // not owned + TBool iDirectoryMode;//this shows wheter it is in a directory + TBool iOpenCBA;//this shows whether Open directory shuold be showed + CCoeControl *iParent; + TAknLayoutRect iCover, iShadow, iOutline, iInside; + CFormattedCellListBoxItemDrawer *iItemDrawer; + TParentType iParentType; + TBool iUrlCompletionMode; + HBufC* iUrlSuffixBuf; + TBool iTouchSupported; + TInt iMaxRecentUrlsToShow; + // shows whether search feature is enabled or not. + TBool iSearchFeature; + CPeriodic* iListScrollTimer; + }; + +#endif // BROWSERADAPTIVELISTPOPUP_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserBookmarksContainer. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_CONTAINER_H +#define BROWSER_BOOKMARKS_CONTAINER_H + +// INCLUDE FILES + +#include "BrowserFavouritesContainer.h" +#include + +// FORWARD DECLARATION + +class CBrowserBookmarksGotoPane; + +// CLASS DECLARATION + +/** +* Top-level control, which contains all component controls in the bookmarks view. +*/ +class CBrowserBookmarksContainer : public CBrowserFavouritesContainer + { + public : // construction, destruction + + /** + * Two-phased constructor. Leaves on failure. + * @param aRect Rectangle of the control (available client rect). + * @param aView The view to which this container belongs. + * @return The constructed container. + */ + static CBrowserBookmarksContainer* NewL( + const TRect& aRect, + CBrowserFavouritesView& aView); + + /** + * Destructor. + */ + virtual ~CBrowserBookmarksContainer(); + + public: // new methods + + /** + * Activate Goto Mode + */ + + void SetGotoActiveL(); + + /** + * Activate Search Pane + */ + void SetSearchActiveL(); + /** + * Deactivate Goto Pane + */ + + void SetGotoInactiveL(); + + /** + * Deactivate Search Pane + */ + void SetSearchInactiveL(); + public: // access to components + + /** + * Get the Goto Pane. + * @return The Goto Pane. + */ + inline CBrowserBookmarksGotoPane* GotoPane() const; + + /** + * Get the Search Pane. + * @return The Search Pane. + */ + inline CBrowserBookmarksGotoPane* SearchPane() const; + + /** + * Check if we are in Goto Mode + * @return ETrue if we are in Goto Mode; EFalse otherwise. + */ + inline TBool GotoPaneActive() const; + + /** + * Check if we are in Search Mode + * @return ETrue if we are in Search Mode; EFalse otherwise. + */ + inline TBool SearchPaneActive() const; + + public: // from CBrowserFavouritesContainer + + /** + * Count component controls. + * @return Number of component controls. + */ + virtual TInt CountComponentControls() const; + + /** + * Get a component control by index. + * @param aIndex Index of component control to be returned. + * @return Component control or NULL. + */ + virtual CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Handle size change, lay out and draw components. + */ + virtual void SizeChanged(); + + /** + * Handle key event. + * @param aKeyEvent The key event. + * @param aType Key event type. + * @return Response (was the key event consumed?). + */ + virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Handle cursor change. + * @param aListBox Listbox in which the cursor has changed. + */ + void HandleCursorChangedL( CEikListBox* aListBox ); + + /** + * Check if some editing is in progress. + */ + TBool IsEditing(); + + /** + * Check if some editing is in progress for Search Pane. + */ + TBool IsEditingSearch(); + + /** + * Get tab index belonging to this view. + * @return The tab index. + */ + TInt TabIndex(); + + /** + * Get resource id for text to be displayed in the empty listbox. + * @return Listbox empty text resource id. + */ + TInt ListboxEmptyTextResourceId(); + + /** + * Get resource id for text to be displayed in the title. + * @return Listbox empty text resource id. + */ + TInt TitleResourceId(); + + /** + * Handles focus changing + * @param aDrawNow + */ + void FocusChanged( TDrawNow aDrawNow ); + + + /** + * HandlePointerEventL + * From CCoeControl + * + */ + void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); + + /** + * HandleResourceChange + * From CCoeControl + */ + void HandleResourceChange(TInt aType); + + protected: // Construct / destruct + + /** + * Constructor. + */ + CBrowserBookmarksContainer(); + + /** + * Called by ConstructL. Leaves on failure. + * Derived classes can override this to add more controls. + * @param aRect Rectangle of the control (available client rect). + * @param aView The view to which this container belongs. + * @return The constructed container. + */ + virtual void ConstructComponentControlsL( + const TRect& aRect, + CBrowserFavouritesView& aView ); + + /** + * Called by ConstructComponentControlsL. + * Leaves on failure. + */ + virtual void ConstructSearchPaneL(); + + protected: // from CBrowserFavouritesContainer + + /** + * Create icon handler for the listbox. + * @return Icon handler for the listbox. + */ + MBrowserFavouritesListboxIconHandler* CreateListboxIconHandlerL(); +#ifdef __SERIES60_HELP + private: + /** + * Get help context for the control. + * @param aContext The context that is filled in. + * @return None. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + +#endif //__SERIES60_HELP + + private: // data + + /** + * Goto Pane. + */ + CBrowserBookmarksGotoPane* iGotoPane; + + /** + * Owned. + * Search Pane. + */ + CBrowserBookmarksGotoPane* iSearchPane; + + /** + * ETrue if Goto pane is active, EFalse by default + */ + TBool iGotoPaneActive; + + /** + * ETrue if Search pane is active, EFalse by default + */ + TBool iSearchPaneActive; + + TBool iSelectionKeyDownPressed; + TBool iSelectionKeyLongPress; + + /** + * Default text in search editor + */ + HBufC* iDefaultSearchText; + + /** + * Saves Search Provider Icon Id, + * used for tracking changes to Icon. + */ + TInt iSearchIconId; + + /** + * Saves Search Icon File Path + * used for tracking changes to Icon. + */ + TFileName iSearchIconFilePath; + }; + +#include "BrowserBookmarksContainer.inl" + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksContainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksContainer.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserBookmarksContainer +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_CONTAINER_INL +#define BROWSER_BOOKMARKS_CONTAINER_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::GotoPane +// --------------------------------------------------------- +// +CBrowserBookmarksGotoPane* CBrowserBookmarksContainer::GotoPane() const + { + return iGotoPane; + } + + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::GotoPaneActive +// --------------------------------------------------------- +// +TBool CBrowserBookmarksContainer::GotoPaneActive() const + { + return iGotoPaneActive; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::SearchPane +// --------------------------------------------------------- +// +CBrowserBookmarksGotoPane* CBrowserBookmarksContainer::SearchPane() const + { + return iSearchPane; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::SearchPaneActive +// --------------------------------------------------------- +// +TBool CBrowserBookmarksContainer::SearchPaneActive() const + { + return iSearchPaneActive; + } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksEditDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksEditDialog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserBookmarkEditDialog. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_EDIT_DIALOG_H +#define BROWSER_BOOKMARKS_EDIT_DIALOG_H + +// INCLUDE FILES + +#include +// #include +#include + +// FORWARD DECLARATION + +class CFavouritesItem; +class CBrowserFavouritesModel; +class CBrowserBookmarksEditFormApModel; +class MApiProvider; +//class MCommsModel; +// class CAknsListBoxBackgroundControlContext; +class CAknNavigationControlContainer; + + +// CLASS DECLARATION + +/** +* Dialog to edit and save bookmark attributes. +*/ +class CBrowserBookmarkEditDialog: public CAknForm + { + public: // construct / destruct + + /** + * Two-phased constructor. Leaves on failure. + * @param aItem Item to edit. Not owned. + * @param aModel Model containing data (actual database handling). + * @param aUid Uid of the edited item. When it is KFavouritesNullUid, the + * item is new (not yet added to the database). Otherwise, it is the Uid + * of the existing item. + * @param aCommsModel Access Point model. Not owned. + * @return The constructed dialog. + */ + static CBrowserBookmarkEditDialog* NewL + ( + CFavouritesItem& aItem, + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + //MCommsModel& aCommsModel, + TInt aUid = KFavouritesNullUid + ); + + /** + * Destructor. + */ + virtual ~CBrowserBookmarkEditDialog(); + + public: // from CAknForm + + /** + * Handle menu commands. + * @param aCommandId Command to handle. + */ + void ProcessCommandL( TInt aCommandId ); + + public: // from base classes + void HandleResourceChange( TInt aType ); + + void HandleResourceChangeL( TInt aType ); + + + protected: // Construct / destruct + + /** + * Constructor. + * @param aItem Item to edit. Not owned. + * @param aModel Model containing data (actual database handling). + * handling. + * @param aUid Uid of the edited item. When it is KFavouritesNullUid, the item + * is new (not yet added to the database). Otherwise, it is the Uid + * of the existing item. + * @return The constructed dialog. + */ + CBrowserBookmarkEditDialog + ( + CFavouritesItem& aItem, + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + TInt aUid + ); + + /** + * Second phase constructor. Leaves on failure. + * @param aApModel Access Point model. Not owned. + */ + void ConstructL( /*MCommsModel& aCommsModel*/ ); + + protected: // from CAknForm (CEikDialog) + + /** + * Handle button press. Same as base class method, except displays note + * "Bookmark saved" or "Not saved", as appropriate, if exiting. + * @param aButtonId Button pressed. + * @return ETrue if the dialog should exit. + */ + TBool OkToExitL( TInt aButtonId ); + + protected: // From CAknForm + /** + * Get data from the editor back to the item and try to save it + * to the database. + * @return ETrue if successfully saved, EFalse otherwise. + */ + TBool SaveFormDataL() ; + + /** + * Initialize context-sensitive menu. + * @param aResourceId Resource id of the menu pane. + * @param aMenuPane Menu pane object being initialized. + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) ; + + private: // From CAknForm + + /** + * Fill the dialog controls with data from the item. + */ + void PreLayoutDynInitL(); + + private: // new methods + + /** + * Fill the dialog controls with data from the item. + */ + void LoadFormDataL(); + + /** + * Try to do the database update with the item. + * @return ETrue if successfully saved, EFalse otherwise. + */ + TBool SaveItemL(); + + /** + * Check if host part of url is too long. + * Cant be over 255 characters. + * @return ETrue if 255 or under, EFalse otherwise. + */ + TBool IsValidUrlHost( const TDesC& aUrl ); + + /** + * Get the text from an edwin control. This method is a workaround for + * an AVKON form bug; the form goes into read-only state BEFORE + * SaveFormDataL is called. So the control there is no longer edwin. + * *** Remove this method when forms are fixed. *** + * @param aText Buffer to receive text. + * @param aControlId Control id. + */ + void GetEdwinText( TDes& aText, TInt aControlId ); + +#ifdef __SERIES60_HELP + + /** + * Get help context for the control. + * @param aContext The context that is filled in. + * @return None. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; +#endif // __SERIES60_HELP + + inline MApiProvider& ApiProvider() { return iApiProvider; } + + private: // data + + CFavouritesItem* iItem; ///< Item to edit. Not owned. + CBrowserFavouritesModel* iModel; ///< Model containing data. + TInt iUid; ///< Uid of the item. KFavouritesNullUid for new items. + TBool iExitDialog; ///< ETrue if the dialog must be dismissed. + CBrowserBookmarksEditFormApModel* iFormApModel; ///< AP model. + TInt iExitNoteResourceId; ///< Resource id to show at exit, or 0. + CAknNavigationControlContainer* iNaviPane; + CAknNavigationDecorator* iNaviDecorator; //Owned + MApiProvider& iApiProvider; + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksEditFormApModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksEditFormApModel.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserBookmarksEditFormApModel. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_EDIT_FORM_AP_MODEL_H +#define BROWSER_BOOKMARKS_EDIT_FORM_AP_MODEL_H + +// INCLUDE FILES + +#include +#include +#include + +// FORWARD DECLARATION + +class CAknQueryValueText; +class CAknQueryValueTextArray; +class MCommsModel; +class CApListItemList; + +// CLASS DECLARATION + +/** +* Model for the WAP AP pop-up field in the Edit Bookmark form. It owns a list +* of Access Points, gotten from the AP Model; and also holds a descriptor +* array containing names of access points. The descriptor array always contains +* string "Default" as first, unless there are no AP-s at all. In that case, +* the array is empty. +*/ +class CBrowserBookmarksEditFormApModel : public CBase + { + public: // construction + + /** + * Two-phased constructor. Leaves on failure. + * @param aCOmmsModel Comms model to use for accessing AP-s. Not owned. + * @return The constructed model. + */ + static CBrowserBookmarksEditFormApModel* NewL + ( MCommsModel& aCommsModel ); + + /** + * Destructor. + */ + virtual ~CBrowserBookmarksEditFormApModel(); + + public: // new methods + + /** + * Get the query value. + * @return The query value. + */ + inline CAknQueryValueText* QueryValue(); + + /** + * Get and store Access Point data from the AP Model. + */ + void ReadApDataL(); + + /** + * Set the current WAP Access point. + * @param aAp Access Point to set as current. + */ + void SetCurrentWapApL( const TFavouritesWapAp& aAp ); + + /** + * Get the current WAP Access point. + * @return The current WAP Access point. + */ + TFavouritesWapAp CurrentWapAp() const; + + /** + * Count WAP Access points. + * @return Number of WAP Access points. + */ + TInt ApCount(); + + + protected: // construction + + /** + * Constructor. + * @param aCommsModel Comms model to use for accessing AP-s. + * Not owned. + */ + CBrowserBookmarksEditFormApModel( MCommsModel& aCommsModel ); + + /** + * Second phase constructor. Leaves on failure. + * @return The constructed model. + */ + void ConstructL(); + + private: // data + + CDesCArrayFlat* iDesCArrayText; ///< AP names as strings. + CAknQueryValueTextArray* iTextArray;///< Text array for the value. + CAknQueryValueText* iTextValue; ///< Value for pop-up query. + MCommsModel* iCommsModel; ///< AP data source. Not owned. + CApListItemList* iApList; ///< List of access points. Owned. + }; + +#include "BrowserBookmarksEditFormApModel.inl" + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksEditFormApModel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksEditFormApModel.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserBookmarksEditFormApModel +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_EDIT_FORM_AP_MODEL_INL +#define BROWSER_BOOKMARKS_EDIT_FORM_AP_MODEL_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::QueryValue +// --------------------------------------------------------- +// +CAknQueryValueText* CBrowserBookmarksEditFormApModel::QueryValue() + { + return iTextValue; + } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksGotoPane.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksGotoPane.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserBookmarksGotoPane. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_GOTO_PANE_H +#define BROWSER_BOOKMARKS_GOTO_PANE_H + +// INCLUDE FILES + +#include +#include "BrowserAdaptiveListPopup.h" +// FORWARD DECLARATION + +class CEikEdwin; +class CAknInputFrame; +class CBrowserBookmarksGotoPane; +class CAknsListBoxBackgroundControlContext; +class CAknsFrameBackgroundControlContext; +class CBrowserFavouritesView; + + +// DEFINES +#ifndef GOTOPANE_POPUPLIST_DISABLE +#define GOTOPANE_POPUPLIST_DISABLE EFalse +#endif + +#ifndef GOTOPANE_POPUPLIST_ENABLE +#define GOTOPANE_POPUPLIST_ENABLE ETrue +#endif + + +// class CBrowserAdaptiveListPopup; +// CLASS DECLARATION + +/** +* Mixin class for handling Bookmark Goto Pane events. +*/ +class MBookmarksGotoPaneObserver + { + + public: // types + + enum TEvent /// Goto Pane events. + { + EEventEditingModeChanged, ///< Editing mode changed. + EEventEnterKeyPressed ///< Enter key pressed during editing. + }; + + public: // new methods + + /** + * Handle Goto Pane event. Derived classes must implement. + * @param aGotoPane The Goto Pane in which the event occurred. + * @param aEvent Goto Pane event. + */ + virtual void HandleBookmarksGotoPaneEventL + ( CBrowserBookmarksGotoPane* aGotoPane, TEvent aEvent ) = 0; + }; + +/** +* Goto Pane for the WML Browser. It looks just like a search field. +* It has two modes, Editing and Non-editing. In editing mode the user can edit +* text and move the cursor. In non-editing mode any key/other event which +* normally means editing enters editing mode automatically. When editing mode +* is entered, existing text is replaced with a default text. +* (Editing in fact corresponds to being focused or not; the two things go +* together.) +*/ +class CBrowserBookmarksGotoPane: public CCoeControl + { + public: // Construct / destruct + + /** + * Two-phased constructor. Leaves on failure. + * @param aView Pointer to Favourites View + * @param aParent Parent control. + * @param aBitmapfile Icon File Path + * @param aIconBitmapId Icon to display. + * @param aIconMaskId Icon Mask + * @param aPopupListStatus True if the pane uses popuplist, + * otherwise false. + * @param aSearchPaneMode Set true if the pane is a Search pane. + * @return The constructed Goto Pane control + */ + static CBrowserBookmarksGotoPane* NewL + ( + const CCoeControl& aParent, + CBrowserFavouritesView* aView, + const TDesC& aBitmapfile, + TInt aIconBitmapId , + TInt aIconMaskId , + TBool aPopupListStatus = GOTOPANE_POPUPLIST_ENABLE, + TBool aSearchPaneMode = EFalse + ); + + + /** + * Destructor. + */ + virtual ~CBrowserBookmarksGotoPane(); + + /** + * SetupSkinContext Sets up the skin + * return None + */ + void SetupSkinContextL(); + + public: // new methods (editing) + + /** + * Check if we are editing. + * @since 1.2 + * @return ETrue if editing, EFalse otherwise. + */ + inline TBool IsEditing() const; + + /** + * Begin editing the pane. Sets up the visibility, etc for editing + */ + void BeginEditingL(); + + + /** + * Cancel editing, but leave the text in place. + * @since 1.2 + */ + void CancelEditingL(); + + /** + * Set text. If editing, it is now cancelled. + * @since 1.2 + * @param aText Text to set. + * @param aClipToFit If ETrue, text is clipped "..." if doesn't fit. + * @param aCancelEditing If EFalse, editing is not cancelled + */ + void SetTextL( const TDesC& aText, TBool aClipToFit = ETrue, TBool aCancelEditing = ETrue ); + + /** + * Set Editor Font Posture to Italic. + */ + void SetTextModeItalicL( ); + + /** + * Get text; ownership passed. The returned buffer is zero-terminated. + * @since 1.2 + * @return Text in a buffer or NULL. Owner is the caller. + */ + HBufC* GetTextL(); + + /** + * Freeze / unfreeze. If frozen, setting text by calling SetTextL or + * Cancelling is disallowed. Use with caution, don't let frozen state + * "stay in" due to some leave! + * (This is used when during dowload we want to protect Goto Pane from + * being updated if some notification kicks in). + * @since 1.2 + * @param aFreeze ETrue for freeze, EFalse to unfreeze. + */ + inline void Freeze( TBool aFreeze ); + + public: // observer support + + /** + * Set observer. Pass NULL pointer to unset. Panics if already set. + * @since 1.2 + * @param aObserver The observer to be notified about Goto Pane events. + */ + void SetGPObserver( MBookmarksGotoPaneObserver* aObserver ); + + public: // Showing / hiding extra line + + /** + * Set line state (show or hide line). Ugly stuff. + * @since 1.2 + * @param aLineVisible ETrue for showing line, EFalse for hiding. + */ + void SetLineState( TBool aLineVisible ); + + void HandleResourceChange( TInt aType ); + public: // from CCoeControl + + /** + * Handle key event. + * @param aKeyEvent The key event. + * @param aType Key event type. + * @return Response (was the key event consumed?). + */ + virtual TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Count component controls. + * @return Number of component controls. + */ + virtual TInt CountComponentControls() const; + + /** + * Get a component control by index. + * @param aIndex Index of component control to be returned. + * @return Component control or NULL. + */ + virtual CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Handle focus change. + * @param aDrawNow Draw now? + */ + virtual void FocusChanged( TDrawNow aDrawNow ); + + /** + * Gives back a pointer to adaptivepopuplist + */ + CBrowserAdaptiveListPopup* PopupList(); + + /** + * Mop supply + * @param TTypeUid aId + */ + TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); + + /** + * Returns editor control of goto pane. + * @since Series60 1.2 + * @return editor control of goto pane + */ + CEikEdwin* Editor() const; + + /** + * HandlePointerEventL + * From CCoeControl + * + */ + void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); + + /** + * Sets/Unsets Virtual Keyboard Flag. + * @param aVKBFlag - ETrue sets the flag, Unsets the flag if EFalse. + */ + void SetVKBFlag( TBool aVKBFlag ); + + protected: // Construct / destruct + + /** + * Constructor. + */ + CBrowserBookmarksGotoPane(CBrowserFavouritesView* aView, TBool aSearchPaneMode ); + + /** + * Second-phase constructor. Leaves on failure. + * @param aParent Parent control. + */ + void ConstructL( const CCoeControl& aParent, const TDesC& aBitmapfile, TInt aIconBitmapId, + TInt aIconMaskId, TBool aPopupListStatus ); + + protected: // from CCoeControl + + /** + * Handle size change, lay out components. + */ + virtual void SizeChanged(); + + private: // new methods + + /** + * Change editing mode. + * @param aEditing ETrue for editing mode. + */ + inline void SetEditingL( TBool aEditing ); + + /** + * Activates Virtual Keyboard. + */ + void ActivateVkbL(); + + private: // data + CBrowserFavouritesView* iView; //Not owned. + /// Editor. Owned. + CEikEdwin* iEditor; + /// Input frame. Owned. + CAknInputFrame* iInputFrame; + /// Editing mode. + TBool iEditing; + /// Observer or NULL. Not owned. + MBookmarksGotoPaneObserver* iGPObserver; + /// ETrue if frozen. + TBool iFrozen; + /// ETrue if initial focusing was done + ///(needed for permanent selection to be working) + TBool iEverFocused; + /// adaptive popuplist + CBrowserAdaptiveListPopup* iBAdaptiveListPopup; + CAknsListBoxBackgroundControlContext* iSkinContext; + CAknsFrameBackgroundControlContext* iInputContext; + // If the control is in Search Pane Mode. + TBool iSearchPaneMode; + // Default text in search editor. Owned + HBufC* iDefaultSearchText; + }; + +#include "BrowserBookmarksGotoPane.inl" + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksGotoPane.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksGotoPane.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserBookmarksGotoPane +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_GOTO_PANE_INL +#define BROWSER_BOOKMARKS_GOTO_PANE_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::IsEditing +// --------------------------------------------------------- +// +TBool CBrowserBookmarksGotoPane::IsEditing() const + { + return iEditing; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::Freeze +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::Freeze( TBool aFreeze ) + { + iFrozen = aFreeze; + } + + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksListboxIconHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksListboxIconHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class TBrowserBookmarksListboxIconHandler. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_LISTBOX_ICON_HANDLER_H +#define BROWSER_BOOKMARKS_LISTBOX_ICON_HANDLER_H + +// INCLUDE FILES + +#include "BrowserFavouritesListboxIconHandler.h" + +// CLASS DECLARATION + +/** +* Icon handling in the WML Browser's Bookmark View listbox. +* The following icons are presented: +* - Mark icon +* - Folder icon +* - Homepage icon +* - Last Visited Page icon +* - Bookmark icon +* - CSD bearer bookmark icon +* - HSCSD bearer bookmark icon +* - GPRS bearer bookmark icon +* - SMS bearer bookmark icon +*/ + +class TBrowserBookmarksListboxIconHandler: + public MBrowserFavouritesListboxIconHandler + { + protected: // from MBrowserFavouritesListboxIconHandler + + /** + * Get item icon index for this item (index into the array). + * @param aItem Item to get icon index for. + * @return Icon index for the item. + */ + TInt ItemIconIndex( const CFavouritesItem& aItem,CBrowserFavouritesListbox* aListbox ) const; + + /** + * Get bearer icon index for this access point (index into the array). + * @param aAccessPoint Access Points to get bearer icon for. + * @param aAccessPoints Access Points to use. + * @return Icon index for the access point. + */ + TInt BearerIconIndex + ( + const TFavouritesWapAp aAccessPoint, + const CApListItemList& aAccessPoints + ) const; + /** + * Dynamically load Icon from files (AVKON skin supported) + * @return pointer to the created icon array + */ + CAknIconArray* LoadIconsL() const; + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksModel.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserBookmarksModel. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_MODEL_H +#define BROWSER_BOOKMARKS_MODEL_H + +// INCLUDE FILES + +#include "BrowserFavouritesModel.h" + +// CLASS DECLARATION +class MApiProvider; + +/** +* Model for the Bookmarks Views of the WML Browser. +*/ +class CBrowserBookmarksModel : public CBrowserFavouritesModel + { + public: + /** + * Constructor. + * @param aApiProvider The API provider + */ + CBrowserBookmarksModel( MApiProvider& aApiProvider ); + // construction + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed model. + */ + static CBrowserBookmarksModel* NewL( MApiProvider& aApiProvider ); + + public: // from CBrowserFavouritesModel + + /** + * Get resource id of some text for an item. + * @param aItem The item to get resource id for. + * @param aType Type of resource text. + * @return Resource id of the text. + */ + TInt StringResourceId + ( + const CFavouritesItem& aItem, + CBrowserFavouritesModel::TTextResourceType aType + ) const; + + MApiProvider& ApiProvider(); + + + + protected: // from CBrowserFavouritesModel + + CFavouritesItemList* GetFoldersSortedLC(); + + private: + const TDesC& GetDBName(); + + private: //data members + MApiProvider& iApiProvider; // API provider + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksOrder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksOrder.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include + +class CBrowserBookmarksOrder : public MFavouritesItemData, + public CBase + { + public: + + static CBrowserBookmarksOrder* NewLC(); + + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CBrowserBookmarksOrder(); + + const CArrayFixFlat& GetBookMarksOrder(); + + void SetBookMarksOrderL(const CArrayFixFlat& aBookMarksOrder); + + public: //From MFavouritesItemData + + void ExternalizeL( RWriteStream& aStream ) const; + + void InternalizeL( RReadStream& aStream ); + + private: //Data members + + CArrayFixFlat* iBMOrderArray; + }; \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserBookmarksView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserBookmarksView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,576 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserBookmarksView. +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_VIEW_H +#define BROWSER_BOOKMARKS_VIEW_H + +// INCLUDE FILES +#include "BrowserFavouritesView.h" +#include "BrowserBookmarksGotoPane.h" +#include "Preferences.h" +#include +#include +#include + + +// CONSTANTS + +//FORWARD DECLARATION + +class CBrowserBookmarksContainer; +class CRecentUrlStore; +class CAsyncDownloadsListExecuter; + +// CLASS DECLARATION + +/** +* Bookmarks View of the WML browser. Derived from CBrowserFavouritesView; +* new methods mostly process Bookmark View specific commands. +*/ +class CBrowserBookmarksView: + public CBrowserFavouritesView, + public MBookmarksGotoPaneObserver, + public MApChangeObserver, + public MPreferencesObserver, + public MBrCtlLoadEventObserver, + public MAknToolbarObserver + { + public: // construction + + /** + * Two-phased constructor. Leaves on failure. + * @param aApiProvider The API provider. + * @return The constructed view. + */ + static CBrowserBookmarksView* NewLC( MApiProvider& aApiProvider, CRecentUrlStore& aRecentUrlStore, TInt aInitialFolderUid = KFavouritesRootUid); + + /** + * Destructor. + */ + virtual ~CBrowserBookmarksView(); + + public: // new methods + + /** + * Force updating the Goto Pane. Does nothing if Goto Pane is not + * visible. + * @since 1.2 + */ + void UpdateGotoPaneL(); + + /** + * Exits Adaptive Bookmarks folder. Called also from BrowserAppUi when a page is + * downloaded from Adaptive Bookmarks. + * @since 2.1 + */ + void ExitAdaptiveBookmarks(); + + /** + * Opens Adaptive Bookmarks folder. + * @since 3.1 + */ + inline void OpenAdaptiveBookmarksWhenActivated( ) + { iOpenAdaptiveBookmarksWhenActivated = ETrue; } + + /** + * Gets the status of selection of the adaptive bookmarks folder. + * @since 3.1 + */ + inline TBool GetAdaptiveBookmarksFolderSelected( ) + { return iAdaptiveBookmarksFolderSelected; } + + inline TBool GetAdaptiveBookmarksFolderWasActive( ) + { return iAdaptiveBookmarksFolderWasActive; } + + void DimToolbarButtons(TBool aDimButtons); + + public: // public methods from CBrowserFavouritesView + + /** + * Handle command. + * @since 1.2 + * @param aCommand Command id. + */ + void HandleCommandL( TInt aCommand ); + + /** + * Get view id. + * @since 1.2 + * @return The view id for this view. + */ + TUid Id() const; + + public: // From MCbaSetter (CBrowserViewBase) + + /** + * Return command set id, to be displayed. + * @since 1.2 + * @return The command set's resource id. + */ + virtual TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/); + + /** + * Helper function to dynamically set LSK + * @since 5.0 + */ + void SetLSKDynL(TSKPair& aLsk, + CBrowserBookmarksGotoPane* aTheGotoPane); + + /** + * Helper function to dynamically set RSK + * @since 5.0 + */ + void SetRSKDynL(TSKPair& aRsk, + CBrowserBookmarksGotoPane* aTheGotoPane); + + /** + * Helper function to dynamically set MSK + * @since 5.0 + */ + void SetMSKDynL(TSKPair& aMsk, const TSKPair aLsk, + CBrowserFavouritesContainer* aTheContainer, + CBrowserBookmarksGotoPane* aTheGotoPane); + + + public: // from MBookmarksGotoPaneObserver + + /** + * Handle Goto Pane event. + * @since 1.2 + * @param aGotoPane The Goto Pane in which the event occurred. + * @param aEvent Goto Pane event. + */ + virtual void HandleBookmarksGotoPaneEventL + ( + CBrowserBookmarksGotoPane* aGotoPane, + MBookmarksGotoPaneObserver::TEvent aEvent + ); + + public: // MAknToolbarObserver + /** + * Called when toolbar events occur + * + * @since 5.0 + * @return void + */ + void OfferToolbarEventL( TInt aCommand ) { HandleCommandL(aCommand); } + + protected: // construction + + /** + * Constructor. + * @param aApiProvider The API provider. + */ + CBrowserBookmarksView( MApiProvider& aApiProvider, CRecentUrlStore& aRecentUrlStore, TInt aInitialFolderUid = KFavouritesRootUid ); + + /** + * Second phase constructor. Leaves on failure. + * @param aViewResourceId Resource id for this view. + * Derived classes should call this first during construction. + */ + void ConstructL( TInt aViewResourceId ); + + protected: // protected CBrowserFavouritesView + + /** + * Handle listbox event. + * @since 1.2 + * @param aListBox Listbox in which the event occurred. + * @param aEventType Event. + */ + void HandleListBoxEventL( + CEikListBox* aListBox, + MEikListBoxObserver::TListBoxEvent aEventType ); + + /** + * Initialize context-sensitive menu. + * @since 1.2 + * @param aResourceId Resource id of the menu pane. + * @param aMenuPane Menu pane object being initialized. + * @param aIndex Index into the visibility map. + * @param aState Selection state. + */ + virtual void DynInitMenuPaneL + ( + TInt aResourceId, + CEikMenuPane* aMenuPane, + TCommandVisibility::TIndex /*aIndex*/, + const TBrowserFavouritesSelectionState& aState + ); + + /** + * Get resource id of text to be displayed in navi pane when + * root folder is shown (TBUF). + * @since 1.2 + * @return Resource id. + */ + TInt RootTitleResourceId() const; + + /** + * Get resource id of Options menu (RESOURCE MENU_BAR). + * @since 1.2 + * @return Resource id. + */ + TInt OptionsMenuResourceId() const; + + /** + * Get resource id of OK-Options menu (RESOURCE MENU_BAR). + * @since 1.2 + * @return Resource id. + */ + TInt OkOptionsMenuResourceId() const; + + /** + * Create the model. Leave on failure. The model is owned by the + * caller (this view, base class). The created model is really + * a CBrowserBokmarksModel. + * @since 1.2 + * @return The constructed model. + */ + virtual CBrowserFavouritesModel* CreateModelL(); + + /** + * Create the container (the main control of the view). The container + * is owned by the caller (this view, base class). The created container + * is really a CBrowserBookmarksContainer. + * Leave on failure. + * @since 1.2 + * @return The constructed main control. + */ + virtual CBrowserFavouritesContainer* CreateContainerL(); + + /** + * Get items to be displayed in a folder. Expects the model's db be + * open. + * @since 1.2 + * @param aFolder Folder which contains the items. + * @return List of items. Pushed on the cleanup stack. + */ + virtual CFavouritesItemList* GetItemsLC( TInt aFolder ); + + /** + * Some displayed data has changed (Favourites database, AP-s, etc). + * Update the view so changes become visible. Safe to call if the view + * is not active; in this case it does nothing. + * This method should not be called if the data change is due to direct + * user activity (opening folders etc.); only for notification + * processing. + * (Same as base class method, except active Goto Pane is not reset if + * downloading is in progress.) + * @since 1.2 + * @param aDbErrorNote If ETrue, unsuccesful database access will bring + * up an error note. + */ + virtual void RefreshL( TBool aDbErrorNote = EFalse ); + + void HandleForegroundEventL( TBool aForeground ); + + protected: // protected methods from CAknView + + /** + * Activate the view. + * @since 1.2 + * @param aCustomMessageId Custom Message Id. + * @param aCustomMessage Custom Message. + */ + virtual void DoActivateL + ( + const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage + ); + + /** + * Deactivate the view. + * @since 1.2 + */ + virtual void DoDeactivate(); + + private: // command handling (additional commands) + + /** + * Available only to process EWmlCmdDelete and EWmlCmdDeleteItems commands.Command "Go to" when the user is editing in the Goto Pane. + */ + void DeleteItems( TInt aCommand ); + + /** + * Command "Go to" when the user is editing in the Goto Pane. + * Go to the URL found in Goto Pane. + * Does nothing if no Goto Pane. + */ + void GotoUrlInGotoPaneL(); + + /** + * Command "Activate". Activate highlighted bookmark. + * Does nothing if no bookmark is highlighted. + */ + void ActivateCurrentBookmarkL(); + + /** + * Command "Add bookmark". Create new bookmark and launch + * Edit bookmark dialog. + */ + void AddNewBookmarkL(); + + /** + * Command "Edit bookmark". Edit highlighted bookmark. + * Does nothing if no bookmark is highlighted. + */ + void EditCurrentBookmarkL(); + + + /** + * Command "Send via Unified Messaging". + * Send selected bookmark(s). + */ + void SendBookmarksL( ); + + + private: // new methods + + /** + * Get the container (as CBrowserBookmarksContainer). + * @return The container. + */ + CBrowserBookmarksContainer* TheContainer(); + + private: // from MApChangeObserver + /** + * Handle change in currently used Access Point. + */ + void ApChangedL( TUint32 aNewAPId ); + + private: // from MPreferencesObserver + + /** + * Handle preferences change. + */ + void HandlePreferencesChangeL( + const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ); + + private: + + /** + * Create Start Page bookmark. Db needs not be open (not used). + * @return The Start Page bookmark, or NULL if no such. + * Ownership passed to caller. + */ + CFavouritesItem* CreateStartPageBookmarkL(); + + private: // from MBrCtlLoadEventObserver + + /** + * A load events notification + * @since 2.8 + * @param aLoadEvent The load event + * @param aSize Size depends on the event + * @param aTransactionId The transaction id of the transaction that had this event + * @return void + */ + void HandleBrowserLoadEventL( TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, + TUint aSize, + TUint16 aTransactionId ); + private: + + /** + * Clear all adaptive bookmarks + */ + void ClearAdaptiveBookmarksL(); + + private: + + /** + * To set empty text for folders. It is different in Adaptive Bookmarks + */ + void SetEmptyTextL(); + + // from CBrowserFavouritesView + TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + +//from CBrowserFavouritesView + /** + * Open next folder. + * @param aForward Open next folder if ETrue, previous if EFalse. + */ + void OpenNextFolderL( TBool aForward ); + + /** + * Update and draw navi pane (show tabs for root, or "1/4" style text + * for subfolders). + * No sanity check; expects the model's table be open. + */ + void UpdateNaviPaneL(); + + /** + * Sorts bookmark items into the saved manual order + * associated to the given folder + * @param aFolder The folder in which the items are stored + * @param aItems The bookmark item list to sort + */ + TBool ManualBMSortL( TInt aFolder, CFavouritesItemList* aItems ); + + /** + * Starts 'item moving mode', when softkeys are ok/cancel + * and ok moves the selected items to the current position in + * bookmarks list + */ + void StartMoveItemsL(); + + /** + * moves the selected items to the current position in + * bookmarks list + */ + void MoveItemsL(); + + /** + * Cancels 'item moving mode', softkeys return to normal, + * focus returns to the first selected item + */ + void CancelMoveItemsL(); + + /* + * Adds the given uid to the last place in bookmarks list + * @param aUid The uid to add + */ + void AddUidToLastPlaceToCurrentListL( TInt aUid ); + + public: + /** + * Dim or Un-dim Toolbar buttons. + */ + void UpdateToolbarButtonsState(); + + /** + * Check to show downloads. + */ + void CheckForDownloads(); + + /** + * Initiates update for favicons + */ + void UpdateFavIconsL(); + + private: // data + /** + * Callback for completing the Browser App init. Normally only + * BookmarksView is initialized first on startup. When bookmarks + * view is shown then this callback is scheduled to complete the + * remaining initialization. + */ + static TInt CompleteAppInitCallback( TAny* aApiProvider ); + + /** + * Uid of AP which is to be used for creating Start Page bookmark. + */ + TUint32 iStartPageApUid; + + /** + * Storing current default AP, to be able to spot when it changes. + * (We get notification when preferences change; but don't know + * what changed in preferences. We are interested only in default AP + * change.) + */ + TUint32 iCurrentDefaultAp; + + /** + * This flag is used in fetch observing: this differentiates events from + * the newly started fetch from events of ongoing fetches (being + * cancelled by the new one). It is ETrue when new fetch has been + * initiated but not yet started (existing fetches will be cancelled + * during this time). + */ + TBool iFetchInit; + + HBufC* iDomainFolderName; + CRecentUrlStore& iRecentUrlStore; + TBool iInAdaptiveBookmarksFolder; + + TWmlSettingsAdaptiveBookmarks iAdaptiveBookmarksCurrentSetting; + + + // For Adaptive Bookmarks - to refresh title when + // coming back from Preferences + TBool iPreferencesChanged; + + // For Manual BM Sorting + // Indicates item moving mode + TBool iManualItemMovingGoingOn; + + // list of uids of items to move + CArrayFixFlat* iItemsToMove; + + // Current order of bookmarks + CBrowserBookmarksOrder* iCurrentOrder; + + // Flag to indicate that Adaptive BM folder has just been inserted to BM list + TBool iInsertAdaptiveBookmarksFolder; + + // Flag to indicate that current BM order needs to be saved + TBool iSaveBMOrder; + + // Flag to indicate the presence of Start Page item + TBool iStartPagePresent; + + // Goto Pane's entered URL and cursor's position + HBufC* iEnteredURL; + TInt iCursorPos; + + TUint16 iTrId; + + CAsyncDownloadsListExecuter* iDownloadsListExecuter; // Owned. + + // True if the view will show the adaptive bookmarks folder + // on activation, otherwise false. + TBool iOpenAdaptiveBookmarksWhenActivated; + + // True if the user opned the Adaptive Bookmarks folder, + // from bookmarks items, otherwise false. + TBool iAdaptiveBookmarksFolderSelected; + + // True if the view was changed, and the adaptive bookmarks folder + // was currently acive. + TBool iAdaptiveBookmarksFolderWasActive; + + // Pen enabled flag + TBool iPenEnabled; + + // Re-Entry Gate flag for Delete Bookmark routine + TBool iHandleDeleteInProgress; + + // Async callback object for delayed App init + CIdle *iAsyncComplete; + + TBool iShowDownlods; + }; + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFaviconHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFaviconHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CBrowserFaviconHandler +* +* +*/ + + +#ifndef __BROWSERFAVICONHANDLER_H +#define __BROWSERFAVICONHANDLER_H + +// INCLUDE FILES +#include +#include +#include "BrowserFaviconScaler.h" + +// CLASS DECLARATION +class MApiProvider; +class CFavouritesItemList; +class CFavouritesItem; + +class MBrowserFaviconObserver + { + public: + virtual TInt DrawFavicons() = 0; + }; + +/** +* CBrowserFaviconHandler. +* +* @lib Browser.app +* @since Series 60 3.1 +*/ +class CBrowserFaviconHandler : public CActive, + public MBrowserFaviconScalerCallback + { + public: // Constructors + + /** + * @param aApiProvider access to AppUi functions + * @param aIconArray an array of icons + * @param aObserver observer for drawing favicons + * @param aFaviconSize size in pixels of the favicons + */ + static CBrowserFaviconHandler* NewLC( + MApiProvider& aApiProvider, + CArrayPtr* aIconArray, + MBrowserFaviconObserver& aObserver, + TSize aFaviconSize ); + + /** + * @param aApiProvider access to AppUi functions + * @param aIconArray an array of icons + * @param aObserver observer for drawing favicons + * @param aFaviconSize size in pixels of the favicons + */ + static CBrowserFaviconHandler* NewL( + MApiProvider& aApiProvider, + CArrayPtr* aIconArray, + MBrowserFaviconObserver& aObserver, + TSize aFaviconSize ); + + /** + * Destructor. + */ + ~CBrowserFaviconHandler(); + + protected: // Constructor and destructor + + /** + * @param aApiProvider access to AppUi functions + * @param aObserver observer for drawing favicons + * @param aFaviconSize size in pixels of the favicons + */ + CBrowserFaviconHandler( MApiProvider& aApiProvider, + MBrowserFaviconObserver& aObserver, + TSize aFaviconSize ); + + public: // from MBrowserFaviconScalerCallback + void ScalingCompletedL(CFbsBitmap* aResult, const TRect& aTargetRect); + + public: // from CActive + + /** + * Cancel any outstanding requests + */ + void DoCancel(); + + /** + * Handles object`s request completion event. + */ + void RunL(); + + public: // New functions + + + /** + * Initiates decoding of favicons for the favourites list in browserengine. + * This will request icon database thread to start decoding requested icons in background. + * @param aFavItems a list of favourites items + */ + void RequestFavicons( CFavouritesItemList* aFavItems ); + + /** + * This is async fetch operation from engine. One icon at a time is fetched and asynchronously + * scaled. E.g. if there are 5 icons to be fetched, then this will cause the BitmapScaler to be + * Active for 5 times. + * overall fetching is Async + * @param aFavItems a list of favourites items + */ + void StartGetFaviconsL( CFavouritesItemList* aFavItems ); + + /** + * Appends the icon to the icon array + * @param aItem the favourites item which is being checked for favicons + * @return Index of favicon array in iIconArray + */ + TInt GetFaviconArrayIndex( const CFavouritesItem& aItem ); + + /** + * Updates the handle to icon array + * @param aIconArray an array of icons + */ + + void UpdateIconArray(CArrayPtr* aIconArray); + + protected: // New functions + + /** + * Gets the favicon for a given url from the Favicon Engine + * @param aUrl a url to check if there is an associated favicon + */ + void GetFaviconL(); + + /** + * Rescales a favicon to fit into the list box graphic pane + * and stores the result in iIconArray + */ + void RescaleFaviconL(); + + /** + * Appends the icon to the icon array + * @return Leave code + */ + TInt AppendToIconArray(); + + + private: // New functions + + void ConstructL( CArrayPtr* aIconArray ); + + // Structures + struct TFaviconIndex + { + TInt iFavouritesItemIndex; + TInt iIndex; + }; + + // Members + MApiProvider& iApiProvider; // NOT owned + MBrowserFaviconObserver& iObserver; // NOT owned + + CArrayPtr* iIconArray; // NOT owned + CArrayFixFlat* iFaviconArrayIndices; // owned + + CFavouritesItemList* iFavItems; // NOT owned + TSize iFaviconSize; + + CGulIcon* iFavicon; // NOT owned + HBufC* iUrl; // owned + + // Counters + TInt iFavItemsCurrentIndex; // position in the favourites item list + TInt iFaviconsFound; // counter for number of favicon which have been found + + TBool iWasLastItemFavicon; + CBrowserFaviconScaler* iBmpScaler; // owned + TBool iHasMask; + }; + + + +#endif // __BROWSERFAVICONHANDLER_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFaviconScaler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFaviconScaler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef CBROWSERFAVICONSCALER_H +#define CBROWSERFAVICONSCALER_H + +// INCLUDES + +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +class CBitmapScaler; +class CFbsBitmap; + +// CLASS DECLARATION + +class MBrowserFaviconScalerCallback + { + public: + virtual void ScalingCompletedL(CFbsBitmap* aResult, const TRect& aTargetRect) = 0; + }; + + +// CLASS DECLARATION + +/** +* +* +* @lib pagescaler.dll +* @since 3.1 +*/ +class CBrowserFaviconScaler : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBrowserFaviconScaler* NewL(MBrowserFaviconScalerCallback& aCallback); + + /** + * Destructor. + */ + virtual ~CBrowserFaviconScaler(); + + public: // New functions + + /** + * + * @since 3.1 + * @param + * @return + */ + void StartScalingL(CFbsBitmap &aSource, const TRect& aTargetRect, TBool aIsMask); + + + private: // Functions from CActive + + void RunL(); + + void DoCancel(); + + + private: + + /** + * C++ constructor. + */ + CBrowserFaviconScaler(MBrowserFaviconScalerCallback& aCallback); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + void DeleteResultBitmap(); + + private: // Data + + MBrowserFaviconScalerCallback* iCallback; + + CFbsBitmap* iResultBitmap; // owned + CBitmapScaler* iScaler; // owned + + TRect iTargetRect; + + }; + +#endif // CBROWSERFAVICONSCALER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,231 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserFavouritesContainer. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_CONTAINER_H +#define BROWSER_FAVOURITES_CONTAINER_H + +// INCLUDE FILES +#include +#include +#include "BrowserFavouritesListboxCursorObserver.h" +#include + +// FORWARD DECLARATION +class CBrowserFavouritesView; +class CBrowserFavouritesListbox; +class CAknNavigationDecorator; +class CAknSearchField; +class MBrowserFavouritesListboxIconHandler; +class CAknsListBoxBackgroundControlContext; + +// CLASS DECLARATION + +/** +* Top-level control, which contains all component controls in the favourites +* view. +* Manages (destroys/creates) component controls. +* Handles key events and forwards them to the appropriate component control. +* Pure virtual. +*/ +class CBrowserFavouritesContainer: + public CCoeControl, + public MBrowserFavouritesListboxCursorObserver, + public MAknNaviDecoratorObserver +{ +public : // construction, destruction + + /** + * Default destructor. + */ + virtual ~CBrowserFavouritesContainer(); + +public: // new methods + + + /** + * Show the tabs in the navi pane. + * @since 1.2 + */ + void ShowRootNaviPane(); + + /** + * Show folder info in navi pane. + * @since 1.2 + * @param aFolderIndex Index of the current folder. + * @param aFolderCount Total number of folders. + */ + void ShowFolderNaviPaneL( TInt aFolderIndex, TInt aFolderCount ); + + /** + * Get tab index belonging to this view. + * Derived classes must provide this method. + * @since 1.2 + * @return The tab index. + */ + virtual TInt TabIndex() = 0; + + /** + * Get resource id for text to be displayed in the empty listbox. + * Derived classes must provide this method. + * @since 1.2 + * @return Listbox empty text resource id. + */ + virtual TInt ListboxEmptyTextResourceId() = 0; + + /** + * Get resource id for text to be displayed in the title. + * Derived classes must provide this method. + * @since 1.2 + * @return Listbox empty text resource id. + */ + virtual TInt TitleResourceId() = 0; + + +public: // access to components + + /** + * Get the creating view. + * @since 1.2 + * @return The creating view. + */ + inline CBrowserFavouritesView& View() const; + + /** + * Get the browsing listbox. + * @since 1.2 + * @return The browsing listbox. + */ + inline CBrowserFavouritesListbox* Listbox() const; + + +public: // from CCoeControl + + /** + * Handle resource change. + * @param aType Event type. + */ + void HandleResourceChange( TInt aType ); + + /** + * Count component controls. + * @return Number of component controls. + */ + TInt CountComponentControls() const; + + /** + * Get a component control by index. + * @param aIndex Index of component control to be returned. + * @return Component control or NULL. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Handle size change, lay out and draw components. + */ + void SizeChanged(); + + /** + * Handle key event. Forwards all key events to the listbox, if present. + * @param aKeyEvent The key event. + * @param aType Key event type. + * @return Response (was the key event consumed?). + */ + TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Handles focus changing + * @param aDrawNow + */ + void FocusChanged( TDrawNow aDrawNow ); + +public: // from MWmlBrowserFavouritesListboxCursorObserver + + /** + * Handle cursor change. + * @param aListBox Listbox in which the cursor has changed. + */ + virtual void HandleCursorChangedL( CEikListBox* aListBox ); + +public: // from MAknNaviDecoratorObserver + virtual void HandleNaviDecoratorEventL( TInt aEventID ); + +protected: // construction + + /** + * Called by ConstructL. Leaves on failure. + * Derived classes can override this to add more controls. + * @param aRect Rectangle of the control (available client rect). + * @param aView The view to which this container belongs. + */ + virtual void ConstructComponentControlsL + ( + const TRect& aRect, + CBrowserFavouritesView& aView + ); + + /** + * Second phase constructor. Leaves on failure. + * Do not override this method in derived classes. Use this one, + * and override ConstructComponentControlsL. + * @param aRect Rectangle of the control (available client rect). + * @param aView The view to which this container belongs. + */ + void ConstructL + ( + const TRect& aRect, + CBrowserFavouritesView& aView + ); + + /** + * Called by ConstructComponentControlsL. Leaves on failure. + * Derived classes must provide this to create own icon handler. + * @return Icon handler for the listbox. + */ + virtual MBrowserFavouritesListboxIconHandler* + CreateListboxIconHandlerL() = 0; + +private: // from MObjectProvider +TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + + +private: // data + + /// The creating view. Not owned. + CBrowserFavouritesView* iView; + /// Browsing listbox. Owned. + CBrowserFavouritesListbox* iListbox; + + /// Navi Pane tabgroup. Owned. + CAknNavigationDecorator* iNaviPaneTabsRoot; + + /// Navi Pane text. Owned. + CAknNavigationDecorator* iNaviPaneTabsFolder; + /// Icon handler. Owned. + MBrowserFavouritesListboxIconHandler* iIconHandler; + CAknsListBoxBackgroundControlContext* iSkinContext; + +}; + +#include "BrowserFavouritesContainer.inl" + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesContainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesContainer.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserFavouritesContainer +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_CONTAINER_INL +#define BROWSER_FAVOURITES_CONTAINER_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesContainer::View +// --------------------------------------------------------- + +CBrowserFavouritesView& CBrowserFavouritesContainer::View() const + { + return *iView; + } + +// --------------------------------------------------------- +// CBrowserFavouritesContainer::Listbox +// --------------------------------------------------------- +// +CBrowserFavouritesListbox* CBrowserFavouritesContainer::Listbox() const + { + return iListbox; + } + + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesFolderListboxIconHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesFolderListboxIconHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class TBrowserFavouritesFolderListboxIconHandler. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_FOLDER_LISTBOX_ICON_HANDLER_H +#define BROWSER_FAVOURITES_FOLDER_LISTBOX_ICON_HANDLER_H + +// INCLUDE FILES + +#include "BrowserFavouritesListboxIconHandler.h" + +// CLASS DECLARATION + +/** +* Icon handling in the WML Browser's Favourites Views Folder Select listboxes. +* This one presents only folder icons: +* - Mark icon (not used but safer this way) +* - Folder icon +* - Root folder icon +*/ + +class TBrowserFavouritesFolderListboxIconHandler: + public MBrowserFavouritesListboxIconHandler + { + public: + /** + * Get the icon indexes for this item (index into the array). + * @param aItem Item to get icon indexes for. + * @param aAccessPoints Access Points to use (if bearer info is needed). + * May be NULL. + * @return Icon indexes for the item. + */ + TBrowserFavouritesIconIndexes IconIndexes + ( + const CFavouritesItem& aItem + /* const CApListItemList* aAccessPoints,*/ + ) const; + + protected: // from MBrowserFavouritesListboxIconHandler + + /** + * Get resource id for the iconarray. + * @return The resource id for the iconarray. + */ + TInt IconArrayResourceId() const; + + /** + * Get item icon index for this item (index into the array). + * @param aItem Item to get icon index for. + * @return Icon index for the item. + */ + TInt ItemIconIndex( const CFavouritesItem& aItem ,CBrowserFavouritesListbox* aListbox ) const; + + TInt ItemIconIndex( const CFavouritesItem& aItem ) const; + + + /** + * Dynamically load Icon from files (AVKON skin supported) + * @return pointer to the created icon array + */ + CAknIconArray* LoadIconsL() const; + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesFolderSelector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesFolderSelector.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserFavouritesFolderSelector. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_FOLDER_SELECTOR_H +#define BROWSER_FAVOURITES_FOLDER_SELECTOR_H + +// INCLUDE FILES + +#include "BrowserFavouritesFolderListboxIconHandler.h" +#include +// FORWARD DECLARATION + +// class CBrowserFavouritesFolderListbox; +class CBrowserFavouritesModel; +class MApiProvider; +class CFavouritesItemList; +class CBrowserFavouritesIconIndexArray; +// class CAknSingleGraphicPopupMenuStyleListBox; +// class MBrowserFavouritesListboxIconHandler; +// CLASS DECLARATION + +class CBrowserFavouritesFolderSelectorListbox : public CAknSingleGraphicPopupMenuStyleListBox +{ +public : + /** + * Constructor. + * @param aIconHandler Pointer to the iconhandler class. Not owned. + */ + CBrowserFavouritesFolderSelectorListbox( const TBrowserFavouritesFolderListboxIconHandler* aIconHandler ); + /** + * This function is called externally when skin is changed. + * This reloads the icons when skin change happens. + * @param aType Type of the resource change + */ + void HandleResourceChange( TInt aType ); + +protected: + /// Icon handler for the listbox. + const TBrowserFavouritesFolderListboxIconHandler* iIconHandler; +}; + +/** +* Folder selector. Contains a popup list to display all folders in a flat list. +*/ +class CBrowserFavouritesFolderSelector: + public CBase + { + public: // construct / destruct + + /** + * Two-phased constructor. Leaves on failure. + * @param aModel Model to be used for reading folder data. Not owned. + * @param aApiProvider Api provider. Not owned. + * @param aExcludeFolder Folder to be excluded from display. + */ + static CBrowserFavouritesFolderSelector* NewL + ( + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + TInt aExcludeFolder + ); + + protected: // construct / destruct + + /** + * Constructor. + * @param aModel Model to be used for reading folder data. Not owned. + * Must remain intact while the dialog exists. + * @param aApiProvider Api provider. Not owned. + * @param aExcludeFolder Folder to be excluded from display. + */ + CBrowserFavouritesFolderSelector( + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + TInt aExcludeFolder ); + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesFolderSelector(); + + /** + * Second phase constructor. + */ + void ConstructL(); + + public: // new methods + + /** + * Launch popup folder selector, return the selected folder's Uid then + * delete the selector. Must not be on the cleanup stack when called + * (this method pushes). + * @return Uid of selectd folder (or KFavouritesNullUid). + */ + TInt ExecuteLD(); + + private: // new methods + + /** + * Get data (items and icon indexes) of folders. + */ + void GetDataL(); + + /** + * Fill listbox. + */ + void FillListboxL(); + + /** + * Get folders to be displayed (all except aFolder). + * @return List of items. Pushed on the cleanup stack. + */ + CFavouritesItemList* GetItemsLC(); + + /** + * Return icon indexes to be displayed in a list. Owner is the caller. + * The returned list must have exactly as much items as aItems. + * @param aItems Item list. + * @return Icon index array. + */ + CBrowserFavouritesIconIndexArray* GetIconIndexesLC + ( CFavouritesItemList& aItems ); + + private: // data + + /// Used for reading folder data. Not owned. + CBrowserFavouritesModel* iModel; + /// Api provider. Not owned. + MApiProvider* iApiProvider; + /// Folder to be excluded from display. + TInt iExcludeFolder; + + /// Real data for this listbox, array of items. Owned. + CFavouritesItemList* iItems; + /// Icon indexes for the items. Owned. + CBrowserFavouritesIconIndexArray* iIconIndexes; + /// Popup list. Owned. + CAknPopupList* iPopupList; + /// Listbox containing data. Owned. + CAknSingleGraphicPopupMenuStyleListBox* iListbox; + /// Listbox item array. Owned. + CDesCArrayFlat* iListboxItemArray; + /// Icon handler for the listbox. + const TBrowserFavouritesFolderListboxIconHandler iIconHandler; + + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesIconIndexArray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesIconIndexArray.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesIconIndexArray and +* class TWmlBrowserFavouritesIconIndexes. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_ICON_INDEX_ARRAY_H +#define BROWSER_FAVOURITES_ICON_INDEX_ARRAY_H + +// INCLUDE FILES + +#include + +// CONSTANTS + +/// No bearer icon for this item. +LOCAL_C const TInt KBrowserFavouritesNoBearerIcon = -1; + +// CLASS DECLARATION + +/** +* Icon indexes for one listbox item. There are two icons, one in the left +* (item/folder/homepage/last visited); and a bearer icon on the right. +* If the WAP AP is not a concrete value, there is no bearer icon. +*/ +struct TBrowserFavouritesIconIndexes + { + public: // data + + /** + * Item icon index (item/folder/last visited/homepage). + */ + TInt iItemIcon; + /** + * Bearer icon index; can be KBrowserFavouritesNoBearerIcon. + */ + TInt iBearerIcon; + }; + +/** +* An array of icon indexes for the listbox. +*/ +class CBrowserFavouritesIconIndexArray: + public CArrayFixFlat + { + public: // construct / destruct + + /** + * Constructor (no code). + */ + inline CBrowserFavouritesIconIndexArray( TInt aGranularity ); + }; + +#include "BrowserFavouritesIconIndexArray.inl" + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesIconIndexArray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesIconIndexArray.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserFavouritesIconIndexArray and +* TWmlBrowserFavouritesIconIndexes. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_ICON_INDEX_ARRAY_INL +#define BROWSER_FAVOURITES_ICON_INDEX_ARRAY_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesIconIndexArray::CBrowserFavouritesIconIndexArray +// --------------------------------------------------------- +// +CBrowserFavouritesIconIndexArray::CBrowserFavouritesIconIndexArray +( TInt aGranularity ) +: CArrayFixFlat( aGranularity ) + { + } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesIncrementalDelete.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesIncrementalDelete.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesIncrementalDelete. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_INCREMENTAL_DELETE +#define BROWSER_FAVOURITES_INCREMENTAL_DELETE + +// INCLUDE FILES + +#include "BrowserFavouritesIncrementalOp.h" + +// CLASS DECLARATION + +/** +* Incremental delete operation. One step deletes one bookmark. Before deleting +* a folder, its contents are deleted manually one-by-one. (Using DeleteL of +* Bookmark Engine for a full folder would delete the folder along with its +* contents in one call. This can be too long if the folder contains many items. +* Therefore this operation deletes the folder contents manually before deleting +* the (already emptied) folder, to keep one StepL short.) +*/ +class CBrowserFavouritesIncrementalDelete: + public CBrowserFavouritesIncrementalOp + { + public: // construct / destruct + + /** + * Two phased constructor. Leaves on failure. + * @param aModel Data model. + * @param aUids Uids to delete. Ownership not taken, must remain + * intact during operation. + * @param aNotDeletedUids Uids of items which could not be deleted + * will be appended to this list. Ownership not taken, must remain + * intact during operation. + * @param aPriority Active Object priority. + * @return The constructed incremental delete operation. + */ + static CBrowserFavouritesIncrementalDelete* NewL + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aNotDeletedUids, + TInt aPriority = CActive::EPriorityStandard + ); + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesIncrementalDelete(); + + protected: // construct / destruct + + /** + * Constructor. + * @param aModel Data model. + * @param aUids Uids to delete. Ownership not taken, must remain + * intact during operation. + * @param aNotDeletedUids Uids of items which could not be deleted + * will be appended to this list. Ownership not taken, must remain + * intact during operation. + * @param aPriority Active Object priority. + */ + CBrowserFavouritesIncrementalDelete + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aNotDeletedUids, + TInt aPriority + ); + + /** + * Second phase constructor. + */ + void ConstructL(); + + protected: // from WmlBrowserFavouritesIncrementalOp + + /** + * Perform next step (delete one item). + * @return Number of steps to come (0 if done). + */ + TInt StepL(); + + /** + * Create and prepare the wait note. + */ + void CreateWaitNoteLC(); + + private: // data + + /// Uids to delete. Not owned. + CArrayFix* iUids; + /// Not deleted uids. Not owned. + CArrayFix* iNotDeletedUids; + /// Uids from folder being deleted. Owned. + CArrayFix* iFolderContents; + /// ETrue if deleting folder contents (the folder itself comes next). + TBool iFolderPending; + /// Index of item being deleted. + TInt iIndex; + + }; + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesIncrementalMove.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesIncrementalMove.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesIncrementalMove. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_INCREMENTAL_MOVE +#define BROWSER_FAVOURITES_INCREMENTAL_MOVE + +// INCLUDE FILES + +#include "BrowserFavouritesIncrementalOp.h" + +// FORWARD DECLARATION + +class CFavouritesItem; + +// CLASS DECLARATION + +/** +* Incremental move operation. +*/ +class CBrowserFavouritesIncrementalMove: + public CBrowserFavouritesIncrementalOp + { + public: // construct / destruct + + /** + * Two phased constructor. Leaves on failure. + * @param aModel Data model. + * @param aUids Uids to move. Ownership not taken, must remain + * intact during operation. + * @param aUnmovableUids Uids of items which could not be moved (due to + * any other reason than name conflict) will be appended to this list. + * Ownership not taken, must remain intact during operation. + * @param aConflictingNameUids Uids of items which could not be moved + * (due to name conflict) will be appended to this list. + * Ownership not taken, must remain intact during operation. + * @param aPriority Active Object priority. + * @param aTargetFolder Uid of the target folder. Nothing is checked. + * @return The constructed incremental move operation. + */ + static CBrowserFavouritesIncrementalMove* NewL + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aUnmovableUids, + CArrayFix& aConflictingNameUids, + TInt aTargetFolder, + TInt aPriority = CActive::EPriorityStandard + ); + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesIncrementalMove(); + + protected: // construct / destruct + + /** + * Constructor. + * @param aModel Data model. + * @param aUids Uids to move. Ownership not taken, must remain + * intact during operation. + * @param aUnmovableUids Uids of items which could not be moved (due to + * any other reason than name conflict) will be appended to this list. + * Ownership not taken, must remain intact during operation. + * @param aConflictingNameUids Uids of items which could not be moved + * (due to name conflict) will be appended to this list. + * Ownership not taken, must remain intact during operation. + * @param aTargetFolder Uid of the target folder. Nothing is checked. + * @param aPriority Active Object priority. + */ + CBrowserFavouritesIncrementalMove + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aUnmovableUids, + CArrayFix& aConflictingNameUids, + TInt aTargetFolder, + TInt aPriority = CActive::EPriorityStandard + ); + + /** + * Second phase constructor. + */ + void ConstructL(); + + protected: // from WmlBrowserFavouritesIncrementalOp + + /** + * Perform next step (move one item). + * @return Number of steps to come (0 if done). + */ + TInt StepL(); + + /** + * Create and prepare the wait note. + */ + void CreateWaitNoteLC(); + + private: // data + + /// Uids to delete. Not owned. + CArrayFix* iUids; + /// Unmovable uids. Not owned. + CArrayFix* iUnmovableUids; + /// Conflicting name uids. Not owned. + CArrayFix* iConflictingNameUids; + /// Target folder Uid. + TInt iTargetFolder; + /// Favourites item used in database updates. Owned. + CFavouritesItem* iItem; + /// Index of item being moved. + TInt iIndex; + + }; + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesIncrementalOp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesIncrementalOp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesIncrementalOp. +* +* +*/ + + +#ifndef WML_BROWSER_FAVOURITES_INCREMENTAL_OP +#define WML_BROWSER_FAVOURITES_INCREMENTAL_OP + +// INCLUDE FILES + +#include +#include + +// FORWARD DECLARATION + +class CBrowserFavouritesModel; +class CAknWaitDialog; + +// CLASS DECLARATION + +/** +* Base incremental operation with a wait dialog; an Active Object. +* Pure virtual. +*/ +class CBrowserFavouritesIncrementalOp: + public CAsyncOneShot, public MProgressDialogCallback + { + public: // construct / destruct + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesIncrementalOp(); + + public: // new methods + + /** + * Start the operation and exclude the caller from the Active Scheduler + * until done (this method returns when the operation is done). + */ + void ExecuteL(); + + protected: // construct / destruct + + /** + * Constructor. + * @param aPriority Active Object priority. + * @param aModel Data model. + */ + CBrowserFavouritesIncrementalOp + ( + CBrowserFavouritesModel& aModel, + TInt aPriority = CActive::EPriorityStandard + ); + + /** + * Second phase constructor. + */ + void ConstructL(); + + protected: // new methods + + /** + * Perform next step. Derived classes must provide this method. + * @return Number of steps to come (0 if done). + */ + virtual TInt StepL() = 0; + + /** + * Create and prepare the wait note. + */ + virtual void CreateWaitNoteLC() = 0; + + /** + * Called when all steps successfully executed; wait note is finished, + * but waiting has not been ended. Not called if cancelled or in case of + * any error. After this call ExecuteL returns. + * Empty implementation provided. + */ + virtual void DoneL(); + + protected: // from CActive + + /** + * Perform one step (or quit if finished). + */ + void RunL(); + + /** + * Cancel protocol implementation. + */ + void DoCancel(); + + /** + * Error handling: abandon operation. + */ + TInt RunError( TInt aError ); + + protected: // from MProgressDialogCallback + + /** + * Callback method; gets called when a dialog is dismissed. + * (This is where iWait is stopped - we wait for the dialog). + * @param aButtonId Button id. + */ + void DialogDismissedL( TInt aButtonId ); + + protected: // data + + CBrowserFavouritesModel* iModel; ///< Data model. Not owned. + CAknWaitDialog* iWaitNote; ///< Wait note. Owned. + + private: // data + + CActiveSchedulerWait* iWait; ///< Wait object. Owned. + + }; + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListbox.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,476 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserFavouritesListbox. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_H +#define BROWSER_FAVOURITES_LISTBOX_H + +// INCLUDES +#include +#include "BrowserFavouritesSelectionState.h" +#include "BrowserFaviconHandler.h" + +// FORWARD DECLARATIONS +class CFavouritesItem; +class CFavouritesItemList; +class CBrowserFavouritesIconIndexArray; +class MBrowserFavouritesListboxIconHandler; +class CBrowserFavouritesListboxModel; +class MBrowserFavouritesListboxCursorObserver; +class CBrowserFavouritesListboxState; +class MApiProvider; + +// MACROS + +// CLASS DECLARATION + +/** +* Listbox to display and browse bookmarks and folders. +* Display is sorted: Homepage first, Last Visited next, bookmarks sorted +* alphabetically, folders come last alphabetically. Markable single-graphics +* style listbox. +*/ +struct TBrowserFavouritesListboxDefaultDatas + { + TInt iPreferedId; + TBool iInSeamlessFolder; + }; + + +/** +* Listbox to display and browse bookmarks and folders. +* Display is sorted: Homepage first, Last Visited next, bookmarks sorted +* alphabetically, folders come last alphabetically. Markable single-graphics +* style listbox. +*/ +class CBrowserFavouritesListbox : public CAknSingleGraphicStyleListBox + ,public MBrowserFaviconObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aParent Parent control. + * @param aIconHandler The icon handler. Not owned. + * @return The constructed listbox. + */ + static CBrowserFavouritesListbox* NewL + ( + MApiProvider& aApiProvider, + const CCoeControl* aParent, + const MBrowserFavouritesListboxIconHandler& aIconHandler + ); + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesListbox(); + + public: // new methods + + /** + * Set listbox observer. + * @param Observer for this listbox. + */ + void SetListboxCursorObserver + ( MBrowserFavouritesListboxCursorObserver* aObserver ); + + /** + * Set new data to listbox. + * @param aItems Items to display. Ownership is taken. Should not be on + * cleanup stack when calling this (this method will push). + * @param aCommsModel to be used when setting bearer icons. + * (Ownership not taken.) + * @param aKeepState If ETrue, try to keep current state (marks etc.). + */ + void SetDataL + ( + CFavouritesItemList* aItems, + TBool aKeepState + ); + + /** + * Get selection state. + * @return Selection state. + */ + TBrowserFavouritesSelectionState SelectionStateL() const; + + /** + * Get currently highlighted item. + * @return Pointer to highlighted object or NULL. + */ + const CFavouritesItem* CurrentItem() const; + + /** + * Get currently marked one item (if more is marked, or nothing + * is marked, return NULL). + * @return Pointer to marked one object or NULL. + */ + const CFavouritesItem* MarkedItemL() const; + + /** + * Highlight the item having uid aUid. Does nothing + * if no item in the listbox has this uid. + * @param aUid Uid of item to highlight. + * @return ETrue if the item was found and highlighted; EFalse if not. + */ + TBool HighlightUidNow( TInt aUid ); + + /** + * Handle markable list command. Does nothing + * if listbox is not markable or empty. + */ + void HandleMarkableListCommandL( TInt aCommand ); + + /** + * Return Uids of marked items. + * @return Array of Uids. The array has been placed on the cleanup + * stack. The caller must destroy it and pop after no longer needed. + */ + CArrayFix* MarkedUidsLC() const; + + /** + * Return Uids of selected items. These are the marked ones, if no marks + * then the highlighted one. + * @return Array of Uids. The array has been placed on the cleanup + * stack. The caller must destroy it and pop after no longer needed. + */ + CArrayFix* SelectedUidsLC() const; + + /** + * Return a list of pointers to selected items. These are the marked + * ones, if no marks then the highlighted one. + * Note that the items exist within the listbox, + * and may be updated! So if you do something with the list which + * can be interrupted by some (other) active objects, copy the items + * first. + * Owner of the items is still the listbox, the owner of the list is + * the caller (i.e. you should delete the list, but not ResetAndDestroy + * it). + * @param aIncludeSpecialItems When ETrue, everything is included. When EFalse, + * homepage, last visited and folder types are excluded. + * @return Array of pointers to items. Items are owned by the listbox. + * The array has been placed on the cleanup stack. The caller must + * destroy it and pop after no longer needed. + */ + CArrayPtr* SelectedItemsLC(TBool aIncludeSpecialItems=ETrue) const; + + /** + * Return a pointer to item having aUid. Note that the item exists + * within the listbox, and may be deleted! So if you do something with + * it which can be interrupted by some (other) active objects, copy the + * item first. + * @param aUid Uid of item to look for. + * @return Pointer to item (owned by the listbox), having this uid; or + * NULL if no such item is found. + */ + const CFavouritesItem* ItemByUid( TInt aUid ) const; + + /** + * Return number of items in the listbox, not considering filters. + */ + TInt UnfilteredNumberOfItems(); + + + /** + * Return number of filtered items in the listbox + */ + TInt FilteredNumberOfItems(); + + + /** + * Update filtering (e.g. item array changed, or filter text changed + * from outside). + */ + void UpdateFilterL(); + + /** + * Query if there is any folder in the listbox. + * @return ETrue if there is any folder. + */ + TBool AnyFoldersL(); + + /* + * Return real indexes of selected items. These are the marked + * ones, if no marks then the highlighted one. + * @param aIncludeCurrent When ETrue, highlighted item is included, even + * if not marked. + * @return Array of view indexes. The array has been placed on the + * cleanup stack. The caller must destroy it and pop after no longer + * needed. + */ + CArrayFix* SelectedRealIndexesLC() const; + + /** + * Get the real index of current item (index into the model). + * @return View index or KErrNotFound if no current item. + */ + TInt CurrentItemRealIndex() const; + + /** + * Set highlight / marks / top item index state. + * @param aState State to restore from. + */ + void SetStateL( const CBrowserFavouritesListboxState& aState ); + + + public: // Functions from CAknSingleGraphicStyleListBox + + /** + * Handle key event. + * @param aKeyEvent The key event. + * @param aType Key event type. + * @return Response (was the key event consumed?). + */ + TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Handle focus change. + * @param aDrawNow Draw now? + */ + void FocusChanged( TDrawNow aDrawNow ); + + /* + * Create listbox model. + * @return The model for this listbox. + */ + void CreateModelL(); + + /** + * Create listbox view. + * @return The view for this listbox. + */ + CListBoxView* MakeViewClassInstanceL(); + + /** + * Create item drawer. + */ + void CreateItemDrawerL(); + + void HandleResourceChange( TInt aType ); + + public: // from MBrowserFaviconObserver + TInt DrawFavicons(); + + public: // defualt item access + inline TBrowserFavouritesListboxDefaultDatas& GetDefaultData() + { return iDefaultDatas; } + + inline CBrowserFaviconHandler* FaviconHandler() + { return iFaviconHandler; } + + inline TBool IsSkinUpdated () + { return iSkinUpdated; } + + void SetSkinUpdated(TBool aSkinUpdated); + + /** + * Italicizes listbox row at index aRowIndex + * + * @param aRowIndex - index of row to be italicized + */ + void ItalicizeRowItemL(TInt aRowIndex); + + /** + * Updates the favourites icons in the list. Initiates async operation + * to fetch and draw icons in background during idle time. + */ + void UpdateFavIconsL(); + + + protected: // Construct / destruct + + /** + * Constructor. + */ + CBrowserFavouritesListbox( MApiProvider& aApiProvider ); + + /** + * Second phase constructor. Leaves on failure. + * @param aParent Parent control. + * @param aIconHandler The icon handler. Not owned. + */ + void ConstructL + ( + const CCoeControl* aParent, + const MBrowserFavouritesListboxIconHandler& aIconHandler + ); + + /** + * Get listbox flags (markable etc.). + * @return listbox flags. + */ + virtual TInt ListboxFlags(); + + private: // new methods, getting listbox data + + /** + * Return items to be displayed in a list. Owner is the caller. + * The returned list must have exactly as much items as aItems. + * @param aCommsModel Comms model to be used for getting AP data. + * @param aItems Item list. + * @return Icon index array. + */ + CBrowserFavouritesIconIndexArray* GetIconIndexesLC + ( CFavouritesItemList& aItems ); + + /** + * Based on existing items and listbox state, calculate the new + * state which will be applied if items are replaced with new ones. + * @param aNewItems New item list. + * @return The new state. Owner is the caller, it must free the + * returned state. + */ + void CalcNewStateL( CFavouritesItemList& aNewItems ); + + /** + * Callback for fetching and drawing favicons + */ + static TInt UpdateFavIconsCallback( TAny* aParam ); + + + private: // new methods: index <--> Uid conversion + + /** + * Convert Uid to index. + * @param aUid Uid to convert. + * @return View index of item having aUid, or KErrNotFound. + */ + TInt UidToViewIndex( TInt aUid ) const; + + /** + * Convert Uids to view indexes on the list. If any Uid is not found, + * it is removed from the list (list may contain less elements + * after calling). + * @param aList List of Uids to convert. + */ + void UidsToViewIndexes( CArrayFix& aList ) const; + + /** + * Convert real indexes to Uids on the list. + * @param aList List of indexes to convert. + */ + void RealIndexesToUids( CArrayFix& aList ) const; + + /** + * Return real indexes of marked items. + * @param aIncludeCurrent When ETrue, highlighted item is included, even + * if not marked. + * @return Array of view indexes. The array has been placed on the + * cleanup stack. The caller must destroy it and pop after no longer + * needed. + */ + CArrayFix* MarkedRealIndexesLC() const; + + + + private: // Conversion between uid <--> view index <--> real index. + + // Note: there are two kinds of indexes in the listbox. One set is + // what is visible in the view (called View index), and the other + // what data is actually stored in the model (called Real index). + // When filtering kicks in, the two kind of indexes do not necessarily + // match, and a mapping between the two must be established. + + + /** + * Convert view index to real index. + * @param aViewlIndex View index (indexing to the visible elements). + * @return Real index or KErrNotFound if not found / not visible. + */ + TInt RealIndex( TInt aViewIndex ) const; + + /** + * Convert view indexes to real indexes on the list. If any index is + * not found / not visible, it is removed from the list (list may + * contain less elements after calling). + * @param aList List of indexes to convert. + */ + void RealIndexes( CArrayFix& aList ) const; + + /** + * Get flags for constructing selection state. + * @param aItem Extract flags from this item. + * @return Flags originating from the item. + */ + TInt SelectionFlags( const CFavouritesItem& aItem ) const; + + /** + * Convenience method; return the model. + * @return The model. + */ + CBrowserFavouritesListboxModel* TheModel() const; + + protected: // data + + /** + * Icon handler (this creates icons and calculates icon indexes). + */ + const MBrowserFavouritesListboxIconHandler* iIconHandler; + + protected: // data + + /** + * Real data for this listbox, array of items. Owned. + */ + CFavouritesItemList* iItems; + + /** + * Icon indexes for the items. Owned. + */ + CBrowserFavouritesIconIndexArray* iIconIndexes; + + /** + * Skin updated status + */ + TBool iSkinUpdated; + + private: // data + + MApiProvider& iApiProvider; // not owned + + /** + * Observer for cursor changes. + */ + MBrowserFavouritesListboxCursorObserver* iCursorObserver; + + /** + * Placeholder for new listbox state, when listbox content changes. + * This should really be a local variable, but it just cannot be done! + * because the cleanup stack cannot be managed (can't swap items in + * the stack). + */ + CBrowserFavouritesListboxState* iNewState; + TBrowserFavouritesListboxDefaultDatas iDefaultDatas; + CBrowserFaviconHandler* iFaviconHandler; + + /** + * Italicized font for setting listbox rows to italics font. + */ + CFbsFont *iFontItalic; + + CIdle *iIconUpdateCallback; + + + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxCursorObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxCursorObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class MWmlBrowserFavouritesListboxCursorObserver. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_CURSOR_OBSERVER_H +#define BROWSER_FAVOURITES_LISTBOX_CURSOR_OBSERVER_H + +// FORWARD DECLARATION + +class CEikListBox; + +// CLASS DECLARATION + +/** +* Observer class for CBrowserFavouritesListbox. Classes implementing +* this protocol will be notified about cursor changes. +*/ +class MBrowserFavouritesListboxCursorObserver + { + public: // new methods + + /** + * Handle cursor change. + * @param aListBox Listbox in which the cursor has changed. + */ + virtual void HandleCursorChangedL( CEikListBox* aListBox ) = 0; + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxIconHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxIconHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class MWmlBrowserFavouritesListboxIconHandler. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_ICON_HANDLER_H +#define BROWSER_FAVOURITES_LISTBOX_ICON_HANDLER_H + +// INCLUDE FILES + +#include +// #include + +// FORWARD DECLARATION + +class CAknIconArray; +class CFavouritesItem; +class CBrowserFavouritesListbox; +class CApListItemList; +class TFavouritesWapAp; +struct TBrowserFavouritesIconIndexes; + +// CLASS DECLARATION + +/** +* Icon handling in the WML Browser's Favourites Views listboxes. +* The problem with listbox icons is that iconarray is held by the listbox's +* itemdrawer, while their indexes are used in the model; and there is no safe +* way to enforce that the indexes used are really exist. So this class was +* introduced to make it safe: an instance is given to the listbox upon +* creation; the listbox uses the factory to create the iconarray for the +* itemdrawer, and setting icon indexes for items. This way, creating the +* iconarray and indexing to it is in the same class. +* Pure virtual. +*/ + +class MBrowserFavouritesListboxIconHandler + { + public: // new methods + + /** + * Create the iconarray. Derived classes please don't forget that the + * 0th icon must be the markable listbox's mark icon. + * @return The created iconarray. Owner is the caller. + */ + CAknIconArray* CreateIconArrayL() const; + + /** + * Get the icon indexes for this item (index into the array). + * @param aItem Item to get icon indexes for. + * @param aAccessPoints Access Points to use (if bearer info is needed). + * May be NULL. + * @return Icon indexes for the item. + */ + TBrowserFavouritesIconIndexes IconIndexes + ( + const CFavouritesItem& aItem, + /* const CApListItemList* aAccessPoints,*/ + CBrowserFavouritesListbox* aListbox + ) const; + + protected: // new methods + + /** + * Get item icon index for this item (index into the array). + * Derived classes must implement this method. + * @param aItem Item to get icon index for. + * @return Icon index for the item. + */ + virtual TInt ItemIconIndex( const CFavouritesItem& aItem ,CBrowserFavouritesListbox* aListbox ) const = 0; + + /** + * Get bearer icon index for this access point (index into the array). + * Derived classes may override this method; current + * implementation returns KBrowserFavouritesNoBearerIcon. + * @param aAccessPoint Access Points to get bearer icon for. + * @param aAccessPoints Access Points to use. + * @return Icon index for the access point. + */ + virtual TInt BearerIconIndex + ( + const TFavouritesWapAp aAccessPoint, + const CApListItemList& aAccessPoints + ) const; + + /** + * Dynamically load Icon from files (AVKON skin supported) + * @return pointer to the created icon array + */ + virtual CAknIconArray* LoadIconsL( ) const = 0; + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxItemDrawer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxItemDrawer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesListboxItemDrawer. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_ITEM_DRAWER_H +#define BROWSER_FAVOURITES_LISTBOX_ITEM_DRAWER_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** +* Custom item drawer, to support the "no-folders-marked" feature. +*/ +class CBrowserFavouritesListboxItemDrawer: public CColumnListBoxItemDrawer + { + public: // construction + + /** + * Constructor. + * @param aTextListBoxModel Listbox model. + * @param aFont Font. + * @param aColumnData Listbox column data. + */ + CBrowserFavouritesListboxItemDrawer + ( + MTextListBoxModel* aTextListBoxModel, + const CFont* aFont, + CColumnListBoxData* aColumnData + ); + + public: // from CColumnListBoxItemDrawer + + /** + * Get item properties for a listbox item. Same as base class behaviour, + * but marking is masked out for folders. + * @param aItemIndex Index of listbox item to get properties of. + * @return Properties of listbox item. + */ + TListItemProperties Properties( TInt aItemIndex ) const; + + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxModel.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserFavouritesListboxModel. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_MODEL_H +#define BROWSER_FAVOURITES_LISTBOX_MODEL_H + +// INCLUDE FILES +// #include +// #include +#include +#include "Browser.hrh" + +// CONSTANTS + +/** +* Buffer size for formatting listbox text. Maximum item name +* plus listbox internals (tabulators for icons etc.) must fit into it. +* The format is "\t\t\t", +* so the added length is 7. +*/ +const TInt KMaxFavouritesItemListboxName = + KFavouritesMaxBookmarkNameDefine + 7; + +// FORWARD DECLARATION + +class CFavouritesItemList; +class CBrowserFavouritesListboxModel; +class CBrowserFavouritesIconIndexArray; +// class CAknListBoxFilterItems; +// class CAknSearchField; +// class CEikListBox; + +// CLASS DECLARATION + +/** +* Item text array for the favourites view listbox; converts item data +* to format what the listbox needs. (This means the returned text includes +* listbox internals (tabulators, icon numbers). +*/ +class TBrowserFavouritesListboxItemTextArray: public MDesCArray + { + public: // from MDesCArray + + /** + * Get number of items in the array. + * @return Number of items. + */ + TInt MdcaCount() const; + + /** + * Text to be displayed for this item. + * @param aIndex Index of item. + * @return TPtrC for this item text. + */ + TPtrC MdcaPoint( TInt aIndex ) const; + + /** + * The model uses this class. + */ + friend class CBrowserFavouritesListboxModel; + + private: // data + + /** + * Pointer to real data. Not owned. + */ + const CFavouritesItemList* iItems; + + /** + * Icon indexes. Not owned. + */ + const CBrowserFavouritesIconIndexArray* iIconIndexes; + + /** + * MdcaPoint() cannot leave, so this buffer is allocated + * to allow formatting. Fortunately, doesn't have to be very + * large. + * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough), + * so wouldn't allow formatting the text in a member... + */ + __MUTABLE TBuf iBuf; + }; + +/** +* Item text array for the favourites view listbox filtering; converts item data +* to format what the filter needs. (This means the returned text is what the +* user sees, and does not include listbox internals (tabulators, icon numbers). +*/ +class TBrowserFavouritesListboxFilterTextArray: public MDesCArray + { + public: // from MDesCArray + + /** + * Get number of items in the array. + * @return Number of items. + */ + TInt MdcaCount() const; + + /** + * Text to be displayed for this item. + * @param aIndex Index of item. + * @return TPtrC for this item text. + */ + TPtrC MdcaPoint( TInt aIndex ) const; + + /** + * The model uses this class. + */ + friend class CBrowserFavouritesListboxModel; + + private: // data + + /** + * Pointer to real data. Not owned. + */ + const CFavouritesItemList* iItems; + + }; + +/** +* Model for the bookmark item listbox. Contains an array of +* CBrowserFavouritesItem pointers; items are owned. +*/ +class CBrowserFavouritesListboxModel: public CAknFilteredTextListBoxModel + { + public: // Construct / destruct + + /** + * Two-phase constructor. Leaves on failure. + * The two arrays passed must have the same number of items. + * @param aItems Itemarray; not owned. + * @param aIconIndexes Icon index array, not owned. + */ + static CBrowserFavouritesListboxModel* NewL + ( + const CFavouritesItemList& aItems, + const CBrowserFavouritesIconIndexArray& aIconIndexes + ); + + /** + * Overcoming base class bugs. Need to set itemarray after the whole + * listbox has been constructed; as the listbox construction + * overwrites itemarray to NULL. To be called as part of the + * construction ("third phase constructor"), AFTER the listbox's + * ConstructL. + */ + void SetItemArray(); + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesListboxModel(); + + public: // new methods + + /** + * Set new data into the model. + * The two arrays passed must have the same number of items. + * @param aItems Itemarray; not owned. + * @param aIconIndexes Icon index array, not owned. + */ + void SetData + ( + const CFavouritesItemList& aItems, + const CBrowserFavouritesIconIndexArray& aIconIndexes + ); + + /** + * Returns pointer to item list. + * @return Pointer to item list. + */ + inline const CFavouritesItemList* Items() const; + + public: // from CTextListBoxModel + + /** + * Get matchable text array (for filtering). + * @return The matchable text array. + */ + const MDesCArray* MatchableTextArray() const; + + protected: // Construct / destruct + + /** + * Constructor. + * The two arrays passed must have the same number of items. + * @param aItems Itemarray; not owned. + * @param aIconIndexes Icon index array, not owned. + */ + CBrowserFavouritesListboxModel + ( + const CFavouritesItemList& aItems, + const CBrowserFavouritesIconIndexArray& aIconIndexes + ); + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + private: // data + + /** + * The item array (real data, array of CFavouritesItem-s). Not owned. + */ + const CFavouritesItemList* iItems; + + /** + * Icon indexes. Not owned. + */ + const CBrowserFavouritesIconIndexArray* iIconIndexes; + + /** + * The item text array (formatting for listbox). + */ + TBrowserFavouritesListboxItemTextArray iItemTexts; + + /** + * The filter text array (formatting for filtering). + */ + TBrowserFavouritesListboxFilterTextArray iFilterTexts; + + }; + +#include "BrowserFavouritesListboxModel.inl" + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxModel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxModel.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserFavouritesListboxModel +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_MODEL_INL +#define BROWSER_FAVOURITES_LISTBOX_MODEL_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::Items +// --------------------------------------------------------- +// +const CFavouritesItemList* CBrowserFavouritesListboxModel::Items() const + { + return iItems; + } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxState.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesListboxState. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_STATE_H +#define BROWSER_FAVOURITES_LISTBOX_STATE_H + +// INCLUDE FILES + +#include + +// CLASS DECLARATION + +/** +* Listbox state. This contains highlighted item Uid, marked item Uids +* and top item Uid. When swithching views or there is a database update, +* the listbox state is saved, and after update an attempt is made to +* restore the listbox in a way so the display is same (or at least similar to) +* as it was before the change. +* Data to this class is fed by CBrowserFavouritesListbox. +* All attributes are public. +*/ +class CBrowserFavouritesListboxState: public CBase + { + friend class CBrowserFavouritesListbox; + friend class CBrowserFavouritesView; + public: // construct / destruct + + /** + * Constructor. + */ + CBrowserFavouritesListboxState(); + + /** + * Destructor. + + */ + ~CBrowserFavouritesListboxState(); + + protected: // data + + TInt iHighlightUid; ///< Uid of highlighted item. + CArrayFix* iMarkUids; ///< Uids of marked items. + TInt iTopItemUid; ///< Uid of top item. + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesListboxView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesListboxView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesListboxView. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_LISTBOX_VIEW_H +#define BROWSER_FAVOURITES_LISTBOX_VIEW_H + +// INCLUDE FILES +#include + +// FORWARD DECLARATION + +class MBrowserFavouritesListboxCursorObserver; + +// CLASS DECLARATION + +/** +* Listbox view, which notifies its observer about cursor movements. +*/ +class CBrowserFavouritesListboxView: public CAknColumnListBoxView + { + public: + + /** + * Constructor. + * @param aListbox Listbox which has this view. + */ + CBrowserFavouritesListboxView( CEikListBox& aListbox ); + + public: // new methods. + + /** + * Set cursor observer. Can be set to NULL. + * @param aCursorObserver This observer (if any) will be + * notified about cursor changes. + */ + void SetCursorObserver + ( MBrowserFavouritesListboxCursorObserver* aCursorObserver ); + + /** + * Move the cursor. Execute base class's method and notify observer. + * @param aCursorMovement Movement occurred in the listbox. + * @param aSelectionMode Selection mode. + */ + void MoveCursorL( CListBoxView::TCursorMovement aCursorMovement, + TSelectionMode aSelectionMode ); + + /** + * Select / highlight items witout moving the cursor. + * @param aSelectionMode Selection mode. + */ + void UpdateSelectionL( TSelectionMode aSelectionMode ); + + private: // data + + /// The listbox. + CEikListBox* iListbox; + /// The cursor movement observer. Can be NULL. + MBrowserFavouritesListboxCursorObserver* iCursorObserver; + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesModel.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,445 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserFavouritesModel. +* +* +*/ + +#ifndef BROWSER_FAVOURITES_MODEL_H +#define BROWSER_FAVOURITES_MODEL_H + +// INCLUDES + +#include +#include +#include "BrowserBookmarksOrder.h" +#include +#include +#include "ApiProvider.h" + +// FORWARD DECLARATION + +class CFavouritesItemList; +class CActiveFavouritesDbNotifier; +class MBrowserFavouritesModelObserver; +class CFavouritesItem; + +// CLASS DECLARATION + +/** +* Model for the Favourites Views of the WML Browser. +* This is a layer above the actual engines that do the data manipulation; +* and provides UI support for that (i.e. dialogs, notes etc.) +* Pure virtual. +*/ +class CBrowserFavouritesModel: public CBase, public MFavouritesDbObserver + { + + public: // types + + /** + * Answer for database queries. + */ + enum TDbQuery + { + EYes, ///< Answer to query is yes. + ENo, ///< Answer to query is no. + EError ///< Could not get answer (i.e. database is busy etc.). + }; + + /** + * Rename mode for adding / updating items (what to do if an item + * to be added / updated in the database has a conflicting name). + */ + enum TRenameMode + { + EAutoRename, ///< Rename silently. + EDontRename, ///< Do not rename (quit operation). + EAskIfRename ///< Ask user. + }; + + public: // construction + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesModel(); + + public: // string resources + + /** + * Resource selector type for strings. + */ + enum TTextResourceType + { + EDefaultName, ///< Default name (e.g. "New Bookmark"). + ERenamePrompt, ///< Rename prompt (e.g. "New Folder:"). + ENewPrompt, ///< New prompt (e.g. "Folder name:"). + ESaved, ///< Saved note (e.g. "Bookmark saved"). + ENotSaved ///< Not saved note (e.g. "Bookmark not saved"). + }; + + /** + * Get resource id of some text for an item. + * @param aItem The item to get resource id for. + * @param aType Type of resource text. + * @return Resource id of the text. + */ + virtual TInt StringResourceId + ( + const CFavouritesItem& aItem, + TTextResourceType aType + ) const = 0; + + /** + * Set the name of this item to default (e.g. "New Bookmark", + * "New Folder" etc.). The name that is set is read from resource, + * the resource id is StringResourceId( EDefaultName ). + * @param aItem The item to set default name for. + */ + void SetNameToDefaultL( CFavouritesItem& aItem ) const; + + public: // database opening / closing / access + + /** + * Open the database. + * After succesful open, notifications to observer may come. + * Safe to call if already open. + * @param aDbErrorNote If ETrue, unsuccesful open will bring up an + * error note. + * @return Error code. + */ + TInt OpenDbL( TBool aDbErrorNote = ETrue ); + + /** + * Close the database. No further notification may come to the + * observer. + */ + void CloseDb(); + + /** + * Start a transaction. + * @param aWrite If ETrue, the table is opened with write-lock on. + * @param aDbErrorNote If ETrue, unsuccesful open will bring up an + * error note. + * @param aLffsCheck If ETrue (the default), free disk space is + * checked to be above critical level (only if aWrite==ETrue). + * Always use the default (except for deleting)! + * @return Error code. + */ + TInt BeginL + ( TBool aWrite, TBool aDbErrorNote, TBool aLffsCheck = ETrue); + + /** + * Commit the transaction. + * Safe to call if not open. + */ + void CommitL(); + + /** + * Add an observer. + * @param aObserver Observer to be notified about database-related + * events. + */ + void AddObserverL( MBrowserFavouritesModelObserver& aObserver ); + + /** + * Remove an observer. Panic if not added. + * @param aObserver The observer. + */ + void RemoveObserver( MBrowserFavouritesModelObserver& aObserver ); + + /** + * Get the database. + * @return The actual database. + */ + inline RFavouritesDb Database() const; + + /** + * Opens an item associated with aUid in aFavFile. + * @return Error code. + */ + + TInt OpenFavouritesFile ( RFavouritesFile & aFavFile, TInt aUid ); + + /** + * Opens an item associated with aUid in aFavFile for replacement. + * @return Error code. + */ + + TInt ReplaceFavouritesFile ( RFavouritesFile & aFavFile, TInt aUid ); + + + public: // database query / update + + /** + * Add an item (folder or bookmark) to the database. + * @param aItem Item to add. + * @param aDbErrorNote If ETrue, unsuccesful database open will bring up an + * error note. + * @param aRenameMode What to do in case of the name is conflicting. + * @return Error code. + */ + TInt AddL + ( + CFavouritesItem& aItem, + TBool aDbErrorNote, + TRenameMode aRenameMode + ); + + /** + * Update an item (folder or bookmark) in the database. + * @param aItem Item data. + * @param aUid Uid of item to be updated. + * @param aDbErrorNote If ETrue, unsuccesful database open will bring up + * an error note. + * @param aRenameMode What to do in case of the name is conflicting. + * @return Error code. + */ + TInt UpdateL + ( + CFavouritesItem& aItem, + TInt aUid, + TBool aDbErrorNote, + TRenameMode aRenameMode + ); + + /** + * Set Homepage. + * @param aItem Item containing Homepage data. + * @param aDbErrorNote If ETrue, unsuccesful database open will bring up an + * error note. + * @param aRenameMode What to do in case of the name is conflicting. + * @return Error code. + */ + TInt SetHomepageL + ( + CFavouritesItem& aItem, + TBool aDbErrorNote, + TRenameMode aRenameMode + ); + + /** + * Set Last Visited Page. + * @param aItem Item containing Homepage data. + * @param aDbErrorNote If ETrue, unsuccesful database open will bring up + * an error note. + * @param aRenameMode What to do in case of the name is conflicting. + * @return Error code. + */ + TInt SetLastVisitedL + ( + CFavouritesItem& aItem, + TBool aDbErrorNote, + TRenameMode aRenameMode + ); + + /** + * Check if there are any folders (except the root). + * @return EYes, ENo or EError (if could not access the database). + */ + TDbQuery AnyFoldersL(); + + /** + * Check if the given list of uids contains + * any folders that are not empty. + * @param aUids List of Uids to check. + * @return EYes if there are non-empty folder(s), ENo if not, + * EError if could not access the database. + */ + TDbQuery AnyNonEmptyFoldersL( CArrayFix& aUids ); + + /** + * Get the ordinal number of this folder in the alphabetically sorted + * list of folders. Expects a transaction. + * @param aFolder The folder to find. + * @param aFolderCount On successful return, this will be set to the + * number of folders. + * @param On successful return, this will be set to the ordinal number + * of the given folder. + * @return Error code. + */ + TInt FolderInfoL + ( TInt aFolder, TInt& aFolderCount, TInt& aFolderIndex ); + + /** + * In the alphabetically sorted list of folders, get Uid of folder next + * to aFolder. Expects a transaction. + * @param aFolder Folder to start from. + * @param aForward If ETrue, get next; if EFalse, get previous. + * @return Uid of the next folder or KFavouritesNullUid in case of any + * error. + */ + TInt NextFolderL( TInt aFolder, TBool aForward ); + + /** + * Display a query for renaming this item. If the query is accepted, + * the item is renamed. + * @param aItem The item to rename. + * @param aItem New item, we do not rename. + * @return ETrue if the query is accepted and the item is renamed. + */ + TBool RenameQueryL( CFavouritesItem& aItem, TBool aNewItem ); + + /** + * Sort items in a list. + * @param aList List to sort. + */ + void SortL( CFavouritesItemList& aList ); + + public: // convenience methods + + /** + * Check if aItem has a unique name (in its parent folder), and if + * not, make its name unique. + * @param aItem Item to set a unique name for. + * @return Error code. + */ + TInt MakeUniqueNameL( CFavouritesItem& aItem ); + + protected: // new functions + + //MApiProvider& ApiProvider() const; + + public: // from MFavouritesDbObserver + + /** + * Handle database event. + * @param aEvent Database event. + */ + void HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent ); + + void ManualSortL(TInt aFolder, CBrowserBookmarksOrder* aBMOrder, CArrayFixFlat* aOrderArray, CFavouritesItemList* aItems); + + /** + * Adds the given uid to the last place in bookmarks list + * @param aUid The uid to add + * @param aOrderArray the array that stores uids in manual order + * @param aCurrentOrder the object that stores manual sorting data + */ + + void AddUidToLastPlaceL( TInt aUid , CArrayFixFlat* aOrderArray, CBrowserBookmarksOrder* aCurrentOrder); + + protected : // construction + + /** + * Constructor. + */ + CBrowserFavouritesModel( MApiProvider& aApiProvider ); + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Returns with the underlying database's name. + * Derived classes must provide this method. + * @return The Database Engine's name. + */ + virtual const TDesC& GetDBName(); + + private: // implementation details + + /** + * Open the database. If unsuccesful, retry two more times in + * 0.2 secs interval. + * @return Error code. + */ + TInt TimedOpenDbL(); + + /** + * Start a transaction. If unsuccesful, retry two more times in + * 0.2 secs interval. + * @param aWrite If ETrue, the table is opened with write-lock on. + * @return Error code. + */ + TInt TimedBeginL( TBool aWrite ); + + /** + * Add/update an item (folder or item) in the database; factoring out + * the common code. + * @param aItem Item data. + * @param aUid + * - When KFavouritesNullUid, the item is added. + * - Otherwise, Uid of the item to be updated. + * @param aDbErrorNote If ETrue, unsuccesful database open will bring up + * an error note. + * @param aRenameMode What to do in case of the name is conflicting. + * @return Error code. + */ + TInt AddUpdateL + ( + CFavouritesItem& aItem, + TInt aUid, + TBool aDbErrorNote, + TRenameMode aRenameMode + ); + + /** + * Compare two descriptors (case insensitive). + * @since 3.2 + * @param aFirst first descriptor + * @param aSecond second descriptor + * @return ETrue if strings match, EFalse otherwise + */ + TBool CompareIgnoreCase( const TDesC& aFirst, const TDesC& aSecond ); + + + protected: + /** + * Get all folders in the root, sorted, and push it on the cleanup + * stack. No sanity check. Expects a transaction. + * @return List of folders. Owner is the caller. + */ + virtual CFavouritesItemList* GetFoldersSortedLC(); + + private: // observer support + + /** + * Call each observer's HandleFavouritesModelChangeL(). + */ + void NotifyObserversL(); + + private: // types + + enum TState ///< Database state. + { + EClosed, ///< Database is closed. + EOpen, ///< Database is open. + ECorrupt ///< Database is corrupted (and is closed) + }; + + private: // data + + /// Used database object. Owned. + + RFavouritesDb iDb; + RFavouritesSession iFavouritesSess; + /// Notifier object. Owned. + CActiveFavouritesDbNotifier* iNotifier; + /// Observers. Array owned, contents not. + CArrayPtrFlat* iObservers; + /// Database state. + TState iState; + + MApiProvider& iApiProvider; + }; + +#include "BrowserFavouritesModel.inl" + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesModel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesModel.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserFavouritesModel +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_MODEL_INL +#define BROWSER_FAVOURITES_MODEL_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesModel::Database +// --------------------------------------------------------- +// +RFavouritesDb CBrowserFavouritesModel::Database() const + { + return iDb; + } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesModelObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesModelObserver.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesModelObserver. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_MODEL_OBSERVER_H +#define BROWSER_FAVOURITES_MODEL_OBSERVER_H + +// CLASS DECLARATION + +/** +* Mixin protocol, observing model changes of a CBrowserFavouritesModel. +*/ +class MBrowserFavouritesModelObserver + { + + public: // new methods + + /** + * Derived classes should implement this method, and act accordingly. + */ + virtual void HandleFavouritesModelChangeL() = 0; + + }; + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesSelectionState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesSelectionState.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CWmlBrowserFavouritesSelectionState. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_SELECTION_STATE_H +#define BROWSER_FAVOURITES_SELECTION_STATE_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** +* Selection state in the Favourites Views. +*/ +struct TBrowserFavouritesSelectionState + { + public: // types + + /** + * Flags for storing listbox highlighted and marked item state. They + * have has slightly different meaning for the two flags. For marking, + * most of the flags mean that the marking *includes* that; for the + * current, most of the flags mean that the current *is* that. + * For example, EHomepage in the marking flags means "Marking includes + * Homepage", while in current flag means "Current is the Homepage". + */ + enum + { + ENone = 0x0, ///< No items. + EAny = 0x1, ///< At least one (marking only). + EAll = 0x2, ///< All (marking only). + ECurrent = 0x4, ///< Current (marking only). + EHomepage = 0x8, ///< Homepage. + EStartPage = 0x10, ///< Start Page. + ELastVisited = 0x20, ///< Last Visited Page. + EItem = 0x40, ///< Any kind of item (incl. specials). + EPlainItem = 0x80, ///< Plain (non-special) item. + EFolder = 0x100 ///< Folder. + }; + + public: // constructor + + /** + * Constructor. Initialize with 0. + */ + inline TBrowserFavouritesSelectionState(); + + public: // new methods + + /** + * Return ETrue if listbox is empty. + * @return ETrue if listbox is empty. + */ + inline TBool IsEmpty() const; + + /** + * Return ETrue if any item is marked. + * @return ETrue if any item is marked. + */ + inline TBool AnyMarked() const; + + /** + * Return ETrue if the current item is marked. + * @return ETrue if the current item is marked. + */ + inline TBool CurrentIsMarked() const; + + /** + * Return ETrue if the all items are marked. + * @return ETrue if the all items are marked. + */ + inline TBool AllIsMarked() const; + + /** + * Return ETrue if the no items are marked. + * @return ETrue if the no items are marked. + */ + inline TBool NoneIsMarked() const; + + /** + * Return ETrue if the no items are marked. + * @return ETrue if the no items are marked. + */ + inline TBool NoItemsMarked() const; + + /** + * Return ETrue if the no folders are marked. + * @return ETrue if the no folders are marked. + */ + inline TBool NoFoldersMarked() const; + + /** + * Count marked items (items + folders). + * @return Count of marked items (items + folders). + */ + inline TInt MarkedCount() const; + + /** + * Return ETrue if the current item is item. + * @return ETrue if the current item is item. + */ + inline TBool CurrentIsItem() const; + + /** + * Return ETrue if the current item is folder. + * @return ETrue if the current item is folder. + */ + inline TBool CurrentIsFolder() const; + + /** + * Return ETrue if selection allows deleting: + * - Marked items contain something deletable, or + * - No marking, highlighted item is deletable. + * @return ETrue if selection allows deleting. + */ + inline TBool AnyDeletable() const; + + /** + * Return ETrue if selection contains at least one non-special item: + * - Marked items contain one non-special item, or + * - No marking, highlighted item is non-special item. + * @return ETrue if selection allows deleting. + */ + inline TBool AnyPlainItem() const; + + /** + * Return ETrue if current item is Homepage, Start Page or Last Visited. + * @return ETrue if current is Homepage, Start Page or Last Visited. + */ + inline TBool CurrentIsSpecial() const; + + /** + * Return ETrue if Homepage, Start Page and/or Last Visited is marked. + * @return ETrue if Homepage, Start Page and/or Last Visited is marked. + */ + inline TBool AnyMarkedSpecial() const; + + /** + * Return ETrue if the current item is start page. + * @return ETrue if the current item is start page. + */ + inline TBool CurrentIsStartPage() const; + + public: // data + + TInt iCurrentFlags; ///< Flags showing the highlighted one. + TInt iMarkFlags; ///< Flags showing marking state. + TInt iMarkedItemCount; ///< Count of marked items. + TInt iMarkedFolderCount; ///< Count of marked folders. + TInt iVisibleItemCount; ///< Count of visible items (not folders). + TInt iVisibleFolderCount; ///< Count of visible folders (not items). + }; + +#include "BrowserFavouritesSelectionState.inl" + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesSelectionState.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesSelectionState.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CWmlBrowserFavouritesSelectionState. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_SELECTION_STATE_INL +#define BROWSER_FAVOURITES_SELECTION_STATE_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::TBrowserFavouritesSelectionState +// --------------------------------------------------------- +// +TBrowserFavouritesSelectionState::TBrowserFavouritesSelectionState() + { + iCurrentFlags = 0; + iMarkFlags = 0; + iMarkedItemCount = 0; + iMarkedFolderCount = 0; + iVisibleItemCount = 0; + iVisibleFolderCount = 0; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::IsEmpty +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::IsEmpty() const + { + return !(iCurrentFlags & EAny); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::AnyMarked +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::AnyMarked() const + { + return iMarkFlags & EAny; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::CurrentIsMarked +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::CurrentIsMarked() const + { + return iMarkFlags & ECurrent; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::AllIsMarked +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::AllIsMarked() const + { + return iMarkFlags & EAll; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::NoneIsMarked +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::NoneIsMarked() const + { + return !AnyMarked(); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::NoItemsMarked +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::NoItemsMarked() const + { + return !(iMarkFlags & EItem); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::NoFoldersMarked +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::NoFoldersMarked() const + { + return !(iMarkFlags & EFolder); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::MarkedCount +// --------------------------------------------------------- +// +TInt TBrowserFavouritesSelectionState::MarkedCount() const + { + return iMarkedItemCount + iMarkedFolderCount; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::CurrentIsItem +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::CurrentIsItem() const + { + return iCurrentFlags & EItem; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::CurrentIsFolder +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::CurrentIsFolder() const + { + return iCurrentFlags & EFolder; + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::AnyDeletable +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::AnyDeletable() const + { + return (EPlainItem | EFolder | ELastVisited) & + (AnyMarked() ? iMarkFlags : iCurrentFlags); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::AnyPlainItem +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::AnyPlainItem() const + { + return EPlainItem & (AnyMarked() ? iMarkFlags : iCurrentFlags); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::CurrentIsSpecial +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::CurrentIsSpecial() const + { + return iCurrentFlags & (EHomepage | EStartPage | ELastVisited); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::AnyMarkedSpecial +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::AnyMarkedSpecial() const + { + return iMarkFlags & (EHomepage | EStartPage | ELastVisited); + } + +// --------------------------------------------------------- +// TBrowserFavouritesSelectionState::CurrentIsStartPage +// --------------------------------------------------------- +// +TBool TBrowserFavouritesSelectionState::CurrentIsStartPage() const + { + return iCurrentFlags & EStartPage; + } +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,579 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class CBrowserFavouritesView. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_VIEW_H +#define BROWSER_FAVOURITES_VIEW_H + +// INCLUDE FILES +#include + +#include "BrowserFavouritesModelObserver.h" +#include "BrowserAppViewBase.h" +#include "CommandVisibility.h" +#include "CommsModel.h" +#include "BrowserFavouritesModel.h" +#include + +// FORWARD DECLARATION +class CFavouritesItemList; +class CBrowserFavouritesContainer; +class CBrowserFavouritesModel; +class CBrowserFavouritesIncrementalOp; +class CBrowserFavouritesListboxState; + +// CLASS DECLARATION + +/** +* Base class for Bookmarks View and Saved Decks View of the WML Browser. +* The common behaviour of these views is collected here. This includes: +* Handling view activation / decativation; +* Interpreting (common) commands; +* Providing context-specific menus. +* Pure virtual; derived classes must provide model and control components +* and items to display. A number of methods can be overridden. +*/ +class CBrowserFavouritesView:public CBrowserViewBase, + public MEikListBoxObserver, + public MBrowserFavouritesModelObserver, + public MCommsModelObserver + { + public: // construction + + /** + * Destructor. + */ + virtual ~CBrowserFavouritesView(); + + public: // From MCbaSetter (CBrowserViewBase) + + /** + * Return command set id, to be displayed. + * @since 1.2 + * @return The command set's resource id. + */ + virtual TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + /** + * Return the resource ID of the seamless folder. + * @param aContextID Context ID of the seamless folder. + * @return The resource ID of the seamless folder or zero if it is not + * seamless. + */ + static TInt GetSeamlessFolderResourceID( TInt aContextID ); + + /** + * Return the resource ID of the seamless folder title. + * @param aContextID Context ID of the seamless folder. + * @return The resource ID of the seamless folder title or zero if it is not + * seamless. + */ + static TInt GetSeamlessFolderTitleResourceID( TInt aContextID ); + + /** + * Examines if the given ID is an ID of a seamless folder. + * @param aContextID Context ID of the folder. + * @return The ETrue if the given ID is a seamless ID otherwise EFalse. + * seamless. + */ + static TBool IsSeamlessFolder( TInt aContextID ); + + + /** + * Configure Context Menu Resource + * + * context-sensitive menu when item(s) marked + */ + void ConfigContextMenu(); + + static TInt RefeshFavoriteListBox( TAny* aFavouritesView ); + + public: // public methods from CAknView (CBrowserViewBase) + + /** + * Handle command. + * @since 1.2 + * @param aCommand Command id. + */ + virtual void HandleCommandL( TInt aCommand ); + + /** + * Get view id. Derived classes must provide this method. + * @return The view id for this view. + */ + virtual TUid Id() const = 0; + + void OpenFixedFolderL(TInt aUid); + + protected : + + // For Adaptive bookmarks folder navigation, used in Bookmarks View + + void SetRootFolderForAdaptiveBookmarks(); + + protected : // construction + + /** + * Constructor. + * @param aApiProvider The API provider. + */ + CBrowserFavouritesView( MApiProvider& aApiProvider, TInt aInitialFolderId = KFavouritesRootUid ); + + /** + * Second phase constructor. Leaves on failure. + * @param aViewResourceId Resource id for this view. + * Derived classes should call this first during construction. + */ + void ConstructL( TInt aViewResourceId ); + + protected: // menu initialization + + /** + * Initialize context-sensitive menu. + * @param aResourceId Resource id of the menu pane. + * @param aMenuPane Menu pane object being initialized. + * @param aIndex Index into the visibility map. + * @param aState Selection state. + */ + virtual void DynInitMenuPaneL + ( + TInt aResourceId, + CEikMenuPane* aMenuPane, + TCommandVisibility::TIndex aIndex, + const TBrowserFavouritesSelectionState& aState + ) = 0; + + protected: // new methods + + /** + * Get resource id of text to be displayed in navi pane when + * root folder is shown (TBUF). + * Derived classes must provide this method. + * @since 1.2 + * @return Resource id. + */ + virtual TInt RootTitleResourceId() const = 0; + + /** + * Get resource id of Options menu (RESOURCE MENU_BAR). + * Derived classes must provide this method. + * @since 1.2 + * @return Resource id. + */ + virtual TInt OptionsMenuResourceId() const = 0; + + /** + * Get resource id of OK-Options menu (RESOURCE MENU_BAR). + * Derived classes must provide this method. + * @since 1.2 + * @return Resource id. + */ + virtual TInt OkOptionsMenuResourceId() const = 0; + + protected: // component creation + + /** + * Create the model. Leave on failure. The model is owned by the + * caller (this view). + * Derived classes must provide this method. + * @return The constructed model. + */ + virtual CBrowserFavouritesModel* CreateModelL() = 0; + + /** + * Create the container (the main control of the view). The container + * is owned by the caller (this view). + * Leave on failure. + * Derived classes must provide this method. + * @return The constructed main control. + */ + virtual CBrowserFavouritesContainer* CreateContainerL() = 0; + + protected: // data retrieval + + /** + * Get items to be displayed in a folder. Expects the model's db be + * open. + * @param aFolder Folder which contains the items. + * @return List of items. Pushed on the cleanup stack. + */ + virtual CFavouritesItemList* GetItemsLC( TInt aFolder ); + + public: + + /** + * Get the model. + * @return The model. + */ + inline CBrowserFavouritesModel& Model() const; + + inline void ShowNextFolerL(TBool aNext) { OpenNextFolderL(aNext); } + + protected: // component retrieval + + /** + * Get the container (the view's main control). + * @return The container. Can be NULL (when view is not activated, + * container does not exist). + */ + inline CBrowserFavouritesContainer* Container() const; + + /** + * Get Uid of the folder shown. + * @return Current folder's Uid. + */ + inline TInt CurrentFolder() const; + + + protected: // new methods + + /** + * If there is a preferred highlight uid, attempt to highlight that. + * If succeeded, preferred highlight uid is cleared ("used up"). + * Otherwise do nothing. + */ + void HighlightPreferredL(); + + /** + * Some displayed data has changed (Favourites database, AP-s, etc). + * Update the view so changes become visible. Safe to call if the view + * is not active; in this case it does nothing. + * This method should not be called if the data change is due to direct + * user activity (opening folders etc.); only for notification + * processing. + * @param aDbErrorNote If ETrue, unsuccesful database access will bring + * up an error note. + */ + virtual void RefreshL( TBool aDbErrorNote = EFalse ); + + /** + * Redraw. + */ + void HandleClientRectChange(); + + protected: // from CAknView + + /** + * Activate the view. Open the database. If it was activated + * previously, try to restore the view as it was before deactivation. + * @param aPrevViewId Previous View Id. + * @param aCustomMessageId Custom Message Id. + * @param aCustomMessage Custom Message. + */ + void DoActivateL + ( + const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage + ); + + /** + * Deactivate the view. Close the database. Save the view state, + * so it can be restored on future activations. + */ + void DoDeactivate(); + + /** + * Initialize context-sensitive menu. Do not override this one; + * override the other. + * @param aResourceId Resource id of the menu pane. + * @param aMenuPane Menu pane object being initialized. + */ + void DynInitMenuPaneL + ( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * Handle foreground event. + * @param aForeground ETrue if foreground. + */ + virtual void HandleForegroundEventL( TBool aForeground ); + + protected: // from MEikListBoxObserver + + /** + * Handle listbox event. + * @param aListBox Listbox in which the event occurred. + * @param aEventType Event. + */ + virtual void HandleListBoxEventL + ( CEikListBox* aListBox, + MEikListBoxObserver::TListBoxEvent aEventType ); + + private: // command handling + + /** + * Command "Back", when showing a folder. Open the parent folder. + * of the currently shown folder. Highlight the folder just closed. + */ + void CloseCurrentFolderL(); + + /** + * Command "Open (folder)". Open the highlighted folder. + * Does nothing if no folder is highlighted. + */ + void OpenCurrentFolderL(); + + /** + * Command "Open (folder)" from OK-Options menu. Open the marked folder. + * Does nothing if no folder is marked or more is marked. + */ + void OpenMarkedFolderL(); + + /** + * Command "Remove" or "Erase". Delete marked item(s). + * Does nothing if no item is highlighted / marked. + */ + virtual void DeleteMarkedItemsL(); + + protected: + /** + * Command "New folder". New folders are alwas created in the root + * folder. + * @return The uid of the newly created folder, or KFavouritesNullUid + * (if not created). + */ + TInt AddNewFolderL(); + + private: + + /** + * Command "Move To Folder". Launch target folder selection dialog and + * move marked item(s). + */ + void MoveMarkedItemsL(); + + + /** + * Command "Rename". Rename current item. + * Does nothing if no item is highlighted. + */ + void RenameCurrentItemL(); + + protected: // implementation details. + + /** + * Open a folder by Uid and display its contents. Expects the + * model's db be open. + * @param aFolder Folder to open. + */ + void OpenFolderL( TInt aFolder ); + + /** + * Open next folder. + * @param aForward Open next folder if ETrue, previous if EFalse. + */ + virtual void OpenNextFolderL( TBool aForward ); + + private: + + /** + * Fill listbox with folder contents. Expects the model's db be open. + * @param aFolder Folder to display. + * @param aKeepState If ETrue, try to restore marks/highlight/top item + * position. + */ + void FillListboxL( TInt aFolder, TBool aKeepState ); + + /** + * Display confirmation dialog before deleting items. The dialog + * displayed is context-dependent (different dialog for one/more + * items, and for non-empty folders). + * @param aUids List of Uids (both item & folder) about to be deleted. + * @param aFolderUids List of folder uids about to be deleted. These + * uids are also in aUids, and are needed only to improve performance. + * (The non-empty folder checking, which is the only database query in + * this method, is performed only for folders. The effect of this is + * visible only if many items are selected.) + * @return ETrue if delete was confirmed; EFalse if not, or in case of + * any error (e.g. database error). + */ + TBool ConfirmDeleteL + ( CArrayFix& aUids, CArrayFix& aFolderUids ); + + /** + * After deleting items, display appropriate note about the outcome. + * @param aUids List of Uids that were selected for deletion. + * @param aNotDeletedUids List of Uids which are not deleted. + */ + void DisplayResultOfDeleteL + ( + const CArrayFix& aUids, + const CArrayFix& aNotDeletedUids + ); + + /** + * Launch target folder selection dialog and return uid of selected + * folder (or KFavouritesNullUid if cancelled or in case of any error). + * If no folders exist, user is prompted to create one. + * @param aExcludeFolder Exclude this folder from selection (current + * folder). + * @return Uid of selected folder, or KFavouritesNullUid. + */ + TInt SelectTargetFolderL( TInt aExcludeFolder ); + + /** + * "First pass" of moving is done; items that could be moved without + * user intervention, has been moved. Some of them may be still there, + * because it is unmovable (e.g. Homepage), or conflicts with a name in + * the target folder. For the latter ones, ask for each if replace the + * old ones, and act accordingly. + * Display appropriate note about what happened. + * @param aFolder The target folder. + * @param aUids List of Uids that were selected for moving. + * @param aUnmovableUids List of Uids which could never be moved. + * @param aConflictingNameUids List of conflicting name Uids. + */ + void HandleMoveResultL + ( + TInt aFolder, + const CArrayFix& aUids, + const CArrayFix& aUnmovableUids, + const CArrayFix& aConflictingNameUids + ); + + /** + * For each of the items in the list, display a rename dialog before + * moving them into the folder. + * @param aFolder The target folder. + * @param aUids List of Uids that were selected for moving. + */ + void RenameAndMoveItemsL + ( const CArrayFix& aUids, TInt aFolder ); + protected: // new methods + + /** + * Update and draw navi pane (show tabs for root, or "1/4" style text + * for subfolders). + * No sanity check; expects the model's table be open. + */ + virtual void UpdateNaviPaneL(); + + private: // new methods + + /** + * The container passes back key events to the view first, to + * allow moving between folders. (The container does not know + * anything about folders.) + */ + friend class CBrowserFavouritesContainer; + + protected: + /** + * Handle key event (called from the container, to allow moving between + * folders. + * @param aKeyEvent The key event. + * @param aType Key event type. + * @return Response (was the key event consumed?). + */ + virtual TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Reset state with deactivation event + */ + void ResetStateInDeActivation(); + + /** + * Needed for updating tool bar buttons when there is a up/down arrow key events received. + **/ + virtual void UpdateToolbarButtonsState(); + + private: // from MWmlBrowserFavouritesModelObserver + + /** + * Handle model change. + */ + void HandleFavouritesModelChangeL(); + + private: // from MCommsModelObserver + + /** + * Handle Comms Model change (AP update). + */ + void HandleCommsModelChangeL(); + + private: // default item settings + + /** + * Set Prefered the current item + */ + void SetPreferedCurrentItemL(); + + /** + * Set Prefered the current item + */ + void SetUnPreferedCurrentItemL(); + + + protected: // data + + /// Preferred highlight uid. + TInt iPreferredHighlightUid; + + /// If ETrue, OK-Options menu is shown instead of normal Options menu. + TBool iShowOkOptions; + + /// Top-level control of the view. Owned + CBrowserFavouritesContainer* iContainer; + + /// Uid of the current folder. + TInt iCurrentFolder; + + /// ETrue between DoActivateL() and DoDeactivate(). + TBool iIsActivated; + + private: // data + + /// The model (data handling). Owned. + CBrowserFavouritesModel* iModel; + TInt iLastSelection; + /// Incremental operation, or NULL if no such. Owned. + CBrowserFavouritesIncrementalOp* iIncrementalOp; + /// ETrue if data update is missed due to incremental operation. + TBool iUpdatePending; + /// Asynchronously update the favourite item's List Box + CIdle* iFavViewRefresh; + protected: + + TBool iRefresh; // Flag to indicate that Bookmarks list should be refreshed. + // ETrue by default, turned off only in cases we want to avoid + // double refresh. Checked in HandleFavouritesModelChangeL. + + TInt iInitialFolder; //Folder to which browser is launched in embedded mode + + // Flag to indicate that we are about to open Preferences view, + // in order not to return to root folder afterwards. + TBool iSaveStateOnDeactivate; + + CBrowserFavouritesListboxState* iSavedListboxState; + }; + +#include "BrowserFavouritesView.inl" + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/BrowserFavouritesView.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/BrowserFavouritesView.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Inline methods for CBrowserFavouritesView. +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_VIEW_INL +#define BROWSER_FAVOURITES_VIEW_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesView::Model +// --------------------------------------------------------- +// +CBrowserFavouritesModel& CBrowserFavouritesView::Model() const + { + return *iModel; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::Container +// --------------------------------------------------------- +// +CBrowserFavouritesContainer* CBrowserFavouritesView::Container() const + { + return iContainer; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::CurrentFolder +// --------------------------------------------------------- +// +TInt CBrowserFavouritesView::CurrentFolder() const + { + return iCurrentFolder; + } + +#endif + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesInc/CommandVisibility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesInc/CommandVisibility.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of class TCmdVisibility. +* +* +*/ + + +#ifndef COMMAND_VISIBILITY_H +#define COMMAND_VISIBILITY_H + +// INCLUDE FILES + +#include + +// FORWARD DECLARATION + +struct TBrowserFavouritesSelectionState; + +// CLASS DECLARATION + +/** +* Visibility info on one menu command. Unfortunately this cannot be put into +* a class, since it is initialized statically. Commands of menu panes are +* put into TCommandVisibilityMap-s (an array of TCommandVisibilityInfo). +* One TCommandVisibilityInfo contains the following information: +* 0. TInt The command. +* 1-5. Visibility under different selection conditions. +* TCommandVisibility::TIndex is used to index into the array. +*/ +typedef const TInt TCommandVisibilityInfo[6]; + +/** +* Variable length array of TCommandVisibilityInfo (i.e. commands and their +* visibility); the array is terminated with -1. This array is handled by +* TCommandVisibility. +*/ +typedef const TCommandVisibilityInfo* TCommandVisibilityMap; + +/* +* This struct provides a way to initialize menu panes with using visibility +* info arrays. +*/ +class TCommandVisibility + { + public: // types + + /* + * Indexes into the visibility info. + */ + enum TIndex + { + ECommand = 0, ///< The command. + ENothing, ///< (0) Visibility (nothing is selected). + EOneItem, ///< (1i) Visibility (one item is selected). + EOneFolder, ///< (1f) Visibility (one folder is selected). + EMoreItems, ///< (*i) Visibility (more selected no folders). + EItemsFolders, ///< (*) Visibility (more selected, incl folders). + EInvalid = -1 ///< Unused (sanity checking). + }; + + public: // new methods + + /** + * Apply visibility to this menu pane (dim commands). + * @param aMenuPane Menu pane to dim. + * @param aCommandInfo Command visibility info to apply. + * @param aIndex Index to use. + */ + static void Apply + ( + CEikMenuPane* aMenuPane, + TCommandVisibilityMap aCommandInfo, + TIndex aIndex + ); + + /** + * Checks whether the menu item can be shown. As this method does not + * get any menu panes, it will not dim menu items. + * @param aCommandInfo Command visibility info to apply. + * @param aIndex Index to use. + * @return EFalse if the menu item for the appropriate command is not + * to be shown. This method returns EFalse otherwise. + */ + static TBool Apply + ( + const TCommandVisibilityInfo& aCommandInfo, + TIndex aIndex + ); + + /** + * Calculate index into the visibility info, based on selection state. + * @param aSelectionState Selection state. + * @param aMarkedOnly If ETrue, consider only marked items. + * @return The index. + */ + static TIndex Index + ( + const TBrowserFavouritesSelectionState& aSelectionState, + TBool aMarkedOnly + ); + }; + + +// CONSTANTS + +// Controlling the visibility. +#define SHOW ETrue ///< Show this command (do not dim). +#define DIM EFalse ///< Dim this command. +#define CUSTOM ETrue ///< Custom handling (for the moment, do not dim). +#define VOID ETrue ///< Never evaluated. + +#endif + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserAdaptiveListPopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserAdaptiveListPopup.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1330 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserPopupList and CBrowserAdaptiveListPopup +* +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "BrowserContentView.h" +#include "BrowserAdaptiveListPopup.h" +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include "BrowserAppViewBase.h" +#include +#include +#include + +#include "eikon.hrh" + +// CONSTANTS +const TInt KMaxIcons = 2; +const TInt KListLengthToShow = 64;//the length of the string in the list +_LIT( KItemTab, "1\t");//prefix for items +_LIT( KDirTab, "0\t");//prefix for directories +const TInt KArrayGranularity = 10; +_LIT( KProtocolIdentifier,"://" ); +const TUint KSlash('/'); +const TUint KPeriod('.'); +const TInt KListHeight = 36; +const TInt KLandscapeListItems = 5; +const TInt KFontHeight = 150; + +static void TextPos(TPoint *aResultArray, const TAknTextLineLayout +&aLayout, TSize aItemSize) + { + TRect itemRect(TPoint(0,0), aItemSize); + TAknLayoutText textLayout; + textLayout.LayoutText(itemRect, aLayout); + aResultArray[0] = textLayout.TextRect().iTl; + aResultArray[1] = textLayout.TextRect().iTl + +textLayout.TextRect().Size(); + } + +static void GfxPos(TPoint *aResultArray, const TAknWindowLineLayout +&aLayout, TSize aItemSize) + { + TRect itemRect(TPoint(0,0), aItemSize); + TAknLayoutRect layout; + layout.LayoutRect(itemRect, aLayout); + aResultArray[0] = layout.Rect().iTl; + aResultArray[1] = layout.Rect().iTl + layout.Rect().Size(); + } + +TSize ListBoxItemSize(CEikListBox &aListBox, CFormattedCellListBoxItemDrawer *aItemDrawer) + { + TSize size = TSize( aItemDrawer->LafItemSize().iWidth, aListBox.View()->ItemSize().iHeight ); + return size; + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserPopupList::CBrowserPopupList() +// +// --------------------------------------------------------- +// +CBrowserPopupList::CBrowserPopupList(TParentType aParentType):CAknSingleGraphicPopupMenuStyleListBox() + { + iParentType = aParentType; + } + +// --------------------------------------------------------- +// CBrowserPopupList::~CBrowserPopupList() +// +// --------------------------------------------------------- +// +CBrowserPopupList::~CBrowserPopupList() + { + } + +// --------------------------------------------------------- +// CBrowserPopupList::ConstructL +// +// --------------------------------------------------------- +// +void CBrowserPopupList::ConstructL(const CCoeControl* aParent, TInt aFlags) + { + CAknSingleGraphicPopupMenuStyleListBox::ConstructL( aParent, aFlags); + } + +// --------------------------------------------------------- +// CBrowserPopupList::SetHighLight +// Sets the highlight of the list +// --------------------------------------------------------- +// +void CBrowserPopupList::SetHighLight(TBool aHighLight) + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + iItemDrawer->SetFlags( CListItemDrawer::ESingleClickEnabled ); +#endif + iListBoxFlags = ( aHighLight ? iListBoxFlags &~ CEikListBox::EDisableHighlight : iListBoxFlags | CEikListBox::EDisableHighlight ); + if ( aHighLight ) + { + iItemDrawer->ClearFlags( CListItemDrawer::EDisableHighlight ); + } + else + { + iItemDrawer->SetFlags( CListItemDrawer::EDisableHighlight ); + } + } + +// --------------------------------------------------------- +// CBrowserPopupList::HighLightEnabled() +// Enables the highlight in the list +// --------------------------------------------------------- +// +TBool CBrowserPopupList::HighLightEnabled() + { + return !( iItemDrawer->Flags() & CListItemDrawer::EDisableHighlight ); + } + +// --------------------------------------------------------- +// CBrowserPopupList::SizeChanged() +// sets the inner layout +// --------------------------------------------------------- +// +void CBrowserPopupList::SizeChanged() + { + CAknSingleGraphicPopupMenuStyleListBox::SizeChanged(); + TAknWindowLineLayout windowLineLayout; + TAknWindowLineLayout windowLineLayoutTmp; + TAknWindowLineLayout windowLineLayoutTmp2; + TAknLayoutRect layoutRect; + TPoint area[2] ; + TRgb color; + CEikFormattedCellListBox &aListBox = *this; + CFormattedCellListBoxItemDrawer *itemDrawer = aListBox.ItemDrawer(); + AknListBoxLayouts::SetupStandardListBox(aListBox); + + AknListBoxLayouts::SetupListboxPos( aListBox, AppLayout::list_single_graphic_popup_wml_pane( 0 )); + + GfxPos(area, + AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_g1(), + ListBoxItemSize(*this, ItemDrawer()) ); + + AknListBoxLayouts::SetupFormGfxCell(aListBox, + itemDrawer, + 0, + AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_g2(), + area[0], + area[1]); + + //sets the rectangle of the text + TextPos(area, + AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_t1( ), + ListBoxItemSize(*this, ItemDrawer()) ); + AknListBoxLayouts::SetupFormAntiFlickerTextCell(aListBox, + itemDrawer, + 1, + AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_t1( ), + area[0], + area[1]); + } + +// --------------------------------------------------------- +// CBrowserPopupList::Draw() +// --------------------------------------------------------- +// +void CBrowserPopupList::Draw(const TRect& /*aRect*/) const + { + TRect windowRect = this->Rect(); + CEikFormattedCellListBox::Draw( windowRect ); + return; + } + + +// ================= CBrowserAdaptiveListPopup ======================= + + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::CBrowserAdaptiveListPopup() +// --------------------------------------------------------- +// +CBrowserAdaptiveListPopup::CBrowserAdaptiveListPopup( CEikEdwin* aGotoPaneEdit, + CCoeControl* aParent, TParentType aParentType, TBool aSearchFeature): + iEditor( aGotoPaneEdit ), iParent( aParent ), + iParentType( aParentType ), iSearchFeature( aSearchFeature ) + { + iTouchSupported = AknLayoutUtils::PenEnabled(); + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +void CBrowserAdaptiveListPopup::ConstructL( ) + { + CreateWindowL(); +//-------- list ------ + iList = new(ELeave) CBrowserPopupList( iParentType ); +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + iList->ConstructL( this , CEikListBox::EDisableItemSpecificMenu ); +#else + iList->ConstructL( this , CEikListBox::ELeftDownInViewRect ); +#endif + iList->SetContainerWindowL( *this ); + if (iTouchSupported) + { + iList->SetListBoxObserver( this ); + } + iList->CreateScrollBarFrameL( ETrue ); + iList->SetMopParent(iParent); + iList->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto); + iList->ScrollBarFrame()->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan ); + iList->UpdateScrollBarsL(); + iList->SetBorder(TGulBorder::ESingleBlack); + iList->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); +//---------- items storing arrays --------- + iItems = new(ELeave) CDesCArrayFlat(KArrayGranularity); + iItemNames = new(ELeave) CDesCArrayFlat(KArrayGranularity); + iItemNamesToShow = new(ELeave) CDesCArrayFlat(KArrayGranularity); +//---------- model ---------- + CTextListBoxModel* model = iList->Model(); + model->SetItemTextArray( iItemNamesToShow ); + model->SetOwnershipType( ELbmDoesNotOwnItemArray ); +//---------- icons ----------- + SetIconsL(); +//--------- other -------- + iFirstGotoContent = KNullDesC().AllocL(); + iPrevGotoContent = KNullDesC().AllocL(); + iPoppedUp = EFalse; + iDirectoryMode = ETrue; + iOpenCBA=EFalse; + iItemDrawer = iList->ItemDrawer(); + iPrevItem = -2; + iUrlCompletionMode = EFalse; + iRecentUrlStore = CBrowserAppUi::Static()->RecentUrlStore(); + if (!iRecentUrlStore) + { + User::Leave(KErrCouldNotConnect); + } + iListScrollTimer = CPeriodic::NewL(CActive::EPriorityIdle); + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::~CBrowserAdaptiveListPopup() +// Destructor +// --------------------------------------------------------- +CBrowserAdaptiveListPopup::~CBrowserAdaptiveListPopup() + { + delete iList; + delete iItems; + delete iItemNames; + delete iItemNamesToShow; + delete iPrevGotoContent; + delete iFirstGotoContent; + if(iListScrollTimer) + { + iListScrollTimer->Cancel(); + delete iListScrollTimer; + } +} + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::SetOrdinalPosition +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::SetOrdinalPosition( TInt aPos ) + { + Window().SetOrdinalPosition( aPos ); + } + +void CBrowserAdaptiveListPopup::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + if (iList && iTouchSupported) + { + //using ComponentControl(0) instead of iList because need access to a + //protected function + ComponentControl(0)->HandlePointerEventL( aPointerEvent ); + } + } + +void CBrowserAdaptiveListPopup::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType) + { + if (iList && aListBox == iList && iTouchSupported) + { + switch (aEventType) + { + case MEikListBoxObserver::EEventItemDoubleClicked: + { + TKeyEvent keyEvent; + keyEvent.iModifiers = 0; + keyEvent.iRepeats = 0; + keyEvent.iCode = EKeyDevice3; + keyEvent.iScanCode = EStdKeyDevice3; + if ( iParentType == EBookmarksGotoPane ) + { + CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKeyDown ); + } + CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKey ); + if ( iParentType == EBookmarksGotoPane ) + { + CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKeyUp ); + } + } + break; + case MEikListBoxObserver::EEventItemClicked: +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + case MEikListBoxObserver::EEventItemSingleClicked: +#endif + HandleItemClickedL( aListBox ); + break; + default: + break; + } + } + } + +void CBrowserAdaptiveListPopup::HandleItemClickedL( CEikListBox* aListBox ) + { + //the first time + if ( !iList->HighLightEnabled() ) + { + iList->SetHighLight( ETrue ); + + //save the original content + if ( !iFirstGotoContent ) + { + delete iFirstGotoContent; + iFirstGotoContent = NULL; + } + iFirstGotoContent = iEditor->GetTextInHBufL(); + if ( !iFirstGotoContent ) + { + iFirstGotoContent = KNullDesC().AllocL(); + } + } + TInt index = aListBox->CurrentItemIndex(); + index = iItems->Count() - index - 1; + TPtrC16 item((*iItems)[ index ] ); + TPtrC rightSide; + + //cut the slash from the end if needed + //permanent sollution until AHLE does not + //solve this problem related to ID: TMCN-5TTRXV error + if ( item[item.Length() - 1] != KSlash ) + { + rightSide.Set( item.Left( item.Length() ) ); + } + else + { + rightSide.Set( item.Left( item.Length() - 1 ) ); + } + + //if true then append the suffix(rightSide), to the + //user-typed data + //else just use the recent URLs text(rightSide) only + if ( iUrlCompletionMode ) + { + HBufC* currentCompletion = HBufC::NewLC( + iFirstGotoContent->Des().Length() + rightSide.Length() + 1 ); + TPtr currentCompletionPtr = currentCompletion->Des(); + + currentCompletionPtr.Copy( iFirstGotoContent->Des() ); + currentCompletionPtr.Append( rightSide ); + currentCompletionPtr.ZeroTerminate(); + iEditor->SetTextL( currentCompletion ); + iEditor->SetCursorPosL( currentCompletionPtr.Length(), EFalse ); + CleanupStack::PopAndDestroy( currentCompletion ); + } + else + { + iEditor->SetTextL( &rightSide ); + iEditor->SetCursorPosL( rightSide.Length(), EFalse ); + } + iEditor->HandleTextChangedL(); + + delete iPrevGotoContent; + iPrevGotoContent = NULL; + iPrevGotoContent = item.AllocL(); + iEditor->DrawNow(); + //change the CBA depending on whether the highlight is + //on url or domain + CBrowserAppUi::Static()->UpdateCbaL(); + } + + +//------------------------------------------------------------------ +// CBrowserAdaptiveListPopup::ShowSingleItemPopupListWithGraphicsL(TBool aShowTitle) +// shows "List pane for single item with graphic" +//------------------------------------------------------------------ +void CBrowserAdaptiveListPopup::ShowPopupListL(TBool aRelayout) + { + TAknWindowLineLayout windowLineLayout; + TAknWindowLineLayout windowLineLayoutTmp; + TAknWindowLineLayout windowLineLayoutMain; + TAknWindowLineLayout windowLineLayoutMainTmp; + TAknWindowLineLayout windowLineLayoutLW; + TAknWindowLineLayout windowLineLayoutLWTmp; + TAknWindowLineLayout windowLineLayoutSLW; + TAknWindowLineLayout windowLineLayoutSLWTmp; + TAknLayoutRect layoutRect; + TAknLayoutRect layoutMainRect; + TAknLayoutRect layoutLWRect; + TAknLayoutRect layoutSLWRect; + + //turn of the highlight + iList->SetHighLight( EFalse ); + //clear arrays + iItems->Reset(); + iItemNames->Reset(); + iItemNamesToShow->Reset(); + + TInt offset; + HBufC* newText; + //get create and get the string from the edit field + if ( iEditor->TextLength() > 0 ) + { + newText = iEditor->GetTextInHBufL(); + CleanupStack::PushL( newText ); + //cut the protokolidentifier from the string + offset = newText->Find( KProtocolIdentifier ); + if ( offset == KErrNotFound ) + { + offset = newText->Length(); + } + else + { + offset = newText->Length() - offset - 3; + } + } + else + { + offset = 0; + newText = KNullDesC().AllocLC(); + } + TPtrC trimmedContent( newText->Right( offset ) ); + TBuf buf; + + //find out if the user typed a ".", if so, bring up the url completion list + TInt periodPos = trimmedContent.LocateReverse( TChar(KPeriod) ); + if ((periodPos != KErrNotFound) && ((periodPos + 1) == trimmedContent.Length())) + { + //add the url completion entries to the popup list + iUrlCompletionMode = ETrue; + CreateURLCompletionListL(); + } + else + { + iUrlCompletionMode = EFalse; + //only include recent URLs if not including the url completion items + iRecentUrlStore->GetData( *iItems, *iItemNames, trimmedContent ); + + //sort alphabetically and... + for(TInt i=0; iCount(); i++) + { + for(TInt j=0; jCount()-1; j++) + { + if ((*iItems)[j].CompareF((*iItems)[j+1]) > 0) + { + RBuf tmp; + CleanupClosePushL(tmp); + tmp.Create((*iItems)[j]); + iItems->Delete(j); + iItems->InsertL( j+1, tmp ); + tmp.Close(); + tmp.Create((*iItemNames)[j]); + iItemNames->Delete(j); + iItemNames->InsertL( j+1, tmp ); + CleanupStack::PopAndDestroy( &tmp ); + } + } + } + //and move url with params i.e google.fi/m=q?xyz do the back of list + TInt i = 0; //iterator + TInt j = 0; //counter + while (i < (iItems->Count()-1) && j < iItems->Count()) + { + TUriParser8 parser; + RBuf8 out; + CleanupClosePushL( out ); + out.Create( (*iItems)[i].Length() ); + RBuf in; + CleanupClosePushL( in ); + in.Create( (*iItems)[i] ); + + CnvUtfConverter::ConvertFromUnicodeToUtf8(out, in ); + + if (( parser.Parse( out ) == KErrNone ) && //if parse ok and + ( parser.Extract( EUriPath ).Length() > 0 || //url contains path + parser.Extract( EUriQuery ).Length() > 0 )) //or query item + { + iItems->AppendL( (*iItems)[i] );//move item to back of the list + iItems->Delete( i ); + iItemNames->AppendL( (*iItemNames)[i] ); + iItemNames->Delete( i ); + } + else + { + i++; + } + j++; + + CleanupStack::PopAndDestroy( &in ); + CleanupStack::PopAndDestroy( &out ); + }; + + + } + iDirectoryMode = EFalse; + CleanupStack::PopAndDestroy();//newText + TInt k; + k = iItems->Count(); + iItemNo = k; + TInt length = KListLengthToShow - 2; + if ( k > 0 ) + { + TInt j; + TPtrC textToShow; + TPtrC itemJ; + //changeing the order + for (j=k-1; j>-1; j--) + { + itemJ.Set( (*iItems)[j] ); + textToShow.Set( itemJ.Left( length ) ); + if ( iDirectoryMode ) + { + //directories and items + if ( itemJ[ itemJ.Length() - 1 ] == KSlash ) + { + //item + buf.Format( _L( "%S%S" ), &KItemTab, &textToShow ); + } + else + { + //directory + buf.Format( _L( "%S%S" ), &KDirTab, &textToShow ); + } + } + else + { + //items only + buf.Format( _L( "%S%S" ), &KItemTab, &textToShow ); + } + iItemNamesToShow->AppendL( buf ); + } + //set how many item will be shown + +#ifdef BRDO_TOUCH_ENABLED_FF + TInt appWidth = iEikonEnv->EikAppUi()->ApplicationRect().Width(); + TInt appHeight = iEikonEnv->EikAppUi()->ApplicationRect().Height(); + //For landscape mode only 5 items can be shown on the screen + if(appWidth > appHeight) + iMaxRecentUrlsToShow = KLandscapeListItems; +#endif + TInt itemstoshow; + if ( k > iMaxRecentUrlsToShow) + { + itemstoshow = iMaxRecentUrlsToShow; + } + else + { + itemstoshow = k; + } + //resetting to original value + iMaxRecentUrlsToShow = CBrowserAppUi::Static()->ContentView()->ApiProvider().Preferences().MaxRecentUrls(); + + //set the main rect of the window + // fixing bug RFON-7E2PPV, don't use ApplicationRect() + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); + windowLineLayoutMain = AknLayout::main_pane( rect, 0, 2, 1 ); + windowLineLayoutMainTmp = windowLineLayoutMain; + layoutMainRect.LayoutRect( rect, windowLineLayoutMainTmp ); + + + windowLineLayoutLW = AppLayout::popup_wml_address_window( 1, itemstoshow ); + + windowLineLayoutLWTmp = windowLineLayoutLW; + layoutLWRect.LayoutRect( layoutMainRect.Rect(), windowLineLayoutLWTmp ); + windowLineLayoutSLW = AknLayoutScalable_Apps::listscroll_popup_wml_pane(); + windowLineLayoutSLWTmp = windowLineLayoutSLW; + layoutSLWRect.LayoutRect( layoutLWRect.Rect(), windowLineLayoutSLWTmp ); + windowLineLayout = AppLayout::list_wml_pane( itemstoshow - 1 ); + windowLineLayoutTmp = windowLineLayout; + layoutRect.LayoutRect( layoutLWRect.Rect(), windowLineLayoutTmp ); + + TRect rectTemp(layoutSLWRect.Rect()); + // force listbox on top of goto pane + rectTemp.iBr.iY = iParent->PositionRelativeToScreen().iY; + rectTemp.iTl.iX = iParent->PositionRelativeToScreen().iX; + // shrink list box to size of list +#ifdef BRDO_TOUCH_ENABLED_FF + TInt listH = KListHeight; +#else + TInt listH = AppLayout::list_single_graphic_popup_wml_pane( 0 ).iH; +#endif + rectTemp.iTl.iY = rectTemp.iBr.iY - (listH * itemstoshow); + // set bottom right x axis to full width + rectTemp.iBr.iX = rect.iBr.iX; + + // we only want to call SetRect() when we have a relayout, otherwise just + // scroll the list to the correct position. Doing this will reduce the amount + // of flicker seen while typing into the gotopane + if ((rectTemp.Size() != Rect().Size()) || aRelayout) + { + //set the window rect + SetRect( rectTemp ); + } + rectTemp = TRect( 0, 0, Rect().Width(), Rect().Height() ); + if ( rectTemp!=iList->Rect() ) + { + //set the rect of the list + iList->SetRect( rectTemp ); + } + else + { + // this scrolls list to the correct position, probably still does too much work + AknListBoxLayouts::SetupListboxPos( *iList, AppLayout::list_single_graphic_popup_wml_pane( 0 )); + } + //the last item is visible + //ScrollToMakeItemVisible scrolls only after some delay + if(!iListScrollTimer->IsActive()) + { + iListScrollTimer->Start(20, 0, + TCallBack(ListScrollTimerCallBack, this)); + } + +#ifdef BRDO_TOUCH_ENABLED_FF + const CFont* pFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont); + TFontSpec fontSpec = pFont->FontSpecInTwips(); + fontSpec.iHeight =KFontHeight; + + CFont* fontNew; + CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips( ( CFont*&)fontNew, fontSpec ); + CFormattedCellListBoxData *pLBData = iList->ItemDrawer()->ColumnData(); + iList->SetItemHeightL(KListHeight); + + if(pLBData && pFont) + { + pLBData->SetSubCellFontL(1,fontNew); + } + + CEikonEnv::Static()->ScreenDevice()->ReleaseFont(fontNew); +#endif + + MakeVisible( ETrue ); + iPoppedUp = ETrue; + DrawNow(); + iList->Draw(rectTemp); + } + else + { + MakeVisible( EFalse ); + iPoppedUp = EFalse; + CBrowserAppUi::Static()->UpdateCbaL(); + } + if (!IsActivated()) + { + ActivateL(); + } + iPrevItem = -2; + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::CreateURLCompletionListL +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::CreateURLCompletionListL() + { + _LIT(KSeparator, ","); + + if (iUrlSuffixBuf) + { + TPtrC urlSuffix(iUrlSuffixBuf->Des()); + TInt index(urlSuffix.FindF(KSeparator)); + TInt offset = 0; + + while (index != KErrNotFound) + { + // Omit empty string + if (index > 0) + { + iItems->AppendL( urlSuffix.Mid(offset,index) ); + } + + offset += (index + 1); + TPtrC remainder(urlSuffix.Mid(offset)); + index = remainder.FindF(KSeparator); + } + + // Cover the cases where we only have one suffix in the list and/or + // the last suffix in the list does not have a comma + if (offset < urlSuffix.Length()) + { + TPtrC remainderB(urlSuffix.Mid(offset, urlSuffix.Length() - offset)); + iItems->AppendL( remainderB ); + } + } + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::HandleControlEventL +// if the content of the edit box changes +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::HandleControlEventL(CCoeControl* aControl,enum MCoeControlObserver::TCoeEvent aEventType) + { + CEikEdwin* edwin = ( CEikEdwin* )aControl; + // the content of the edit box changes + if ( MCoeControlObserver::EEventStateChanged == aEventType ) + { + HBufC* newText = edwin->GetTextInHBufL(); + if (!newText) + { + newText = KNullDesC().AllocL(); + } + CleanupStack::PushL( newText ); + //check whether the last content is different to the one in the editbox + if ( !iPrevGotoContent || iPrevGotoContent->Compare( *newText ) ) + { + ShowPopupListL(); + delete iPrevGotoContent; + iPrevGotoContent = NULL; + iPrevGotoContent = newText; + CleanupStack::Pop( newText );//ownership is taken + } + else + { + if ( !iPrevGotoContent ) + { + CleanupStack::PopAndDestroy( newText ); + } + else + { + ShowPopupListL(); + delete iPrevGotoContent; + iPrevGotoContent = NULL; + iPrevGotoContent = newText; + CleanupStack::Pop( newText );//ownership is taken + } + } + //change the CBA + if ( iOpenCBA ) + { + iOpenCBA = EFalse; + CBrowserAppUi::Static()->UpdateCbaL(); + } + } + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::CountComponentControls +// +// --------------------------------------------------------- +// +TInt CBrowserAdaptiveListPopup::CountComponentControls() const + { + if ( iList == NULL ) + { + return 0; + } + return 1; + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::ComponentControl +// +// --------------------------------------------------------- +// +CCoeControl* CBrowserAdaptiveListPopup::ComponentControl(TInt aIndex) const + { + if (aIndex==0) + { + return iList; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::OfferKeyEventL +// Handles key events +// --------------------------------------------------------- +// +TKeyResponse CBrowserAdaptiveListPopup::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse resp = EKeyWasNotConsumed; + if (( iPoppedUp && + !CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() && + (CBrowserAppUi::Static()->LastActiveViewId() == KUidBrowserContentViewId) ) || (( iPoppedUp ) && + (CBrowserAppUi::Static()->LastActiveViewId() != KUidBrowserContentViewId))) + { + TInt currIndex = iItems->Count() - iList->CurrentItemIndex() - 1; + + //the joystick is pressed + if ( aKeyEvent.iCode == EKeyOK ) + { + if ( ( iList->HighLightEnabled() ) + && ( iDirectoryMode ) + && ( (*iItems)[ currIndex ][(*iItems)[ currIndex ].Length() - 1] != KSlash ) ) + { + SetDirectoryModeL( EFalse ); + resp = EKeyWasConsumed; + } + else + { + if (iEditor->TextLength()!=0) + { + HidePopupL(); + } + } + } + + //the joystick is pressed up + else if ( aKeyEvent.iCode == EKeyLeftUpArrow // Northwest + || aKeyEvent.iCode == EStdKeyDevice10 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyUpArrow // North + || aKeyEvent.iCode == EKeyRightUpArrow // Northeast + || aKeyEvent.iCode == EStdKeyDevice11 ) // : Extra KeyEvent supports diagonal event simulator wedge + { + resp = EKeyWasConsumed; + //the first time + if ( !iList->HighLightEnabled() ) + { + iList->SetHighLight( ETrue ); + currIndex = iList->Model()->NumberOfItems()-1; + iList->ScrollToMakeItemVisible( currIndex ); + iList->SetCurrentItemIndex( currIndex ); + DrawNow(); + //save the original content + if ( iFirstGotoContent != NULL ) + { + delete iFirstGotoContent; + iFirstGotoContent = NULL; + } + iFirstGotoContent = iEditor->GetTextInHBufL(); + if (iFirstGotoContent == NULL) + { + iFirstGotoContent = KNullDesC().AllocL(); + } + } + else + { + if( iSearchFeature ) + { + if( iList->CurrentItemIndex() == 0 ) + { + resp = EKeyWasConsumed; + return resp; + } + } + resp=iList->OfferKeyEventL( aKeyEvent, aType ); + } + if ( currIndex > -1 ) + { + //copy the selected item to edit field + TPtrC16 item; + TPtrC rightSide; + TInt newIndex; + newIndex = iItems->Count() - iList->CurrentItemIndex() - 1; + item.Set( (*iItems)[ newIndex ] ); + //cut the slash from the end if needed + //permanent sollution until AHLE does not + //solve this problem related to ID: TMCN-5TTRXV error + + //if URL completion, then we want to append the item to the item in the edit field + if (iUrlCompletionMode) + { + TPtr16 ptr = iFirstGotoContent->Des(); + + HBufC* buf = HBufC::NewLC(ptr.Length() + item.Length() + 1); + + buf->Des().Copy(ptr); + buf->Des().Append(item); + buf->Des().ZeroTerminate(); + + + rightSide.Set(buf->Des()); + + iEditor->SetTextL( &rightSide ); + iEditor->SetCursorPosL( rightSide.Length(), EFalse ); + + CleanupStack::PopAndDestroy(); //buf + } + else + { + if ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash ) + { + rightSide.Set( item.Left( item.Length() ) ); + } + else + { + rightSide.Set( item.Left( item.Length() - 1 ) ); + } + iEditor->SetTextL( &rightSide ); + iEditor->SetCursorPosL( rightSide.Length(), EFalse ); + } + delete iPrevGotoContent; + iPrevGotoContent = NULL; + iPrevGotoContent = item.AllocL(); + iEditor->DrawNow(); + //change the CBA depending on whether the highlight is + //on url or domain + if ( ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash ) && iDirectoryMode ) + { + iOpenCBA = ETrue; + } + else + { + iOpenCBA = EFalse; + } + CBrowserAppUi::Static()->UpdateCbaL(); + } + } + + //the joystisk is pressed down + else if ( aKeyEvent.iCode == EKeyLeftDownArrow // Southwest + || aKeyEvent.iCode == EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge + || aKeyEvent.iCode == EKeyDownArrow // South + || aKeyEvent.iCode == EKeyRightDownArrow // Southeast + || aKeyEvent.iCode == EStdKeyDevice12 ) // : Extra KeyEvent supports diagonal event simulator wedge + { + resp = EKeyWasConsumed; + if( iSearchFeature ) + { + if ( iPrevItem <= 0 ) + { + if(! iList->HighLightEnabled() ) + { + resp = EKeyWasNotConsumed; + return resp; + } + } + } + //it was the last item + if ( iPrevItem == 0 ) + { + //write back the original string + iList->SetHighLight( EFalse ); + iEditor->SetTextL( iFirstGotoContent ); + iEditor->HandleTextChangedL(); + iEditor->SetCursorPosL( iFirstGotoContent->Length(), EFalse ); + delete iPrevGotoContent; + iPrevGotoContent = NULL; + iPrevGotoContent = iFirstGotoContent->AllocL(); + iEditor->DrawNow(); + DrawNow(); + //change the CBA + if ( iOpenCBA ) + { + iOpenCBA = EFalse; + CBrowserAppUi::Static()->UpdateCbaL(); + } + return resp; + } + else if ( ( currIndex > -1 ) && iList->HighLightEnabled() ) + { + //write the selected items string to the editor + TPtrC16 item; + TPtrC rightSide; + TInt newIndex; + resp = iList->OfferKeyEventL( aKeyEvent, aType ); + newIndex = iItems->Count() - iList->CurrentItemIndex() - 1; + item.Set( (*iItems)[ newIndex ] ); + //cut the slash from the end if needed + //permanent sollution until AHLE does not + //solve this problem related to ID: TMCN-5TTRXV error + if ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash ) + { + rightSide.Set( item.Left( item.Length() ) ); + } + else + { + rightSide.Set( item.Left( item.Length() - 1 ) ); + } + + //if true then append the suffix (rightSide), to the + //user-typed data + //else just use the recent URLs text(rightSide) only + if ( iUrlCompletionMode ) + { + HBufC* currentCompletion = HBufC::NewLC( + iFirstGotoContent->Des().Length() + rightSide.Length() + 1 ); + TPtr currentCompletionPtr = currentCompletion->Des(); + + currentCompletionPtr.Copy( iFirstGotoContent->Des() ); + currentCompletionPtr.Append( rightSide ); + currentCompletionPtr.ZeroTerminate(); + iEditor->SetTextL( currentCompletion ); + iEditor->SetCursorPosL( currentCompletionPtr.Length(), EFalse ); + CleanupStack::PopAndDestroy( currentCompletion ); + } + else + { + iEditor->SetTextL( &rightSide ); + iEditor->SetCursorPosL( rightSide.Length(), EFalse ); + } + iEditor->HandleTextChangedL(); + + if ( iPrevGotoContent != NULL ) + { + delete iPrevGotoContent; + iPrevGotoContent = NULL; + } + iPrevGotoContent = item.AllocL(); + iEditor->DrawNow(); + //change the CBA depending on whether the highlight is + //on url or domain + if ( ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash ) && iDirectoryMode ) + { + iOpenCBA = ETrue; + } + else + { + iOpenCBA = EFalse; + } + CBrowserAppUi::Static()->UpdateCbaL(); + } + } + + if ( iList->HighLightEnabled() ) + { + iPrevItem = currIndex; + } + } + return resp; + } + + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::HidePopupL +// Hides the popup list +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::HidePopupL() + { + //clear the lists + if ( iPoppedUp ) + { + HBufC* newText = HBufC::NewLC( iEditor->TextLength() ); + TPtr newTextDes = newText->Des(); + iEditor->GetText( newTextDes ); + iEditor->ClearSelectionL(); + iEditor->SetTextL( newText ); + iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); + CleanupStack::PopAndDestroy( newText ); + iItemNames->Reset(); + iList->Reset(); + if (!IsActivated()) + { + ActivateL(); + } + MakeVisible(EFalse); + DrawNow(); + iPrevItem = -2; + iPoppedUp = EFalse; + // highlight a directory, cancel goto pane + // activate goto pane again -> softkey problem + iOpenCBA = EFalse; + CBrowserAppUi::Static()->UpdateCbaL(); + } + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::IsInDirectoryMode +// gives back the directory mode +// --------------------------------------------------------- +// +TBool CBrowserAdaptiveListPopup::IsInDirectoryMode() + { + return iDirectoryMode; + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::SetDirectoryMode +// Sets the directory mode +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::SetDirectoryModeL(TBool aDirMode) + { + iDirectoryMode = aDirMode; + if ( aDirMode == EFalse ) + { + //put the slash to the back of the editor fileds string + //it will show the directory mode + TInt length; + length = iEditor->TextLength() + 1; + HBufC* newText = HBufC::NewLC( length ); + TPtr newTextDes = newText->Des(); + iEditor->GetText( newTextDes ); + newTextDes.Append( TChar(KSlash) ); + iEditor->SetTextL( newText ); + iEditor->SetCursorPosL( length, EFalse ); + CleanupStack::PopAndDestroy( newText ); + iEditor->DrawNow(); + ShowPopupListL(); + //change the CBA + if ( iOpenCBA ) + { + iOpenCBA = EFalse; + CBrowserAppUi::Static()->UpdateCbaL(); + } + } + return; + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::IsOpenDirToShow +// Show which CBA is about to show +// --------------------------------------------------------- +// +TBool CBrowserAdaptiveListPopup::IsOpenDirToShow() +{ + return iOpenCBA; +} + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::IsPoppedUp +// Show whether the list is popped up or not +// --------------------------------------------------------- +// +TBool CBrowserAdaptiveListPopup::IsPoppedUp() +{ + return iPoppedUp; +} + + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::HandleResourceChange +// If new skin is set the icons will be reloaded +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::HandleResourceChange( TInt aType ) + { + TRAP_IGNORE( HandleResourceChangeL( aType ) ); + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::HandleResourceChangeL +// If new skin is set the icons will be reloaded +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::HandleResourceChangeL( TInt aType ) + { + if (( aType == KAknsMessageSkinChange )|| + ( aType == KEikDynamicLayoutVariantSwitch ) ) + { + CArrayPtr* array = + iList->ItemDrawer()->ColumnData()->IconArray(); + + array->ResetAndDestroy(); + delete array; + SetIconsL(); + } + + CCoeControl::HandleResourceChange(aType); + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect)) + { + SetRect(rect); + } + } + + if ( ( aType == KEikDynamicLayoutVariantSwitch ) && ( iPoppedUp ) ) + { + + if ( AknLayoutUtils::PenEnabled() ) + { + SetOrdinalPosition( 0 ); + } + + TInt selectionIndex = -1; + HBufC* originalText = NULL; + TInt popitem( 0 ); + if ( iList->HighLightEnabled() ) + { + selectionIndex = iList->CurrentItemIndex(); + //save the editors content + originalText = iEditor->GetTextInHBufL(); + if (originalText == NULL) + { + originalText = KNullDesC().AllocL(); + } + CleanupStack::PushL( originalText ); + ++popitem; + //write back the first string + iEditor->SetTextL( iFirstGotoContent ); + iEditor->HandleTextChangedL(); + } + ShowPopupListL(ETrue); + if ( selectionIndex > -1) + { + iEditor->SetTextL( originalText ); + iEditor->SetCursorPosL( originalText->Length(), EFalse ); + iEditor->HandleTextChangedL(); + iList->SetHighLight( ETrue ); + iList->ScrollToMakeItemVisible( selectionIndex ); + iList->SetCurrentItemIndex( selectionIndex ); + DrawNow(); + iEditor->DrawNow(); + } + if ( popitem ) + { + CleanupStack::PopAndDestroy( popitem ); // originalText + } + } + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::SetIconsL() +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::SetIconsL() +{ + CArrayPtr* icons = + new(ELeave) CAknIconArray( KMaxIcons ); + CleanupStack::PushL(icons); // PUSH Icon + CGulIcon* newIcon; + CFbsBitmap *newIconBmp; + CFbsBitmap *newIconMaskBmp; + + TParse* fp = new(ELeave) TParse(); + CleanupStack::PushL(fp); + TInt err = fp->Set(KBrowserDirAndFile, &KDC_APP_BITMAP_DIR, NULL); + if (err != KErrNone) + { + User::Leave(err); + } + TBuf iconFile= fp->FullName(); + CleanupStack::PopAndDestroy(fp); + + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlFolderAdap, + newIconBmp, + newIconMaskBmp, + iconFile, + EMbmBrowserQgn_prop_wml_folder_adap, + EMbmBrowserQgn_prop_wml_folder_adap_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlBmAdap, + newIconBmp, + newIconMaskBmp, + iconFile, + EMbmBrowserQgn_prop_wml_bm_adap, + EMbmBrowserQgn_prop_wml_bm_adap_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + iList->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); + CleanupStack::Pop(); // POP Icon +} + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::SetUrlSuffixList() +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::SetUrlSuffixList(HBufC* urlSuffixList) + { + iUrlSuffixBuf = urlSuffixList; + } + +// --------------------------------------------------------- +// CBrowserAdaptiveListPopup::SetMaxRecentUrls() +// --------------------------------------------------------- +// +void CBrowserAdaptiveListPopup::SetMaxRecentUrls (TInt maxRecentUrls) + { + iMaxRecentUrlsToShow = maxRecentUrls; + } + +TInt CBrowserAdaptiveListPopup::ListScrollTimerCallBack(TAny* aAny) + { + CBrowserAdaptiveListPopup* self = static_cast( aAny ); + self->DoListScrolling(); + self->iListScrollTimer->Cancel(); + return KErrNone; + } + +void CBrowserAdaptiveListPopup::DoListScrolling() + { + iList->ScrollToMakeItemVisible( iList->Model()->NumberOfItems()-1 ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,888 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserBookmarksContainer. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include "BrowserBookmarksView.h" + +#include "CommonConstants.h" +#include "BrowserFavouritesView.h" +#include "BrowserBookmarksContainer.h" +#include "BrowserBookmarksGotoPane.h" +#include "BrowserFavouritesListbox.h" +#include "BrowserUtil.h" +#include "BrowserAppUi.h" +#include "BrowserBookmarksListboxIconHandler.h" +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include "BrowserApplication.h" +#include +#endif // __SERIES60_HELP +#include "Logger.h" +#include +#include +#include + +// CONSTANTS + +/// Tab index for Bookmarks View. +LOCAL_D const TInt KBookmarkTabIndex = 0; +const TInt KMaxTitleLength = 512; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::NewL +// --------------------------------------------------------- +// +CBrowserBookmarksContainer* CBrowserBookmarksContainer::NewL( + const TRect& aRect, + CBrowserFavouritesView& aView) + { + CBrowserBookmarksContainer* container = + new (ELeave) CBrowserBookmarksContainer; + CleanupStack::PushL( container ); + container->ConstructL( aRect, aView ); + CleanupStack::Pop(); // container + return container; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::~CBrowserBookmarksContainer +// --------------------------------------------------------- +// +CBrowserBookmarksContainer::~CBrowserBookmarksContainer() + { + delete iGotoPane; + delete iSearchPane; + delete iDefaultSearchText; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::SetGotoActiveL +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::SetGotoActiveL() + { + if( !iGotoPaneActive) + { + iGotoPaneActive = ETrue; + + Listbox()->UpdateFilterL(); + if( iSearchPane ) + { + iGotoPane->SetVKBFlag( EFalse ); + // Check for Search Configuration Changes // + if( View().ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId ) + != iSearchIconId ) + { + ConstructSearchPaneL(); + } + + iSearchPane->SetFocus( EFalse ); + // only one editor can be active at a time // + iSearchPaneActive = EFalse; + // we still need to display search, when showing for first time // + iSearchPane->MakeVisible(ETrue); + iSearchPane->CancelEditingL(); + } + + // redraw + SizeChanged(); + + // It is important to set the Text and Italic property after SizeChanged, because + // iInputFrame->SetRect() event on GoTo/Search Pane calls the scalable version + // ( AknLayoutUtils::LayoutEdwinScalable ) which overwrites all the properties for + // Char and Para Formats. + if( iSearchPane ) + { + iSearchPane->SetTextModeItalicL(); + HBufC* text = iSearchPane->GetTextL(); + CleanupStack::PushL( text ); + if ( !text->Length() ) + { + //TODO: read possible title valu from cenrep, if not found seyt the default text + HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); + TPtr searchProviderPtr = searchProvider->Des(); + + View().ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, + KMaxTitleLength , searchProviderPtr); + if( searchProvider->Length() == 0 ) + { + iSearchPane->SetTextL( *iDefaultSearchText ); + } + else + { + iSearchPane->SetTextL( searchProviderPtr ); + } + CleanupStack::PopAndDestroy(searchProvider); + + } + CleanupStack::PopAndDestroy( text ); + } + + iGotoPane->BeginEditingL(); + DrawDeferred(); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::SetSearchActiveL +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::SetSearchActiveL() + { + if( ! iSearchPaneActive ) + { + // Check for Search Configuration Changes // + if( View().ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId ) + != iSearchIconId ) + { + ConstructSearchPaneL(); + } + + iSearchPane->SetVKBFlag( EFalse ); + iSearchPane->SetFocus( ETrue ); + iSearchPaneActive = ETrue; + + Listbox()->UpdateFilterL(); + // only one editor can be active at a time + iGotoPaneActive = EFalse; + iGotoPane->MakeVisible(ETrue); + iGotoPane->SetFocus( EFalse ); + iGotoPane->CancelEditingL(); + + // redraw + SizeChanged(); + + // Not Focused, so set the current Text Mode to italics. + iGotoPane->SetTextModeItalicL(); + // if gotopane is empty add default text + HBufC* text = iGotoPane->GetTextL(); + CleanupStack::PushL( text ); + if ( !text->Length() ) + { + iGotoPane->SetTextL( KWWWString ); + } + CleanupStack::PopAndDestroy( text ); + + iSearchPane->BeginEditingL(); + DrawDeferred(); + } + + } + + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::SetGotoInactiveL(); +// --------------------------------------------------------- +// + +void CBrowserBookmarksContainer::SetGotoInactiveL() + { + if( iGotoPaneActive || iSearchPaneActive ) + { + + if( iSearchPane ) + { + /* In Search Feature we have to move between the editors preserving the + * text added, clear the text when cancel is pressed. + */ + iGotoPane->SetTextL( KNullDesC , ETrue ); + SetSearchInactiveL(); + } + // Deactivate GoTo Pane + iGotoPaneActive = EFalse; + + // Deactivate GoTo Pane + iGotoPane->MakeVisible( EFalse ); + iGotoPane->CancelEditingL(); + iGotoPane->SetFocus( EFalse ); + + // redraw + Listbox()->UpdateFilterL(); + SizeChanged(); + DrawDeferred(); + } + } + +void CBrowserBookmarksContainer::SetSearchInactiveL() + { + iSearchPaneActive = EFalse; + iSearchPane->SetTextL( KNullDesC , ETrue); + iSearchPane->MakeVisible( EFalse ); + iSearchPane->CancelEditingL(); + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::CountComponentControls +// --------------------------------------------------------- +// +TInt CBrowserBookmarksContainer::CountComponentControls() const + { + return (Listbox() ? 1 : 0) + (iGotoPane ? 1 : 0) + (iSearchPane? 1 : 0) ; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::ComponentControl +// --------------------------------------------------------- +// +CCoeControl* CBrowserBookmarksContainer::ComponentControl +( TInt aIndex ) const + { + switch (aIndex) + { + case 0: + { + return Listbox(); + } + + case 1: + { + return iGotoPane; + } + case 2: + { + return iSearchPane; + } + default: + { + return NULL; + } + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::SizeChanged +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::SizeChanged() + { + TRect rect = Rect(); + TInt unfilteredNumberOfItems = Listbox()->UnfilteredNumberOfItems(); + + // if goto pane is active + if( iGotoPaneActive || iSearchPaneActive ) + { + if( iSearchPane ) + { + TAknWindowLineLayout findPane = AknLayout::find_pane(); + + // Enable / disable line in Goto Pane (hide if listbox is empty). + iGotoPane->SetLineState( unfilteredNumberOfItems > 0 ); + + TAknWindowLineLayout listLayout = AknLayout::list_gen_pane( 1 ); + + TRect listBoxRect = AknLayoutUtils::RectFromCoords( rect,listLayout.il, + listLayout.it, listLayout.ir, listLayout.ib, listLayout.iW, listLayout.iH); + + /* Now we need to make room for both Goto and Search Pane. + * No layout specification was suitable for this case, so + * substracting the height of pane. + */ + listBoxRect.iBr.iY -= findPane.iH; + + // In Goto Mode, the listbox is laid out leaving space for Goto Pane. + Listbox()->SetRect( listBoxRect ); + + + // Now Lay out Search Pane as if it was the old Find Pane. + AknLayoutUtils::LayoutControl( iSearchPane, rect, findPane ); + + TRect gotoRect = AknLayoutUtils::RectFromCoords( rect,findPane.il, findPane.it, + findPane.ir, findPane.ib, findPane.iW, findPane.iH); + + // Calculate the new position for GoToPane. + gotoRect.iTl.iY -= ( findPane.iH ); + gotoRect.iBr.iY -= ( findPane.iH ); + iGotoPane->SetRect( gotoRect ); + + } + else + { + // Enable / disable line in Goto Pane (hide if listbox is empty). + iGotoPane->SetLineState( unfilteredNumberOfItems > 0 ); + + // In Goto Mode, the listbox is laid out leaving space for Goto Pane. + AknLayoutUtils::LayoutControl( Listbox(), rect, AknLayout::list_gen_pane( 1 )); + + // Lay out Goto Pane as if it was the old Find Pane. + AknLayoutUtils::LayoutControl( iGotoPane, rect, AknLayout::find_pane() ); + } + } + else + { + // Fall back upon default behavior in base-class, which lays out the bookmarks list only + CBrowserFavouritesContainer::SizeChanged(); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CBrowserBookmarksContainer::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { +/* +LOG_ENTERFN( "BookmarksContainer::OfferKeyEventL" ); +BROWSER_LOG( ( _L("aType: %d, aKeyEvent.iCode: %d, iScanCode: %d, iRepeats: %d"), + aType, aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iRepeats ) ); +*/ + TKeyResponse result = EKeyWasNotConsumed; + TKeyEvent keyEvent( aKeyEvent ); + + // Selection Key handling + if( keyEvent.iScanCode == EStdKeyDevice3 ) + { + // it is possible to activate BookmarksView from ContentView + // via a long press of Selection key, so here we must capture + // the KeyDown. Long press processing will be done only if key + // was pressed originally in this view. + if( aType == EEventKeyDown ) + { + iSelectionKeyDownPressed = ETrue; + result = EKeyWasConsumed; + } + else if( aType == EEventKeyUp ) + { + if( !iSelectionKeyLongPress && iSelectionKeyDownPressed ) + { + // short press of Selection key, pass it to GotoPane + keyEvent.iCode = EKeyOK; + result = EKeyWasNotConsumed; + } + else + { + // long press of Selection key was already processed + result = EKeyWasConsumed; + } + iSelectionKeyDownPressed = EFalse; + iSelectionKeyLongPress = EFalse; + } + else if( aType == EEventKey ) + { + if( keyEvent.iRepeats && iSelectionKeyDownPressed ) + { + const CFavouritesItem* item = Listbox()->CurrentItem(); + if ( item ) + { + // The option for the user to download the page in new window is disabled + CBrowserAppUi::Static()->FetchBookmarkL( *item ); + } + iSelectionKeyLongPress = ETrue; + iSelectionKeyDownPressed = EFalse; + } + + if ( (aKeyEvent.iScanCode == EStdKeyHash) || + ( aKeyEvent.iModifiers & + ( EModifierShift | EModifierLeftShift | EModifierRightShift | + EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) + { + + // Hash key press will be used for Mark/UnMark functionality + // Let Platform Listbox handle this. + result = EKeyWasNotConsumed; + } + else + { + result = EKeyWasConsumed; + } + } + } + + // If the Goto Pane exists and we're not fetching, decide + // if we should pass key event to the goto pane + if ( iGotoPane && ( !CBrowserAppUi::Static()->Fetching() || iGotoPaneActive ) ) + { + // If the key hadn't been consumed, so far, determine if the keystroke + // should be handled by goto pane + if ( ( result == EKeyWasNotConsumed ) || iSearchPaneActive ) + { + // Goto pane has highest priority; if it's active, arrow keys go there. + // If fetching is in progress, no key events are offered, to prevent it + // from getting the focus and popping up a new CBA. + + // Enter Key now handled through HandleCommand in BrowserBookmarksView like MSK + // This change affects the enter key on the QWERTY keyboard when we run emulator + if ( EStdKeyEnter == aKeyEvent.iScanCode && EEventKey == aType && + AknLayoutUtils::MSKEnabled() && + ( iGotoPaneActive || iSearchPaneActive ) ) + { + // Handle MSK press + CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); + if ( myCba != NULL ) + { + TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); + View().HandleCommandL(cmdId); + result = EKeyWasConsumed; + } + } + else + { + if ( iSearchPane && iSearchPaneActive) + { + // Process separately for Search Feature + if ( iGotoPaneActive ) + { + result = iGotoPane->OfferKeyEventL( keyEvent, aType ); + } + else + { + result = iSearchPane->OfferKeyEventL( keyEvent, aType ); + } + } + else + { + if ( iGotoPaneActive ) + { + // Once activated let goto pane handle all the keys + result = iGotoPane->OfferKeyEventL( keyEvent, aType ); + } + else // if ( !iGotoPaneActive ) + { + // Only a valid digit or character should popup the goto pane. + // We will ignore h/w key events, i.e. camera cover, camera + // shutter, zoom, etc... iCode is only valid for EEventKey, + // not EEventKeyDown, so we have to use iScanCode. because + // the goto pane decides to popup on EEventKeyDown. Use + // upper case of iScanCode since there is no overlap of + // h/w scan codes and uppercase letters. + TChar inputCharCode( aKeyEvent.iScanCode ); + TBool isDigit = inputCharCode.IsDigit(); + TUint upperCase = inputCharCode.GetUpperCase(); + if ( isDigit || + (( upperCase >= 0x41 /*A*/ ) && ( upperCase <= 0x5A /*Z*/ )) ) + { + // Valid digit or character was entered, let goto pane + // determine if it handles the keys from here on. + result = iGotoPane->OfferKeyEventL( aKeyEvent, aType ); + if ( result == EKeyWasConsumed ) + { + // goto pane is not active, make it active now + SetGotoActiveL(); + } + } + } + } + } + } + + if ( iSearchPane ) + { + if ( ( iGotoPaneActive || iSearchPaneActive) && + result == EKeyWasNotConsumed ) + { + + if ( aKeyEvent.iCode == EKeyUpArrow ) + { + result = EKeyWasConsumed; + if ( iSearchPaneActive ) + { + SetGotoActiveL(); + iGotoPane->SetVKBFlag( ETrue ); + } + } + + if ( aKeyEvent.iCode == EKeyDownArrow ) + { + result = EKeyWasConsumed; + if ( iGotoPaneActive ) + { + SetSearchActiveL(); + iSearchPane->SetVKBFlag( ETrue ); + } + } + } + } + } + + // For handling Enter key in emulator / Keyboard ( Enter key should behave similar to MSK ) + if ( EStdKeyEnter == keyEvent.iScanCode && EEventKey == aType && + AknLayoutUtils::MSKEnabled() && result == EKeyWasNotConsumed ) + { + CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); + if(myCba != NULL) + { + TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); + if(EAknSoftkeyContextOptions == cmdId) + { + View().MenuBar()->TryDisplayContextMenuBarL(); + result = EKeyWasConsumed; + } + else if(Listbox()->Model()->ItemTextArray()->MdcaCount() == 0) + { + View().HandleCommandL(cmdId); + result = EKeyWasConsumed; + } + } + } + + if ( result == EKeyWasNotConsumed ) + { + // Otherwise, base class handles Find pane, arrows between folders and + // the listbox. + result = CBrowserFavouritesContainer::OfferKeyEventL( keyEvent, aType ); + } + + return result; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::HandleCursorChangedL +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::HandleCursorChangedL +( CEikListBox* +#ifdef _DEBUG + aListBox // used only for debugging purposes +#endif + ) + { +#ifdef _DEBUG + __ASSERT_DEBUG( aListBox == Listbox(), + Util::Panic( Util::EFavouritesBadListbox ) ); +#endif + + if ( iGotoPane->IsVisible() ) + { + // Set Goto Pane text (URL or default http text) - this will cancel + // Goto Pane editing. + TPtrC url( KWWWString ); + TBrowserFavouritesSelectionState selection = + Listbox()->SelectionStateL(); + if ( !selection.AnyMarked() && selection.CurrentIsItem() ) + { + // Exactly one item is selected. + const CFavouritesItem* item = Listbox()->CurrentItem(); + if ( item ) // Sanity check. + { + // If one item is highlighted, set to current URL. + url.Set( Util::StripUrl( item->Url() ) ); + } + } + iGotoPane->SetTextL( url, ETrue ); + iGotoPane->SetFocus ( EFalse ); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::IsEditing +// --------------------------------------------------------- +// +TBool CBrowserBookmarksContainer::IsEditing() + { + TBool editing = EFalse; + editing = iGotoPane->IsEditing(); + return editing; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::IsEditingSearch +// --------------------------------------------------------- +// +TBool CBrowserBookmarksContainer::IsEditingSearch() + { + TBool editing = EFalse; + if( iSearchPane ) + { + editing = iSearchPane->IsEditing(); + } + return editing; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::TabIndex +// --------------------------------------------------------- +// +TInt CBrowserBookmarksContainer::TabIndex() + { + return KBookmarkTabIndex; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::ListboxEmptyTextResourceId +// --------------------------------------------------------- +// +TInt CBrowserBookmarksContainer::ListboxEmptyTextResourceId() + { + return R_BROWSER_BOOKMARKS_TEXT_NO_BOOKMARKS; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::TitleResourceId +// --------------------------------------------------------- +// +TInt CBrowserBookmarksContainer::TitleResourceId() + { + return R_BROWSER_OPTION_BOOKMARKS; + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::CBrowserBookmarksContainer +// --------------------------------------------------------- +// +CBrowserBookmarksContainer::CBrowserBookmarksContainer() + : iGotoPaneActive( EFalse ), + iSearchPaneActive(EFalse) + { + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::ConstructComponentControlsL +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::ConstructComponentControlsL( + const TRect& aRect, + CBrowserFavouritesView& aView ) + { + CBrowserFavouritesContainer::ConstructComponentControlsL + ( aRect, aView ); + + + // Construct Goto Pane. + + //pass view to bookmarks goto pane + iGotoPane = CBrowserBookmarksGotoPane::NewL( *this, &aView, KAvkonBitmapFile, + EMbmAvkonQgn_indi_find_goto, + EMbmAvkonQgn_indi_find_goto_mask); + iGotoPane->SetFocus( EFalse ); + + if( View().ApiProvider().Preferences().SearchFeature() ) + { + ConstructSearchPaneL(); + iSearchPane->SetFocus( EFalse ); + iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH ); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::CreateListboxIconHandlerL +// --------------------------------------------------------- +// +MBrowserFavouritesListboxIconHandler* +CBrowserBookmarksContainer::CreateListboxIconHandlerL() + { + return new (ELeave) TBrowserBookmarksListboxIconHandler; + } + +#ifdef __SERIES60_HELP +// --------------------------------------------------------- +// CBrowserBookmarksContainer::GetHelpContext() +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KUidBrowserApplication; + aContext.iContext = KOSS_HLP_BM_MAIN; + } +#endif // __SERIES60_HELP + +// --------------------------------------------------------- +// CBrowserBookmarksContainer::FocusChanged() +// --------------------------------------------------------- +// +void CBrowserBookmarksContainer::FocusChanged( TDrawNow aDrawNow ) + { + if ( IsEditing() ) + { + iGotoPane->SetFocus( IsFocused(), aDrawNow ); + } + else if( IsEditingSearch() ) + { + iSearchPane->SetFocus( IsFocused(), aDrawNow ); + } + else if ( Listbox() && Listbox()->IsVisible() ) + { + Listbox()->SetFocus( IsFocused(), aDrawNow ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksContainer::HandlePointerEventL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + if (AknLayoutUtils::PenEnabled()) + { + // if goto is active, if a pointer event falls within its rect, + // pass all pointer events to it (such as, to bring up the editor's letter-entry) + // + // otherwise, if it falls within the listbox's rect + // + + // Now we have two different panes so we have to check explicitly before passing controls + // to any panes. + if( iGotoPane && ( iGotoPaneActive || iSearchPaneActive) ) + { + if( iSearchPane )//implies presence of search feature. + { + if( iGotoPane->Rect().Contains( aPointerEvent.iPosition) ) + { + if( !iGotoPaneActive ) + { + SetGotoActiveL(); + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + else + { +#endif + iGotoPane->HandlePointerEventL(aPointerEvent); +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + } +#endif + + iGotoPane->SetVKBFlag( ETrue ); + } + else if( iSearchPane->Rect().Contains( aPointerEvent.iPosition) ) + { + if( !iSearchPaneActive ) + { + SetSearchActiveL(); + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + else + { +#endif + iSearchPane->HandlePointerEventL(aPointerEvent); +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + } +#endif + + iSearchPane->SetVKBFlag( ETrue ); + } + else + { + if(aPointerEvent.iType == TPointerEvent::EButton1Down ) + { + CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneCancel); + SetGotoInactiveL(); + } + } + } + else + { + iGotoPane->HandlePointerEventL(aPointerEvent); + } + } + else + { + // normally, pass all pointer events down to the listbox + Listbox()->HandlePointerEventL(aPointerEvent); + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksContainer::ConstructSearchPaneL +// ---------------------------------------------------------------------------- +// + +void CBrowserBookmarksContainer::ConstructSearchPaneL() + { + TFileName iconFile; + MPreferences& preferences = View().ApiProvider().Preferences(); + + TInt iconId = preferences.GetIntValue( KBrowserSearchIconId ); + // Get the Search Icon File Path. + preferences.GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile ); + + // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane. + // Comparing Icon File path as well, because it may be possible that two different + // Icon files have same icon id. + if( iconId != iSearchIconId + || iSearchIconFilePath.Compare( iconFile ) != 0 ) + { + + TInt iconMaskId = preferences.GetIntValue( KBrowserSearchIconMaskId ); + + // Save IconId + iSearchIconId = iconId; + // Save Icon File + iSearchIconFilePath = iconFile; + + + // No Icon file or IconId or IconMaskId set , then it means no search provider is still + // selected and set by search application, in that case we use the default icon for Search. + if( ! iconFile.Length() + || iconId == -1 + || iconMaskId == -1 ) + { + iconId = EMbmAvkonQgn_indi_find_glass; + iconMaskId = EMbmAvkonQgn_indi_find_glass_mask; + iconFile = KAvkonBitmapFile; + } + + if( iSearchPane ) + { + delete iSearchPane; + iSearchPane = NULL; + } + + + // iSearchPane != NULL, implies presence of search feature, hence it can be + // used to validate search feature avoiding repetative calls to utils and + // avoiding need of separate variable. + iSearchPane = CBrowserBookmarksGotoPane::NewL( *this, + &(View()), + iconFile, + iconId, + iconMaskId, + GOTOPANE_POPUPLIST_DISABLE, + ETrue + ); + + CBrowserBookmarksView* bookmarkView = REINTERPRET_CAST( CBrowserBookmarksView* , &( View() )); + // Set Pane observer + iSearchPane->SetGPObserver( bookmarkView ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksContainer::HandleResourceChange +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksContainer::HandleResourceChange(TInt aType) + { + CBrowserFavouritesContainer::HandleResourceChange( aType); + if( aType == KEikDynamicLayoutVariantSwitch) + { + // If search feature exsist + if( iSearchPane ) + { + if( iSearchPaneActive ) + { + iGotoPane->SetTextModeItalicL( ); + } + else + { + iSearchPane->SetTextModeItalicL( ); + } + } + } + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksEditDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksEditDialog.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,523 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserBookmarkEditDialog. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include // TUriParser + +#include "BrowserBookmarksEditFormApModel.h" +#include "BrowserBookmarksEditDialog.h" +#include "BrowserFavouritesModel.h" +#include "BrowserDialogs.h" +#include "BrowserAppUi.h" +#include "BrowserAppViewBase.h" +#include "commonconstants.h" +#include "Browser.hrh" +#include "BrowserUtil.h" + +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include "BrowserApplication.h" +#include +#endif // __SERIES60_HELP + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::NewL +// --------------------------------------------------------- +// +CBrowserBookmarkEditDialog* CBrowserBookmarkEditDialog::NewL + ( + CFavouritesItem& aItem, + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + //MCommsModel& aCommsModel, + TInt aUid /* = KFavouritesNullUid */ + ) + { + CBrowserBookmarkEditDialog* form = + new (ELeave) CBrowserBookmarkEditDialog( + aItem, + aModel, + aApiProvider, + aUid + ); + CleanupStack::PushL( form ); + form->ConstructL( /* aApiProvider.CommsModel() */ ); + CleanupStack::Pop(); // form + return form; + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::~CBrowserBookmarkEditDialog +// --------------------------------------------------------- +// +CBrowserBookmarkEditDialog::~CBrowserBookmarkEditDialog() + { + delete iFormApModel; + delete iNaviDecorator; + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::ProcessCommandL +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::ProcessCommandL( TInt aCommandId ) + { + switch ( aCommandId ) + { + case EAknCmdExit: + { + // Custom added commands. Forward to view. + // Note that we respond to EAknCmdExit, not CEikCmdExit; it's + // because we don't get it through the AppUi framework (instead, + // we forward it there now). + CBrowserAppUi::Static()->HandleCommandL(EWmlCmdUserExit); + break; + } + +#ifdef __SERIES60_HELP + + case EAknCmdHelp: + { + CBrowserAppUi::Static()->HandleCommandL(EAknCmdHelp); + break; + } + +#endif //__SERIES60_HELP + + default: + { + // Standard form commands. + CAknForm::ProcessCommandL( aCommandId ); + if ( iExitDialog ) + { + TryExitL( EAknSoftkeyBack ); + } + break; + } + } + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::CBrowserBookmarkEditDialog +// --------------------------------------------------------- +// +CBrowserBookmarkEditDialog::CBrowserBookmarkEditDialog + ( + CFavouritesItem& aItem, + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + TInt aUid + ) + : iItem( &aItem ), + iModel( &aModel ), + iUid( aUid ), + iExitDialog( EFalse ), + iExitNoteResourceId( 0 ), // By default do not show any note. + iApiProvider( aApiProvider ) + { + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::ConstructL +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::ConstructL( /*MCommsModel& aCommsModel*/ ) + { + CAknForm::ConstructL(); + iFormApModel = CBrowserBookmarksEditFormApModel::NewL( ApiProvider().CommsModel()/*aCommsModel*/ ); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarkEditDialog::OkToExitL +// ---------------------------------------------------------------------------- +// +TBool CBrowserBookmarkEditDialog::OkToExitL( TInt aButtonId ) + { + TBool ret = CAknForm::OkToExitL( aButtonId ); + if ( ret && iExitNoteResourceId ) + { + // Exiting; show appropriate note if applicable. + TBrowserDialogs::InfoNoteL( + R_BROWSER_INFO_NOTE, iExitNoteResourceId ); + } + //pop empty label from navipane + if ( ret ) + iNaviPane->Pop(); + return ret; + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::SaveFormDataL +// --------------------------------------------------------- +// +TBool CBrowserBookmarkEditDialog::SaveFormDataL() + { + // Of KWmlFavouritesMaxUrlDefine, KWmlFavouritesMaxUsernameDefine, KWmlFavouritesMaxPasswordDefine + // and KWmlFavouritesMaxBookmarkNameDefine the biggest is KWmlFavouritesMaxUrlDefine. + TBuf buf; + + // Get title. + GetEdwinText( buf, EWmlControlEditBmEditTitle ); + iItem->SetNameL( buf.Left(KFavouritesMaxName) ); + + // Get address. + GetEdwinText( buf, EWmlControlEditBmEditAddress ); + HBufC* text = HBufC::NewL(KFavouritesMaxUrlDefine); + + // Do not check return value from Parse(). If the user wants to create a + // badly formed url then let them do so. + TUriParser url; + url.Parse( buf ); + + // Add a default scheme if it is not already present. + if( !url.IsPresent( EUriScheme ) ) + { + _LIT( KBookmarkDefaultScheme, "http://" ); + + text->Des().Copy( KBookmarkDefaultScheme ); + } + // Error prone code. If user enters the whole KFavouritesMaxUrlDefine(1024) amount of + // characters with out the http:// infront, well have a USER:23 here. + // Hack aplied for now and included in FIX: EKDN-7P64KZ + // Needs a proper error raised and a fix. + // + // Check if long enough and append, if not we dont add http:// + // and alert user in SaveItemL() with popup that there must be an url + // NOTICE: THIS NEEDS A PROPER FIX - THIS IS A TEMP WORKAROUND + if( ( buf.Length() + text->Length() ) <= KFavouritesMaxUrlDefine ) + { + text->Des().Append( buf ); + } + else + { + text->Des().Copy( buf ); + } + + + Util::EncodeSpaces(text); + CleanupStack::PushL(text);// push after encode because the pointer may change + iItem->SetUrlL( text->Des() ); + CleanupStack::PopAndDestroy();// text + + // Get username. + GetEdwinText( buf, EWmlControlEditBmEditUsername ); + iItem->SetUserNameL( buf ); + + // Get password. + STATIC_CAST( CEikSecretEditor*, Control( EWmlControlEditBmEditPassword ) ) + ->GetText( buf ); + iItem->SetPasswordL( buf ); + + // Get WAP Access point. + TFavouritesWapAp ap = iFormApModel->CurrentWapAp(); + if ( !ap.IsNull() ) + { + // We set it back only if not NULL. + // AP is NULL if invalid (bookmark was edited, but the ap was not and + // it is left "Invalid". In that case we leave ap as-is. + iItem->SetWapAp( ap ); + } + + return SaveItemL(); + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::DynInitMenuPaneL +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::DynInitMenuPaneL +( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane ); + if ( aResourceId == R_AVKON_FORM_MENUPANE ) + { + // Disallow user addition / deletion / labeling. + aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); + aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue ); + aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); + // Add "Exit". + aMenuPane->AddMenuItemsL + ( R_BROWSER_BOOKMARKS_MENU_PANE_EDIT_BOOKMARK ); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::PreLayoutDynInitL +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::PreLayoutDynInitL() + { + LoadFormDataL(); + CAknForm::PreLayoutDynInitL(); + + CEikStatusPane *sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane(); + // Fetch pointer to the default navi pane control + iNaviPane = + (CAknNavigationControlContainer*)sp->ControlL( + TUid::Uid( EEikStatusPaneUidNavi ) ); + iNaviDecorator = iNaviPane->CreateNavigationLabelL( _L("") ); + + // push empty label, to avoid tab group visibility in BookmarkEditor. + iNaviPane->PushL( *iNaviDecorator ); + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::LoadFormDataL +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::LoadFormDataL() + { + + // Set title. + const TPtrC tptrcName = iItem->Name(); + STATIC_CAST( CEikEdwin*, Control( EWmlControlEditBmEditTitle ) )-> + SetTextL( &(tptrcName) ); + + // Set address. + const TPtrC tptrcUrl = iItem->Url(); + STATIC_CAST( CEikEdwin*, Control( EWmlControlEditBmEditAddress ) )-> + SetTextL( &(tptrcUrl) ); + + // Set username. + const TPtrC tptrcUserName = iItem->UserName(); + STATIC_CAST( CEikEdwin*, Control( EWmlControlEditBmEditUsername ) )-> + SetTextL( &(tptrcUserName) ); + + // Set password. + STATIC_CAST( CEikSecretEditor*,Control( EWmlControlEditBmEditPassword ) )-> + SetText( iItem->Password() ); + + // Set WAP Access Point popup field's query value. + CAknPopupField* wapApSelector = STATIC_CAST + ( CAknPopupField*, Control( EWmlControlEditBmWapApSelector ) ); + wapApSelector->SetQueryValueL( iFormApModel->QueryValue() ); + // Set current WAP Access Point. + iFormApModel->SetCurrentWapApL( iItem->WapAp() ); + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::SaveItemL +// --------------------------------------------------------- +// +TBool CBrowserBookmarkEditDialog::SaveItemL() + { + TInt res; + CBrowserFavouritesModel::TRenameMode renameMode = + CBrowserFavouritesModel::EDontRename; + + iExitNoteResourceId = 0; // By default, do not show any note. + + if ( !iItem->Name().Length() ) + { + // No title for this item. Make a default name and ensure auto renaming + // to non-conflicting name (without user interaction). + iModel->SetNameToDefaultL( *iItem ); + renameMode = CBrowserFavouritesModel::EAutoRename; + } + + if ( iItem->Url().Length() && iItem->Url() != KHttpString && IsValidUrlHost( iItem->Url() ) ) + { + if ( iUid == KFavouritesNullUid ) + { + // This is a new item. Add it. + res = iModel->AddL( *iItem, /*aDbErrorNote=*/ETrue, renameMode ); + } + else + { + // Editing an existing item. Update now. + res = iModel->UpdateL + ( *iItem, iUid, /*aDbErrorNote=*/ETrue, renameMode ); + } + switch ( res ) + { + case KErrNone: + { + iExitDialog = ETrue; + break; + } + case KErrAlreadyExists: + { + // Name conflicts. Let the user know. + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + R_BROWSER_BOOKMARKS_NAME_ALREADY_USED + ); + // Set focus to name field and keep editing. + TryChangeFocusToL( EWmlControlEditBmEditTitle ); + // Select all, cursor is at end. + CEikEdwin* nameEditor = STATIC_CAST + ( CEikEdwin*, Control( EWmlControlEditBmEditTitle ) ); + nameEditor->SetSelectionL( nameEditor->TextLength(), 0 ); + nameEditor->DrawDeferred(); + iExitDialog = EFalse; + break; + } + default: + { + iExitDialog = EFalse; + break; + } + } + } + else + { + // No Address. Cannot save this bookmark. + res = TBrowserDialogs::ConfirmQueryYesNoL( + R_BROWSER_BOOKMARKS_TEXT_QUERY_ADDRESS ); + if ( !res /*res == EAknSoftkeyNo*/ ) + { + // User decided not to save the bookmark. Exit now. + iExitNoteResourceId = iModel->StringResourceId + ( *iItem, CBrowserFavouritesModel::ENotSaved ); + iExitDialog = ETrue; + } + else + { + // Set focus to address field and keep editing. + TryChangeFocusToL( EWmlControlEditBmEditAddress ); + CEikEdwin* urlEditor = STATIC_CAST + ( CEikEdwin*, Control( EWmlControlEditBmEditAddress ) ); + // Select none, cursor is at end. + urlEditor->SetSelectionL + ( urlEditor->TextLength(), urlEditor->TextLength() ); + urlEditor->DrawDeferred(); + iExitDialog = EFalse; + } + } + return iExitDialog; + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::IsValidUrlHost +// --------------------------------------------------------- +// +TBool CBrowserBookmarkEditDialog::IsValidUrlHost( const TDesC& aUrl ) + { + TBool isValid = EFalse; + _LIT(KHttpMark, "://"); + // Get the position of end of protocol definition + TInt position = aUrl.Find( KHttpMark ); + if ( position != KErrNotFound ) + { + TPtrC16 url = aUrl.Right( aUrl.Length() - position - KHttpMark().Length() ); + // Locate the next slash which is the end of host part of url + TInt slashLocation = url.Locate('/'); + // We check the total length of host part of url. + // If over 255 we return EFalse + if ( slashLocation == KErrNotFound ) + { + if ( ( url.Length() + position + KHttpMark().Length() ) <= 255 ) + { + isValid = ETrue; + } + } + else + { + if ( ( position + slashLocation + KHttpMark().Length() ) <= 255 ) + { + isValid = ETrue; + } + } + } + return isValid; + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::GetEdwinText +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::GetEdwinText +( TDes& aText, TInt aControlId ) + { + STATIC_CAST( CEikEdwin*, Line( aControlId )->iControl )->GetText( aText ); + } + + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::HandleResourceChange +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::HandleResourceChange( TInt aType ) + { + TRAP_IGNORE( HandleResourceChangeL( aType ) ); + } + +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::HandleResourceChangeL +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::HandleResourceChangeL( TInt aType ) + { + CAknForm::HandleResourceChange(aType); + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect)) + { + SetRect(rect); + } + } + } + +#ifdef __SERIES60_HELP +// --------------------------------------------------------- +// CBrowserBookmarkEditDialog::GetHelpContext() +// --------------------------------------------------------- +// +void CBrowserBookmarkEditDialog::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KUidBrowserApplication; + if ( iUid == KFavouritesNullUid ) + { + // Add bookmark help + aContext.iContext = KOSS_HLP_BM_ADDBM; + } + else + { + // Edit bookmark help + aContext.iContext = KOSS_HLP_BM_EDIT; + } + } +#endif // __SERIES60_HELP + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksEditFormApModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksEditFormApModel.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserBookmarksEditFormApModel. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include "BrowserBookmarksEditFormApModel.h" +#include "CommsModel.h" +#include "Browser.hrh" +#include + +// CONSTANTS + +/// Granularity of iDesCArrayText. +LOCAL_D const TInt KGranularity = 4; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::NewL +// --------------------------------------------------------- +// +CBrowserBookmarksEditFormApModel* +CBrowserBookmarksEditFormApModel::NewL( MCommsModel& aCommsModel ) + { + CBrowserBookmarksEditFormApModel* model = + new (ELeave) CBrowserBookmarksEditFormApModel( aCommsModel ); + CleanupStack::PushL( model ); + model->ConstructL(); + CleanupStack::Pop(); // model + return model; + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::~CBrowserBookmarksEditFormApModel +// --------------------------------------------------------- +// +CBrowserBookmarksEditFormApModel::~CBrowserBookmarksEditFormApModel() + { + delete iTextValue; + delete iTextArray; + delete iDesCArrayText; + delete iApList; + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::ReadApDataL +// --------------------------------------------------------- +// +void CBrowserBookmarksEditFormApModel::ReadApDataL() + { + // Work on new lists, until they are fully created. + CApListItemList* apList = iCommsModel->CopyAccessPointsL(); + //CApListItemList* apList = new (ELeave) CApListItemList(); // Test empty. + CleanupStack::PushL( apList ); + CDesCArrayFlat* desCArrayText = + new (ELeave) CDesCArrayFlat( KGranularity ); + CleanupStack::PushL( desCArrayText ); + + TInt count = apList->Count(); + if ( count ) + { + // We have some access points; fill iDesCArray with names (otherwise + // it stays empty). + + // Add "Default" first. + HBufC* defaultApName = CCoeEnv::Static()->AllocReadResourceLC + ( R_BROWSER_BOKMARKS_TEXT_DEFAULT_WAPAP ); + desCArrayText->AppendL( *defaultApName ); + CleanupStack::PopAndDestroy(); // defaultApName + + // Then continue with real AP names. + TInt i; + TPtrC apName; + for ( i = 0; i < count; i++ ) + { + apName.Set( apList->At( i )->Name() ); + if ( apName.Length() > KBrowserMaxWapApName ) + { + // Since AP names are of unlimited length, we might have to + // trim. + apName.Set( apName.Left( KBrowserMaxWapApName ) ); + } + desCArrayText->AppendL( apName ); + } + } + + // Replace inst vars with new lists only after success. + CleanupStack::Pop( 2 ); // desCArrayText, apList: become members + delete iDesCArrayText; // (does not leave) + iDesCArrayText = desCArrayText; // (does not leave) + delete iApList; // (does not leave) + iApList = apList; // (does not leave) + iTextArray->SetArray( *iDesCArrayText ); + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::SetCurrentWapApL +// --------------------------------------------------------- +// +void CBrowserBookmarksEditFormApModel::SetCurrentWapApL +( const TFavouritesWapAp& aAp ) + { + TInt count = iApList->Count(); + + if ( count ) + { + // Default value index is KErrNotFound ("Invalid" is displayed). + // If AP is Null, or specified but does not exist, this value is used. + TInt index = KErrNotFound; + if ( aAp.IsDefault() ) + { + // For "Default" Ap-s, highlight 0th element "Default". + index = 0; + } + else if ( !aAp.IsNull() ) + { + // Get index of element having this ApId. If not found, index stays + // KErrNotFound (That will display the "Invalid" text). + // + // "Null" and "Default" checks already done: call to ApId is safe. + TUint32 apId = aAp.ApId(); + TInt i; + for ( i = 0; i < count; i++ ) + { + if ( iApList->At( i )->Uid() == apId ) + { + // Got it; i is the index of the AP in the array. Add 1 + // to it, since 0th element is "Default". + index = i + 1; + break; + } + } + } + iTextValue->SetCurrentValueIndex( index ); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::CurrentWapAp +// --------------------------------------------------------- +// +TFavouritesWapAp CBrowserBookmarksEditFormApModel::CurrentWapAp() const + { + TFavouritesWapAp ap; + + ap.SetNull(); // "Null" value used if no AP-s exist or AP is "Invalid". + + TInt count = iApList->Count(); + if ( count ) + { + TInt index = iTextValue->CurrentValueIndex(); + if ( index == 0 ) + { + // Oth element ("Default"). + ap.SetDefault(); + } + else if ( index > 0 && index <= count ) + { + // "Index-1" is a valid index into array (real AP). + // + // (CurrentValueIndex may return an out-of-bounds value, if AP is + // "Invalid". This value is -1; but is not well published; so + // instead of testing for -1, we do proper range checking. That + // is the safest we can do, and adds minuscule overhead.) + ap.SetApId( iApList->At( index - 1 )->Uid() ); + } + } + + return ap; + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::ApCount +// --------------------------------------------------------- +// +TInt CBrowserBookmarksEditFormApModel::ApCount() + { + return iApList->Count(); + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::CBrowserBookmarksEditFormApModel +// --------------------------------------------------------- +// +CBrowserBookmarksEditFormApModel::CBrowserBookmarksEditFormApModel +( MCommsModel& aCommsModel ) +: iCommsModel( &aCommsModel ) + { + } + +// --------------------------------------------------------- +// CBrowserBookmarksEditFormApModel::ConstructL +// --------------------------------------------------------- +// +void CBrowserBookmarksEditFormApModel::ConstructL() + { + iApList = new (ELeave) CApListItemList(); + iDesCArrayText = new (ELeave) CDesCArrayFlat( KGranularity ); + iTextArray = CAknQueryValueTextArray::NewL(); + iTextArray->SetArray( *iDesCArrayText ); + iTextValue = CAknQueryValueText::NewL(); + iTextValue->SetArrayL( iTextArray ); + + ReadApDataL(); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksGotoPane.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksGotoPane.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,858 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserBookmarksGotoPane. +* +* +*/ + + +// INCLUDE FILES +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "BrowserBookmarksGotoPane.h" +#include "BrowserUtil.h" +#include "commonconstants.h" +#include "BrowserAdaptiveListPopup.h" +#include "WmlBrowserBuild.h" //feature manager +#include "browser.hrh" +#include "BrowserAppUi.h" +#include "BrowserFavouritesView.h" +#include "Preferences.h" +#include +#include "BrowserUiSDKCRKeys.h" + +#include +#include + +#include +#include +#include + +#include +#include +using namespace SkinLayout; + +// CONSTANTS +const TInt EUseSkinContext = 0x01; +const TInt EParentAbsolute = 0x02; +const TInt KRightSpace = 10; //space in pixels left at the end of text editor. +// CONSTANTS +const TInt KMaxTitleLength = 512; +_LIT(KAddressText,"http://www."); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::NewL +// --------------------------------------------------------- +// +CBrowserBookmarksGotoPane* CBrowserBookmarksGotoPane::NewL + ( + const CCoeControl& aParent, + CBrowserFavouritesView* aContentView, + const TDesC& aBitmapfile, + TInt aIconBitmapId, + TInt aIconMaskId, + TBool aPopupListStatus, + TBool aSearchPaneMode + ) + { + CBrowserBookmarksGotoPane* gotoPane = + new(ELeave) CBrowserBookmarksGotoPane(aContentView, aSearchPaneMode); + CleanupStack::PushL( gotoPane ); + gotoPane->ConstructL( aParent, aBitmapfile, aIconBitmapId, aIconMaskId, aPopupListStatus ); + CleanupStack::Pop(); // gotoPane + return gotoPane; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane +// --------------------------------------------------------- +// +CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane() + { + delete iEditor; + delete iInputFrame; + delete iSkinContext; + delete iInputContext; + delete iBAdaptiveListPopup; + delete iDefaultSearchText; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::BeginEditingL() +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::BeginEditingL() + { + if ( !iFrozen ) + { + // If its a GoTo Pane Mode. + if( !iSearchPaneMode ) + { + if( iView->ApiProvider().Preferences().SearchFeature() ) + { + // If there is no text, then we need to place back + // the default text, else preserve the previously + // typed text. + HBufC* text = iEditor->GetTextInHBufL(); + if( !text ) + { + SetTextL( KWWWString ); + } + else + { + delete text; + } + } + else + SetTextL( KWWWString ); + } + else + { + if( iView->ApiProvider().Preferences().SearchFeature() ) + { + //Clear searchpane on focus if default text is there + HBufC* text = iEditor->GetTextInHBufL(); + if ( text ) + { + CleanupStack::PushL( text ); + if ( !text->Compare( iDefaultSearchText->Des() ) ) + { + iEditor->SetTextL( &KNullDesC ); + } + CleanupStack::PopAndDestroy( text ); + } + } + } + + MakeVisible( ETrue ); + SetEditingL( ETrue ); + iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); + if (AknLayoutUtils::PenEnabled() + && ( !iView->ApiProvider().Preferences().SearchFeature()) ) + { + ActivateVkbL(); + } + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::CancelEditingL() +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::CancelEditingL() + { + if ( !iFrozen ) + { + // Clear selection when focus moved, only + // affects when both the editors are visible. + // no need for condition. + TInt pos = iEditor->CursorPos(); + iEditor->SetSelectionL(pos,pos); + SetEditingL( EFalse ); + + // Cancel Adaptive List popup if its active + if ( NULL != iBAdaptiveListPopup) + { + iBAdaptiveListPopup->SetDirectoryModeL( ETrue ); + iBAdaptiveListPopup->HidePopupL(); + } + } + + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetTextL +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::SetTextL +( const TDesC& aText, TBool aClipToFit /*=ETrue*/, TBool aCancelEditing ) + { + + CFbsFont * font = NULL; + + if ( !iFrozen ) + { + if ( aClipToFit && aText.Length() ) + { + // Allocate 3 chars more (make sure "..." fits). + HBufC* buf = HBufC::NewLC( aText.Length() + 3 ); + *buf = aText; + TPtr ptr( buf->Des() ); + CTextView* textView = iEditor->TextView(); + if ( textView ) + { + //The Textview does not use the iConEnv->NormalFont() for drawing so we can not use it for measurement. + //Textview uses the default char format font for drawing. See bug: EHCN-6U59SN + TBuf typeface; + CEikonEnv::Static()->ReadResource(typeface,R_EIK_DEFAULT_CHAR_FORMAT_TYPEFACE); + TResourceReader reader; + CEikonEnv::Static()->CreateResourceReaderLC(reader,R_EIK_DEFAULT_CHAR_FORMAT_HEIGHT); + TInt height = reader.ReadInt16(); + CleanupStack::PopAndDestroy(); // reader + + TFontSpec fontSpec(typeface, height); + CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips((CFont*&)font, fontSpec); + + AknTextUtils::ClipToFit + ( + ptr, + *font, + textView->ViewRect().Width() - KRightSpace + ); + } + iEditor->SetTextL( &ptr ); + CleanupStack::PopAndDestroy(); // buf + } + else + { + if( iSearchPaneMode ) + { + iEditor->SetTextL( &aText ); + } + else + { + if ( aText.Length() ) + { + iEditor->SetTextL( &aText ); + } + else + { + TBufC<16> buf(KAddressText); + HBufC* tmpBuf = NULL; + tmpBuf = buf.AllocLC(); + iEditor->SetTextL( tmpBuf ); + CleanupStack::PopAndDestroy(); // tmpBuf + } + } + } + + iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); + if ( !iEverFocused ) + { + iEditor->SetFocus( ETrue ); + } + + if ( !iEverFocused ) + { + iEditor->SetFocus( IsFocused() ); + iEverFocused = ETrue; + } + SetEditingL( !aCancelEditing ); + DrawDeferred(); + } + + // release font if it was used + if (font != NULL) + { + CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font); + } + + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::GetTextL +// --------------------------------------------------------- +// +HBufC* CBrowserBookmarksGotoPane::GetTextL() + { + HBufC* text = HBufC::NewL( iEditor->TextLength() + 1 ); + TPtr ptr = text->Des(); + iEditor->GetText( ptr ); + ptr.ZeroTerminate(); + if( !iSearchPaneMode ) + { + Util::EncodeSpaces(text); + } + + return text; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetObserver +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::SetGPObserver +( MBookmarksGotoPaneObserver* aObserver ) + { + /*__ASSERT_DEBUG( !iGPObserver, \ + Util::Panic( Util::EGotoPaneObserverAlreadySet ) );*/ + iGPObserver = aObserver; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetLineState +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::SetLineState( TBool aLineVisible ) + { + iInputFrame->SetLineState( aLineVisible ); + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::OfferKeyEventL +// --------------------------------------------------------- +// +// Note: +// +// Below, there are several keys in the ISO-Latin-1 range that we +// exclude from use in a URL: +// +// - EStdKeyDevice10 0xC9 E-accent acute Northwest +// - EStdKeyDevice11 0xCA E-accent circumflex Northeast +// - EStdKeyDevice12 0xCB E-umlaut Southeast +// - EStdKeyDevice13 0xCC I-accent grave Southwest +// +// While these ought to be vaguely acceptable in certain parts of a URL, +// they are also used by some navigation drivers as our "diagonal event" +// codes so turn up as the user navigates the cursor. Because of this, +// today, we prevent them from being inserted as characters. There's +// a second set of code ranges (in the 0x8XXX range) that's also defined +// for these events; if the driver writers ever manage to get all of +// the navigation drivers using this "out-of-band" range, we can +// eliminate filtering the ISO-Latin-1 range of characters that we +// do here. +// +// + +TKeyResponse CBrowserBookmarksGotoPane::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse response = EKeyWasNotConsumed; + TChar iInputChar = TChar( aKeyEvent.iScanCode ); + + + if ( iBAdaptiveListPopup ) + { + response = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType ); + } + + if ( iEditing && response != EKeyWasConsumed) + { + // Editing; most keys simply forwarded to the editor. + switch ( aKeyEvent.iCode ) + { + case EKeyOK: + { + response = EKeyWasConsumed; // MSK is now handled through HandleCommand in BrowserBookmarksView + break; + } + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge + { // Here, "eat" all of the diagonals so they have no effect... + response = EKeyWasConsumed; + break; + } + + case EKeyEnter: + // Handle EnterKey as "GOTO" for Touch, VKB's enter key + if ( AknLayoutUtils::PenEnabled() ) + { + CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo); + // In case of search feature, we need to pass EKeyWasConsumed for EKeyEnter + if ( iView->ApiProvider().Preferences().SearchFeature() ) + { + response = EKeyWasConsumed; + } + break; + } + + // Else *FALL THROUGH* to default in case Pen is not enabled. + default: + { + response = iEditor->OfferKeyEventL(aKeyEvent, aType ); + break; + } + } + + // In the absence of search feature + // Force key event to be consumed if you're editing + // regardless of what's happened to it. + // + // This forces user to press cancel to continue other tasks + if ( !iView->ApiProvider().Preferences().SearchFeature() ) + { + response = EKeyWasConsumed; + } + } + else if ( response != EKeyWasConsumed ) + { + // Key consumed yet? If not, process onwards... + if ( (aKeyEvent.iScanCode == EStdKeyHash) || + ( aKeyEvent.iModifiers & + ( EModifierShift | EModifierLeftShift | EModifierRightShift | + EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) + { + + // Hash key press will be used for Mark/UnMark functionality + // Let Platform Listbox handle this. + response = EKeyWasNotConsumed; + } + + // + // Not currently editing the GoTo pane. + // Catch alpha and numeric to pop + // up goto pane + // + // Only popup the GoTo Pane with a KeyDown event. + // Otherwise, if browser is pushed to the backround (but still active) + // in favor of the App Shell, A long "0" press will reactivate the browser and + // leave a KeyUp to (wrongly) pop the pane up + // + // Note that we exclude Unicode 0xC4 and 0xC5 which + // are defined as EStdkeyYes and EStdkeyNo. These + // map to the Send and End keys respectively. Normally, + // 0xC4 and 0xC5 can be considered alpha digits, but we + // exclude them so that they will not pop the GoTo pane + // + // We do the same thing for all of the diagonal motion events + // so they have no effect either. + // + // Otherwise, key event is generated again (to channel through FEP) + // + else if ( !iFrozen + && aType == EEventKeyDown + && iInputChar.IsAlphaDigit() // We want alpha numeric keys to popup goto pane + && iInputChar != EStdKeyYes // Ignore Send (green key) + && iInputChar != EStdKeyNo // Ignore End (red key) + && iInputChar != EKeyRightUpArrow // Ignore Northeast + && iInputChar != EStdKeyDevice11 // : Extra KeyEvent supports diagonal event simulator wedge + && iInputChar != EKeyRightDownArrow // Ignore Southeast + && iInputChar != EStdKeyDevice12 // : Extra KeyEvent supports diagonal event simulator wedge + && iInputChar != EKeyLeftDownArrow // Ignore Southwest + && iInputChar != EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge + && iInputChar != EKeyLeftUpArrow // Ignore Northwest + && iInputChar != EStdKeyDevice10 ) // : Extra KeyEvent supports diagonal event simulator wedge + { + // These keys activate the Goto Pane. + // We'll consume the key event so it ends here + response = EKeyWasConsumed; + + BeginEditingL(); + + iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); + iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); + iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); + } + else + { + // Other keys do not activate the Goto Pane. + // Let someone else take the key event + response = EKeyWasNotConsumed; + } + } + return response; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::CountComponentControls +// --------------------------------------------------------- +// +TInt CBrowserBookmarksGotoPane::CountComponentControls() const + { + return 2; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::ComponentControl +// --------------------------------------------------------- +// +CCoeControl* CBrowserBookmarksGotoPane::ComponentControl +( TInt aIndex ) const + { + switch ( aIndex ) + { + case 0: + { + return iInputFrame; + } + + case 1: + { + return iEditor; + } + + default: + { + return NULL; + } + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::FocusChanged +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::FocusChanged( TDrawNow aDrawNow ) + { + iEditor->SetFocus( IsFocused(), aDrawNow ); + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane +// --------------------------------------------------------- +// +CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane(CBrowserFavouritesView* aView, TBool aSearchPaneMode) +: iView( aView ), + iEditing( EFalse ), + iFrozen( EFalse ), + iBAdaptiveListPopup( NULL ), + iSearchPaneMode( aSearchPaneMode ) + { + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::ConstructL +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::ConstructL ( const CCoeControl& aParent, const TDesC& aBitmapfile, + TInt aIconBitmapId, TInt aIconMaskId, TBool aPopupListStatus ) + + { + SetContainerWindowL( aParent ); // This is now non-window owning control + SetMopParent(const_cast(&aParent)); + iEditor = new (ELeave) CEikEdwin; + iInputFrame = CAknInputFrame::NewL( iEditor, EFalse, aBitmapfile, + aIconBitmapId, aIconMaskId, 0 ); + iInputFrame->SetContainerWindowL( *this ); + iEditor->SetContainerWindowL( *this ); + AknEditUtils::ConstructEditingL(iEditor, KFavouritesMaxUrlGotoPaneDefine, 1, EAknEditorCharactersLowerCase, EAknEditorAlignRight, EFalse, ETrue, EFalse); + iEditor->AddFlagToUserFlags( CEikEdwin::EAlwaysShowSelection ); + iEditor->SetBorder( TGulBorder::ENone ); + iEditor->SetAknEditorCase( EAknEditorLowerCase ); + iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); + iEditor->SetSkinBackgroundControlContextL(NULL); + if (AVKONAPAC) + { + // Disallow chinese input. + iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | EAknEditorNumericInputMode ); + } + + // In Search Mode we allow all types of inputs + TInt editorFlags( (iSearchPaneMode ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) | EAknEditorFlagUseSCTNumericCharmap ); + + // Always disable T9 input for goto url + editorFlags = (editorFlags | EAknEditorFlagNoT9); + + iEditor->SetAknEditorFlags( editorFlags ); + + + iEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase | EAknEditorLowerCase ); + + iEditor->CreateTextViewL(); + SetupSkinContextL(); + iEditing = EFalse; + TBool searchFeature = iView->ApiProvider().Preferences().SearchFeature(); + if ( searchFeature ) + { + HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); + TPtr searchProviderPtr = searchProvider->Des(); + + iView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, + KMaxTitleLength , searchProviderPtr); + if( searchProvider->Length() == 0 ) + { + iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH ); + } + else + { + iDefaultSearchText = searchProvider->AllocL(); + } + CleanupStack::PopAndDestroy(searchProvider); + } + + //adaptive popuplist + iBAdaptiveListPopup = NULL; + if( aPopupListStatus && AUTOCOMP ) //ask the feature manager + { + iBAdaptiveListPopup= new (ELeave) CBrowserAdaptiveListPopup( + iEditor, this, EBookmarksGotoPane, searchFeature); + iBAdaptiveListPopup->ConstructL(); + iEditor->SetObserver( iBAdaptiveListPopup ); + if (iView) + { + iBAdaptiveListPopup->SetUrlSuffixList(iView->ApiProvider().Preferences().URLSuffixList()); + iBAdaptiveListPopup->SetMaxRecentUrls(iView->ApiProvider().Preferences().MaxRecentUrls()); + } + } + + ActivateL(); + MakeVisible( EFalse ); + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::SizeChanged +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::SizeChanged() + { + TAknLayoutRect layoutRectTemp; + TAknWindowLineLayout windowLayoutTmp, windowLayoutTmp2; + + windowLayoutTmp = AknLayout::Find_pane_elements_Line_4(); + windowLayoutTmp2 = windowLayoutTmp; + layoutRectTemp.LayoutRect( Rect(), windowLayoutTmp2 ); + iEditor->SetRect( layoutRectTemp.Rect() ); + iInputFrame->SetRect( Rect() ); + TRAP_IGNORE(SetupSkinContextL()); + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetEditingL +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::SetEditingL( TBool aEditing ) + { + if ( aEditing != iEditing ) + { + iEditing = aEditing; + SetFocus( iEditing ); + if ( iGPObserver ) + { + iGPObserver->HandleBookmarksGotoPaneEventL + ( + this, + MBookmarksGotoPaneObserver::EEventEditingModeChanged + ); + } + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::PopupList +// --------------------------------------------------------- +// +CBrowserAdaptiveListPopup* CBrowserBookmarksGotoPane::PopupList() + { + return iBAdaptiveListPopup; + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::HandleResourceChange +// --------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::HandleResourceChange( TInt aType ) + { + CCoeControl::HandleResourceChange( aType ); + + if ( iBAdaptiveListPopup ) + { + iBAdaptiveListPopup->HandleResourceChange( aType ); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksGotoPane::MopSupplyObject +// --------------------------------------------------------- +// +TTypeUid::Ptr CBrowserBookmarksGotoPane::MopSupplyObject( TTypeUid aId ) + { + return MAknsControlContext::SupplyMopObject( aId, iSkinContext ); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::Editor +// ---------------------------------------------------------------------------- +CEikEdwin* CBrowserBookmarksGotoPane::Editor() const + { + return iEditor; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::HandlePointerEventL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksGotoPane::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + if (AknLayoutUtils::PenEnabled()) + { + if(iEditor && Rect().Contains(aPointerEvent.iPosition)) + { + iEditor->HandlePointerEventL(aPointerEvent); + if ( !iEditing ) + { + SetEditingL( ETrue ); + iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); + CBrowserAppUi::Static()->UpdateCbaL(); + } + } + else + { + if(aPointerEvent.iType == TPointerEvent::EButton1Down) + { + // pointer outside of control + CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneCancel); + } + } + } + } +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetupSkinContextL +// ---------------------------------------------------------------------------- +void CBrowserBookmarksGotoPane::SetupSkinContextL() + { + TAknsItemID tileIID = KAknsIIDQsnBgColumnA; + + TAknWindowLineLayout tile = + Column_background_and_list_slice_skin_placing_Line_2(); + + TAknLayoutRect mainPane; + mainPane.LayoutRect( + iAvkonAppUi->ApplicationRect(), + AKN_LAYOUT_WINDOW_main_pane( iAvkonAppUi->ApplicationRect(), + 0, 0, 1) ); + TAknLayoutRect listRect; + listRect.LayoutRect( mainPane.Rect(), AknLayout::list_gen_pane(0) ); + + TAknLayoutRect tileRect; + tileRect.LayoutRect(mainPane.Rect(), tile); + + if ( !iSkinContext ) + { + iSkinContext = CAknsListBoxBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMainListGene, + listRect.Rect(), + EUseSkinContext & EParentAbsolute, + tileIID, + tileRect.Rect() ); + } + else + { + iSkinContext->SetRect( listRect.Rect() ); + } + + + if ( !iInputContext ) + { + iInputContext = CAknsFrameBackgroundControlContext::NewL( + KAknsIIDQsnFrInput, TRect(0,0,0,0),TRect(0,0,0,0),EFalse ); + } + + iInputFrame->SetInputContext(iInputContext); + iEditor->SetSkinBackgroundControlContextL(iInputContext); + + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::ActivateVkbL +// ---------------------------------------------------------------------------- +void CBrowserBookmarksGotoPane::ActivateVkbL() + { + if (iEditor && iEditor->TextView()) + { + // make sure observer is set + iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); + + // simulate pointer event to force VKB + + // first get point at cursor location + TInt pos = iEditor->CursorPos(); + CTextView* textView = iEditor->TextView(); + TPoint curPos; + textView->DocPosToXyPosL(pos, curPos); + + TPointerEvent pe; + pe.iPosition = curPos; + + pe.iType = TPointerEvent::EButton1Down; + iEditor->HandlePointerEventL(pe); + + // VKB will only activate if nothing selected + iEditor->SetSelectionL(pos, pos); + + pe.iType = TPointerEvent::EButton1Up; + iEditor->HandlePointerEventL(pe); + iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); + + } + } + + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetTextModeItalic +// ---------------------------------------------------------------------------- +void CBrowserBookmarksGotoPane::SetTextModeItalicL( ) + { + + // Editor Control is laid in a scalable way, so we need to get the correct font + // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips, + // as done above in SetTextL() but it does not provide correct fonts for editor. + // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it + // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by + // iInputFrame->SetRect(), which overwrites all the properties for Editor. + + TAknTextComponentLayout editorLayout; + TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) ); + editorLayout = AknLayoutScalable_Avkon::input_find_pane_t1( apac ? 1: 0 ); + TAknTextLineLayout lineLayout = editorLayout.LayoutLine(); + TInt fontid = lineLayout.FontId(); + const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid ); + + TCharFormat charFormat; + TCharFormatMask charFormatMask; + charFormat.iFontSpec = font->FontSpecInTwips(); + charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic ); + charFormatMask.SetAttrib(EAttFontTypeface); + charFormatMask.SetAttrib(EAttFontHeight); + charFormatMask.SetAttrib(EAttFontStrokeWeight); + charFormatMask.SetAttrib(EAttFontPosture); + + // Owner ship of charFormatLayer is taken by Editor + CCharFormatLayer* charFormatLayer = NULL; + charFormatLayer = CCharFormatLayer::NewL(charFormat,charFormatMask); + iEditor->SetCharFormatLayer(charFormatLayer); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksGotoPane::SetVKBFlag +// ---------------------------------------------------------------------------- +void CBrowserBookmarksGotoPane::SetVKBFlag( TBool aVKBFlag ) + { +#if defined(BRDO_SEARCH_INTEGRATION_FF) + if( aVKBFlag ) + { + iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); + } + else + { + iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); + } +#endif + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksListboxIconHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksListboxIconHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,398 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of TBrowserBookmarksListboxIconHandler. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include "BrowserBookmarksListboxIconHandler.h" +#include "BrowserFavouritesListbox.h" +#include "BrowserFavouritesIconIndexArray.h" +#include "BrowserFavouritesView.h" +#include +#include +#include +#include +#include + +#include "CommonConstants.h" +#include + +// LOCAL TYPES + +/** +* Icon indexes. Numeric values MUST match the resource definition order. +*/ +enum + { + EIconIndexListboxMark = 0, ///< Listbox mark icon index. + EIconIndexFolder = 1, ///< Folder icon index. + EIconIndexHomepage = 2, ///< Homepage icon index. + EIconIndexLastVisitedPage = 3, ///< Last Visited icon index. + EIconIndexBookmark = 4, ///< Bookmark icon index. + EIconIndexCsdBearer = 5, ///< CSD bearer icon index. + EIconIndexHscsdBearer = 6, ///< HSCSD bearer icon index. + EIconIndexGprsBearer = 7, ///< GPRS bearer icon index. + EIconIndexSeamlessLinksFolder = 8, ///< Seamless links icon index + EIconIndexAdaptiveFolder = 9, ///< Adaptive Bookmarks domain folder icon index + EIconIndexAdaptiveBookmark = 10, ///< Adaptive Bookmarks bookmark icon index + EIconIndexDefaultBookmark = 11, ///< Adaptive Bookmarks bookmark icon index + EIconIndexRSSFolder = 12, ///< RSS Folder icon index + EIconIndexService = 13 ///< service icon + }; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TBrowserBookmarksListboxIconHandler::ItemIconIndex +// --------------------------------------------------------- +// +TInt TBrowserBookmarksListboxIconHandler::ItemIconIndex +( const CFavouritesItem& aItem ,CBrowserFavouritesListbox* aListbox ) const + { + if ( aItem.Uid() == KFavouritesHomepageUid ) + { + return EIconIndexHomepage; + } + if ( aItem.Uid() == KFavouritesStartPageUid ) + { + return EIconIndexHomepage; + } + if ( aItem.Uid() == KFavouritesLastVisitedUid ) + { + return EIconIndexLastVisitedPage; + } + //service icon + if( aItem.ContextId() == KFavouritesServiceContextId ) + { + return EIconIndexService; + } + + //seamless links folders have a different icon + if( CBrowserFavouritesView::IsSeamlessFolder( aItem.ContextId() ) ) + { + return EIconIndexSeamlessLinksFolder; + } + + // recent url folder + if ( aItem.Uid() == KFavouritesAdaptiveItemsFolderUid ) + { + return EIconIndexAdaptiveFolder; + } + + /// RSS folder handling + + if (aItem.Uid()==KFavouritesRSSItemUid) + { + return EIconIndexRSSFolder; + } + + /// The order is important, because Adaptive bookmarks folder accidentally has a context id + /// and acts like a seamless folder + if( aListbox->GetDefaultData().iPreferedId == aItem.Uid() && aListbox->GetDefaultData().iInSeamlessFolder) + { + return EIconIndexDefaultBookmark; + } + + return aItem.IsItem() ? EIconIndexBookmark : EIconIndexFolder; + } + +// --------------------------------------------------------- +// TBrowserBookmarksListboxIconHandler::BearerIconIndex +// --------------------------------------------------------- +// +TInt TBrowserBookmarksListboxIconHandler::BearerIconIndex + ( + const TFavouritesWapAp aAccessPoint, + const CApListItemList& aAccessPoints + ) const + { + if ( !aAccessPoint.IsNull() && !aAccessPoint.IsDefault() ) + { + // Set an invalid bearer type value. + TApBearerType bearer = EApBearerTypeAll; + // Get access point with this uid. + TUint32 apUid = aAccessPoint.ApId(); + TInt i; + TInt count = aAccessPoints.Count(); + for ( i = 0; i < count; i++ ) + { + if ( aAccessPoints.At( i )->Uid() == apUid ) + { + // Got the AP, set bearer type to its bearer. + bearer = aAccessPoints.At( i )->BearerType(); + break; + } + } + // If the bearer type is set, get icon index for it. + switch( bearer ) + { + case EApBearerTypeCSD: + { + return EIconIndexCsdBearer; + } + + case EApBearerTypeGPRS: + { + return EIconIndexGprsBearer; + } + + case EApBearerTypeHSCSD: + { + return EIconIndexHscsdBearer; + } + + default: + { + break; + } + } + } + // Access Point is "Null", "Default", or just not found. + return KBrowserFavouritesNoBearerIcon; + } + +// --------------------------------------------------------- +// TBrowserBookmarksListboxIconHandler::LoadIconsL +// --------------------------------------------------------- +// +CAknIconArray* TBrowserBookmarksListboxIconHandler::LoadIconsL() const +{ + CAknIconArray* icons = + new(ELeave) CAknIconArray( 20 ); + CleanupStack::PushL(icons); // PUSH Icon + CGulIcon* newIcon; + CFbsBitmap *newIconBmp; + CFbsBitmap *newIconMaskBmp; + + TBuf iconFileAvkon= KAvkonMbmPath(); + TParse* fp = new(ELeave) TParse(); + CleanupStack::PushL(fp); + TInt err = fp->Set(KBrowserDirAndFile, &KDC_APP_BITMAP_DIR, NULL); + if (err != KErrNone) + { + User::Leave(err); + } + TBuf iconFileBrowser= fp->FullName(); + CleanupStack::PopAndDestroy(fp); + + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + //EMbmAvkonQgn_indi_marked_add + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiMarkedAdd, + newIconBmp, + newIconMaskBmp, + iconFileAvkon, + EMbmAvkonQgn_indi_marked_add, + EMbmAvkonQgn_indi_marked_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmAvkonQgn_prop_folder_small + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropFolderSmall, + newIconBmp, + newIconMaskBmp, + iconFileAvkon, + EMbmAvkonQgn_prop_folder_small, + EMbmAvkonQgn_prop_folder_small_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //"z:\\system\\apps\\browser\\Browser.mbm"; + //EMbmBrowserQgn_prop_wml_home + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlHome, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_home, + EMbmBrowserQgn_prop_wml_home_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_bm_last + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlBmLast, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_bm_last, + EMbmBrowserQgn_prop_wml_bm_last_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_bm + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlBm, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_bm, + EMbmBrowserQgn_prop_wml_bm_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_indi_wml_csd_add + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiWmlCsdAdd, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_indi_wml_csd_add, + EMbmBrowserQgn_indi_wml_csd_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_indi_wml_hscsd_add + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiWmlHscsdAdd, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_indi_wml_hscsd_add, + EMbmBrowserQgn_indi_wml_hscsd_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_indi_wml_gprs_add + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiWmlGprsAdd, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_indi_wml_gprs_add, + EMbmBrowserQgn_indi_wml_gprs_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_folder_link_seamless + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlFolderLinkSeamless, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_folder_link_seamless, + EMbmBrowserQgn_prop_wml_folder_link_seamless_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_folder_adap + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlFolderAdap, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_folder_adap, + EMbmBrowserQgn_prop_wml_folder_adap_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + + //EMbmBrowserQgn_prop_wml_bm_adap + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlBmAdap, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_bm_adap, + EMbmBrowserQgn_prop_wml_bm_adap_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + + //EMbmBrowserQgn_prop_psln_active + + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropPslnActive, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_psln_active, + EMbmBrowserQgn_prop_psln_active_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + + //EMbmBrowserQgn_prop_folder_rss + + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropFolderRss, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_folder_rss, + EMbmBrowserQgn_prop_folder_rss_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + +#if defined(BRDO_SEARCH_INTEGRATION_FF) + //Browser service + + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropBrowserInfoSmall, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_browser_info_small, + EMbmBrowserQgn_prop_browser_info_small_mask ); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp ); + CleanupStack::Pop(2); + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); +#endif + + CleanupStack::Pop(); // POP Icon + return icons; +} + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksModel.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,186 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserBookmarksModel. +* +* +*/ + + +// INCLUDE FILES + +#include "BrowserBookmarksModel.h" +#include "BrowserUtil.h" +#include +#include +#include +#include +#include +#include "ApiProvider.h" +#include "Preferences.h" +#include "CommonConstants.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserBookmarksModel::CBrowserBookmarksModel +// --------------------------------------------------------- +// +CBrowserBookmarksModel::CBrowserBookmarksModel( MApiProvider& aApiProvider ) + : CBrowserFavouritesModel( aApiProvider ), iApiProvider( aApiProvider ) + { + } + +// --------------------------------------------------------- +// CBrowserBookmarksModel::ApiProvider +// --------------------------------------------------------- +// +MApiProvider& CBrowserBookmarksModel::ApiProvider() + { + return iApiProvider; + } + +// --------------------------------------------------------- +// CBrowserBookmarksModel::NewL +// --------------------------------------------------------- +// +CBrowserBookmarksModel* CBrowserBookmarksModel::NewL( MApiProvider& aApiProvider ) + { + CBrowserBookmarksModel* model = + new (ELeave) CBrowserBookmarksModel( aApiProvider ); + CleanupStack::PushL( model ); + model->ConstructL(); + CleanupStack::Pop(); + return model; + } + +// --------------------------------------------------------- +// CBrowserBookmarksModel::StringResourceId +// --------------------------------------------------------- +// +TInt CBrowserBookmarksModel::StringResourceId + ( + const CFavouritesItem& aItem, + CBrowserFavouritesModel::TTextResourceType aType + ) const + { + switch ( aType ) + { + case CBrowserFavouritesModel::EDefaultName: + { + if ( aItem.IsFolder() ) + { + return R_BROWSER_FAVOURITES_TEXT_FLDR_NAME_DEFAULT; + } + else + { + return R_BROWSER_BOOKMARKS_TEXT_DEFAULT_BM_TITLE; + } + } + + case CBrowserFavouritesModel::ERenamePrompt: + { + if ( aItem.IsFolder() ) + { + return R_BROWSER_FAVOURITES_TEXT_FLDR_ITEM_NAME_PRMPT; + } + else + { + return R_BROWSER_FAVOURITES_TEXT_PRMPT_EDIT_NAME; + } + } + + case CBrowserFavouritesModel::ENewPrompt: + { + if ( aItem.IsFolder() ) + { + return R_BROWSER_FAVOURITES_TEXT_FLDR_NAME_PRMPT; + } + else + { + return R_BROWSER_FAVOURITES_TEXT_PRMPT_EDIT_NAME; + } + } + + case CBrowserFavouritesModel::ESaved: + { + return R_BROWSER_BOOKMARKS_TEXT_BM_SAVED; + } + + case CBrowserFavouritesModel::ENotSaved: + { + return R_BROWSER_BOOKMARKS_TEXT_BM_NOT_SAVED; + } + + default: + { + break; + } + } + + Util::Panic( Util::EUnExpected ); + /*NOTREACHED*/ + return 0; + } + +// --------------------------------------------------------- +// CBrowserBookmarksModel::GetFoldersSortedLC +// --------------------------------------------------------- +// +CFavouritesItemList* CBrowserBookmarksModel::GetFoldersSortedLC() + { + CFavouritesItemList* folders = new (ELeave) CFavouritesItemList(); + CleanupStack::PushL( folders ); + + if ((ADAPTIVEBOOKMARKS)&&(ApiProvider().Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOn )) + { + CFavouritesItem* adaptiveItemsFolder = Database().CreateAdaptiveItemsFolderL(); + CleanupStack::PushL(adaptiveItemsFolder); + HBufC* folderName=StringLoader::LoadLC(R_BROWSER_ADAPTIVE_BOOKMARKS_FOLDER); + adaptiveItemsFolder->SetNameL(*folderName); + CleanupStack::PopAndDestroy();//folderName + folders->AppendL( adaptiveItemsFolder ); + CleanupStack::Pop(); // adaptiveItemsFolder: owner is the list now. + } + + // Get all folders. + Database().GetAll( *folders, KFavouritesRootUid, CFavouritesItem::EFolder ); + // Sort folders, + CBrowserBookmarksOrder* currentOrder = CBrowserBookmarksOrder::NewLC(); + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL(orderArray); + if( Database().GetData( KFavouritesRootUid ,*currentOrder ) == KErrNone ) + { + if( currentOrder->GetBookMarksOrder().Count() > 0 ) + { + orderArray->AppendL( &( currentOrder->GetBookMarksOrder()[0] ), currentOrder->GetBookMarksOrder().Count()); + ManualSortL(KFavouritesRootUid, currentOrder, orderArray, folders); + } + } + CleanupStack::PopAndDestroy(2); //currentOrder, orderArray + + return folders; + } + +// --------------------------------------------------------- +// CBrowserBookmarksModel::GetDBName +// --------------------------------------------------------- +// +const TDesC& CBrowserBookmarksModel::GetDBName() + { + return KBrowserBookmarks; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksOrder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksOrder.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include "BrowserBookmarksOrder.h" +#include "Commonconstants.h" + +_LIT( KBrowserBMOrderDataBegin, "BMOrderDataBegin" ); +_LIT( KBrowserBMOrderDataEnd, "BMOrderDataEnd" ); + + +// --------------------------------------------------------- +// CBrowserBookmarksOrder::NewLC() +// --------------------------------------------------------- +// + +CBrowserBookmarksOrder* CBrowserBookmarksOrder::NewLC() + { + CBrowserBookmarksOrder* order = + new (ELeave) CBrowserBookmarksOrder(); + CleanupStack::PushL(order); + order->ConstructL(); + return order; + } + +// --------------------------------------------------------- +// CBrowserBookmarksOrder::ConstructL() +// --------------------------------------------------------- +// + +void CBrowserBookmarksOrder::ConstructL() + { + iBMOrderArray = new (ELeave) CArrayFixFlat(KGranularityHigh); + } + +CBrowserBookmarksOrder::~CBrowserBookmarksOrder() + { + delete iBMOrderArray; + } + +// --------------------------------------------------------- +// CBrowserBookmarksOrder::InternalizeL +// --------------------------------------------------------- +// + +void CBrowserBookmarksOrder::InternalizeL( RReadStream& aStream ) + { + iBMOrderArray->Reset(); + HBufC* tag = HBufC::NewLC(sizeof (KBrowserBMOrderDataBegin)); + TInt err = 0; + TPtr des = tag->Des(); + + TRAP(err, aStream>>des ); + if ( (err == KErrNone) && (tag->Des() == KBrowserBMOrderDataBegin ) ) + { + TInt count = aStream.ReadInt16L(); + for (TInt i=0; iAppendL(value); + } + else + if (err != KErrEof) + { + User::Leave(err); + } + } + + TRAP(err, aStream>>des ); + if (tag->Des() != KBrowserBMOrderDataEnd) + { + iBMOrderArray->Reset(); + } + } + CleanupStack::PopAndDestroy(tag); + } + +// --------------------------------------------------------- +// CBrowserBookmarksOrder::ExternalizeL +// --------------------------------------------------------- +// + +void CBrowserBookmarksOrder::ExternalizeL( RWriteStream& aStream ) const + { + aStream<Count()); + for (TInt i=0; iCount(); i++) + { + aStream.WriteInt16L((*iBMOrderArray)[i]); + } + aStream<& CBrowserBookmarksOrder::GetBookMarksOrder() + { + return *iBMOrderArray; + } + +// --------------------------------------------------------- +// CBrowserBookmarksOrder::SetBookMarksOrderL +// --------------------------------------------------------- +// + +void CBrowserBookmarksOrder::SetBookMarksOrderL(const CArrayFixFlat& aBookMarksOrder) + { + + iBMOrderArray->Reset(); + if ( aBookMarksOrder.Count() ) + { + iBMOrderArray->AppendL(&(aBookMarksOrder[0]), aBookMarksOrder.Count()); + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,2997 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CBrowserBookmarksView. +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include + +#ifndef AVERELL2_BLUETOOTH_MISSING + #include +#endif + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef RD_SCALABLE_UI_V2 +#include +#endif + + +#include "BrowserDialogs.h" +#include "BrowserBookmarksView.h" +#include "BrowserBookmarksContainer.h" +#include "BrowserBookmarksModel.h" +#include "BrowserFavouritesListbox.h" +#include "BrowserBookmarksEditDialog.h" +#include "BrowserBookmarksGotoPane.h" +#include "CommonConstants.h" +#include "BrowserUtil.h" +#include "BrowserAppUi.h" +#include "Browser.hrh" +#include "CommandVisibility.h" +#include "BrowserBmOTABinSender.h" +#include "CommsModel.h" +#include +#include "BrowserUiVariant.hrh" +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include "BrowserDownloadUtil.h" +#include "Display.h" +#include "logger.h" + +#include "eikon.hrh" + + +// CONSTANTS +const TInt KAdaptiveBookmarksFirstPositionInBMView = 0; +const TInt KAdaptiveBookmarksSecondPositionInBMView = 1; + +const TInt KBrowserDesCArrayGranularity = 8; + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::NewLC +// ---------------------------------------------------------------------------- +// +CBrowserBookmarksView* CBrowserBookmarksView::NewLC( + MApiProvider& aApiProvider, + CRecentUrlStore& aRecentUrlStore, + TInt aInitialFolderUid ) + { + CBrowserBookmarksView* view = new (ELeave) CBrowserBookmarksView( aApiProvider, + aRecentUrlStore, + aInitialFolderUid ); + CleanupStack::PushL( view ); + + view->ConstructL( R_BROWSER_BOOKMARKS_VIEW ); + + return view; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::~CBrowserBookmarksView +// ---------------------------------------------------------------------------- +// +CBrowserBookmarksView::~CBrowserBookmarksView() + { +LOG_ENTERFN("CBrowserBookmarksView::~CBrowserBookmarksView"); + delete iDownloadsListExecuter; + iDownloadsListExecuter = 0; + + if ( !ApiProvider().ExitInProgress() ) + { + // Remove observers only in destructor. See comment in ConstructL why. + ApiProvider().Preferences().RemoveObserver( this ); + ApiProvider().Connection().UnsetApChangeObserver(); + } + CBrowserBookmarksContainer* container = TheContainer(); + if ( container ) + { + container->GotoPane()->SetGPObserver( NULL ); + if( ApiProvider().Preferences().SearchFeature() ) + container->SearchPane()->SetGPObserver( NULL ); + } + delete iDomainFolderName; + delete iItemsToMove; + delete iCurrentOrder; + delete iEnteredURL; + delete iAsyncComplete; +BROWSER_LOG( ( _L("delete iEnteredUrl 1") ) ); + iCursorPos = -1; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::UpdateGotoPaneL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::UpdateGotoPaneL() + { +LOG_ENTERFN("BookmarksView::UpdateGotoPaneL"); + // Simulate cursor movement; that will cancel editing (if editing) + // and refresh Goto Pane. + if ( Container() ) + { + if ( iEnteredURL ) + { + BROWSER_LOG( ( _L("iEnteredUrl exists") ) ); + if ( iCursorPos >=0 ) // update pane only once! + { + TheContainer()->GotoPane()->SetTextL( iEnteredURL->Des(), + EFalse, + EFalse ); + + CEikEdwin* editor = STATIC_CAST( CEikEdwin*, + TheContainer()->GotoPane()->ComponentControl( 1 ) ); + editor->SetCursorPosL( iCursorPos, EFalse ); + iCursorPos = -1; + TheContainer()->GotoPane()->SetFocus( ETrue ); + } + } + else + { + Container()->HandleCursorChangedL( Container()->Listbox() ); + } + } + } + +// -------------------------------------------------------------------------------- +// CBrowserBookmarksView::DeleteItems +// -------------------------------------------------------------------------------- +// +void CBrowserBookmarksView::DeleteItems( TInt aCommand ) + { + + if (iHandleDeleteInProgress) + return; + + iHandleDeleteInProgress = ETrue; + + const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); + + if (!item) + { + return; + } + + if ( item->ParentFolder() == KFavouritesAdaptiveItemsFolderUid ) + { + TBool confirm; + CArrayPtr* items = Container()->Listbox()->SelectedItemsLC(); + + if ( items->Count() == 1 ) + { + confirm = TBrowserDialogs::ConfirmQueryYesNoL( R_BROWSER_FAVOURITES_TEXT_QUERY_COMMON_CONF_DELETE, (*items)[0]->Name()); + } + else if (items->Count() > 1) + { + confirm = TBrowserDialogs::ConfirmQueryYesNoL( R_BROWSER_FAVOURITES_TEXT_DEL_ITEMS_QUERY, items->Count()); + } + else + { + confirm = EFalse; + } + + if (confirm) + { + for ( TInt i = 0; i < items->Count(); i++ ) + { + iRecentUrlStore.DeleteData(items->At( i )->Url()); + } + Container()->Listbox()->View()->ClearSelection(); + iSaveBMOrder = ETrue; + RefreshL(); + } + + CleanupStack::PopAndDestroy();//items + } + else + { + iSaveBMOrder = ETrue; + CBrowserFavouritesView::HandleCommandL( aCommand ); + } + + iHandleDeleteInProgress = EFalse; + + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::HandleCommandL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::HandleCommandL( TInt aCommand ) + { +LOG_ENTERFN("BookmarksView::HandleCommandL"); + // + // FIRST SWITCH Generic CBA commands to original commands + // use ProcessCommandL to route through akn to make sure + // command gets routed to the right place + // + // + + // Assume generic command unless default case, below. + TBool genericCmdHandled = ETrue; + + switch ( aCommand ) + { + case EBrowserBookmarksCmdCancel: + { + if ( iManualItemMovingGoingOn ) + { + ProcessCommandL(EWmlCmdMoveCancel); + } + else if( TheContainer() + && ( TheContainer()->GotoPane()->IsEditing() + || TheContainer()->SearchPane()->IsEditing())) + { + ProcessCommandL(EWmlCmdGotoPaneCancel); + } + break; + } + case EBrowserBookmarksCmdOpen: + { + const CFavouritesItem* item = NULL; + if (Container()) + { + item = Container()->Listbox()->CurrentItem(); + } + + if ( item && item->IsFolder() ) + { + ProcessCommandL(EWmlCmdOpenFolder); + } + else + { + ProcessCommandL(EWmlCmdDownload); + } + + break; + } + case EBrowserBookmarksCmdBack: + { + // default remap is to say back from folder + TInt cmd = EWmlCmdBackFromFolder; + + // unless we have these conditions + if ( !iInAdaptiveBookmarksFolder ) + { + if ( iCurrentFolder == KFavouritesRootUid ) + { + if ( ApiProvider().IsPageLoaded() || ApiProvider().Fetching() ) + { + cmd = EWmlCmdBackToPage; + } + } + } + ProcessCommandL(cmd); + break; + } + default: + { + genericCmdHandled = EFalse; + break; + } + } + + if (genericCmdHandled) + { + return; + } + + // + // EXISTING (regular) command set + // + if ( TheContainer() ) + { + switch ( aCommand ) + { + // CBA commands. + case EWmlCmdGotoPaneGoTo: + { + if( TheContainer()->GotoPaneActive() ) + { + if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0) + { + // Cancel editing and sets Goto Pane text back. + if (TheContainer()->GotoPane()->PopupList() != NULL) + { + TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + TheContainer()->GotoPane()->PopupList()->HidePopupL(); + } + GotoUrlInGotoPaneL(); + } + } + else // it was from searchpane + { + if (TheContainer()->SearchPane()->Editor()->TextLength()!= 0) + { + // Launch Search application with search parameters + // and cancel editing of search and goto. + // Dim Toolbar buttons + DimToolbarButtons(EFalse); + HBufC* searchString = TheContainer()->SearchPane()->GetTextL(); + CleanupStack::PushL( searchString ); + if( searchString ) + { + UpdateCbaL(); + // Set GoTo/Search Inactive + TheContainer()->SetGotoInactiveL(); + LaunchSearchApplicationL( *searchString ); + } + CleanupStack::PopAndDestroy( searchString ); + } + // set LSK to GOTO now + UpdateCbaL(); + } + break; + } + case EWmlCmdGotoPaneSelect: + { + if (TheContainer()->GotoPane()->Editor()->TextLength()!= 0) + { + // Cancel editing and sets Goto Pane text back. + if (TheContainer()->GotoPane()->PopupList() != NULL) + { + TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + TheContainer()->GotoPane()->PopupList()->HidePopupL(); + } + // set LSK to GOTO now + UpdateCbaL(); + } + break; + } + + + case EWmlCmdNewFolder: + { + TInt uid = CBrowserFavouritesView::AddNewFolderL( ); + + AddUidToLastPlaceToCurrentListL(uid); + iRefresh = EFalse; + Model().Database().SetData( CurrentFolder() , *iCurrentOrder ); + break; + } + case EWmlCmdMove: + { + StartMoveItemsL(); + break; + } + case EWmlCmdMoveOk: + { + MoveItemsL(); + break; + } + case EWmlCmdMoveCancel: + { + CancelMoveItemsL(); + break; + } + + case EWmlCmdMoveToFolder: + { + iSaveBMOrder = ETrue; + CBrowserFavouritesView::HandleCommandL(aCommand); + break; + } + + case EWmlCmdGotoPaneCancel: + { + // Cancel editing and sets Goto Pane text back. + if (TheContainer()->GotoPane()->PopupList() != NULL) + { + TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( ETrue ); + TheContainer()->GotoPane()->PopupList()->HidePopupL(); + } + delete iEnteredURL; + iEnteredURL = NULL; + BROWSER_LOG( ( _L("delete iEnteredUrl 2") ) ); + iCursorPos = -1; + + TheContainer()->SetGotoInactiveL(); + + DimToolbarButtons(EFalse); + + break; + } + + // Menu commands. + case EWmlCmdFavourites: + { + if ( iInAdaptiveBookmarksFolder ) + { + ExitAdaptiveBookmarks(); + } + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + break; + } + + case EWmlCmdBackToPage: + { + ApiProvider().SetViewToReturnOnClose( KUidBrowserBookmarksViewId ); + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + break; + } + + case EWmlCmdDownload: + case EWmlCmdDownloadPage: + { + ActivateCurrentBookmarkL(); + break; + } + +#ifdef __RSS_FEEDS + case EWmlCmdOpenFeedsFolder: + { + //complete remaining startup in Browser and then proceed + if ( !ApiProvider().StartedUp() ) + ApiProvider().CompleteDelayedInit(); + ApiProvider().FeedsClientUtilities().ShowFolderViewL(); + break; + } +#endif // __RSS_FEEDS + + + case EWmlCmdLaunchHomePage: + { + AppUi()->HandleCommandL( aCommand ); + break; + } + + case EWmlCmdOpenItem: + { + // re-handle the open item command depending on whether a folder or an + // item is selected. + if ( Container() && Container()->Listbox() ) + { + const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); + if ( item && item->IsFolder() ) + { + HandleCommandL(EWmlCmdOpenFolder); + } + else + { + HandleCommandL(EWmlCmdDownload); + } + } + break; + } + + case EWmlCmdAddBookmark: + { + AddNewBookmarkL(); + break; + } + + case EWmlCmdGoToAddressAndSearch: + case EWmlCmdGoToAddress: // MSK for Recent Url page + case EWmlCmdSwitchToGotoActive: + { + DimToolbarButtons(ETrue); +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + CEikButtonGroupContainer* cba = Cba()->Current(); + CEikCba* eikCba = static_cast( cba->ButtonGroup() ); + if( eikCba ) + { + eikCba->EnableItemSpecificSoftkey( EFalse ); + } +#endif + TheContainer()->SetGotoActiveL(); + break; + } + + case EIsCmdSearchWeb: + { + DimToolbarButtons(ETrue); +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + CEikButtonGroupContainer* cba = Cba()->Current(); + CEikCba* eikCba = static_cast( cba->ButtonGroup() ); + if( eikCba ) + { + eikCba->EnableItemSpecificSoftkey( EFalse ); + } +#endif + TheContainer()->SetSearchActiveL(); + break; + } + + case EWmlCmdEditBookmark: + { + EditCurrentBookmarkL(); + break; + } + + case EWmlCmdSetAsHomePage: + { + if ( Container() && Container()->Listbox() ) + { + const CFavouritesItem* item = + Container()->Listbox()->CurrentItem(); + if ( item && item->IsItem() && + TBrowserDialogs::ConfirmQueryYesNoL( + R_QTN_BROWSERBM_QUERY_SET_AS_HOME_PAGE ) ) + { + ApiProvider().Preferences().SetHomePageUrlL( item->Url() ); + ApiProvider().Preferences().SetHomePageTypeL( EWmlSettingsHomePageAddress ); + } + } + break; + } + + case EWmlCmdPreferences: + { + CBrowserFavouritesView::HandleCommandL( aCommand ); + break; + } + + case EWmlCmdCopyToBookmarks: + { + CArrayPtr* items = + Container()->Listbox()->SelectedItemsLC(); + if (items->Count()) + { + // Set WAP AP. + CFavouritesItem* item; + for (TInt i=0;iCount();i++) + { + item = CFavouritesItem::NewL(); + *item = *( items->At( i ) ); + CleanupStack::PushL( item ); + item->SetParentFolder( KFavouritesRootUid ); + Model().AddL( *item, EFalse, CBrowserFavouritesModel::EAutoRename ); + AddUidToLastPlaceToCurrentListL( item->Uid() ); + CleanupStack::PopAndDestroy();//item + } + iRefresh = EFalse; + Model().Database().SetData( CurrentFolder() , *iCurrentOrder ); + Container()->Listbox()->View()->ClearSelection(); + if (items->Count()==1) + { + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + R_BROWSER_ADAPTIVE_BOOKMARKS_ADAPTIVE_BOOKMARK_COPIED + ); + } + else + { + TBrowserDialogs::InfoNoteL( + R_BROWSER_INFO_NOTE, + R_BROWSER_ADAPTIVE_BOOKMARKS_ADAPTIVE_BOOKMARKS_COPIED, + items->Count() ); + } + } + CleanupStack::PopAndDestroy();//items + break; + } + + case EWmlCmdRename: + { + // NO rename on menu + { + CBrowserFavouritesView::HandleCommandL( aCommand ); + } + break; + } + + case EWmlCmdDelete: + { + DeleteItems( aCommand ); + break; + } // case + + + case EWmlCmdClearAdaptiveBookmarks: + { + if ( TBrowserDialogs::ConfirmQueryYesNoL( + R_BROWSER_ADAPTIVE_BOOKMARKS_DELETE_ALL_ADAPTIVE_BOOKMARKS) ) + { + ClearAdaptiveBookmarksL(); + } + break; + } + + case EWmlCmdClearAdaptiveBookmarksNoPrompt: + { + ClearAdaptiveBookmarksL(); + break; + } + + case EWmlCmdOpenFolder: + { + if ( TheContainer()->GotoPane()->PopupList() ) + { + if ( TheContainer()->GotoPane()->PopupList()->IsPoppedUp() ) + { + TheContainer()->GotoPane()->PopupList()->SetDirectoryModeL( + EFalse ); + break; // This case is supposed to fall through into the next case in certain + // conditions. + } + } + } + + case EWmlCmdOpenMarkedFolder: + { + SetEmptyTextL(); + if (Container()->Listbox()->CurrentItem()->Uid() == + KFavouritesAdaptiveItemsFolderUid ) + { + iAdaptiveBookmarksFolderSelected = ETrue; + iInAdaptiveBookmarksFolder = ETrue; + SetEmptyTextL(); + RefreshL(); + } + else + { + CBrowserFavouritesView::HandleCommandL( aCommand ); + UpdateToolbarButtonsState(); + } + break; + } + + case EWmlCmdBackFromFolder: + { + Container()->Listbox()->ClearSelection(); + if ( iDomainFolderName ) + { + HBufC* domainFolderNameToHighlight; + domainFolderNameToHighlight = HBufC::NewL( + iDomainFolderName->Length() ); + CleanupStack::PushL( domainFolderNameToHighlight ); + + domainFolderNameToHighlight->Des().Append( *iDomainFolderName ); + delete iDomainFolderName; + iDomainFolderName = NULL; + + CFavouritesItemList* items = + GetItemsLC( KFavouritesAdaptiveItemsFolderUid ); + TInt indexToHighlight = 0; + + for ( TInt i = 0; i < items->Count(); i++ ) + { + if ( (*items)[i]->Name() == (*domainFolderNameToHighlight) ) + { + indexToHighlight = i; + } + } + + CleanupStack::PopAndDestroy(); // items + CleanupStack::PopAndDestroy(); // domainFolderNameToHighlight + + HBufC* title; + title=iCoeEnv->AllocReadResourceLC( + R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE ); + ApiProvider().Display().SetTitleL( *title ); + CleanupStack::PopAndDestroy(); // title + RefreshL(); + Container()->Listbox()->SetCurrentItemIndexAndDraw( + indexToHighlight ); + } + else + { + if ( iInAdaptiveBookmarksFolder ) + { + iAdaptiveBookmarksFolderSelected = EFalse; + iInAdaptiveBookmarksFolder=EFalse; + SetEmptyTextL(); + HBufC* title; + title=iCoeEnv->AllocReadResourceLC( + TheContainer()->TitleResourceId() ); + UpdateNaviPaneL(); + ApiProvider().Display().SetTitleL( *title ); + iPreferredHighlightUid=KFavouritesAdaptiveItemsFolderUid; + CleanupStack::PopAndDestroy(); // title + RefreshL(); + } + else + { + CBrowserFavouritesView::HandleCommandL( aCommand ); + } + } + // Back from a folder may require change in toolbar button state + UpdateToolbarButtonsState(); + break; + } + + case EWmlCmdSendBookmarkViaUnifiedMessage: + { + // Both case can be handled alike - SendBookmarksL + // uses SelectedItemsLC - this always what we want (if there is + // something marked, those; if no marked, the highlighted one). + SendBookmarksL( ); + break; + } + + +#ifdef __SERIES60_HELP + case EAknCmdHelp: + { + STATIC_CAST(CBrowserAppUi*, AppUi())->HandleCommandL(EAknCmdHelp); + break; + } +#endif //__SERIES60_HELP + + case EWmlCmdDownloads: + { + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowDownloads + + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + } + + case EWmlCmdDownloadPageNewWindow: + { + const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); + if ( item ) + { + CBrowserAppUi::Static()->OpenLinkInNewWindowL( *item ); + } + break; + } + + default: + { + if (aCommand == EWmlCmdDelete && + (Container()->Listbox()->CurrentItem()->ParentFolder()==KFavouritesAdaptiveItemsFolderUid)) + { + DeleteItems( aCommand ); + break; + } + CBrowserFavouritesView::HandleCommandL( aCommand ); + break; + } + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::SetEmptyTextL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::SetEmptyTextL() + { + HBufC* buf; + if (iInAdaptiveBookmarksFolder) + { + HBufC* title; + if (iDomainFolderName != NULL) + { + ApiProvider().Display().SetTitleL( *iDomainFolderName ); + } + else + { + title=iCoeEnv->AllocReadResourceLC( R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE ); + ApiProvider().Display().SetTitleL( *title ); + CleanupStack::PopAndDestroy(); // title + } + buf = iCoeEnv->AllocReadResourceLC( R_BROWSER_ADAPTIVE_BOOKMARKS_NO_ADAPTIVE_BOOKMARKS ); + } + else + { + buf = iCoeEnv->AllocReadResourceLC( TheContainer()->ListboxEmptyTextResourceId() ); + } + TheContainer()->Listbox()->View()->SetListEmptyTextL( *buf ); + CleanupStack::PopAndDestroy(); // buf + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::Id +// ---------------------------------------------------------------------------- +// +TUid CBrowserBookmarksView::Id() const + { + return KUidBrowserBookmarksViewId; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CommandSetResourceIdL +// ---------------------------------------------------------------------------- +// +TInt CBrowserBookmarksView::CommandSetResourceIdL() + { + // massive re-work for 5.0, to dynamically assign CBA + return(R_BROWSER_BUTTONS_CBA_DYNAMIC); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CommandSetResourceDynL +// ---------------------------------------------------------------------------- +// + +void CBrowserBookmarksView::CommandSetResourceDynL(TSKPair& aLsk, TSKPair& aRsk, TSKPair& aMsk) +{ + // + // Get gotoPane pointer and appropriate Container pointer. + // + // These are passed in to the LSK, RSK, MSK dynamic setting functions + // and used to help chose the appropriate softkeys + // + CBrowserBookmarksGotoPane* gotoPanePtr = NULL; + CBrowserBookmarksContainer* theContainer = TheContainer(); + + // if the container doesn't exist, leave gotoPanePtr at NULL + if (theContainer) + { + gotoPanePtr = theContainer->GotoPane(); + } + + // set LSK, RSK, MSK respectively + SetLSKDynL(aLsk, gotoPanePtr); + SetRSKDynL(aRsk, gotoPanePtr); + SetMSKDynL(aMsk, aLsk, theContainer, gotoPanePtr); + + // + // Finally, if the contextual menu command was assigned to the MSK, + // we need to set up the menu now + // + if ( aMsk.id() == EAknSoftkeyContextOptions ) + { + ConfigContextMenu(); + } +} + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::SetLSKDynL +// ---------------------------------------------------------------------------- +// + +void CBrowserBookmarksView::SetLSKDynL(TSKPair& aLsk, + CBrowserBookmarksGotoPane* aGotoPane) +{ + CBrowserBookmarksContainer* theContainer = TheContainer(); + CBrowserBookmarksGotoPane* searchPane = NULL; + if( theContainer ) + { + searchPane = theContainer->SearchPane(); + } + // Default lsk is option + aLsk.setPair(EAknSoftkeyOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION); + + if ( iManualItemMovingGoingOn ) + { + aLsk.setPair(EWmlCmdMoveOk, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OK); + } + else if ( aGotoPane && aGotoPane->IsEditing() ) + { + // default for goto is go + aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_WML_SOFTK_GO); + + if (aGotoPane->PopupList() && + aGotoPane->PopupList()->IsOpenDirToShow() ) + { + aLsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN); + } + else if (aGotoPane->PopupList() && + aGotoPane->PopupList()->IsPoppedUp() && + !iPenEnabled) + { + // LSK Select is only for non-touch devices + aLsk.setPair(EWmlCmdGotoPaneSelect, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_SELECT); + } + } + else if( searchPane && searchPane->IsEditing() ) + { + aLsk.setPair(EWmlCmdGotoPaneGoTo, R_BROWSER_BOOKMARKS_DYN_SK_QTN_IS_SOFTK_SEARCH); + } +} + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::SetRSKDynL +// ---------------------------------------------------------------------------- +// + +void CBrowserBookmarksView::SetRSKDynL(TSKPair& aRsk, + CBrowserBookmarksGotoPane* aGotoPane) +{ + CBrowserBookmarksContainer* theContainer = TheContainer(); + CBrowserBookmarksGotoPane* searchPane = NULL; + if( theContainer ) + { + searchPane = theContainer->SearchPane(); + } + if ( iManualItemMovingGoingOn ) + { + aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL); + } + else if( (aGotoPane && aGotoPane->IsEditing()) || (searchPane && searchPane->IsEditing()) ) + { + // default for goto is cancel + aRsk.setPair(EBrowserBookmarksCmdCancel, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_CANCEL); + } + else + { + // default case for everything else is Back + aRsk.setPair(EBrowserBookmarksCmdBack, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_BACK); + + // OR, it could be exit under these conditions + if ( (!iInAdaptiveBookmarksFolder && !ApiProvider().IsPageLoaded() && !ApiProvider().Fetching()) ) + { + if ( iCurrentFolder == KFavouritesRootUid ) + { + aRsk.setPair(EAknSoftkeyExit, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_EXIT); + } + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::SetMSKDynL +// ---------------------------------------------------------------------------- +// + +void CBrowserBookmarksView::SetMSKDynL(TSKPair& aMsk, const TSKPair aLsk, + CBrowserFavouritesContainer* aContainer, + CBrowserBookmarksGotoPane* aGotoPane) + { + // setup any marked items flag for convenience + // also verify that container is defined + TBool anyMarkedItems = EFalse; + if ( aContainer) + { + anyMarkedItems = aContainer->Listbox()->SelectionStateL().AnyMarked(); + } + else + { + return; + } + + // + // Usually, MSK is context menu if marked items. + // The exception is if moving is in progress (and marked items).. then its the dot (in place of OK). + // Otherwise, the Open Command is thrown. + // + if ( anyMarkedItems ) + { + if ( iManualItemMovingGoingOn ) + { + aMsk.setPair(EWmlCmdMoveOk, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OK); + } + else + { + aMsk.setPair(EAknSoftkeyContextOptions, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPTION); + } + } + else + { + aMsk.setPair(EBrowserBookmarksCmdOpen, R_BROWSER_BOOKMARKS_DYN_SK_TEXT_SOFTKEY_OPEN); + } + + CBrowserBookmarksContainer* theContainer = TheContainer(); + CBrowserBookmarksGotoPane* searchPane = NULL; + if( theContainer ) + { + searchPane = theContainer->SearchPane(); + } + // + // UNDER these special conditions, the msk is set differently: + // + if ( aGotoPane && aGotoPane->IsEditing() ) + { + // follow whatever the lsk is set to + aMsk = aLsk; + } + else if( searchPane && searchPane->IsEditing() ) + { + // follow whatever the lsk is set to + aMsk = aLsk; + } + else + { + if ( iInAdaptiveBookmarksFolder ) + { + if ( aContainer->Listbox()->UnfilteredNumberOfItems() <= 0 ) + { + aMsk.setPair( EWmlCmdGoToAddress, R_BROWSER_BOOKMARKS_DYN_SK_QTN_BROWSER_MSK_GOTO ); + } + } + else + { + if ( (reinterpret_cast (AppUi())->IsEmbeddedModeOn()) || + iCurrentFolder == KFavouritesRootUid ) + { + if ( aContainer->Listbox()->UnfilteredNumberOfItems() <= 0 ) + { + aMsk.setPair( EWmlCmdAddBookmark, R_BROWSER_BOOKMARKS_DYN_SK_QTN_MSK_ADD ); + } + } + else + { + if ( aContainer->Listbox()->UnfilteredNumberOfItems() <= 0 ) + { + aMsk.setPair( EWmlCmdAddBookmark, R_BROWSER_BOOKMARKS_DYN_SK_QTN_MSK_ADD ); + } + } + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::HandleBookmarksGotoPaneEventL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::HandleBookmarksGotoPaneEventL + ( + CBrowserBookmarksGotoPane* +#ifdef _DEBUG + aGotoPane // used only for debugging purposes +#endif + , + MBookmarksGotoPaneObserver::TEvent aEvent + ) + { +#ifdef _DEBUG + __ASSERT_DEBUG( aGotoPane == TheContainer()->GotoPane() || + aGotoPane == TheContainer()->SearchPane(), \ + Util::Panic( Util::EFavouritesInternal ) ); +#endif + + switch ( aEvent ) + { + case MBookmarksGotoPaneObserver::EEventEnterKeyPressed: + { + HandleCommandL( EWmlCmdGotoPaneGoTo ); + break; + } + + case MBookmarksGotoPaneObserver::EEventEditingModeChanged: + { + UpdateCbaL(); + break; + } + + default: + { + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CBrowserBookmarksView +// ---------------------------------------------------------------------------- +// +CBrowserBookmarksView::CBrowserBookmarksView ( MApiProvider& aApiProvider, + CRecentUrlStore& aRecentUrlStore, + TInt aInitialFolderUid ) + : CBrowserFavouritesView( aApiProvider, aInitialFolderUid ), + iFetchInit( EFalse ), + + iRecentUrlStore (aRecentUrlStore) + + + + { + // Initially start with default AP as Start Page AP. + iCurrentDefaultAp = iStartPageApUid = + ApiProvider().Preferences().DefaultAccessPoint(); + iPenEnabled = AknLayoutUtils::PenEnabled(); + iHandleDeleteInProgress = EFalse; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::ConstructL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::ConstructL( TInt aViewResourceId ) + { +LOG_ENTERFN("BookmarksView::ConstructL"); + CBrowserFavouritesView::ConstructL( aViewResourceId ); + // Begin observing changes in active AP and default AP. Note that we + // set/unset observers here, not in DoActivateL/DoDeactivate: we do the + // observing even if the view is not active. This is needed, because + // preferences and the active AP can be changed from other views also. + // If notification kicks in when the view is not active, display RefreshL + // is, of course, suppressed (in base class). + ApiProvider().Preferences().AddObserverL( this ); + ApiProvider().Connection().SetApChangeObserver( *this ); + iOpenAdaptiveBookmarksWhenActivated = EFalse; + iAdaptiveBookmarksFolderSelected = EFalse; + iInAdaptiveBookmarksFolder=EFalse; + iAdaptiveBookmarksCurrentSetting = + ApiProvider().Preferences().AdaptiveBookmarks(); + iEnteredURL = NULL; +BROWSER_LOG( ( _L("delete iEnteredUrl 3") ) ); + iCursorPos = -1; + + //Since the webcore will be reading the bookmark information in background + //thread, its important to refresh when the thread notifies the fresh data. + //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false + //Make it true so that latest FavIcon db info is shown + iRefresh = ETrue; + +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + if ( ApiProvider().Preferences().SearchFeature() ) // hide the button which is not needed + Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue , EFalse); + else + Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue , EFalse); +#else + Toolbar()->HideItem( EWmlCmdAddBookmark, ETrue , EFalse); + + //disable both the goto items and activate one of them depending on availability of search feature during bookmarks activation + Toolbar()->HideItem( EWmlCmdGoToAddress, ETrue , EFalse); + Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, ETrue , EFalse ); + +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + Toolbar()->HideItem( EWmlCmdDelete, ETrue , EFalse); +#else + Toolbar()->HideItem( EWmlCmdPreferences, ETrue , EFalse); +#endif + + Cba()->MakeVisible( EFalse); + StatusPane()->MakeVisible( EFalse ); +#endif + + if (iPenEnabled) + { + Toolbar()->SetToolbarObserver(this); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::HandleListBoxEventL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::HandleListBoxEventL( + CEikListBox* aListBox, + MEikListBoxObserver::TListBoxEvent aEventType ) + { + if ( aListBox == Container()->Listbox() ) + { + switch ( aEventType ) + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + case MEikListBoxObserver::EEventEmptyListClicked: + return; +#endif + case MEikListBoxObserver::EEventEnterKeyPressed: + case MEikListBoxObserver::EEventItemDoubleClicked: +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + case MEikListBoxObserver::EEventItemSingleClicked: +#endif + { + if ( iManualItemMovingGoingOn ) + { + MoveItemsL(); + return; + } + else if ( Container()->Listbox()->CurrentItem() ) + { + //complete remaining startup in Browser and then proceed + if ( !ApiProvider().StartedUp() ) + ApiProvider().CompleteDelayedInit(); + + if ( Container()->Listbox()->CurrentItem()->IsItem()) + { + ActivateCurrentBookmarkL(); + return; + } + else + { + if (Container()->Listbox()->CurrentItem()->Uid()==KFavouritesAdaptiveItemsFolderUid) + { + iAdaptiveBookmarksFolderSelected = ETrue; + iInAdaptiveBookmarksFolder=ETrue; + SetEmptyTextL(); + RefreshL(); + + iPreviousViewID = KUidBrowserBookmarksViewId; + return; + } + } + } + break; + } + default: + { + break; + } + } + } + + if ( TheContainer()->Listbox()->CurrentItem() && TheContainer()->Listbox()->CurrentItem()->IsFolder() ) + { + SetEmptyTextL(); + } + + CBrowserFavouritesView::HandleListBoxEventL( aListBox, aEventType ); + UpdateToolbarButtonsState(); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::DynInitMenuPaneL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::DynInitMenuPaneL + ( + TInt aResourceId, + CEikMenuPane* aMenuPane, + TCommandVisibility::TIndex /*aIndex */, + const TBrowserFavouritesSelectionState& aState + ) + { + LOG_ENTERFN("CBrowserBookmarksView::DynInitMenuPaneL"); + + __ASSERT_DEBUG( (aMenuPane != NULL), Util::Panic( Util::EUninitializedData )); + + const CFavouritesItem* item = TheContainer()->Listbox()->CurrentItem(); + + switch ( aResourceId ) + { + case R_BROWSER_BOOKMARKS_MENU_PANE: + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + if(iItemsToMove ) + { + aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, ETrue ); + } + else + { + if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) ) + { + TBool dimSaveAsHomePage = EFalse; + + if ( (item && (item->IsFolder() || + item->Uid() == KFavouritesAdaptiveItemsFolderUid || + item->ContextId()))) + { + dimSaveAsHomePage = ETrue; + } + else + { + dimSaveAsHomePage = ApiProvider().IsEmbeddedModeOn() || !aState.CurrentIsItem() + || ( aState.MarkedCount() > 1 ); + } + + aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage ); + } + if (!item) + { + aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); + } + else if ( (item && (item->IsFolder() || + item->Uid() == KFavouritesAdaptiveItemsFolderUid || + item->ContextId()))) + { + aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); + } + } + + aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); + + if(iInAdaptiveBookmarksFolder) + { + aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + } + if ( ( item ) && + ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) || + ( item->ContextId() != NULL ) || + (item->IsReadOnly()) ) //If the bookmarks are the default provided by operator + ) + { + // We can't delete adaptive bookmarks folder, + // or seamless folders + aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + } + if( item && item->IsFolder()) + { + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + } + +#endif + // downloads + if(ApiProvider().StartedUp()) + aMenuPane->SetItemDimmed( EWmlCmdDownloads, !ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads ) ); + + // edit + if ( !item || (iInAdaptiveBookmarksFolder && aState.IsEmpty() )) + { + aMenuPane->SetItemDimmed( EWmlCmdManageBookmarks, ETrue ); + } +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + // add bookmark + if ( iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue ); + } + + // create folder + if ( iCurrentFolder != KFavouritesRootUid || iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue ); + } +#endif + + if ( iInAdaptiveBookmarksFolder && aState.IsEmpty() ) + { + aMenuPane->SetItemDimmed( EWmlCmdBmActions, ETrue ); + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + if (!item) + { + aMenuPane->SetItemDimmed( EWmlCmdMarkUnmark, ETrue ); + } +#endif +/* + if (BRDO_BROWSER_UPDATE_UI_FF) + { + aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdHelpMenu, ETrue ); + } +*/ + break; + } + case R_GOTO_SUBMENU: + { + // back to page + if ( !ApiProvider().IsPageLoaded() && !ApiProvider().Fetching()) + { + aMenuPane->SetItemDimmed( EWmlCmdBackToPage, ETrue ); + } + + // bookmarks + aMenuPane->SetItemDimmed( EWmlCmdFavourites, ETrue ); + + // web feeds + if (ApiProvider().IsEmbeddedModeOn()) + { + aMenuPane->SetItemDimmed( EWmlCmdOpenFeedsFolder, ETrue ); + } + + // history + aMenuPane->SetItemDimmed( EWmlCmdHistory, ETrue ); + + // home + aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ETrue ); + //search + if ( ! ApiProvider().Preferences().SearchFeature() ) + { + aMenuPane->SetItemDimmed( EIsCmdSearchWeb, ETrue ); + } + break; + } + case R_BMACTIONS_SUBMENU: + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + // send + aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue ); + + if (!item) + { + aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); + } + else if ( (item && (item->IsFolder() || + item->Uid() == KFavouritesAdaptiveItemsFolderUid || + item->ContextId()))) + { + aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue ); + } +#endif + // copy to bookmarks + if ( !iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue ); + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + // set as homepage + if ( ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting ) ) + { + TBool dimSaveAsHomePage = EFalse; + + if ( (item && (item->IsFolder() || + item->Uid() == KFavouritesAdaptiveItemsFolderUid || + item->ContextId()))) + { + dimSaveAsHomePage = ETrue; + } + else + { + dimSaveAsHomePage = ApiProvider().IsEmbeddedModeOn() || !aState.CurrentIsItem() + || ( aState.MarkedCount() > 1 ); + } + + aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, dimSaveAsHomePage ); + } + // add bookmark + if ( iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue ); + } +#endif + // set preferred/unpreferred + if ( !iContainer->Listbox()->CurrentItem() ) + { + aMenuPane->SetItemDimmed( EWmlCmdSetPreferredBookmark, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdSetUnPreferredBookmark, ETrue ); + } + else + { + if ( ( iCurrentFolder == KFavouritesRootUid )|| + !iContainer->Listbox()->GetDefaultData().iInSeamlessFolder || + ( iContainer->Listbox()->GetDefaultData().iPreferedId == + iContainer->Listbox()->CurrentItem()->Uid() ) + ) + { + aMenuPane->SetItemDimmed( EWmlCmdSetPreferredBookmark, ETrue ); + } + + if ( ( iCurrentFolder == KFavouritesRootUid ) || + !iContainer->Listbox()->GetDefaultData().iInSeamlessFolder || + !( iContainer->Listbox()->GetDefaultData().iPreferedId == + iContainer->Listbox()->CurrentItem()->Uid() ) + ) + { + aMenuPane->SetItemDimmed( EWmlCmdSetUnPreferredBookmark, + ETrue ); + } + } + + break; + } + case R_BOOKMARKS_EDIT_SUBMENU: + { + // edit bookmark + if (!item || aState.MarkedCount() > 0) + { + aMenuPane->SetItemDimmed( EWmlCmdEditBookmark, ETrue ); + } + else if (( (item && (item->IsFolder() || + item->Uid() == KFavouritesAdaptiveItemsFolderUid || + item->ContextId() || aState.CurrentIsSpecial() || iInAdaptiveBookmarksFolder))) +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + ||(item->IsReadOnly())//If the bookmarks are readonly(set by the operator) +#endif + ) + { + aMenuPane->SetItemDimmed( EWmlCmdEditBookmark, ETrue ); + } + + // rename + + // Can't rename recent urls and seamless folders - can only rename basic folders + if ( item->IsFolder() && + (item->Uid() != KFavouritesAdaptiveItemsFolderUid) && + (item->ContextId() == NULL) ) + { + // more item is marked -> dim rename + if ( aState.MarkedCount() > 0 ) + { + aMenuPane->SetItemDimmed( EWmlCmdRename, ETrue ); + } + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdRename, ETrue ); + } + +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + // delete + if (!item) + { + aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); + } + else if ( item->Uid() == KFavouritesAdaptiveItemsFolderUid || + item->ContextId() || + !aState.AnyDeletable() ) + { + aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); + } + + // move + if ( iInAdaptiveBookmarksFolder || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2 ) ) + { + aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); + } + + // move to folder + if ( !aState.AnyPlainItem() || (iCurrentFolder == KFavouritesRootUid && + iContainer && iContainer->Listbox() && !iContainer->Listbox()->AnyFoldersL()) ) + { + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + } + // create folder + if ( iCurrentFolder != KFavouritesRootUid || iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue ); + } +#endif + + break; + } + case R_BROWSER_FAVOURITES_MENU_PANE_MARK_UNMARK: + { + // For items and folders, show "Mark" or "Unmark". + aMenuPane->SetItemDimmed ( aState.CurrentIsMarked() ? EWmlCmdMark : EWmlCmdUnmark, ETrue ); + #ifndef SHOW_UNMARK_ALL_ALWAYS + + // We must show "Unmark all", even if nothing is marked. + // + // The case when there are no items at all, is not handled here: + // in that case we don't have "Edit list" menu. + if ( aState.NoneIsMarked() ) + { + aMenuPane->SetItemDimmed( EWmlCmdUnmarkAll, ETrue ); + } + #endif // SHOW_UNMARK_ALL_ALWAYS + + #ifndef SHOW_MARK_ALL_ALWAYS + // As for "mark all", consider items only. + if ( (aState.iVisibleItemCount == aState.iMarkedItemCount) && (aState.iVisibleFolderCount == aState.iMarkedFolderCount) ) + { + //Checking for both items and folders + aMenuPane->SetItemDimmed( EWmlCmdMarkAll, ETrue ); + } + else if( (aState.iVisibleItemCount == 0) && (aState.iVisibleFolderCount < 2))//Only one folder is present and no items + { + aMenuPane->SetItemDimmed( EWmlCmdMarkAll, ETrue ); + } + #endif // SHOW_MARK_ALL_ALWAYS + break; + } + case R_BROWSER_BOOKMARKS_MENU_PANE_OK: + { + // Bookmark-specific handling. + if ( aState.IsEmpty() || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2)||iInAdaptiveBookmarksFolder) + { + aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdMove, EFalse ); + } + + //Disable MoveToFolder option if you are in RecentlyVisitedUrl folder + if( iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + // These options are not required when user press MSK + aMenuPane->SetItemDimmed( EWmlCmdAddBookmark, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdSwitchToGotoActive, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdNewFolder, ETrue ); + } + + if( iContainer && iContainer->Listbox() && !iContainer->Listbox()->AnyFoldersL() ) + { + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + } + const CFavouritesItem* item = NULL; + if(TheContainer() && TheContainer()->Listbox()) + item = TheContainer()->Listbox()->CurrentItem(); + + if ( ( item ) && + ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) || + ( item->ContextId() != NULL ) ) + ) + { + // We can't delete adaptive bookmarks folder, + // or seamless folders + aMenuPane->SetItemDimmed( EWmlCmdDelete, ETrue ); + aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue ); + } + + //Enable CopyToBookmarks option if you are in RecentlyVisitedUrl folder + if( iInAdaptiveBookmarksFolder ) + { + aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, EFalse ); + } + //judge the selected items include RecentlyVisitedUrl folder or not, if include set "copy to bookmarks" dim + CArrayPtr* items = Container()->Listbox()->SelectedItemsLC(); + if (items->Count()) + { + for (TInt i=0;iCount();i++) + { + if((*items)[i]->Uid() == KFavouritesAdaptiveItemsFolderUid ) + { + aMenuPane->SetItemDimmed( EWmlCmdCopyToBookmarks, ETrue ); + } + } + } + CleanupStack::PopAndDestroy();//items + break; + } + default: + { + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::RootTitleResourceId +// ---------------------------------------------------------------------------- +// +TInt CBrowserBookmarksView::RootTitleResourceId() const + { + if ( iOpenAdaptiveBookmarksWhenActivated ) + { + return R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE; + } + else + { + return R_BROWSER_OPTION_BOOKMARKS; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::OptionsMenuResourceId +// ---------------------------------------------------------------------------- +// +TInt CBrowserBookmarksView::OptionsMenuResourceId() const + { + return ( R_BROWSER_BOOKMARKS_MENU_BAR ); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::OkOptionsMenuResourceId +// ---------------------------------------------------------------------------- +// +TInt CBrowserBookmarksView::OkOptionsMenuResourceId() const + { + return R_BROWSER_BOOKMARKS_MENU_BAR_OK; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CreateModelL +// ---------------------------------------------------------------------------- +// +CBrowserFavouritesModel* CBrowserBookmarksView::CreateModelL() + { + return CBrowserBookmarksModel::NewL(ApiProvider()); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CreateContainerL +// ---------------------------------------------------------------------------- + +CBrowserFavouritesContainer* CBrowserBookmarksView::CreateContainerL() + { + CBrowserBookmarksContainer* container = + CBrowserBookmarksContainer::NewL( ClientRect(), *this ); + container->GotoPane()->SetGPObserver( this ); + if( ApiProvider().Preferences().SearchFeature() ) + container->SearchPane()->SetGPObserver( this ); + return container; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::MoveItemsL +// ---------------------------------------------------------------------------- +void CBrowserBookmarksView::MoveItemsL() + { + + // Get the Uid of currently highlighted bookmark item from listbox. + // NOTE: Listbox indexes is based on "visible" items in list box, our order + // array has visible and invisible items, we have to use Uid to find items. + const CFavouritesItem* toItem = Container()->Listbox()->CurrentItem(); + TInt toUid(NULL); + if ( toItem ) { + toUid = toItem->Uid(); + if (toUid == (*iItemsToMove)[0]) + { // Moving to same location so change nothing, cleanup, & exit + CancelMoveItemsL(); + return; + } + } + + // Get a copy of the ordered array, it may contain visible and hidden items. + CArrayFixFlat* orderArray = + new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL( orderArray ); + + orderArray->AppendL( & ( iCurrentOrder->GetBookMarksOrder()[0] ), + iCurrentOrder->GetBookMarksOrder().Count() ); + + if ( toUid == NULL ) { + toUid = (*orderArray)[orderArray->Count()-1] ; + } + + + // Create a sorted "bookmarks to be moved" array + CArrayFixFlat* sortedItemsToMove = + new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL( sortedItemsToMove ); + + + // Walk our copy of the ordered bookmark array and + // 1. Delete the bookmark items to be moved from the ordered array + // 2. Sort the bookmark items to be moved to match the visible order of the list + TInt i( 0 ); // index into order bookmark list + TInt j( 0 ); // index into sorted iItemsToMove + for ( i=0; i < orderArray->Count(); i++ ) { + TInt orderArrayUid = (*orderArray)[i]; + + // Find bookmark to be moved, sort and remove + for ( j=0; j < iItemsToMove->Count(); j++ ) { + if ( (*iItemsToMove)[j] == orderArrayUid ) { + sortedItemsToMove->AppendL( (*iItemsToMove)[j] ); + orderArray->Delete( i ); + i--; + break; + } + } + + // Stop sorting, if we're done + if ( iItemsToMove->Count() == sortedItemsToMove->Count() ) { + break; + } + } + + // Find the highlighted bookmark item and insert the newly ordered + // "bookmark items to be moved" in there + for ( i=0; i < orderArray->Count(); i++ ) { + if ( toUid == (*orderArray)[ i ] ) { + for ( j=0; j < sortedItemsToMove->Count(); j++ ) { + orderArray->InsertL( i+j, (*sortedItemsToMove)[j] ); + } + break; + } + } + + iCurrentOrder->SetBookMarksOrderL( *orderArray ); + Model().Database().SetData( CurrentFolder(), *iCurrentOrder ); + + iManualItemMovingGoingOn = EFalse; + Container()->Listbox()->ClearSelection(); + iPreferredHighlightUid = (*sortedItemsToMove)[0]; + + // Delete our arrays sortedItemsToMove, orderArray + CleanupStack::PopAndDestroy( 2 ); + delete iItemsToMove; + iItemsToMove = NULL; + + UpdateCbaL(); + // UnDim Toolbar buttons + DimToolbarButtons(EFalse); + + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CancelMoveItems +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::CancelMoveItemsL() + { + iManualItemMovingGoingOn = EFalse; + HandleCommandL(EWmlCmdUnmarkAll); + UpdateCbaL(); + // UnDim Toolbar buttons + DimToolbarButtons(EFalse); + iPreferredHighlightUid = ( *iItemsToMove )[0]; + delete iItemsToMove; + iItemsToMove = NULL; + RefreshL(); + } + + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::StartMoveItems +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::StartMoveItemsL() + { + iManualItemMovingGoingOn = ETrue; + + TInt moveFrom = ( *Container()->Listbox()->SelectedRealIndexesLC() )[0]; + CleanupStack::PopAndDestroy(); //SelectedRealIndexesLC + TInt count = Container()->Listbox()->SelectedRealIndexesLC()->Count(); + CleanupStack::PopAndDestroy(); //SelectedRealIndexesLC + if ( ( count == 1 ) + && ( Container()->Listbox()->CurrentItemRealIndex() == moveFrom ) ) + { + HandleCommandL(EWmlCmdMark); + } + + + if (iItemsToMove) + { + delete iItemsToMove; + iItemsToMove = NULL; + } + iItemsToMove = new (ELeave) CArrayFixFlat( KGranularityHigh ); + + CArrayPtr* items = + Container()->Listbox()->SelectedItemsLC(); + + for ( TInt i = 0; i < items->Count(); i++ ) + { + iItemsToMove->AppendL( (*(*items)[i]).Uid() ); + } + CleanupStack::PopAndDestroy(items); + UpdateCbaL(); + // Dim Toolbar buttons + DimToolbarButtons(ETrue); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::ManualBMSortL +// ---------------------------------------------------------------------------- +// +TBool CBrowserBookmarksView::ManualBMSortL( TInt aFolder, + CFavouritesItemList* aItems ) + { + __ASSERT_DEBUG( (aItems != NULL), Util::Panic( Util::EUninitializedData )); + + delete iCurrentOrder; + iCurrentOrder = NULL; + iCurrentOrder = CBrowserBookmarksOrder::NewLC(); + CleanupStack::Pop(); + if ( aItems->Count() ) + { + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL(orderArray); + + if ( !Model().Database().GetData( aFolder ,*iCurrentOrder ) ) + { + if ( iCurrentOrder->GetBookMarksOrder().Count() > 0 ) + { + orderArray->AppendL( & ( iCurrentOrder->GetBookMarksOrder()[0] ), + iCurrentOrder->GetBookMarksOrder().Count()); + + if ( aFolder == KFavouritesRootUid ) + { + TInt i = 0; + + while ( i < orderArray->Count() && + !( (*orderArray)[i] == KFavouritesStartPageUid )) + { + i++; + } + + if ( i == orderArray->Count() ) + { + if ( iStartPagePresent ) + { + orderArray->InsertL( 0, KFavouritesStartPageUid ); + iSaveBMOrder = ETrue; + } + } + else + { + if ( !iStartPagePresent ) + { + orderArray->Delete(i); + iSaveBMOrder = ETrue; + } + } + if ( iInsertAdaptiveBookmarksFolder ) + { + iInsertAdaptiveBookmarksFolder = EFalse; + i = 0; + + while ( i < orderArray->Count() && + !( (*orderArray)[i] == + KFavouritesAdaptiveItemsFolderUid )) + { + i++; + } + + if ( i < orderArray->Count() ) + { + orderArray->Delete(i); + } + if ( orderArray->Count() ) + { + if ( (*orderArray)[0] == KFavouritesStartPageUid ) + { + orderArray->InsertL( 1, + KFavouritesAdaptiveItemsFolderUid ); + } + else + { + orderArray->InsertL( 0, + KFavouritesAdaptiveItemsFolderUid ); + } + } + } + else + if ( (ADAPTIVEBOOKMARKS) && + ( ApiProvider().Preferences().AdaptiveBookmarks() == + EWmlSettingsAdaptiveBookmarksOn ) ) + { + i = 0; + + while ( i < orderArray->Count() && + !( (*orderArray)[i] == + KFavouritesAdaptiveItemsFolderUid )) + { + i++; + } + + if ( i == orderArray->Count() != 0 ) + { + if ( (*orderArray)[0] == KFavouritesStartPageUid ) + { + orderArray->InsertL( 1, + KFavouritesAdaptiveItemsFolderUid ); + } + else + { + orderArray->InsertL( 0, + KFavouritesAdaptiveItemsFolderUid ); + } + } + } + + //add new items to the beginning of the list, if there is any + for ( TInt j = 0; j < aItems->Count(); j++ ) + { + i = 0; + while ( i < orderArray->Count() && + !( (*orderArray)[i] == aItems->At(j)->Uid() )) + { + i++; + } + + if ( i == orderArray->Count() && + !(aItems->At(j)->IsFactoryItem() ) && + !(aItems->At(j)->Uid() == + KFavouritesAdaptiveItemsFolderUid) && + !(aItems->At(j)->Uid() == KFavouritesStartPageUid) ) + { + Model().AddUidToLastPlaceL( aItems->At(j)->Uid(), + orderArray, iCurrentOrder ); + } + } + } + Model().ManualSortL(aFolder, iCurrentOrder, orderArray, aItems); + orderArray->Reset(); + } + } + + orderArray->Reset(); + + if ( aItems->Count() ) + { + for ( TInt i = 0; i < aItems->Count(); i++ ) + { + orderArray->AppendL( (*aItems)[i]->Uid() ); + } + iCurrentOrder->SetBookMarksOrderL( *orderArray ); + } + if ( iSaveBMOrder ) + { + iSaveBMOrder = EFalse; + Model().Database().SetData( aFolder, *iCurrentOrder ); + } + CleanupStack::PopAndDestroy( orderArray ); + } + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::GetItemsL +// ---------------------------------------------------------------------------- +// +CFavouritesItemList* CBrowserBookmarksView::GetItemsLC( TInt aFolder ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + CFavouritesItemList* items; + if ( iInAdaptiveBookmarksFolder ) + { + items= new (ELeave) CFavouritesItemList(); + CleanupStack::PushL(items);//1 + CDesCArrayFlat* aditems = new ( ELeave ) + CDesCArrayFlat( KBrowserDesCArrayGranularity ); + aditems->Reset(); + CleanupStack::PushL(aditems);//2 + + CDesCArrayFlat* adnames = new ( ELeave ) + CDesCArrayFlat( KBrowserDesCArrayGranularity ); + adnames->Reset(); + CleanupStack::PushL(adnames);//3 + + CFavouritesItem* adaptiveItem; + + if ( !iRecentUrlStore.GetData( *aditems, *adnames) ) + { + for (TInt i=0;iMdcaCount(); i++) + { + adaptiveItem= CFavouritesItem::NewL(); + CleanupStack::PushL(adaptiveItem);//4 + adaptiveItem->SetUrlL( aditems->MdcaPoint(i) ); + adaptiveItem->SetNameL(adnames->MdcaPoint(i).Left(KFavouritesMaxName)); + adaptiveItem->SetType(CFavouritesItem::EItem); + adaptiveItem->SetParentFolder(KFavouritesAdaptiveItemsFolderUid); + items->AppendL(adaptiveItem); + CleanupStack::Pop(); // adaptiveItem + } + } + CleanupStack::PopAndDestroy( 2 );// aditems, adnames + } + else + { + items = new (ELeave) CFavouritesItemList(); + CleanupStack::PushL( items ); + Model().Database().GetAll( *items, aFolder ); + TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage + if ( aFolder == KFavouritesRootUid ) + { + // Create Start Page item to be displayed in root folder (if exist). + // (Start Page does not really exist in the database.) + CFavouritesItem* startPage = CreateStartPageBookmarkL(); + if ( startPage ) + { + if (!iStartPagePresent) + { + iStartPagePresent = ETrue; + iSaveBMOrder = ETrue; + } + CleanupStack::PushL( startPage ); // ownersip is here. + items->InsertL( 0, startPage ); + CleanupStack::Pop(); // startPage: owner is the list now. + aBMPosition=KAdaptiveBookmarksSecondPositionInBMView; // Adaptive BM folder is second if there is a startpage item + } + else + { + if (iStartPagePresent) + { + iStartPagePresent = EFalse; + iSaveBMOrder = ETrue; + } + } + } + + if ( aFolder == KFavouritesRootUid ) + { + // Create Adaptive Items Folder item to be displayed in root folder (if exist). + // (Start Page does not really exist in the database.) + if ( ( ADAPTIVEBOOKMARKS ) && + ( ApiProvider().Preferences().AdaptiveBookmarks() == + EWmlSettingsAdaptiveBookmarksOn )) + { + CFavouritesItem* adaptiveItemsFolder = + Model().Database().CreateAdaptiveItemsFolderL(); + CleanupStack::PushL(adaptiveItemsFolder); + HBufC* folderName=StringLoader::LoadLC( + R_BROWSER_ADAPTIVE_BOOKMARKS_FOLDER); + adaptiveItemsFolder->SetNameL(*folderName); + + CleanupStack::PopAndDestroy();//folderName + items->InsertL( aBMPosition , adaptiveItemsFolder ); + CleanupStack::Pop(); // adaptiveItemsFolder: owner is the list now. + } + } + ManualBMSortL( aFolder, items ); + } +PERFLOG_STOP_WRITE("\t\t\t\t BM View GetItemsLC" ); + return items; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::RefreshL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::RefreshL( TBool aDbErrorNote ) + { + // Same as base class method, except that refreshing Goto Pane is + // disallowed when fetching is in progress. + // Base class call is TRAP-ped to make sure that frozen state of the Goto + // Pane does not stay in due to a leave; but after removing the frozen + // state, we trow up the catched leave again (if any). + TBool fetching = ApiProvider().Fetching(); + + if ( (fetching && TheContainer() && TheContainer()->GotoPane() ) + || ( TheContainer() && TheContainer()->GotoPane() && TheContainer()->GotoPane()->IsEditing() )) + { + TheContainer()->GotoPane()->Freeze( ETrue ); + } + + TRAPD( err, CBrowserFavouritesView::RefreshL( aDbErrorNote ) ); + + + if ( TheContainer() && TheContainer()->GotoPane() ) + { + TheContainer()->GotoPane()->Freeze( EFalse ); + } + User::LeaveIfError( err ); + // Refresh (i.e. bookmark creation in an empty folder) may cause the need + // for toolbar button state to change. + UpdateToolbarButtonsState(); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::DoActivateL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::DoActivateL ( + const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage + ) + { +PERFLOG_LOCAL_INIT +PERFLOG_STOPWATCH_START + LOG_ENTERFN("CBrowserBookmarksView::DoActivateL"); + LOG_WRITE_FORMAT(" aCustomMessageId: %d", aCustomMessageId); + +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + // Quick activation for first time only to show bookmarks view fast + if(!ApiProvider().StartedUp()) + { + CBrowserFavouritesView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); + if ( aCustomMessageId == KUidCustomMsgDownloadsList ) + { + iShowDownlods = ETrue; + // Show the downloads later since contentview has not initialized yet + } + + // complete remaining application launch process, aynchronously + // complete remaining init as soon as possible, otherwise it can be dangerous (crash) + // since UI code (views) are interdependent + iAsyncComplete = CIdle::NewL( CActive::EPriorityHigh ); + iAsyncComplete->Start( TCallBack( CompleteAppInitCallback, &iApiProvider ) ); + return; + } +#endif + + Toolbar()->HideItem( EWmlCmdAddBookmark, EFalse , ETrue); + +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + Toolbar()->HideItem( EWmlCmdDelete, EFalse , ETrue); +#else + Toolbar()->HideItem( EWmlCmdPreferences, EFalse , ETrue); +#endif + + if ( ApiProvider().Preferences().SearchFeature() ) + { + Toolbar()->HideItem( EWmlCmdGoToAddressAndSearch, EFalse, ETrue); + } + else + { + Toolbar()->HideItem( EWmlCmdGoToAddress, EFalse, ETrue); + } + + Cba()->MakeVisible( ETrue); + + StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); + StatusPane()->MakeVisible( ETrue ); + ApiProvider().Display().ClearMessageInfo(); + + iAdaptiveBookmarksFolderWasActive = EFalse; + + if ( iOpenAdaptiveBookmarksWhenActivated ) + { + iInAdaptiveBookmarksFolder = ETrue; + } + CBrowserFavouritesView::DoActivateL + ( aPrevViewId, aCustomMessageId, aCustomMessage ); + ApiProvider().BrCtlInterface().AddLoadEventObserverL( this ); + + if ( iPreferencesChanged ) + { + iPreferencesChanged=EFalse; + if ( iInAdaptiveBookmarksFolder ) + { + SetEmptyTextL(); + RefreshL(); + } + } + + if ( aCustomMessageId == KUidCustomMsgDownloadsList ) + { + LOG_WRITE(" KUidCustomMsgDownloadsList"); + // open the downloads list asynchronously not to block DoActivateL! + if ( iDownloadsListExecuter == 0 ) + { + iDownloadsListExecuter = new (ELeave) CAsyncDownloadsListExecuter( ApiProvider() ); + } + iDownloadsListExecuter->Start(); + } + if ( iOpenAdaptiveBookmarksWhenActivated ) + { + iInAdaptiveBookmarksFolder = ETrue; + SetEmptyTextL(); + RefreshL(); + iOpenAdaptiveBookmarksWhenActivated = EFalse; + } + + UpdateToolbarButtonsState(); + +PERFLOG_STOP_WRITE("BMView DoActivate") +// LOG_LEAVEFN("CBrowserBookmarksView::DoActivateL"); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CompleteAppInitCallback +// ---------------------------------------------------------------------------- +// +TInt CBrowserBookmarksView::CompleteAppInitCallback( TAny* aProvider ) + { + MApiProvider *apiProvider = STATIC_CAST(MApiProvider*, aProvider); + TBool result = apiProvider->CompleteDelayedInit(); + return result; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::UpdateFavIcons +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::UpdateFavIconsL() + { + if ( Container() && Container()->Listbox() ) + Container()->Listbox()->UpdateFavIconsL(); + } + + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CheckForDownloads +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::CheckForDownloads() + { + if(iShowDownlods) + { + if ( iDownloadsListExecuter == 0 ) + iDownloadsListExecuter = new (ELeave) CAsyncDownloadsListExecuter( ApiProvider() ); + iDownloadsListExecuter->Start(); + } + } +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::DoDeactivate +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::DoDeactivate() + { + if ( !iSaveStateOnDeactivate ) + { + ExitAdaptiveBookmarks(); + } + if ( !ApiProvider().ExitInProgress() ) + { + if ( ApiProvider().StartedUp() ) + ApiProvider().BrCtlInterface().RemoveLoadEventObserver( this ); + } + CBrowserFavouritesView::DoDeactivate(); + iManualItemMovingGoingOn = EFalse; + // UnDim Toolbar buttons + DimToolbarButtons(EFalse); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::GotoUrlInGotoPaneL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::GotoUrlInGotoPaneL() + { +LOG_ENTERFN("BookmarksView::GotoUrlInGotoPaneL"); + CBrowserBookmarksContainer* container = TheContainer(); + if ( container->GotoPane()->IsEditing() ) + { + // Dim Toolbar buttons + DimToolbarButtons(EFalse); + + delete iEnteredURL; + iEnteredURL = NULL; + BROWSER_LOG( ( _L("delete iEnteredUrl 4") ) ); + + iEnteredURL = container->GotoPane()->GetTextL(); + if ( iEnteredURL ) + { + iTrId = 0; + CEikEdwin* editor = STATIC_CAST(CEikEdwin*, container->GotoPane()->ComponentControl(1)); + iCursorPos = editor->CursorPos(); + + UpdateCbaL(); + // Cancel editing, but leave entered text in place. + container->GotoPane()->CancelEditingL(); + + ApiProvider().FetchL( iEnteredURL->Des(), CBrowserLoadObserver::ELoadUrlTypeOther ); + if ( !ApiProvider().Fetching() ) + { + container->SetGotoInactiveL(); + } + } + } + } +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::ExitAdaptiveBookmarks() +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::ExitAdaptiveBookmarks() + { + if (iInAdaptiveBookmarksFolder) + { + iAdaptiveBookmarksFolderWasActive = ETrue; + iInAdaptiveBookmarksFolder=EFalse; + delete iDomainFolderName; + iDomainFolderName=NULL; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::DimToolbarButtons() +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::DimToolbarButtons(TBool aDimButtons) + { + Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, aDimButtons , ETrue ); + Toolbar()->SetItemDimmed( EWmlCmdGoToAddress, aDimButtons , ETrue ); + Toolbar()->SetItemDimmed( EWmlCmdGoToAddressAndSearch, aDimButtons , ETrue ); +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + Toolbar()->SetItemDimmed( EWmlCmdDelete, aDimButtons , ETrue ); +#else + Toolbar()->SetItemDimmed( EWmlCmdPreferences, aDimButtons , ETrue ); +#endif + if (!aDimButtons) + { + // when undimming buttons we may not want them all back on + UpdateToolbarButtonsState(); + } + Toolbar()->DrawNow(); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::ActivateCurrentBookmarkL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::ActivateCurrentBookmarkL() + { + if ( Container() && Container()->Listbox() ) + { + const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); + if ( item && item->IsItem() ) + { + ApiProvider().FetchBookmarkL( *item ); + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::AddNewBookmarkL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::AddNewBookmarkL() + { + // Make an item and fill it with default values. + CFavouritesItem* item = CFavouritesItem::NewLC(); + item->SetType( CFavouritesItem::EItem ); + item->SetParentFolder( CurrentFolder() ); + item->SetUrlL( KHttpString ); + Model().SetNameToDefaultL( *item ); + TInt err = Model().MakeUniqueNameL( *item ); + if ( !err ) + { + // to prevent faded statuspane at the begining of dialog activation + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() ) + ->StatusPane(); + sp->DrawNow(); + + // Dim Toolbar buttons + DimToolbarButtons(ETrue); + + // We have the item with a default unique name. Let the user edit it. + CBrowserBookmarkEditDialog* dialog = + CBrowserBookmarkEditDialog::NewL + ( + *item, + Model(), + //ApiProvider().CommsModel() + ApiProvider() + ); + dialog->ExecuteLD( R_BROWSER_BOOKMARKS_DIALOG_EDIT ); + + // Un-Dim Toolbar buttons + DimToolbarButtons(EFalse); + + // If the bookmark was added to the database, highlight it. + // Unlike in AddNewFolderL, adding the item to the database + // and setting highlight uid (next line of code) runs in the RunL + // method of different active objects. So the database notification + // may have came in or may not by now. + // This way of doing the highlight (setting a preferred and calling + // HighlightPreferred works in both cases. + iPreferredHighlightUid = item->Uid(); + // If not added, iPreferredHighlightUid is now KFavouritesNullUid, + // so the following does nothing. + if ( iPreferredHighlightUid != KFavouritesNullUid ) + { + // Highlight newly added item. + HighlightPreferredL(); + } + } + AddUidToLastPlaceToCurrentListL( item->Uid() ); + iRefresh = EFalse; + Model().Database().SetData( CurrentFolder() , *iCurrentOrder ); + CleanupStack::PopAndDestroy(); // item + Container()->Listbox()->ClearSelection(); + } + + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::AddUidToLastPlaceToCurrentListL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::AddUidToLastPlaceToCurrentListL( TInt aUid ) + { + if ( iCurrentOrder ) + { + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL( orderArray ); + + if (iCurrentOrder->GetBookMarksOrder().Count()) + { + orderArray->AppendL( &( iCurrentOrder->GetBookMarksOrder()[0] ), + iCurrentOrder->GetBookMarksOrder().Count()); + } + + Model().AddUidToLastPlaceL(aUid, orderArray, iCurrentOrder); + + iCurrentOrder->SetBookMarksOrderL( *orderArray ); + CleanupStack::PopAndDestroy( orderArray ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarks::EditCurrentBookmarkL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::EditCurrentBookmarkL() + { + if ( Container() && Container()->Listbox() ) + { + const CFavouritesItem* listboxItem = + Container()->Listbox()->CurrentItem(); + if ( listboxItem && listboxItem->IsItem() ) + { + // to prevent faded statuspane at the begining of dialog activation + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, + CEikonEnv::Static()->EikAppUi() ) + ->StatusPane(); + sp->DrawNow(); + + // Dim Toolbar buttons + DimToolbarButtons(ETrue); + + CFavouritesItem* item = CFavouritesItem::NewLC(); + *item = *listboxItem; + CBrowserBookmarkEditDialog* dialog = + CBrowserBookmarkEditDialog::NewL + ( + *item, + Model(), + ApiProvider(), + listboxItem->Uid() + ); + dialog->ExecuteLD( R_BROWSER_BOOKMARKS_DIALOG_EDIT ); + CleanupStack::PopAndDestroy(); // item + + // unDim Toolbar buttons + DimToolbarButtons(EFalse); + + iPreferredHighlightUid = item->Uid(); + + // Force a refresh of database changes. + iRefresh = ETrue; + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::SendBookmarksL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::SendBookmarksL( ) + { + CArrayPtr* items = + Container()->Listbox()->SelectedItemsLC(); + + MBmOTABinSender& sender = ApiProvider().BmOTABinSenderL(); + + sender.ResetAndDestroy(); + + TBool result( ETrue ); + TInt index( 0 ); + TInt count( items->Count() ); + +#ifndef _BOOKMARK_SENT_ASCII + for ( index = 0; index < count; ++index ) + { + if ( ( *items )[ index ]->Url().Length() > KMaxUrlLenghtInOTA ) + { +#pragma message ( __FILE__ ": TODO: Length of bookmark address cannot exceed 255bytes!") + result = EFalse; + } + } +#endif // _BOOKMARK_SENT_ASCII + + if ( result ) + { + for ( index = 0; index < count; ++index ) + { + sender.AppendL( ( *items )[ index ]->Url(), + ( *items )[ index ]->Name() ); + } + } + + // to save memory + CleanupStack::PopAndDestroy(); // items; + + if ( result ) + { + sender.SendAddressL( ); + } + + Container()->Listbox()->SetCurrentItemIndexAndDraw( Container()->Listbox()->CurrentItemIndex()); + } + + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::TheContainer +// ---------------------------------------------------------------------------- +// +CBrowserBookmarksContainer* CBrowserBookmarksView::TheContainer() + { + return STATIC_CAST( CBrowserBookmarksContainer*, Container() ); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::ApChangedL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::ApChangedL( TUint32 aNewAPId ) + { + if ( aNewAPId != iStartPageApUid ) + { + // New AP has been taken into use. Set Start Page to that. + iStartPageApUid = aNewAPId; + // Redraw view. Note that this does nothing if view is not activated. + RefreshL( EFalse ); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::HandlePreferencesChangeL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::HandlePreferencesChangeL( + const TPreferencesEvent /*aEvent*/, + TPreferencesValues& /*aValues*/, + TBrCtlDefs::TBrCtlSettings /*aSettingType*/ ) + { + // adaptive bookmarks setting changed + if ( iAdaptiveBookmarksCurrentSetting != + ApiProvider().Preferences().AdaptiveBookmarks() ) + { + iAdaptiveBookmarksCurrentSetting = + ApiProvider().Preferences().AdaptiveBookmarks(); + + if ( iAdaptiveBookmarksCurrentSetting != + EWmlSettingsAdaptiveBookmarksOn ) + { + if ( iPreferredHighlightUid == KFavouritesAdaptiveItemsFolderUid ) + { + Container()->Listbox()->View()->SetCurrentItemIndex( 0 ); + } + + ExitAdaptiveBookmarks(); + + if ( iAdaptiveBookmarksCurrentSetting == + EWmlSettingsAdaptiveBookmarksOff ) + { + if ( TBrowserDialogs::ConfirmQueryYesNoL( + R_BROWSER_ADAPTIVE_BOOKMARKS_DELETE_ALL_ADAPTIVE_BOOKMARKS ) ) + { + iRecentUrlStore.ClearData(); + } + } + } + else + { + iInsertAdaptiveBookmarksFolder = ETrue; + iSaveBMOrder = ETrue; + } + } + + TUint32 defaultAp = ApiProvider().Preferences().DefaultAccessPoint(); + + if ( defaultAp != iCurrentDefaultAp ) + { + // Default AP changed. Set Start Page bookmark to that. + iCurrentDefaultAp = iStartPageApUid = defaultAp; + // Redraw view. Note that this does nothing if view is not activated. + RefreshL( EFalse ); + } + + iPreferencesChanged=ETrue; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CreateStartPageBookmarkL +// ---------------------------------------------------------------------------- +// +CFavouritesItem* CBrowserBookmarksView::CreateStartPageBookmarkL() + { +LOG_ENTERFN("CBrowserBookmarksView::CreateStartPageBookmarkL"); + // no HomePage if Type is Bookmarks + // or 'Always ask' feature is selected + TWmlSettingsHomePage pgtype = ApiProvider().Preferences().HomePageType(); + TBool accessPointSelectionMode( + (ApiProvider().Preferences().AccessPointSelectionMode() == EAlwaysAsk) && + ( EWmlSettingsHomePageAccessPoint == pgtype ) ); +LOG_WRITE_FORMAT(" pgType: %d", pgtype ); +LOG_WRITE_FORMAT(" selection mode: %d", accessPointSelectionMode ); + if ( accessPointSelectionMode || (pgtype == EWmlSettingsHomePageBookmarks) ) + { + return NULL; + } + + CFavouritesItem* startPage = NULL; + TUint defaultAp = ApiProvider().Preferences().DefaultAccessPoint(); +LOG_WRITE_FORMAT(" defaultAp: %d", defaultAp ); + if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is an access point defined + { + // Get pointer to Start Page AP (or NULL if no such); + /* + Modified by MOG + --------------------- Performance Changes ---------------------- + remove dependency from CommsModel becasue the cached list may not be pre + CApListItem* apItem = + ApiProvider().CommsModel().AccessPoints()->ItemForUid( defaultAp ); + ---------------------- Performance Changes ---------------------- + */ + CApAccessPointItem* apItem = iApiProvider.Preferences().AllPreferencesL().iDefaultAPDetails; + if ( apItem ) + { + const HBufC* defaultHP = apItem->ReadConstLongTextL( EApWapStartPage ); + if ( defaultHP->Length() ) + { + // Have AP and the AP has Start Page address. Hurray. + startPage = Model().Database().CreateStartPageItemL(); + CleanupStack::PushL( startPage ); + TBuf name; + apItem->ReadTextL(EApWapAccessPointName, name); + startPage->SetNameL( name ); + startPage->SetUrlL( *defaultHP ); + TFavouritesWapAp ap; + ap.SetApId( defaultAp ); + startPage->SetWapAp( ap ); + CleanupStack::Pop(); // startPage: owner is the caller. + } + } + } +//LOG_LEAVEFN("CBrowserBookmarksView::CreateStartPageBookmarkL"); + return startPage; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::OfferKeyEventL +// ---------------------------------------------------------------------------- +// +TKeyResponse CBrowserBookmarksView::OfferKeyEventL( + const TKeyEvent& aKeyEvent, TEventCode aType ) + { + // This method is called back from the container, to process the keypresses + // that cannot be handled by the container. Those are (currently) the + // left/right arrow keypresses, since the container does not know anything + // about what folder is open, which knowledge is required to process + // arrow presses. So we do that here. + // Any other key processing is still in the container. + TKeyResponse result = EKeyWasNotConsumed; + switch ( aKeyEvent.iCode ) + { + + case EKeyLeftArrow: // West + { + if ( ( CurrentFolder() != KFavouritesRootUid ) || ( iInAdaptiveBookmarksFolder ) ) + { + // We are in some folder. Move between subfolders in the leftwards direction. + if ( !ApiProvider().IsEmbeddedModeOn() && !iManualItemMovingGoingOn ) + { + OpenNextFolderL( /*aForward=*/EFalse ); + } + result = EKeyWasConsumed; + } + break; + } + + case EKeyRightArrow: // East + { + if ( ( CurrentFolder() != KFavouritesRootUid ) || ( iInAdaptiveBookmarksFolder ) ) + { + // We are in some folder. Move between subfolders in the rightwards direction. + if ( !ApiProvider().IsEmbeddedModeOn() && !iManualItemMovingGoingOn ) + { + OpenNextFolderL( /*aForward=*/ETrue ); + } + result = EKeyWasConsumed; + } + break; + } + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge + { // Here, "eat" all of the diagonals so they have no effect + result = EKeyWasConsumed; + break; + } + + case EKeyBackspace: + case EKeyDelete: + { + TBrowserFavouritesSelectionState state = + iContainer->Listbox()->SelectionStateL(); + const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); + + if ( ( state.AnyDeletable() ) && + // We can't delete adaptive bookmarks folder or seamless folders' + ( item ) && + ( item->Uid() != KFavouritesAdaptiveItemsFolderUid ) && + ( item->ContextId() == NULL ) + ) + { + // Clear key deletes the selection (or highlighted items). + if (iInAdaptiveBookmarksFolder) + { + HandleCommandL(EWmlCmdDelete); + result = EKeyWasConsumed; + } + else if (iManualItemMovingGoingOn) + // Manual Move in progress -- disable delete key + { + result = EKeyWasConsumed; + } + else + { + result =CBrowserFavouritesView::OfferKeyEventL(aKeyEvent,aType); + } + + } + break; + } + + case EKeyOK: + // OK key is handled through MSK handling + result = EKeyWasConsumed; + break; + + case EKeyEnter: + { + if ( iManualItemMovingGoingOn ) + { + MoveItemsL(); + result = EKeyWasConsumed; + } + else + { + result = CBrowserFavouritesView::OfferKeyEventL(aKeyEvent,aType); + } + break; + } + + default: + { + result =CBrowserFavouritesView::OfferKeyEventL(aKeyEvent,aType); + break; + } + } + + return result; + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::OpenNextFolderL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::OpenNextFolderL( TBool aForward ) + { + if ( !Model().BeginL( EFalse, ETrue ) ) + { + TInt nextFolder; + if ( iInAdaptiveBookmarksFolder ) + { + // If in domain then forget about it + if (iDomainFolderName) + { + delete iDomainFolderName; + iDomainFolderName = NULL; + } + + nextFolder = Model().NextFolderL( KFavouritesAdaptiveItemsFolderUid, + aForward ); + if ( nextFolder != KFavouritesNullUid ) + { + iInAdaptiveBookmarksFolder = EFalse; + } + } + else + { + nextFolder = Model().NextFolderL( CurrentFolder(), aForward ); + } + + if ( nextFolder != KFavouritesNullUid ) + { + if ( nextFolder != KFavouritesAdaptiveItemsFolderUid ) + { + SetEmptyTextL(); + OpenFolderL( nextFolder ); + } + } + Model().CommitL(); + if ( nextFolder == KFavouritesAdaptiveItemsFolderUid ) + { + iInAdaptiveBookmarksFolder=ETrue; + SetEmptyTextL(); + SetRootFolderForAdaptiveBookmarks(); + SetEmptyTextL(); + RefreshL(); + } + } + // Changing folder may require change in toolbar button state + UpdateToolbarButtonsState(); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::UpdateNaviPaneL +// ---------------------------------------------------------------------------- +// +void CBrowserBookmarksView::UpdateNaviPaneL() + { + if (iInAdaptiveBookmarksFolder) + { + // In other folder, show "1/4" style text. + TInt folderIndex; + TInt folderCount; + TInt err; + err = Model().FolderInfoL( KFavouritesAdaptiveItemsFolderUid, + folderCount, folderIndex ); + if ( !err ) + { + TheContainer()->ShowFolderNaviPaneL( folderIndex, folderCount ); + } + } + else + { + CBrowserFavouritesView::UpdateNaviPaneL(); + } + } + +// --------------------------------------------------------------------------- +// CBrowserBookmarksView::HandleBrowserLoadEventL +// --------------------------------------------------------------------------- +// +void CBrowserBookmarksView::HandleBrowserLoadEventL( + TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, + TUint /* aSize */, + TUint16 aTransactionId ) + { +LOG_ENTERFN("BookmarksView::HandleBrowserLoadEventL"); + // only GotoPane is interested in LoadEvents! + if ( Container() ) + { + if ( aLoadEvent != TBrCtlDefs::EEventThumbnailAvailable) + { + // If in bookmarks view, a background page load is in + // progress, just update the soft keys when page load is finished. + // (ie. RSK would be "Stop" while page loading but change to "Exit" + // when page load finished) + if ( aLoadEvent == TBrCtlDefs::EEventLoadFinished ) + { + UpdateCbaL(); + } + } + // save transaction id + if ( aLoadEvent == TBrCtlDefs::EEventUrlLoadingStart && iTrId == 0 ) + { + iTrId = aTransactionId; + } + // first content chunk arrived + else if ( aLoadEvent == TBrCtlDefs::EEventNewUrlContentArrived && + iTrId == aTransactionId ) + { + if ( iEnteredURL ) + { + delete iEnteredURL; + iEnteredURL = NULL; + BROWSER_LOG( ( _L("delete iEnteredUrl 5") ) ); + } + iCursorPos = -1; + } + } + } + + +// --------------------------------------------------------------------------- +// CBrowserBookmarksView::ClearAdaptiveBookmarksL +// --------------------------------------------------------------------------- +// +void CBrowserBookmarksView::ClearAdaptiveBookmarksL() + { + iRecentUrlStore.ClearData(); + Container()->Listbox()->View()->ClearSelection(); + RefreshL(); + } + +// --------------------------------------------------------------------------- +// CBrowserBookmarksView::UpdateToolbarButtonsState +// --------------------------------------------------------------------------- +// +void CBrowserBookmarksView::UpdateToolbarButtonsState() + { + if ( Container() && Container()->Listbox() ) + { + const CFavouritesItem* item = Container()->Listbox()->CurrentItem(); + + // Button: EWmlCmdDelete + // Default case: un-dim the delete Button + // Case: Not an item so dim delete button + // Special Case: dim button for adaptive folder and + // seamless links + TBrowserFavouritesSelectionState state = iContainer->Listbox()->SelectionStateL(); + + TBool needToDimDeleteBtn = !item + || ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) + || ( item->ContextId() != NULL ) + || (!state.AnyDeletable()); + + Toolbar()->SetItemDimmed( EWmlCmdDelete, needToDimDeleteBtn, ETrue ); + //set EWmlCmdAddBookmark dim in RecentlyVisitedUrl Folder + Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, iInAdaptiveBookmarksFolder, ETrue); + if(iManualItemMovingGoingOn) + { + DimToolbarButtons(ETrue); + } + } + } + +void CBrowserBookmarksView::HandleForegroundEventL( TBool aForeground ) + { + // make sure we call base class function before proceeding + CBrowserFavouritesView::HandleForegroundEventL(aForeground); + if ( aForeground ) + { + if ( TheContainer()->GotoPaneActive() && TheContainer()->GotoPane()->PopupList()->IsPoppedUp() ) + { + // The pop up messes the screen when changing layouts + // So make sure to redraw the pane while coming to foreground + TheContainer()->GotoPane()->PopupList()->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + } + } + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFaviconHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFaviconHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,405 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFaviconHandler +* +* +*/ + + +// INCLUDES +#include "BrowserFaviconHandler.h" +#include "ApiProvider.h" +#include "BrowserUtil.h" +#include +#include +#include +#include +#include +#include + +// number of favicons to get before redrawing +const TInt KNumFaviconsToRedraw = 3 ; + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::CBrowserFaviconHandler() +// ---------------------------------------------------------------------------- +// +CBrowserFaviconHandler::CBrowserFaviconHandler( + MApiProvider& aApiProvider, + MBrowserFaviconObserver& aObserver, + TSize aFaviconSize ) : + CActive( CActive::EPriorityIdle ), + iApiProvider( aApiProvider ), + iObserver( aObserver ), + iFaviconSize( aFaviconSize ) + { + CActiveScheduler::Add( this ); + } + + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::~CBrowserFaviconHandler() +// ---------------------------------------------------------------------------- +// +CBrowserFaviconHandler::~CBrowserFaviconHandler() + { + Cancel(); + if(iBmpScaler!=NULL) + { + iBmpScaler->Cancel(); + } + delete iBmpScaler; + delete iFaviconArrayIndices; + delete iFavicon; + } + + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::NewL() +// ---------------------------------------------------------------------------- +// +CBrowserFaviconHandler* CBrowserFaviconHandler::NewL( + MApiProvider& aApiProvider, + CArrayPtr* aIconArray, + MBrowserFaviconObserver& aObserver, + TSize aFaviconSize ) + { + CBrowserFaviconHandler* self = + CBrowserFaviconHandler::NewLC( aApiProvider, + aIconArray, + aObserver, + aFaviconSize ); + + CleanupStack::Pop(); + return self; + } + + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::NewLC() +// ---------------------------------------------------------------------------- +// +CBrowserFaviconHandler* CBrowserFaviconHandler::NewLC( + MApiProvider& aApiProvider, + CArrayPtr* aIconArray, + MBrowserFaviconObserver& aObserver, + TSize aFaviconSize ) + { + CBrowserFaviconHandler* self = + new ( ELeave ) CBrowserFaviconHandler( aApiProvider, + aObserver, + aFaviconSize ); + CleanupStack::PushL( self ); + self->ConstructL( aIconArray ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::ConstructL() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::ConstructL( CArrayPtr* aIconArray ) + { + iIconArray = aIconArray; // not owned + iFaviconArrayIndices = new ( ELeave ) CArrayFixFlat( 4 ); + + // Construct Favicon Engine + iBmpScaler = CBrowserFaviconScaler::NewL(*this); + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::RequestFavicons() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::RequestFavicons( CFavouritesItemList* aFavItems ) + { + TInt count = aFavItems->Count(); + while(count) + { + CFavouritesItem& item = *aFavItems->At( count - 1); // index starts from 0 + CGulIcon *favIcon = NULL; + + // Request Favicon from Engine - there should be new API for request, but no har to use it + if ( item.Url().Length() ) + iFavicon = iApiProvider.BrCtlInterface().GetBitmapData(item.Url(), TBrCtlDefs::EBitmapFavicon ); + + if ( favIcon ) + { + delete iFavicon; + iFavicon = NULL; + } + count--; + } + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::StartGetFaviconsL() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::StartGetFaviconsL( CFavouritesItemList* aFavItems ) + { + Cancel(); + iBmpScaler->Cancel(); + + if ( aFavItems->Count() ) + { + // New request for favicons: + iFavItems = aFavItems; + + // Initialisation. + iFavItemsCurrentIndex = 0; // will be incremented before favicon getting + iFaviconsFound = 0; // keeps track of favicons found + iFaviconArrayIndices->Reset(); // refresh the array mapping uid's to favicons + + // Initiate the getting of favicons + GetFaviconL(); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::GetFaviconL() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::GetFaviconL() + { + // The whole list has already been checked - we're finished + if ( iFavItemsCurrentIndex >= iFavItems->Count() ) + { + iObserver.DrawFavicons(); + } + else + { + // Step through the item array until we find a favicon, or reach the end + do + { + iWasLastItemFavicon = EFalse; + + CFavouritesItem& item = *iFavItems->At( iFavItemsCurrentIndex ); + if ( iFavicon ) + { + // Make sure ongoing scaling is cancelled (if any) + Cancel(); + iBmpScaler->Cancel(); + + delete iFavicon; + iFavicon = NULL; + } + + // Get Favicon from Engine + if ( item.Url().Length() ) + { + iFavicon = iApiProvider.BrCtlInterface().GetBitmapData(item.Url(), TBrCtlDefs::EBitmapFavicon ); + } + + // Asynchronously scales the favicon and stores it in an array + if ( iFavicon ) + { + iWasLastItemFavicon = ETrue; + RescaleFaviconL(); + iFaviconsFound++; + __ASSERT_DEBUG( !( iFavItemsCurrentIndex > iFavItems->Count() ), + Util::Panic( Util::EOutOfRange ) ); + break; + } + } while ( ++iFavItemsCurrentIndex < iFavItems->Count() ); + } + + // If we exited the 'do' and the last item wasn't a favicon + // it means we're finished + if ( !iWasLastItemFavicon && ( iFaviconsFound % KNumFaviconsToRedraw ) ) + { + iObserver.DrawFavicons(); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::RescaleFaviconL() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::RescaleFaviconL() + { + iHasMask = (iFavicon->Mask() != NULL); + if (iHasMask) + { + iBmpScaler->StartScalingL( *iFavicon->Mask(), iFaviconSize, ETrue ); + } + else + { + iBmpScaler->StartScalingL( *iFavicon->Bitmap(), iFaviconSize, EFalse ); + } + // Complete two asynchronous requests. + iStatus = KRequestPending; + SetActive(); + + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::AppendToIconArray() +// ---------------------------------------------------------------------------- +// +TInt CBrowserFaviconHandler::AppendToIconArray() + { + TInt err( KErrNone ); + TInt arrayIndex(-1); + + // Add the favicon to the icon array + TRAP( err, iIconArray->AppendL( iFavicon ); ); + + // Favicon was successfully added to the array + if ( !err ) + { + arrayIndex = iIconArray->Count() - 1; + + // Keep track of the index of the favicon in the icon array + if ( arrayIndex > -1 ) + { + TFaviconIndex faviconIndex; + faviconIndex.iFavouritesItemIndex = iFavItems->At( iFavItemsCurrentIndex )->Uid(); + faviconIndex.iIndex = arrayIndex; + TRAP( err, iFaviconArrayIndices->AppendL( faviconIndex ); ) + + // If there was an error remove the favicon from the icon array + if ( err ) + { + iIconArray->Delete( iIconArray->Count() - 1 ); + } + else + { + iFavicon = NULL; // favicon ownership passed + iFavItemsCurrentIndex++; // we can go to the next item now + } + } + } + + // Ownership of the favicon was not passed, so we need to delete it + if ( err ) + { + iFaviconsFound--; // one less favicon in the array + } + + return err; + } + + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::GetFaviconArrayIndex() +// ---------------------------------------------------------------------------- +// +TInt CBrowserFaviconHandler::GetFaviconArrayIndex( const CFavouritesItem& aItem ) + { + TInt arrayIndex( KErrNotFound ); + + // Find the index of the favicon in the icon array + for ( TInt i=0; iCount(); i++ ) + { + // if uid is 0 then don't associate with favicon. for adaptive bookmarks + if ( aItem.Uid() && aItem.Uid() == iFaviconArrayIndices->At(i).iFavouritesItemIndex ) + { + arrayIndex = iFaviconArrayIndices->At(i).iIndex; + break; + } + } + return arrayIndex; + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::ScalingCompletedL() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::ScalingCompletedL(CFbsBitmap* aResult, const TRect& /*aTargetRect*/) + { + // Check that favicon hasn't already disappeared (i.e. if race cond in which scaler returns + // after you've already left and deleted the icon handle concerned + if(NULL == iFavicon) + { + return; + } + + + // Add the favicon to the icon array (which also contains other icons) + if (iHasMask) + { + iFavicon->SetMask(aResult); + iHasMask = EFalse; + iBmpScaler->StartScalingL( *iFavicon->Bitmap(), iFaviconSize, EFalse ); + } + else + { + iFavicon->SetBitmap(aResult); + iFavicon->SetBitmapsOwnedExternally(EFalse); + TInt err = AppendToIconArray(); + + // Complete the AO + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + } + } +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::DoCancel() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::DoCancel() + { + TRequestStatus* s = &iStatus; + User::RequestComplete( s, KErrNone ); + } + + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::RunL() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::RunL() + { + TBool drawFavicons( EFalse ); + + // Redraw the favicons at a predefined frequency + if ( iFaviconsFound % KNumFaviconsToRedraw == 0 ) + { + drawFavicons = ETrue; + } + else + { + // We're not getting any more favicons: draw any undrawn ones + if ( iStatus != KErrNone ) + { + // do a final draw + drawFavicons = ETrue; + } + } + + if ( drawFavicons && iFaviconsFound ) + { + iObserver.DrawFavicons(); + } + + // Continue getting favicons if no errors + if ( iStatus == KErrNone ) + { + GetFaviconL(); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserFaviconHandler::UpdateIconArray() +// ---------------------------------------------------------------------------- +// +void CBrowserFaviconHandler::UpdateIconArray(CArrayPtr* aIconArray) + { + iIconArray = aIconArray; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFaviconScaler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFaviconScaler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES + +#include "BrowserFaviconScaler.h" + +#include +#include + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS + +// MACROS + +// LOCAL CONSTANTS AND MACROS + +// MODULE DATA STRUCTURES + +// LOCAL FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// ============================= LOCAL FUNCTIONS =============================== + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserFaviconScaler::CBrowserFaviconScaler +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBrowserFaviconScaler::CBrowserFaviconScaler(MBrowserFaviconScalerCallback& aCallback) + : CActive(CActive::EPriorityIdle-1), iCallback(&aCallback) + { + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CBrowserFaviconScaler::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBrowserFaviconScaler::ConstructL() + { + iScaler = CBitmapScaler::NewL(); + } + +// ----------------------------------------------------------------------------- +// CBrowserFaviconScaler::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBrowserFaviconScaler* CBrowserFaviconScaler::NewL(MBrowserFaviconScalerCallback& aCallback) + { + CBrowserFaviconScaler* self = new( ELeave ) CBrowserFaviconScaler(aCallback); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// Destructor +CBrowserFaviconScaler::~CBrowserFaviconScaler() + { + Cancel(); + delete iScaler; + //delete iResultBitmap; + } + + +// ----------------------------------------------------------------------------- +// CBrowserFaviconScaler::StartScalingL +// +// +// ----------------------------------------------------------------------------- +// +void CBrowserFaviconScaler::StartScalingL(CFbsBitmap& aSource, const TRect& aTargetRect, TBool aIsMask) + { + // cancel outstanding request + Cancel(); + + // create target bitmap + iResultBitmap = new (ELeave) CFbsBitmap(); + TDisplayMode dispMode = (aIsMask) ? EGray256 : aSource.DisplayMode(); + User::LeaveIfError(iResultBitmap->Create(aTargetRect.Size(), dispMode)); + + // start scaling, async + iTargetRect = aTargetRect; + iScaler->Scale(&iStatus, aSource, *iResultBitmap, EFalse); + + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CPageOverview::DeleteResultBitmap +// +// +// ----------------------------------------------------------------------------- +// +void CBrowserFaviconScaler::DeleteResultBitmap() + { + delete iResultBitmap; + iResultBitmap = 0; + } + + +// ----------------------------------------------------------------------------- +// CPageOverview::DoCancel +// +// +// ----------------------------------------------------------------------------- +// +void CBrowserFaviconScaler::DoCancel() + { + iScaler->Cancel(); + DeleteResultBitmap(); + } + + +// ----------------------------------------------------------------------------- +// CPageOverview::RunL +// +// +// ----------------------------------------------------------------------------- +// +void CBrowserFaviconScaler::RunL() + { + iCallback->ScalingCompletedL(iResultBitmap, iTargetRect); + // if the callback called StartScalingL(), we must not delete the bitmap + if (!IsActive()) + { + //DeleteResultBitmap(); + } + } + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,362 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesContainer. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for TResourceReader +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "Display.h" +#include "Preferences.h" +#include "BrowserAppUi.h" +#include "BrowserUIVariant.hrh" +#include "CommonConstants.h" +#include "BrowserFavouritesView.h" +#include "BrowserFavouritesContainer.h" +#include "BrowserFavouritesListbox.h" +#include "BrowserFavouritesListboxModel.h" +#include "BrowserFavouritesListboxIconHandler.h" +#include "logger.h" + +// CONSTANTS +LOCAL_D const TInt KTabId = 88888; +LOCAL_D const TInt KMaxNaviText = 25; // format is "/". +_LIT( KFormat, "%d/%d" ); + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::~CBrowserFavouritesContainer +// ----------------------------------------------------------------------------- +// +CBrowserFavouritesContainer::~CBrowserFavouritesContainer() + { + delete iListbox; + delete iIconHandler; + delete iSkinContext; + delete iNaviPaneTabsFolder; + } + + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::ShowRootNaviPane +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::ShowRootNaviPane() + { + // If text is showing, destroy now - this pops off teh Navi Pane. + delete iNaviPaneTabsFolder; + iNaviPaneTabsFolder = NULL; + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::ShowFolderNaviPaneL +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::ShowFolderNaviPaneL +( TInt aFolderIndex, TInt aFolderCount ) + { + CAknNavigationControlContainer* naviPane = + iView->ApiProvider().Display().NaviPaneL(); + if ( !iNaviPaneTabsFolder ) + { + // Folder's tab group not yet created. Make it now. + iNaviPaneTabsFolder = naviPane->CreateTabGroupL(); + iNaviPaneTabsFolder->SetNaviDecoratorObserver(this); + } + + TBuf buf; + // Format Navi Pane text "1/4" style. + buf.Format( KFormat, aFolderIndex + 1, aFolderCount ); + AknTextUtils::LanguageSpecificNumberConversion( buf ); + + CEikImage* folderIcon = new (ELeave) CEikImage; + CleanupStack::PushL( folderIcon ); + TResourceReader rr; + iCoeEnv->CreateResourceReaderLC( rr, R_BROWSER_ICON_PROP_FOLDER ); + folderIcon->ConstructFromResourceL( rr ); + folderIcon->SetPictureOwnedExternally( EFalse ); // has ownership now + CleanupStack::PopAndDestroy(); // rr + + CAknTabGroup* tabGroup = + STATIC_CAST( CAknTabGroup*, iNaviPaneTabsFolder->DecoratedControl() ); + if ( tabGroup->TabCount() ) + { + // Already created. Change the contents. + tabGroup->ReplaceTabL + ( + KTabId, + buf, + folderIcon->Bitmap(), // ownership passed + folderIcon->Mask() // ownership passed + ); + } + else + { + // Created just now. Add the contents. + tabGroup->AddTabL + ( + KTabId, + buf, + folderIcon->Bitmap(), // ownership passed + folderIcon->Mask() // ownership passed + ); + } + folderIcon->SetPictureOwnedExternally( ETrue ); // ownership passed + CleanupStack::PopAndDestroy(); // folderIcon + + tabGroup->SetTabFixedWidthL( EAknTabWidthWithOneTab ); + tabGroup->SetActiveTabById( KTabId ); + + iNaviPaneTabsFolder->SetScrollButtonDimmed + ( CAknNavigationDecorator::ELeftButton, aFolderIndex == 0 ); + iNaviPaneTabsFolder->SetScrollButtonDimmed + ( + CAknNavigationDecorator::ERightButton, + aFolderIndex == aFolderCount - 1 + ); + + // If not yet pushed, this will do the push; if already there, this brings + // it to top and draws. + naviPane->PushL( *iNaviPaneTabsFolder ); + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::ComponentControl +// ----------------------------------------------------------------------------- +// +CCoeControl* CBrowserFavouritesContainer::ComponentControl +( TInt aIndex ) const + { + switch (aIndex) + { + case 0: + return iListbox; + + default: + return 0; + } + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::CountComponentControls +// ----------------------------------------------------------------------------- +// +TInt CBrowserFavouritesContainer::CountComponentControls() const + { + return (iListbox ? 1 : 0) ; + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::SizeChanged +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::SizeChanged() + { + // Listbox is empty; listbox takes the whole area. + iListbox->SetRect( Rect() ); + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::OfferKeyEventL +// ----------------------------------------------------------------------------- +// +TKeyResponse CBrowserFavouritesContainer::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + CBrowserAppUi* ui = CBrowserAppUi::Static(); + TKeyResponse result = EKeyWasNotConsumed; + + if (ui->OfferApplicationSpecificKeyEventL(aKeyEvent, aType) == EKeyWasConsumed) + { + return EKeyWasConsumed; + } + + + if ( result == EKeyWasNotConsumed ) + { + // Otherwise, give the view a chance to handle arrow presses + // (moving between subfolders). + result = iView->OfferKeyEventL( aKeyEvent, aType ); + } + + if ( result == EKeyWasNotConsumed && iListbox ) + { + // Otherwise, let the listbox fiddle with it. This will NOT consume + // arrow presses (base class overridden). + result = iListbox->OfferKeyEventL( aKeyEvent, aType ); + + if( (aKeyEvent.iCode == EKeyDownArrow) || (aKeyEvent.iCode == EKeyUpArrow) ) + { + iView->UpdateToolbarButtonsState(); + } + + } + + return result; + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::HandleCursorChangedL +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::HandleCursorChangedL +( CEikListBox* /*aListBox*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::HandleNaviDecoratorEventL +// +// Called when user touches the left or right arrow in navipane +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::HandleNaviDecoratorEventL( TInt aEventID ) + { + // used to swap the arrow key functionality for Arabic, etc... + TBool forward(!(AknLayoutUtils::PenEnabled() && AknLayoutUtils::LayoutMirrored())); + + switch (aEventID) + { + case MAknNaviDecoratorObserver::EAknNaviDecoratorEventRightTabArrow: + iView->ShowNextFolerL(forward); + break; + case MAknNaviDecoratorObserver::EAknNaviDecoratorEventLeftTabArrow: + iView->ShowNextFolerL(!forward); + break; + default: + break; + } + } + + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::ConstructComponentControlsL +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::ConstructComponentControlsL( + const TRect& /*aRect*/, + CBrowserFavouritesView& aView ) + { + // Construct listbox. + iIconHandler = CreateListboxIconHandlerL(); + iListbox = CBrowserFavouritesListbox::NewL( iView->ApiProvider(), this, *iIconHandler ); + iListbox->SetListBoxObserver( &aView ); + iListbox->SetListboxCursorObserver( this ); + HBufC* buf = iCoeEnv->AllocReadResourceLC( ListboxEmptyTextResourceId() ); + iListbox->View()->SetListEmptyTextL( *buf ); + CleanupStack::PopAndDestroy(); // buf + + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::ConstructL +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::ConstructL +( const TRect& aRect, CBrowserFavouritesView& aView ) + { + iView = &aView; + + //CAknNavigationControlContainer* naviPane = iView->ApiProvider().Display().NaviPaneL(); + + CreateWindowL(); + SetMopParent( iView ); + + ConstructComponentControlsL( aRect, *iView ); + + TAknsItemID tileIID = KAknsIIDSkinBmpListPaneNarrowA; + TAknLayoutRect listGenPane; + listGenPane.LayoutRect(iAvkonAppUi->ClientRect() , + AknLayout::list_gen_pane( 0 )); + + TAknLayoutRect column; + column.LayoutRect(iAvkonAppUi->ClientRect() , + AknLayout::A_column()); + + iSkinContext = CAknsListBoxBackgroundControlContext::NewL( + KAknsIIDSkinBmpMainPaneUsual, + listGenPane.Rect(), //TODOVRa: Should come from LAF! + EFalse, tileIID, + column.Rect() ); //TODOVRa: Should come from LAF! + SetRect( aRect ); + ActivateL(); + } + + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::MopSupplyObject +// ----------------------------------------------------------------------------- +// +TTypeUid::Ptr CBrowserFavouritesContainer::MopSupplyObject( TTypeUid aId ) + { + if( aId.iUid == MAknsControlContext::ETypeId ) + { + return MAknsControlContext::SupplyMopObject( aId, iSkinContext ); + } + + return SupplyMopObject( aId, (MAknEditingStateIndicator*)NULL ); + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::HandleResourceChange +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::HandleResourceChange( TInt aType ) + { + // goes through all the subcomponents + CCoeControl::HandleResourceChange( aType ); + + if (aType == KEikDynamicLayoutVariantSwitch) + { + SetRect(iView->ClientRect()); + DrawDeferred(); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserFavouritesContainer::FocusChanged +// ----------------------------------------------------------------------------- +// +void CBrowserFavouritesContainer::FocusChanged( TDrawNow aDrawNow ) + { + if ( iListbox && iListbox->IsVisible() ) + { + Listbox()->SetFocus( IsFocused(), aDrawNow ); + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesFolderListboxIconHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesFolderListboxIconHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,289 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of TWmlBrowserFavouritesFolderListboxIconHandler. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include "BrowserFavouritesFolderListboxIconHandler.h" +#include "BrowserFavouritesIconIndexArray.h" +#include "BrowserFavouritesView.h" +#include +#include +#include +#include +#include + +#include "CommonConstants.h" +#include + +// CONSTANTS + +// MACROS + +// LOCAL TYPES + +/** +* Icon indexes. Numeric values MUST match the resource definition order. +*/ +enum + { + EIconIndexListboxMark = 0, ///< Listbox mark icon index. + EIconIndexFolder = 1, ///< Folder icon index. + EIconIndexRootFolder = 2, ///< Root folder icon index. + EIconIndexHomepage = 3, ///< Homepage icon index. + EIconIndexLastVisitedPage = 4, ///< Last Visited icon index. + EIconIndexBookmark = 5, ///< Bookmark icon index. + EIconIndexCsdBearer = 6, ///< CSD bearer icon index. + EIconIndexHscsdBearer = 7, ///< HSCSD bearer icon index. + EIconIndexGprsBearer = 8, ///< GPRS bearer icon index. + EIconIndexSeamlessLinksFolder = 9 ///< Seamless links icon index + }; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TBrowserFavouritesFolderListboxIconHandler::IconArrayResourceId +// --------------------------------------------------------- +// +TInt TBrowserFavouritesFolderListboxIconHandler::IconArrayResourceId() const + { + return R_BROWSER_FAVOURITES_FOLDER_LISTBOX_ICONS; + } + +//----------------------------------------------------------------------------- +// MBrowserFavouritesListboxIconHandler::IconIndexes +//----------------------------------------------------------------------------- +// +TBrowserFavouritesIconIndexes + TBrowserFavouritesFolderListboxIconHandler::IconIndexes( + const CFavouritesItem& aItem ) const + { + TBrowserFavouritesIconIndexes indexes; + indexes.iItemIcon = ItemIconIndex( aItem ); + indexes.iBearerIcon = KBrowserFavouritesNoBearerIcon; //Bearer icons removed + return indexes; + } + +// --------------------------------------------------------- +// TBrowserFavouritesFolderListboxIconHandler::ItemIconIndex +// --------------------------------------------------------- +// +TInt TBrowserFavouritesFolderListboxIconHandler::ItemIconIndex +( const CFavouritesItem& aItem,CBrowserFavouritesListbox* /*aListbox*/ ) const + { + return ItemIconIndex(aItem); + } + +// --------------------------------------------------------- +// TBrowserFavouritesFolderListboxIconHandler::ItemIconIndex +// --------------------------------------------------------- +// +TInt TBrowserFavouritesFolderListboxIconHandler::ItemIconIndex +( const CFavouritesItem& aItem ) const + { + if ( aItem.Uid() == KFavouritesRootUid ) + { + return EIconIndexRootFolder; + } + if ( aItem.Uid() == KFavouritesHomepageUid ) + { + return EIconIndexHomepage; + } + if ( aItem.Uid() == KFavouritesStartPageUid ) + { + return EIconIndexHomepage; + } + if ( aItem.Uid() == KFavouritesLastVisitedUid ) + { + return EIconIndexLastVisitedPage; + } + + //seamless links folders have a different icon + if( CBrowserFavouritesView::IsSeamlessFolder( aItem.ContextId() ) ) + { + return EIconIndexSeamlessLinksFolder; + } + + return aItem.IsItem() ? EIconIndexBookmark : EIconIndexFolder; + } + + +// --------------------------------------------------------- +// TBrowserFavouritesFolderListboxIconHandler::LoadIconsL +// --------------------------------------------------------- +// +CAknIconArray* TBrowserFavouritesFolderListboxIconHandler::LoadIconsL() const +{ + CAknIconArray* icons = + new(ELeave) CAknIconArray( 20 ); + CleanupStack::PushL(icons); // PUSH Icon + CGulIcon* newIcon; + CFbsBitmap *newIconBmp; + CFbsBitmap *newIconMaskBmp; + + TBuf iconFileAvkon= KAvkonMbmPath(); + TParse* fp = new(ELeave) TParse(); + CleanupStack::PushL(fp); + TInt err = fp->Set(KBrowserDirAndFile, &KDC_APP_BITMAP_DIR, NULL); + if (err != KErrNone) + { + User::Leave(err); + } + TBuf iconFileBrowser= fp->FullName(); + CleanupStack::PopAndDestroy(fp); + + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiMarkedAdd, + newIconBmp, + newIconMaskBmp, + iconFileAvkon, + EMbmAvkonQgn_indi_marked_add, + EMbmAvkonQgn_indi_marked_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmAvkonQgn_prop_folder_small; maskId = EMbmAvkonQgn_prop_folder_small_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropFolderSmall, + newIconBmp, + newIconMaskBmp, + iconFileAvkon, + EMbmAvkonQgn_prop_folder_small, + EMbmAvkonQgn_prop_folder_small_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmAvkonQgn_indi_level_back; maskId = EMbmAvkonQgn_indi_level_back_mask; } + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiLevelBack, + newIconBmp, + newIconMaskBmp, + iconFileAvkon, + EMbmAvkonQgn_indi_level_back, + EMbmAvkonQgn_indi_level_back_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //"z:\\system\\apps\\browser\\Browser.mbm"; + //EMbmBrowserQgn_prop_wml_home; maskId = EMbmBrowserQgn_prop_wml_home_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlHome, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_home, + EMbmBrowserQgn_prop_wml_home_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_bm_last; maskId = EMbmBrowserQgn_prop_wml_bm_last_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlBmLast, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_bm_last, + EMbmBrowserQgn_prop_wml_bm_last_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_bm; maskId = EMbmBrowserQgn_prop_wml_bm_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlBm, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_bm, + EMbmBrowserQgn_prop_wml_bm_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_indi_wml_csd_add; maskId = EMbmBrowserQgn_indi_wml_csd_add_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiWmlCsdAdd, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_indi_wml_csd_add, + EMbmBrowserQgn_indi_wml_csd_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_indi_wml_hscsd_add; maskId = EMbmBrowserQgn_indi_wml_hscsd_add_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiWmlHscsdAdd, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_indi_wml_hscsd_add, + EMbmBrowserQgn_indi_wml_hscsd_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_indi_wml_gprs_add; maskId = EMbmBrowserQgn_indi_wml_gprs_add_mask; }, + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnIndiWmlGprsAdd, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_indi_wml_gprs_add, + EMbmBrowserQgn_indi_wml_gprs_add_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + //EMbmBrowserQgn_prop_wml_folder_link_seamless; maskId = EMbmBrowserQgn_prop_wml_folder_link_seamless_mask; } + AknsUtils::CreateIconLC( skinInstance, + KAknsIIDQgnPropWmlFolderLinkSeamless, + newIconBmp, + newIconMaskBmp, + iconFileBrowser, + EMbmBrowserQgn_prop_wml_folder_link_seamless, + EMbmBrowserQgn_prop_wml_folder_link_seamless_mask); + newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp); + CleanupStack::Pop(2); // newIconBmp, newIconMaskBmp (see CreateIconLC) + CleanupStack::PushL(newIcon); + icons->AppendL( newIcon ); + CleanupStack::Pop(newIcon); + + CleanupStack::Pop(); // POP Icon + return icons; +} + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesFolderSelector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesFolderSelector.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesFolderSelector. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "BrowserFavouritesFolderSelector.h" +#include "BrowserFavouritesModel.h" +#include "BrowserFavouritesIconIndexArray.h" +#include "BrowserUtil.h" +#include "ApiProvider.h" +#include "CommsModel.h" +#include "CommonConstants.h" +#include "BrowserFavouritesView.h" + +// CONSTANTS + +/** +* Granularity of the listbox item array. +*/ +LOCAL_C const TInt KGranularity = 4; + +/** +* Buffer size for formatting listbox text. Maximum item name +* plus listbox internals (tabulators for icons etc.) must fit into it. +* The format is "\t", +* so the added length is 4. +*/ +LOCAL_C const TInt KMaxListboxLineLen = KFavouritesMaxName + 4; + +/** +* Format for formatting a listbox line. +*/ +_LIT( KListboxLineFormat, "%d\t%S" ); + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelectorListbox::CBrowserFavouritesFolderSelectorListbox +// --------------------------------------------------------- +// +CBrowserFavouritesFolderSelectorListbox::CBrowserFavouritesFolderSelectorListbox( const TBrowserFavouritesFolderListboxIconHandler* aIconHandler ) : + CAknSingleGraphicPopupMenuStyleListBox() + { + iIconHandler = aIconHandler; + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelectorListbox::HandleResourceChange +// --------------------------------------------------------- +// +void CBrowserFavouritesFolderSelectorListbox::HandleResourceChange( TInt aType ) +{ + if ( aType == KAknsMessageSkinChange ) + { + CArrayPtr* array = + ItemDrawer()->ColumnData()->IconArray(); + + array->ResetAndDestroy(); + delete array; + + CAknIconArray* iconArray = NULL; + TRAPD( err, + iconArray = iIconHandler->CreateIconArrayL() + ) + + if ( !err ) + { + ItemDrawer()->ColumnData()->SetIconArray( iconArray ); + } + delete iconArray; + } + return; +} + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::NewL +// --------------------------------------------------------- +// +CBrowserFavouritesFolderSelector* CBrowserFavouritesFolderSelector::NewL + ( + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + TInt aExcludeFolder + ) + { + CBrowserFavouritesFolderSelector* selector = + new (ELeave) CBrowserFavouritesFolderSelector + ( aModel, aApiProvider, aExcludeFolder ); + CleanupStack::PushL( selector ); + selector->ConstructL(); + CleanupStack::Pop(); // selector + return selector; + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::CBrowserFavouritesFolderSelector +// --------------------------------------------------------- +// +CBrowserFavouritesFolderSelector::CBrowserFavouritesFolderSelector + ( + CBrowserFavouritesModel& aModel, + MApiProvider& aApiProvider, + TInt aExcludeFolder + ) +: iModel( &aModel ), + iApiProvider( &aApiProvider ), + iExcludeFolder( aExcludeFolder ) + { + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::~CBrowserFavouritesFolderSelector +// --------------------------------------------------------- +// +CBrowserFavouritesFolderSelector::~CBrowserFavouritesFolderSelector() + { + delete iListboxItemArray; + delete iListbox; + delete iIconIndexes; + delete iItems; + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesFolderSelector::ConstructL() + { + iListbox = new (ELeave) CBrowserFavouritesFolderSelectorListbox( &iIconHandler ); + iPopupList = CAknPopupList::NewL + ( iListbox, R_BROWSER_FAVOURITES_CBA_MOVETOFOLDER_MOVECANCEL_MOVE ); + HBufC* title = CCoeEnv::Static()->AllocReadResourceLC + ( R_BROWSER_FAVOURITES_TEXT_MOVE_TO_PRMPT ); + iPopupList->SetTitleL( *title ); + CleanupStack::PopAndDestroy(); // title + iListbox->ConstructL + ( iPopupList, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); + iListboxItemArray = new (ELeave) CDesCArrayFlat( KGranularity ); + CTextListBoxModel* listboxModel = iListbox->Model(); + listboxModel->SetItemTextArray( iListboxItemArray ); + listboxModel->SetOwnershipType( ELbmDoesNotOwnItemArray ); + iListbox->CreateScrollBarFrameL( ETrue ); + iListbox->ScrollBarFrame()->SetScrollBarVisibilityL + ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + iListbox->ItemDrawer()->ColumnData()->SetIconArray + ( iIconHandler.CreateIconArrayL() ); + iListbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::ExecuteLD +// --------------------------------------------------------- +// +TInt CBrowserFavouritesFolderSelector::ExecuteLD() + { + TInt uid = KFavouritesNullUid; + GetDataL(); + FillListboxL(); + if ( iPopupList->ExecuteLD() ) + { + uid = iItems->IndexToUid( iListbox->View()->CurrentItemIndex() ); + } + iPopupList = NULL; // ExecuteLD has already deleted it. + delete this; + return uid; + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::GetDataL +// --------------------------------------------------------- +// +void CBrowserFavouritesFolderSelector::GetDataL() + { + // Getting data. Make sure that the item and icon index data does not + // go out of sync - only set them to members when both is gotten. + CFavouritesItemList* items = GetItemsLC(); + CBrowserFavouritesIconIndexArray* iconIndexes = + GetIconIndexesLC( *items ); + // Replace data with new. + delete iIconIndexes; // Not NULL-ed, because... + delete iItems; // Not NULL-ed, because... + iItems = items; // ... this cannot leave + iIconIndexes = iconIndexes; // ... this cannot leave + CleanupStack::Pop( 2 ); // iconIndexes, items: now members. + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::FillListboxL +// --------------------------------------------------------- +// +void CBrowserFavouritesFolderSelector::FillListboxL() + { + TBuf buf; + TBuf name; + TInt i; + TInt resId = 0; + + iListboxItemArray->Reset(); + + for ( i = 0; i < iItems->Count(); i++ ) + { + if(!iItems->At(i)->IsHidden()) + { + + resId = CBrowserFavouritesView::GetSeamlessFolderResourceID( + iItems->At(i)->ContextId() ); + + if(resId) // a seamless link folder. Get the localised name. + { + HBufC* seamlessLinkName = CCoeEnv::Static()->AllocReadResourceLC( resId ); + name = seamlessLinkName->Des(); + CleanupStack::PopAndDestroy(); // seamlessLinkName + } + else // not a seamless link folder. + { + name = iItems->At( i )->Name(); + // Replace TAB characters with spaces. + for ( TInt i = 0; i < name.Length(); i++ ) + { + if ( name[i] == '\t' ) + { + name[i] = ' '; + } + } + } + + buf.Format( KListboxLineFormat, iIconIndexes->At( i ).iItemIcon, &name ); + iListboxItemArray->AppendL( buf ); + } + else + { + iItems->Delete(i); + i--; + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::GetItemsLC +// --------------------------------------------------------- +// +CFavouritesItemList* CBrowserFavouritesFolderSelector::GetItemsLC() + { + CFavouritesItemList* items = new (ELeave) CFavouritesItemList(); + CleanupStack::PushL( items ); + + if ( iModel->BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) + == KErrNone ) + { + // Get all folders. + iModel->Database().GetAll + ( *items, KFavouritesNullUid, CFavouritesItem::EFolder ); + iModel->CommitL(); + + // Remove iExcludeFolder. + TInt index = items->UidToIndex( iExcludeFolder ); + if ( index >= 0 ) + { + items->Delete( index ); + } + + // Set custom localized name for root. + index = items->UidToIndex( KFavouritesRootUid ); + if ( index >= 0 ) + { + HBufC* rootName = CCoeEnv::Static()->AllocReadResourceLC + ( R_BROWSER_FAVOURITES_TEXT_FLDR_ROOT_LEVEL ); + items->At( index )->SetNameL( *rootName ); + CleanupStack::PopAndDestroy(); // rootName + } + + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat( KGranularityHigh ); + CleanupStack::PushL( orderArray ); + CBrowserBookmarksOrder* currentOrder = CBrowserBookmarksOrder::NewLC();; + if ( iModel->Database().GetData( KFavouritesRootUid ,*currentOrder ) == KErrNone) + { + if ( currentOrder->GetBookMarksOrder().Count() > 0 ) + { + orderArray->AppendL( &( currentOrder->GetBookMarksOrder()[0] ), currentOrder->GetBookMarksOrder().Count()); + orderArray->InsertL( 0 , KFavouritesRootUid ); + iModel->ManualSortL( KFavouritesRootUid, currentOrder, orderArray, items ); + } + } + else + { + iModel->SortL( *items ); + } + CleanupStack::Pop(2);// orderArray, currentOrder + } + + return items; + } + +// --------------------------------------------------------- +// CBrowserFavouritesFolderSelector::GetIconIndexesLC +// --------------------------------------------------------- +// +CBrowserFavouritesIconIndexArray* +CBrowserFavouritesFolderSelector::GetIconIndexesLC +( CFavouritesItemList& aItems ) + { + // Create new empty list. + CBrowserFavouritesIconIndexArray* iconIndexes = + new (ELeave) CBrowserFavouritesIconIndexArray( KGranularity ); + CleanupStack::PushL( iconIndexes ); + // Get list of access points. Not copy, owned by the AP model. + // const CApListItemList* apList = iApiProvider->CommsModel().AccessPoints(); + // Fill the list. + TInt i = 0; + TInt count = aItems.Count(); + for ( i = 0; i < count; i++ ) + { + iconIndexes->AppendL + ( iIconHandler.IconIndexes( *(aItems.At( i ) ) ) ); + } + return iconIndexes; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesIncrementalDelete.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesIncrementalDelete.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserFavouritesIncrementalDelete. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include "BrowserFavouritesIncrementalDelete.h" +#include "BrowserFavouritesModel.h" + +// CONSTANTS + +/// Granularity of the folder-contents array. +LOCAL_D const TInt KGranularity = 4; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalDelete::NewL +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalDelete* +CBrowserFavouritesIncrementalDelete::NewL + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aNotDeletedUids, + TInt aPriority /*=CActive::EPriorityStandard*/ + ) + { + CBrowserFavouritesIncrementalDelete* incDel = + new (ELeave) CBrowserFavouritesIncrementalDelete + ( aModel, aUids, aNotDeletedUids, aPriority ); + CleanupStack::PushL( incDel ); + incDel->ConstructL(); + CleanupStack::Pop(); // incDel + return incDel; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalDelete::~CBrowserFavouritesIncrementalDelete +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalDelete::~CBrowserFavouritesIncrementalDelete() + { + delete iFolderContents; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalDelete::CBrowserFavouritesIncrementalDelete +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalDelete::CBrowserFavouritesIncrementalDelete + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aNotDeletedUids, + TInt aPriority + ) +: CBrowserFavouritesIncrementalOp( aModel, aPriority ), iUids( &aUids ), + iNotDeletedUids( &aNotDeletedUids ), iFolderPending( EFalse ), iIndex( 0 ) + { + } + +// CBrowserFavouritesIncrementalDelete::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalDelete::ConstructL() + { + CBrowserFavouritesIncrementalOp::ConstructL(); + iFolderContents = new (ELeave) CArrayFixFlat( KGranularity ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalDelete::StepL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesIncrementalDelete::StepL() + { + if ( iFolderContents->Count() ) + { + // Deleting one item from folder. + (void)iModel->Database().Delete( iFolderContents->At( 0 ) ); + iFolderContents->Delete( 0 ); + } + else if ( iIndex < iUids->Count() ) + { + // Still have item in the main list to delete. + TInt uid = iUids->At( iIndex ); + // Check if it is a non-empty folder: get contents. + // + // The variable iFolderPending is a performance optimization: avoid + // querying contents of a folder twice. (If iFolderPending == ETrue, + // and we reach this point, that means that the last item in a folder + // was deleted in the last StepL. The contents of this folder were + // already queried). + if ( !iFolderPending ) + { + // The contents of this folder were not queried yet: do it now. + iModel->Database().GetUids( *iFolderContents, uid ); + } + if ( iFolderContents->Count() ) + { + // Folder is not empty, do nothing now. iIndex is not incremented + // (deletion of this folder becomes pending) and next StepL will + // begin deleting the contents. + iFolderPending = ETrue; + } + else + { + // Deleting an empty (pending) folder or an ordinary item. + iFolderPending = EFalse; + if ( iModel->Database().Delete( uid ) != KErrNone ) + { + // Error deleting. + iNotDeletedUids->AppendL( uid ); + } + iIndex++; + } + } + return iUids->Count() - iIndex; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalDelete::CreateWaitNoteLC +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalDelete::CreateWaitNoteLC() + { + iWaitNote = new (ELeave) CAknWaitDialog + ( REINTERPRET_CAST( CEikDialog**, &iWaitNote ) ); + iWaitNote->PrepareLC( R_WMLBROWSER_FAVOURITES_NOTE_DELETING ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesIncrementalMove.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesIncrementalMove.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserFavouritesIncrementalMove. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include "BrowserFavouritesIncrementalMove.h" +#include "BrowserFavouritesModel.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalMove::NewL +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalMove* +CBrowserFavouritesIncrementalMove::NewL + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aUnmovableUids, + CArrayFix& aConflictingNameUids, + TInt aTargetFolder, + TInt aPriority /*=CActive::EPriorityStandard*/ + ) + { + CBrowserFavouritesIncrementalMove* incMove = + new (ELeave) CBrowserFavouritesIncrementalMove + ( + aModel, + aUids, + aUnmovableUids, + aConflictingNameUids, + aTargetFolder, + aPriority + ); + CleanupStack::PushL( incMove ); + incMove->ConstructL(); + CleanupStack::Pop(); // incMove + return incMove; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalMove::~CBrowserFavouritesIncrementalMove +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalMove::~CBrowserFavouritesIncrementalMove() + { + delete iItem; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalMove::CBrowserFavouritesIncrementalMove +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalMove::CBrowserFavouritesIncrementalMove + ( + CBrowserFavouritesModel& aModel, + CArrayFix& aUids, + CArrayFix& aUnmovableUids, + CArrayFix& aConflictingNameUids, + TInt aTargetFolder, + TInt aPriority + ) +: CBrowserFavouritesIncrementalOp( aModel, aPriority ), + iUids( &aUids ), + iUnmovableUids( &aUnmovableUids ), + iConflictingNameUids( &aConflictingNameUids ), + iTargetFolder( aTargetFolder ), + iIndex( 0 ) + { + } + +// CBrowserFavouritesIncrementalMove::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalMove::ConstructL() + { + CBrowserFavouritesIncrementalOp::ConstructL(); + iItem = CFavouritesItem::NewL(); + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalMove::StepL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesIncrementalMove::StepL() + { + if ( iIndex < iUids->Count() ) + { + TInt uid = iUids->At( iIndex ); + TInt err = iModel->Database().Get( uid, *iItem ); + if ( !err ) + { + iItem->SetParentFolder( iTargetFolder ); + err = iModel->Database().Update + ( *iItem, uid, /*aAutoRename=*/EFalse ); + } + switch ( err ) + { + case KErrNone: + { + // All is well. + break; + } + case KErrAlreadyExists: + { + iConflictingNameUids->AppendL( uid ); + break; + } + default: + { + iUnmovableUids->AppendL( uid ); + break; + } + } + iIndex++; + } + return iUids->Count() - iIndex; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalMove::CreateWaitNoteLC +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalMove::CreateWaitNoteLC() + { + iWaitNote = new (ELeave) CAknWaitDialog + ( REINTERPRET_CAST( CEikDialog**, &iWaitNote ) ); + iWaitNote->PrepareLC( R_WMLBROWSER_FAVOURITES_NOTE_MOVING ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesIncrementalOp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesIncrementalOp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserFavouritesIncrementalOp. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include "BrowserFavouritesIncrementalOp.h" +#include "BrowserFavouritesModel.h" +#include "Browser.hrh" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::~CBrowserFavouritesIncrementalOp +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalOp::~CBrowserFavouritesIncrementalOp() + { + // Base class cancels. + delete iWaitNote; // Safety code. + if ( iWait && iWait->IsStarted() ) // Safety code. + { + iWait->AsyncStop(); + } + delete iWait; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::ExecuteL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalOp::ExecuteL() + { + CreateWaitNoteLC(); + iWaitNote->SetCallback( this ); + iWaitNote->RunLD(); + Call(); // Schedule first step. + iWait->Start(); // Wait for completion. + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::CBrowserFavouritesIncrementalOp +// --------------------------------------------------------- +// +CBrowserFavouritesIncrementalOp::CBrowserFavouritesIncrementalOp + ( + CBrowserFavouritesModel& aModel, + TInt aPriority /*=CActive::EPriorityStandard*/ + ) +: CAsyncOneShot( aPriority ), iModel( &aModel ) + { + // Base class adds this to the Active Scheduler. + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalOp::ConstructL() + { + iWait = new (ELeave) CActiveSchedulerWait(); + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::DoneL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalOp::DoneL() + { + // Default is do nothing. + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::RunL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalOp::RunL() + { + if ( StepL() ) + { + // More steps to go. + Call(); + } + else + { + // This call deletes the dialog and NULL-s ptr. When dialog goes down, + // DialogDismisedL will be called, and we call DoneL() and stop + // waiting there. + iWaitNote->ProcessFinishedL(); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::DoCancel +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalOp::DoCancel() + { + delete iWaitNote; + iWaitNote = NULL; + iWait->AsyncStop(); + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::RunError +// --------------------------------------------------------- +// +TInt CBrowserFavouritesIncrementalOp::RunError( TInt aError ) + { + // Own part of error processing: clean up the wait note and terminate + // the waiting. Then propagate the error up to base classes. + delete iWaitNote; + iWaitNote = NULL; + iWait->AsyncStop(); + return aError; + } + +// --------------------------------------------------------- +// CBrowserFavouritesIncrementalOp::DialogDismissedL +// --------------------------------------------------------- +// +void CBrowserFavouritesIncrementalOp::DialogDismissedL( TInt /*aButtonId*/ ) + { + DoneL(); + iWait->AsyncStop(); + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesListbox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesListbox.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1187 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesListbox. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BrowserFavouritesListbox.h" +#include "BrowserFavouritesListboxState.h" +#include "BrowserFavouritesListboxModel.h" +#include "BrowserFavouritesListboxView.h" +#include "BrowserFavouritesModel.h" +#include "CommsModel.h" +#include "BrowserFavouritesListboxIconHandler.h" +#include "BrowserFavouritesIconIndexArray.h" +#include "BrowserUtil.h" +#include "BrowserFavouritesListboxCursorObserver.h" +#include "BrowserFavouritesListboxState.h" +#include "BrowserFavouritesListboxItemDrawer.h" +#include "ApiProvider.h" +#include "BrowserAppUi.h" + +#include "BrowserFaviconHandler.h" +#include +#include + +#include "eikon.hrh" + + +// CONSTANTS +/// Granularity of the icon index array. +LOCAL_C const TInt KGranularity = 4; + + +// ================= LOCAL FUNCTIONS ======================= + +/** +* Append elements from aSource to the end of aTarget. +* @param aTarget Array which receives copied elements from aSource. +* @param aSource Elements from this will be appended to aTarget. +*/ +LOCAL_D void AppendArrayL +( CArrayFix& aTarget, const CArrayFix& aSource ) + { + TInt i; + TInt count = aSource.Count(); + for ( i = 0; i < count; i++ ) + { + aTarget.AppendL( aSource.At( i ) ); + } + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::NewL +// --------------------------------------------------------- +// +CBrowserFavouritesListbox* CBrowserFavouritesListbox::NewL + ( + MApiProvider& aApiProvider, + const CCoeControl* aParent, + const MBrowserFavouritesListboxIconHandler& aIconHandler + ) + { + CBrowserFavouritesListbox* listbox = + new (ELeave) CBrowserFavouritesListbox( aApiProvider ); + CleanupStack::PushL( listbox ); + listbox->ConstructL( aParent, aIconHandler ); + CleanupStack::Pop(); // listbox + return listbox; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::~CBrowserFavouritesListbox +// --------------------------------------------------------- +// +CBrowserFavouritesListbox::~CBrowserFavouritesListbox() + { + delete iFaviconHandler; + delete iIconIndexes; + delete iItems; + delete iNewState; + if(iIconUpdateCallback) iIconUpdateCallback->Cancel(); + delete iIconUpdateCallback; + + if ( iFontItalic ) + { + CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() ); + screenDev.ReleaseFont( iFontItalic ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SetListboxCursorObserver +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::SetListboxCursorObserver +(MBrowserFavouritesListboxCursorObserver* aObserver) + { + iCursorObserver = aObserver; + if ( View() ) + { + STATIC_CAST( CBrowserFavouritesListboxView*, View() )-> + SetCursorObserver( aObserver ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SetDataL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::SetDataL +( CFavouritesItemList* aItems, /*MCommsModel& aCommsModel,*/ TBool aKeepState ) + { + __ASSERT_DEBUG( aItems, Util::Panic( Util::EUnExpected ) ); + + // Ownership of aItems is taken, and will become a member (but not yet + // that) - push until then. + CleanupStack::PushL( aItems ); + + // Get all favicons asynchronously by iteration on icon array + /* TODO: There should a callback from engine when favIcon are decode + otherwise it takes some redundant calls to engine in order to get + the favIcons to UI. */ +#ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + if(iApiProvider.StartedUp()) + UpdateFavIconsL(); +#else + iFaviconHandler->StartGetFaviconsL( aItems ); +#endif + + + // Get icon indexes into new list. Replace the existing + // data only if successfully gotten. This ensures that they don't go out + // of sync (there cannot be different number of items in the two list). + CBrowserFavouritesIconIndexArray* newIconIndexes = + GetIconIndexesLC( /*aCommsModel,*/ *aItems ); + + if ( aKeepState ) + { + // Calculate new state now, while we still have old items. + CalcNewStateL( *aItems ); + } + + // Got new data. Empty existing data, but keep the empty lists. + ClearSelection(); + iItems->ResetAndDestroy(); + iIconIndexes->Reset(); + SetTopItemIndex(0); + UpdateFilterL(); + HandleItemRemovalL(); + // Replace data with new. + delete iIconIndexes; // Not NULL-ed, because... + delete iItems; // Not NULL-ed, because... + iItems = aItems; // ... this cannot leave + iIconIndexes = newIconIndexes; // ... this cannot leave + + // Let the model know the change. + TheModel()->SetData( *iItems, *iIconIndexes ); // ... this cannot leave + + CleanupStack::Pop( 2 ); // newIconIndexes, aItems: now members. + HandleItemAdditionL(); + UpdateFilterL(); + if ( aKeepState ) + { + // Now set the new state into listbox, then discard it. + __ASSERT_DEBUG( iNewState, Util::Panic( Util::EUnExpected ) ); + SetStateL( *iNewState ); + delete iNewState; + iNewState = NULL; + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::UpdateFavIcons +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::UpdateFavIconsL() + { + if(iIconUpdateCallback) + iIconUpdateCallback->Cancel(); + else + iIconUpdateCallback = CIdle::NewL(CActive::EPriorityIdle); + + iFaviconHandler->RequestFavicons(iItems); + iIconUpdateCallback->Start(TCallBack(UpdateFavIconsCallback, this)); + } + +// ---------------------------------------------------------------------------- +// CBrowserBookmarksView::CompleteAppInitCallback +// ---------------------------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::UpdateFavIconsCallback( TAny* aParam ) + { + CBrowserFavouritesListbox *favListBox = STATIC_CAST(CBrowserFavouritesListbox*, aParam); + TRAP_IGNORE( (favListBox->iFaviconHandler->StartGetFaviconsL(favListBox->iItems)) ) + return EFalse; + } + + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::DrawFavicons +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::DrawFavicons() + { + // We have some favicons to draw + TInt err = KErrNone; + + //Update the icon indices + TRAP( err, + CBrowserFavouritesIconIndexArray* newIconIndexes = + GetIconIndexesLC( /*aCommsModel,*/ *iItems ); + iIconIndexes->Reset(); + delete iIconIndexes; + iIconIndexes = newIconIndexes; + CleanupStack::Pop( newIconIndexes ); + ); + + // Don't draw the favicons if there is a leave + if ( !err ) + { + // Let the model know the change and update the lisbox. + TheModel()->SetData( *iItems, *iIconIndexes ); + DrawNow(); + } + + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SelectionStateL +// --------------------------------------------------------- +// +TBrowserFavouritesSelectionState +CBrowserFavouritesListbox::SelectionStateL() const + { + TBrowserFavouritesSelectionState state; + + // Check marking first. + const CArrayFix* selection = MarkedRealIndexesLC(); + TInt i; + TInt count = selection->Count(); + for ( i = 0; i < count; i++ ) + { + state.iMarkFlags |= + SelectionFlags( *(iItems->At( selection->At( i ) )) ); + if ( iItems->At( selection->At( i ) )->IsItem() ) + { + state.iMarkedItemCount++; + } + else + { + state.iMarkedFolderCount++; + } + } + + if ( count == iItems->Count() ) + { + state.iMarkFlags |= TBrowserFavouritesSelectionState::EAll; + } + + TInt visibleCount; + CAknListBoxFilterItems* filter = TheModel()->Filter(); + visibleCount = filter ? filter->FilteredNumberOfItems() : iItems->Count(); + for ( i = 0; i < visibleCount; i++ ) + { + if ( iItems->At( RealIndex( i ) )->IsItem() ) + { + state.iVisibleItemCount++; + } + else + { + state.iVisibleFolderCount++; + } + } + + TKeyArrayFix key( 0, ECmpTInt32 ); + TInt dummy; + if ( !selection->Find( CurrentItemRealIndex(), key, dummy ) ) + { + state.iMarkFlags |= + TBrowserFavouritesSelectionState::ECurrent; + } + + CleanupStack::PopAndDestroy(); // selection + + // Then comes the current. + const CFavouritesItem* current = CurrentItem(); + if ( current ) + { + state.iCurrentFlags |= SelectionFlags( *current ); + } + + return state; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::CurrentItem +// --------------------------------------------------------- +// +const CFavouritesItem* CBrowserFavouritesListbox::CurrentItem() const + { + TInt index = CurrentItemRealIndex(); + if ( index >= 0 ) + { + return iItems->At( index ); + } + return NULL; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::MarkedItemL +// --------------------------------------------------------- +// +const CFavouritesItem* CBrowserFavouritesListbox::MarkedItemL() const + { + CFavouritesItem* item = NULL; + CArrayFix* marked = MarkedRealIndexesLC(); + if ( marked->Count() == 1 ) + { + item = iItems->At( marked->At( 0 ) ); + } + CleanupStack::PopAndDestroy(); + return item; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::HighlightUidNow +// --------------------------------------------------------- +// +TBool CBrowserFavouritesListbox::HighlightUidNow( TInt aUid ) + { + TInt index = 0; + if (aUid != 0) + { + index = UidToViewIndex( aUid ); + } + + if ( index >= 0 ) + { + SetCurrentItemIndexAndDraw( index ); + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::HandleMarkableListCommandL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::HandleMarkableListCommandL( TInt aCommand ) + { + if ( ListboxFlags() & EAknListBoxMarkableList ) + { + TInt index; + switch ( aCommand ) + { + case EWmlCmdMark: + { + index = CurrentItemIndex(); + if ( index >= 0 ) + { + View()->SelectItemL( index ); + } + break; + } + + case EWmlCmdUnmark: + { + index = CurrentItemIndex(); + if ( index >= 0 ) + { + View()->DeselectItem( index ); + } + break; + } + + case EWmlCmdMarkAll: + { + ClearSelection(); + TInt count = Model()->NumberOfItems(); + if ( count ) + { + TInt i = 0; + CArrayFixFlat* selection = + new(ELeave) CArrayFixFlat( 1 ); + CleanupStack::PushL( selection ); + selection->SetReserveL( count ); + for ( i = 0; i < count; i++ ) + { + selection->AppendL( i ); + } + SetSelectionIndexesL( selection ); + CleanupStack::PopAndDestroy(); // selection + } + break; + } + + case EWmlCmdUnmarkAll: + { + ClearSelection(); + break; + } + + default: + { + Util::Panic( Util::EUnExpected ); + } + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::MarkedUidsLC +// --------------------------------------------------------- +// +CArrayFix* CBrowserFavouritesListbox::MarkedUidsLC() const + { + CArrayFix* array = MarkedRealIndexesLC(); + RealIndexesToUids( *array ); + return array; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SelectedUidsLC +// --------------------------------------------------------- +// +CArrayFix* CBrowserFavouritesListbox::SelectedUidsLC() const + { + CArrayFix* array = SelectedRealIndexesLC(); + RealIndexesToUids( *array ); + return array; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SelectedItemsLC +// --------------------------------------------------------- +// +CArrayPtr* +CBrowserFavouritesListbox::SelectedItemsLC(TBool aIncludeSpecialItems) const + { + CArrayPtrFlat* itemPtrs = + new (ELeave) CArrayPtrFlat( KGranularity ); + CleanupStack::PushL( itemPtrs ); + CArrayFix* indexes = SelectedRealIndexesLC(); + TInt i; + TInt count = indexes->Count(); + for ( i = 0; i < count; i++ ) + { + CFavouritesItem* item = iItems->At( indexes->At( i ) ); + + if ( !aIncludeSpecialItems ) + { + // Skip special items: + // folders, homepage, last visited & start page URLs. + // Need a workaround for the start page since CFavouritesItem + // does not provide IsStartPage() or something similar. + if ( (item->Uid() == KFavouritesHomepageUid ) || + (item->Uid() == KFavouritesLastVisitedUid ) || + item->IsFolder() || + item->Uid() == KFavouritesStartPageUid ) + continue; + } + itemPtrs->AppendL( item ); + } + CleanupStack::PopAndDestroy(); // indexes + return itemPtrs; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::ItemByUid +// --------------------------------------------------------- +// +const CFavouritesItem* CBrowserFavouritesListbox::ItemByUid +( TInt aUid ) const + { + return iItems->ItemByUid( aUid ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::UnfilteredNumberOfItems +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::UnfilteredNumberOfItems() + { + return iItems->Count(); + } + + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::FilteredNumberOfItems +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::FilteredNumberOfItems() + { + + CAknListBoxFilterItems* filter = TheModel()->Filter(); + return filter->FilteredNumberOfItems(); + } + + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::UpdateFilterL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::UpdateFilterL() + { + CAknListBoxFilterItems* filter = TheModel()->Filter(); + if ( filter ) + { + filter->HandleItemArrayChangeL(); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::AnyFoldersL +// --------------------------------------------------------- +// +TBool CBrowserFavouritesListbox::AnyFoldersL() + { + TInt i; + TInt count = iItems->Count(); + for ( i = 0; i < count; i++ ) + { + if ( iItems->At( i )->IsFolder() ) + { + if (iItems->At( i )->Uid()!=KFavouritesAdaptiveItemsFolderUid) return ETrue; //exclude Adaptive Bookmarks Folder + } + } + return EFalse; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CBrowserFavouritesListbox::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse result = EKeyWasNotConsumed; + + switch ( aKeyEvent.iCode ) + { + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftArrow: // West + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyRightArrow: // East + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge + { + // This listbox does not consume left/right or diagonal keypresses. + // (The base class always does, even if it doesn't use them ) + break; + } + + default: + { + result = CAknSingleGraphicStyleListBox::OfferKeyEventL + ( aKeyEvent, aType ); + // Call UpdateCBA to update MSK in case of mark/unmark + CBrowserAppUi::Static()->UpdateCbaL(); + } + + } + + return result; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::FocusChanged +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::FocusChanged( TDrawNow aDrawNow ) + { + // Do nothing until the listbox is fully constructed + // The dialogpage sets the focus before calling ConstructL + if ( iView ) + { + CAknSingleGraphicStyleListBox::FocusChanged( aDrawNow ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::CreateModelL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::CreateModelL() + { + iModel = CBrowserFavouritesListboxModel::NewL( *iItems, *iIconIndexes ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::MakeViewClassInstanceL +// --------------------------------------------------------- +// +CListBoxView* CBrowserFavouritesListbox::MakeViewClassInstanceL() + { + return new (ELeave) CBrowserFavouritesListboxView( *this ); + } + + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::CreateItemDrawerL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::CreateItemDrawerL() + { + CAknSingleGraphicStyleListBox::CreateItemDrawerL(); + } + + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::CBrowserFavouritesListbox +// --------------------------------------------------------- +// +CBrowserFavouritesListbox::CBrowserFavouritesListbox + ( MApiProvider& aApiProvider ) : + iApiProvider( aApiProvider ) + { + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::ConstructL + ( + const CCoeControl* aParent, + const MBrowserFavouritesListboxIconHandler& aIconHandler + ) + { + iSkinUpdated = EFalse; + iIconHandler = &aIconHandler; + iItems = new (ELeave) CFavouritesItemList(); + iIconIndexes = + new (ELeave) CBrowserFavouritesIconIndexArray( KGranularity ); + CAknSingleGraphicStyleListBox::ConstructL( aParent, ListboxFlags() ); + // MUST call this after the listbox has finished; listbox construction + // is buggy and overwrites the model's itemarray ptr. + TheModel()->SetItemArray(); + CreateScrollBarFrameL( ETrue ); + ScrollBarFrame()->SetScrollBarVisibilityL + ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + + // Load icons + ItemDrawer()->ColumnData()->SetIconArray + ( iIconHandler->CreateIconArrayL() ); + + // Store the size of an icon + TAknWindowComponentLayout layout = + AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0); + + TAknLayoutRect naviPaneGraphicsLayoutRect; + TRect listBoxGraphicRect; + TRect rect = iAvkonAppUi->ClientRect(); + + + naviPaneGraphicsLayoutRect.LayoutRect( rect, layout); + listBoxGraphicRect = naviPaneGraphicsLayoutRect.Rect(); + + TSize listBoxGraphicSize( listBoxGraphicRect.iBr.iX - listBoxGraphicRect.iTl.iX, + listBoxGraphicRect.iBr.iY - listBoxGraphicRect.iTl.iY ); + // Favicon handler + iFaviconHandler = CBrowserFaviconHandler::NewL( + iApiProvider, + ItemDrawer()->ColumnData()->IconArray(), + *this, + listBoxGraphicSize ); + + ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); + + + // Setup italicized font for use later + const CFont* logicalFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont); + + // Note: This font is owned by the application's system font array (where it + // is likely already to have been created) and does not need to be + // released. It can just go out of scope.// Extract font information + TFontSpec fontSpec = logicalFont->FontSpecInTwips();// Desired height, weight, and posture already set in locals + fontSpec.iFontStyle.SetPosture( EPostureItalic );// Obtain new font + CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() ); + screenDev.GetNearestFontInTwips( ( CFont*& )iFontItalic, fontSpec ); + + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::ListboxFlags +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::ListboxFlags() + { + return AknLayoutUtils::PenEnabled() ? + EAknListBoxStylusMarkableList : EAknListBoxMarkableList; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::GetIconIndexesLC +// --------------------------------------------------------- +// +CBrowserFavouritesIconIndexArray* +CBrowserFavouritesListbox::GetIconIndexesLC +( /*MCommsModel& aCommsModel, */CFavouritesItemList& aItems ) + { + // Create new empty list. + CBrowserFavouritesIconIndexArray* iconIndexes = + new (ELeave) CBrowserFavouritesIconIndexArray( KGranularity ); + CleanupStack::PushL( iconIndexes ); + // Get list of access points. Not copy, owned by the AP model. + // const CApListItemList* apList = aCommsModel.AccessPoints(); + // Fill the list. + TInt i = 0; + TInt count = aItems.Count(); + for ( i = 0; i < count; i++ ) + { + iconIndexes->AppendL + ( iIconHandler->IconIndexes( *(aItems.At( i ))/*, apList*/,this ) ); + } + return iconIndexes; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::CalcNewStateL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::CalcNewStateL +( CFavouritesItemList& aNewItems ) + { + delete iNewState; + iNewState = NULL; + iNewState = new( ELeave ) CBrowserFavouritesListboxState; + + // 1. Check if we have any new item. If yes, highlight goes to first + // new one. + TInt i; + TInt count = aNewItems.Count(); + for ( i = 0; i < count; i++ ) + { + if ( iItems->UidToIndex( aNewItems.IndexToUid( i ) ) == + KErrNotFound ) + { + // New item, not found among the old ones. + // Set highlight to that, and also becomes top item. + iNewState->iHighlightUid = iNewState->iTopItemUid = + aNewItems.IndexToUid( i ); + break; + } + } + + // 2. If there is no new item, get the new highlight. That is the old + // one, if still exists, or the next remaining one after the + // deleted old one(s). + TInt uid; + if ( iNewState->iHighlightUid == KFavouritesNullUid ) + { + i = CurrentItemRealIndex(); + if ( i >= 0 ) + { + // Have current item. + // Now go down the old list, beginning from highlighted one; + // find first item that still exists. + count = iItems->Count(); + for ( /*current highlight index: i*/; i < count; i++ ) + { + uid = iItems->At( i )->Uid(); + if ( aNewItems.UidToIndex( uid ) != KErrNotFound ) + { + iNewState->iHighlightUid = uid; + break; + } + } + // Here we should have higlight uid, unless the deleted element(s) + // were last. In that case, set last item highlighted (if there is + // anything to highlight). + if ( iNewState->iHighlightUid == KFavouritesNullUid && + aNewItems.Count() ) + { + iNewState->iHighlightUid = aNewItems.IndexToUid + ( aNewItems.Count() - 1 ); + } + } + } + + // 3. Get mark uids. Whether these uids exist in the new list or not, is + // not checked here; setting marks to the already changed listbox is + // fool-proof. + iNewState->iMarkUids = MarkedUidsLC(); + CleanupStack::Pop(); // Uid list; ownership is now in the state. + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SetStateL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::SetStateL +( const CBrowserFavouritesListboxState& aState ) + { + TInt topIndex; + + // Set marks. + if ( aState.iMarkUids->Count() ) + { + CArrayFix* marks = new (ELeave) CArrayFixFlat( 4 ); + CleanupStack::PushL( marks ); + marks->AppendL + ( aState.iMarkUids->Back( 0 ), aState.iMarkUids->Count() ); + UidsToViewIndexes( *marks ); + SetSelectionIndexesL( marks ); + CleanupStack::PopAndDestroy(); // marks + } + + // Set top item index. + topIndex = UidToViewIndex ( aState.iTopItemUid ); + if ( topIndex >= 0 ) + { + // Always try to fill the listbox (if there were empty lines below, + // "scroll down", instead of strictly restoring the top item index). + TInt topIndexToSeeLastItem = Model()->NumberOfItems() - + View()->NumberOfItemsThatFitInRect( View()->ViewRect() ); + if ( topIndexToSeeLastItem < 0 ) + { + topIndexToSeeLastItem = 0; + } + topIndex = Min( topIndex, topIndexToSeeLastItem ); + SetTopItemIndex( topIndex ); + } + + // Set higlight. + TInt curIndex = UidToViewIndex ( aState.iHighlightUid ); + if ( curIndex < 0 ) + { + // If cannot restore highlight, set it to top item. + curIndex = topIndex; + } + if ( curIndex >= 0 ) + { + SetCurrentItemIndex( curIndex ); + } + + DrawNow(); + + if ( iCursorObserver ) + { + // Cursor now points to some different item. Let the observer know it. + iCursorObserver->HandleCursorChangedL( this ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::UidToViewIndex +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::UidToViewIndex( TInt aUid ) const + { + TInt viewIndex = KErrNotFound; + TInt realIndex = iItems->UidToIndex( aUid ); + if ( realIndex >= 0 ) + { + CAknListBoxFilterItems* filter = TheModel()->Filter(); + if ( filter ) + { + // Have filter, do the conversion. + viewIndex = filter->VisibleItemIndex( realIndex ); + } + else + { + // No filter, no conversion necessary. + viewIndex = realIndex; + } + } + return viewIndex; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::UidsToViewIndexes +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::UidsToViewIndexes +( CArrayFix& aList ) const + { + TInt i; + TInt j; + TInt index; + TInt count = aList.Count(); + for ( i = 0, j = 0; i < count; i++ ) + { + index = UidToViewIndex( aList.At ( i ) ); + if ( index != KErrNotFound ) + { + aList.At( j++ ) = index; + } + } + if ( j < count ) + { + // Not all Uids were converted. Delete the trailing rubbish. + aList.Delete( j, count - j ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::RealIndexesToUids +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::RealIndexesToUids +( CArrayFix& aList ) const + { + TInt i; + TInt uid; + TInt count = aList.Count(); + for ( i = 0; i < count; i++ ) + { + uid = iItems->IndexToUid( aList.At( i ) ); + __ASSERT_DEBUG( uid != KFavouritesNullUid, \ + Util::Panic( Util::EFavouritesBadBookmarkUid ) ); + aList.At( i ) = uid; + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::MarkedRealIndexesLC +// --------------------------------------------------------- +// +CArrayFix* CBrowserFavouritesListbox::MarkedRealIndexesLC() const + { + CListBoxView::CSelectionIndexArray* array = + new (ELeave) CArrayFixFlat( KGranularity ); + CleanupStack::PushL( array ); + if ( iItems->Count() ) + { + const CArrayFix* marked; + CAknListBoxFilterItems* filter = TheModel()->Filter(); + if ( filter ) + { + // Filter knows all. + filter->UpdateSelectionIndexesL(); + marked = filter->SelectionIndexes(); +#if 1 /* TODO remove when AVKON bug fixed*/ + // Overcoming AVKON bug. If filter criteria is empty (i.e. the + // user is not typing in the filter), selection indexes between + // the filter and the listbox are not synchronized! Unfortunately, + // this strange back-way is the only means by we can discover if + // we have criteria or not; CAknListBoxFilterItems has the + // criteria as private; and the CAknSearchField, which holds the + // filter (and has the string) is not accessible here in the + // listbox (it's in the container). + if ( filter->FilteredNumberOfItems() == + filter->NonFilteredNumberOfItems() ) + { + marked = View()->SelectionIndexes(); + } +#endif + } + else + { + // No filter. + marked = View()->SelectionIndexes(); + } + AppendArrayL( /*aTarget=*/*array, /*aSource=*/*marked ); + } + return array; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SelectedRealIndexesLC +// --------------------------------------------------------- +// +CArrayFix* CBrowserFavouritesListbox::SelectedRealIndexesLC() const + { + CListBoxView::CSelectionIndexArray* selection = + MarkedRealIndexesLC(); + if ( selection->Count() == 0 ) + { + // No marks; use the highlighted one. + selection->AppendL( CurrentItemRealIndex() ); + } + return selection; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::CurrentItemRealIndex +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::CurrentItemRealIndex() const + { + return RealIndex( CurrentItemIndex() /*that's view index*/ ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::RealIndex +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::RealIndex( TInt aViewIndex ) const + { + TInt index = KErrNotFound; + if ( aViewIndex >= 0 ) + { + CAknListBoxFilterItems* filter = TheModel()->Filter(); + if ( filter ) + { + // If we have the index and the filter also, do the conversion. + index = filter->FilteredItemIndex( aViewIndex ); + } + else + { + index = aViewIndex; + } + } + return index; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::RealIndexes +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::RealIndexes( CArrayFix& aList ) const + { + TInt i; + TInt j; + TInt index; + TInt count = aList.Count(); + for ( i = 0, j = 0; i < count; i++ ) + { + index = RealIndex( aList.At ( i ) ); + if ( index != KErrNotFound ) + { + aList.At( j++ ) = index; + } + } + if ( j < count ) + { + // Not all indexes were converted. Delete the trailing rubbish. + aList.Delete( j, count - j ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SelectionFlags +// --------------------------------------------------------- +// +TInt CBrowserFavouritesListbox::SelectionFlags +( const CFavouritesItem& aItem ) const + { + TInt flags = 0; + if ( aItem.IsItem() ) + { + switch ( aItem.Uid() ) + { + case KFavouritesHomepageUid: + { + flags |= + TBrowserFavouritesSelectionState::EAny | + TBrowserFavouritesSelectionState::EHomepage | + TBrowserFavouritesSelectionState::EItem; + break; + } + + case KFavouritesStartPageUid: + { + flags |= + TBrowserFavouritesSelectionState::EAny | + TBrowserFavouritesSelectionState::EStartPage | + TBrowserFavouritesSelectionState::EItem; + break; + } + + case KFavouritesLastVisitedUid: + { + flags |= + TBrowserFavouritesSelectionState::EAny | + TBrowserFavouritesSelectionState::ELastVisited | + TBrowserFavouritesSelectionState::EItem; + break; + } + + default: + { + flags |= + TBrowserFavouritesSelectionState::EAny | + TBrowserFavouritesSelectionState::EPlainItem | + TBrowserFavouritesSelectionState::EItem; + break; + } + } + } + else + { + flags |= + TBrowserFavouritesSelectionState::EAny | + TBrowserFavouritesSelectionState::EFolder; + } + return flags; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::TheModel +// --------------------------------------------------------- +// +CBrowserFavouritesListboxModel* +CBrowserFavouritesListbox::TheModel() const + { + return REINTERPRET_CAST( CBrowserFavouritesListboxModel*, Model() ); + } + + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::HandleResourceChange +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::HandleResourceChange( TInt aType ) + { + CAknSingleGraphicStyleListBox::HandleResourceChange( aType ); + if ( aType == KAknsMessageSkinChange ) + { + CArrayPtr* array = + ItemDrawer()->ColumnData()->IconArray(); + + array->ResetAndDestroy(); + delete array; + + CAknIconArray* iconArray = NULL; + TRAPD( err, + iconArray = iIconHandler->CreateIconArrayL() + ) + + if ( !err ) + { + ItemDrawer()->ColumnData()->SetIconArray( iconArray ); + iFaviconHandler->UpdateIconArray(ItemDrawer()->ColumnData()->IconArray()); + SetSkinUpdated(ETrue); + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::SetSkinUpdated +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::SetSkinUpdated(TBool aSkinUpdated) + { + iSkinUpdated = aSkinUpdated; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListbox::ItalicizeRowItemL +// --------------------------------------------------------- +// +void CBrowserFavouritesListbox::ItalicizeRowItemL(TInt aRowIndex) + { + if (ItemDrawer() && ItemDrawer()->ColumnData() && iFontItalic) + { + ItemDrawer()->ColumnData()->SetColumnFontForRowL( aRowIndex, 1, iFontItalic ); + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesListboxIconHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesListboxIconHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of MWmlBrowserFavouritesListboxIconHandler. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include "BrowserFavouritesListboxIconHandler.h" +#include "BrowserFavouritesIconIndexArray.h" +#include "BrowserFavouritesListbox.h" +#include "BrowserFaviconHandler.h" + +// CONSTANTS + +//================== MEMBER FUNCTIONS ========================================= + +//----------------------------------------------------------------------------- +// MBrowserFavouritesListboxIconHandler::CreateIconArrayL +//----------------------------------------------------------------------------- +// +CAknIconArray* MBrowserFavouritesListboxIconHandler::CreateIconArrayL() const + { + return LoadIconsL( ); + } + +//----------------------------------------------------------------------------- +// MBrowserFavouritesListboxIconHandler::IconIndexes +//----------------------------------------------------------------------------- +// +TBrowserFavouritesIconIndexes + MBrowserFavouritesListboxIconHandler::IconIndexes( + const CFavouritesItem& aItem, + CBrowserFavouritesListbox* aListbox ) const + { + TBrowserFavouritesIconIndexes indexes; + + // Do we have a Favicon? + TInt faviconIndex; + faviconIndex = aListbox->FaviconHandler()->GetFaviconArrayIndex( aItem ); + + if ( faviconIndex != KErrNotFound && aListbox->GetDefaultData().iPreferedId != aItem.Uid() ) + { + indexes.iItemIcon = faviconIndex; + } + else + { + indexes.iItemIcon = ItemIconIndex( aItem,aListbox ); + } + + indexes.iBearerIcon = KBrowserFavouritesNoBearerIcon; //Bearer icons removed + return indexes; + } + +//----------------------------------------------------------------------------- +// MBrowserFavouritesListboxIconHandler::BearerIconIndex +//----------------------------------------------------------------------------- +// +TInt MBrowserFavouritesListboxIconHandler::BearerIconIndex( + const TFavouritesWapAp /*aAccessPoint*/, + const CApListItemList& /*aAccessPoints*/ + ) const + { + return KBrowserFavouritesNoBearerIcon; + } + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesListboxItemDrawer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesListboxItemDrawer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserFavouritesListboxItemDrawer. +* +* +*/ + + +// INCLUDE FILES +#include "BrowserFavouritesListboxItemDrawer.h" +#include "BrowserFavouritesListboxModel.h" +#include +#include + +//================== MEMBER FUNCTIONS ========================================= + +//----------------------------------------------------------------------------- +// CBrowserFavouritesListboxItemDrawer::CBrowserFavouritesListboxItemDrawer +//----------------------------------------------------------------------------- +// +CBrowserFavouritesListboxItemDrawer::CBrowserFavouritesListboxItemDrawer + ( + MTextListBoxModel* aTextListBoxModel, + const CFont* aFont, + CColumnListBoxData* aColumnData + ) + : CColumnListBoxItemDrawer( aTextListBoxModel, aFont, aColumnData ) + { + } + +//----------------------------------------------------------------------------- +// CBrowserFavouritesListboxItemDrawer::Properties +//----------------------------------------------------------------------------- +// +TListItemProperties CBrowserFavouritesListboxItemDrawer::Properties( + TInt aItemIndex ) const + { + CAknListBoxFilterItems *filter = + STATIC_CAST(CAknFilteredTextListBoxModel*,iModel)->Filter(); + if ( filter ) + { + aItemIndex = filter->FilteredItemIndex( aItemIndex ); + } + TListItemProperties properties = + CColumnListBoxItemDrawer::Properties( aItemIndex ); + + // SEARCH CUSTOM: Updated below for Italics in bookmarks view + // Selection of Folders is allowed, so no need to set it as Hidden. + // if ( STATIC_CAST( CBrowserFavouritesListboxModel*, iModel ) -> + // Items()->At( aItemIndex )->IsFolder() ) + // { + // // If this is a folder, set "hidden selection" true. + // properties.SetHiddenSelection( ETrue ); + // } + + + //Better solution would be adding italics properties to CFavouritesItem, but it requires changes in FavouritesEngine API + CFavouritesItem* fi = STATIC_CAST( CBrowserFavouritesListboxModel*, iModel ) -> + Items()->At( aItemIndex ); + if ( fi->ContextId() == KFavouritesServiceContextId ) + { + properties.SetItalics(ETrue); + } + return properties; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesListboxModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesListboxModel.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,235 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesListboxModel. +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include "BrowserFavouritesListboxModel.h" +#include "BrowserFavouritesIconIndexArray.h" +#include "BrowserUtil.h" + +// ================= LOCAL FUNCTIONS ======================= + +/** +* Copy aSOurce to aTarget, replacing TAB characters with spaces. +* @param aSource Source descriptor. +* @param aTarget Target descriptor. +*/ +LOCAL_C void RemoveTabs( const TDesC& aSource, TDes& aTarget ) + { + TChar ch; + TInt i; + TInt length = aSource.Length(); + // Initialize target to empty string. + aTarget.SetLength( 0 ); + // Copy source to target, replace whitespace with space. + for ( i = 0; i < length; i++ ) + { + ch = aSource[i]; + if ( ch == '\t' ) + { + ch = ' '; + } + aTarget.Append( ch ); + } + } + +// ================= MEMBER FUNCTIONS ======================= +// ====== TBrowserFavouritesListboxFilterTextArray ======= + +// --------------------------------------------------------- +// TBrowserFavouritesListboxItemTextArray::MdcaCount +// --------------------------------------------------------- +// +TInt TBrowserFavouritesListboxItemTextArray::MdcaCount() const + { + return iItems->Count(); + } + +// --------------------------------------------------------- +// TBrowserFavouritesListboxItemTextArray::MdcaPoint +// --------------------------------------------------------- +// +TPtrC TBrowserFavouritesListboxItemTextArray::MdcaPoint +( TInt aIndex ) const + { + // Sorry, need to cast away the const-ness from the buffer. + // It was made definitely for formatting! Odd that this method + // is const. + CFavouritesItem* item = iItems->At( aIndex ); + TBrowserFavouritesIconIndexes iconIndexes = iIconIndexes->At( aIndex ); + + TBuf name; + + RemoveTabs( item->Name(), name ); + + if ( iconIndexes.iBearerIcon == KBrowserFavouritesNoBearerIcon ) + { + _LIT( KFormatNoBearer, "%d\t%S\t\t" ); + MUTABLE_CAST( TBuf&, iBuf + ). //lint !e665 expression macro param ok + Format + ( + KFormatNoBearer, + iconIndexes.iItemIcon, + &name + ); + } + else + { + _LIT( KFormatWithBearer, "%d\t%S\t%d\t" ); + MUTABLE_CAST( TBuf&, iBuf + ). //lint !e665 expression macro param ok + Format + ( + KFormatWithBearer, + iconIndexes.iItemIcon, + &name, + iconIndexes.iBearerIcon + ); + } + return iBuf; + } + +// ================= MEMBER FUNCTIONS ======================= +// ====== TBrowserFavouritesListboxFilterTextArray ======= + +// --------------------------------------------------------- +// TBrowserFavouritesListboxFilterTextArray::MdcaCount +// --------------------------------------------------------- +// +TInt TBrowserFavouritesListboxFilterTextArray::MdcaCount() const + { + return iItems->Count(); + } + +// --------------------------------------------------------- +// TBrowserFavouritesListboxFilterTextArray::MdcaPoint +// --------------------------------------------------------- +// +TPtrC TBrowserFavouritesListboxFilterTextArray::MdcaPoint +( TInt aIndex ) const + { + return iItems->At( aIndex )->Name(); + } + +// ================= MEMBER FUNCTIONS ======================= +// =========== CBrowserFavouritesListboxModel ============ + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::NewL +// --------------------------------------------------------- +// +CBrowserFavouritesListboxModel* CBrowserFavouritesListboxModel::NewL + ( + const CFavouritesItemList& aItems, + const CBrowserFavouritesIconIndexArray& aIconIndexes + ) + { + CBrowserFavouritesListboxModel* model = + new (ELeave) CBrowserFavouritesListboxModel( aItems, aIconIndexes ); + CleanupStack::PushL( model ); + model->ConstructL(); + CleanupStack::Pop(); // model + return model; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::SetItemArray +// --------------------------------------------------------- +// +void CBrowserFavouritesListboxModel::SetItemArray() + { + // Need to set them after the listbox has been constructed; otherwise + // listbox construction will reset the item text array to NULL. + SetItemTextArray( &iItemTexts ); + SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::~CBrowserFavouritesListboxModel +// --------------------------------------------------------- +// +CBrowserFavouritesListboxModel::~CBrowserFavouritesListboxModel() + { + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::SetData +// --------------------------------------------------------- +// +void CBrowserFavouritesListboxModel::SetData + ( + const CFavouritesItemList& aItems, + const CBrowserFavouritesIconIndexArray& aIconIndexes + ) + { + iItems = &aItems; + iIconIndexes = &aIconIndexes; + __ASSERT_DEBUG( iItems->Count() == iIconIndexes->Count(), \ + Util::Panic( Util::EFavouritesBadIconIndexArray ) ); + // Propagate data to formatting classes. + iItemTexts.iItems = iItems; + iItemTexts.iIconIndexes = iIconIndexes; + iFilterTexts.iItems = iItems; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::MatchableTextArray +// --------------------------------------------------------- +// +const MDesCArray* CBrowserFavouritesListboxModel::MatchableTextArray() const + { + return &iFilterTexts; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::CBrowserFavouritesListboxModel +// --------------------------------------------------------- +// +CBrowserFavouritesListboxModel::CBrowserFavouritesListboxModel + ( + const CFavouritesItemList& aItems, + const CBrowserFavouritesIconIndexArray& aIconIndexes + ) +: CAknFilteredTextListBoxModel(), iItems( &aItems ), + iIconIndexes( &aIconIndexes ) + { + __ASSERT_DEBUG( iItems->Count() == iIconIndexes->Count(), \ + Util::Panic( Util::EFavouritesBadIconIndexArray ) ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxModel::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesListboxModel::ConstructL() + { + // Propagate data to formatting classes. + iItemTexts.iItems = iItems; + iItemTexts.iIconIndexes = iIconIndexes; + iFilterTexts.iItems = iItems; + // Base class method already called by listbox. Nasty buggy mess. + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesListboxState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesListboxState.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CWmlBrowserFavouritesListboxState. +* +* +*/ + + +// INCLUDE FILES + +#include "BrowserFavouritesListboxState.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesListboxState::CBrowserFavouritesListboxState +// --------------------------------------------------------- +// +CBrowserFavouritesListboxState::CBrowserFavouritesListboxState() + { + iHighlightUid = KFavouritesNullUid; + iTopItemUid = KFavouritesNullUid; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxState::~CBrowserFavouritesListboxState +// --------------------------------------------------------- +// +CBrowserFavouritesListboxState::~CBrowserFavouritesListboxState() + { + delete iMarkUids; + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesListboxView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesListboxView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesListboxView. +* +* +*/ + + +// INCLUDE FILES + +#include "BrowserFavouritesListboxView.h" +#include "BrowserFavouritesListboxCursorObserver.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesListboxView::CBrowserFavouritesListboxView +// --------------------------------------------------------- +// +CBrowserFavouritesListboxView::CBrowserFavouritesListboxView +( CEikListBox& aListbox ): iListbox( &aListbox ) + { + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxView::SetCursorMoveObserver +// --------------------------------------------------------- +// +void CBrowserFavouritesListboxView::SetCursorObserver +( MBrowserFavouritesListboxCursorObserver* aCursorObserver ) + { + iCursorObserver = aCursorObserver; + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxView::MoveCursorL +// --------------------------------------------------------- +// +void CBrowserFavouritesListboxView::MoveCursorL +( CListBoxView::TCursorMovement aCursorMovement, + TSelectionMode aSelectionMode ) + { + CAknColumnListBoxView::MoveCursorL( aCursorMovement, aSelectionMode ); + if ( iCursorObserver ) + { + iCursorObserver->HandleCursorChangedL( iListbox ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesListboxView::UpdateSelectionL +// --------------------------------------------------------- +// +void CBrowserFavouritesListboxView::UpdateSelectionL +( TSelectionMode aSelectionMode ) + { + CAknColumnListBoxView::UpdateSelectionL( aSelectionMode ); + if ( iCursorObserver ) + { + iCursorObserver->HandleCursorChangedL( iListbox ); + } + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesModel.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1081 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesModel. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include // This contains CAknDialog +#include +#include +#include +#include +#include +#include +#include + +#include "BrowserFavouritesModel.h" +#include "BrowserFavouritesModelObserver.h" +#include "BrowserUtil.h" +#include "BrowserDialogs.h" +#include +#include "BrowserFavouritesView.h" + +#include "Browser.hrh" + +#include +#include // TCollateMethod +#include "CommonConstants.h" + + +// MACROS + +/// Cosmetic purpose macro (resource names are overly too long). +#define _R(str) R_BROWSER_FAVOURITES_ ## str + +/// Time to wait before retry database OpenL() or BeginL() (==0.2 secs). +#ifdef KRetryWait +#undef KRetryWait +#endif +#define KRetryWait 200 /*TTimeIntervalMicroSeconds32*/ + +// CONSTANTS + +/// Granularity of observer array. +LOCAL_C const TInt KGranularityObservers = 4; + +/// Number of attempts to retry after unsuccesful database OpenL() or BeginL(). +LOCAL_C const TInt KLocalRetryCount = 2; + +/** +* Estimated number of bytes in FFS for one writing operation. This amount +* is checked to be available before each transaction which places write-lock. +* Exact size is not known (because what happens in a transaction is unknown). +* A typical bookmark is estimated to be less than ~200 bytes; so assuming the +* typical operation of adding one bookmark (with database transaction +* overhead and safety) is estimated to be 400 bytes. This should be a safe +* guess. +*/ +LOCAL_C const TInt KEstimatedFfsUsage = 400; + +// ==================== LOCAL FUNCTIONS ==================== + +/** +* Comparison function for two items. +* Comparison rule: +* - Start Page is smaller than anything else; +* - otherwise, Homepage is smaller than anything else; +* - otherwise, Last Visited is smaller than anything else; +* - otherwise, any item is smaller than any folder; +* - otherwise, Root Folder is smaller than any other; +* - otherwise compare by name. +* @param aLeft item to compare to aRight. +* @param aRight Item to compare to aLeft. +* @return +* - negative value, if aLeft is less than aRight; +* - 0, if aLeft equals to aRight; +* - positive value, if aLeft is greater than aRight. +*/ +LOCAL_C TInt CompareItemsL +( const CFavouritesItem& aLeft, const CFavouritesItem& aRight ) + { + // Start Page is smaller than anything else; + if ( aLeft.Uid() == KFavouritesStartPageUid ) + { + return -1; + } + if ( aRight.Uid() == KFavouritesStartPageUid ) + { + return 1; + } + // otherwise, Adaptive Bookmarks is smaller than anything else; + if ( aLeft.Uid() == KFavouritesAdaptiveItemsFolderUid ) + { + return -1; + } + if ( aRight.Uid() == KFavouritesAdaptiveItemsFolderUid ) + { + return 1; + } + // otherwise, Homepage is smaller than anything else; + if ( aLeft.Uid() == KFavouritesHomepageUid ) + { + return -1; + } + if ( aRight.Uid() == KFavouritesHomepageUid ) + { + return 1; + } + // otherwise, Last Visited is smaller than anything else; + if ( aLeft.Uid() == KFavouritesLastVisitedUid ) + { + return -1; + } + if ( aRight.Uid() == KFavouritesLastVisitedUid ) + { + return 1; + } + // otherwise, any item is smaller than any folder; + if ( aLeft.IsItem() && aRight.IsFolder() ) + { + return -1; + } + if ( aRight.IsItem() && aLeft.IsFolder() ) + { + return 1; + } + // otherwise, Root Folder is smaller than any other; + if ( aLeft.Uid() == KFavouritesRootUid ) + { + return -1; + } + // otherwise, Null ContextId is smaller than any ContextId; + if ( aLeft.ContextId() == KFavouritesNullContextId && aRight.ContextId() != KFavouritesNullContextId ) + { + return -1; + } + if ( aRight.ContextId() == KFavouritesNullContextId && aLeft.ContextId() != KFavouritesNullContextId ) + { + return 1; + } + // otherwise compare by name. + return aLeft.Name().CompareC( aRight.Name() ); + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesModel::~CBrowserFavouritesModel +// --------------------------------------------------------- +// +CBrowserFavouritesModel::~CBrowserFavouritesModel() + { + delete iNotifier; + iNotifier = NULL; + delete iObservers; + CloseDb(); + iFavouritesSess.Close(); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::SetNameToDefaultL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::SetNameToDefaultL +( CFavouritesItem& aItem ) const + { + HBufC* name = CCoeEnv::Static()->AllocReadResourceLC + ( StringResourceId( aItem, EDefaultName ) ); + aItem.SetNameL( *name ); + CleanupStack::PopAndDestroy(); // name + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::OpenDbL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::OpenDbL( TBool aDbErrorNote /*=ETrue*/ ) + { + TInt err = KErrNone; + + switch ( iState ) + { + case EOpen: + { + // Already open. + break; + } + + case ECorrupt: + { + // Useless. + err = KErrNotReady; + break; + } + + case EClosed: + { + // Try to open now. + err = TimedOpenDbL(); + if ( err ) + { + // Failed to open. + if ( aDbErrorNote ) + { + TBrowserDialogs::ErrorNoteL + ( _R(TEXT_CANNOT_ACCESS_DB) ); + } + } + else + { + // Success opening. + iState = EOpen; + iNotifier->Start(); + } + break; + } + + default: + { + break; + } + } + + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::CloseDb +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::CloseDb() + { + if ( iNotifier ) + { + // Need to check existence - ConstructL can leave half the way! + iNotifier->Cancel(); + } + if ( iState == EOpen ) + { + iDb.Close(); + } + iState = EClosed; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::BeginL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::BeginL +( TBool aWrite, TBool aDbErrorNote, TBool aLffsCheck /*=ETrue*/ ) + { + TInt err; + + // Before attempting db modification, check if we would go below Critical + // Level in FFS (disk). The value used for checking is an estimate. + // Reading the db also allocates some bytes (transaction log), but + // this is not estimated and not checked, because it should be small + // enough, and would slow down operation. (Typical use is to read a lot + // and write much less.) + if ( + aLffsCheck && + aWrite && + Util::FFSSpaceBelowCriticalLevelL + ( /*aShowErrorNote=*/aDbErrorNote, KEstimatedFfsUsage ) + ) + { + err = KErrDiskFull; + return err; + } + + // Open database. + err = OpenDbL( /*aDbErrorNote=*/EFalse ); // Error note (if any) is here. + // Start a transaction. + if ( !err ) + { + err = TimedBeginL( aWrite ); + } + + if ( err && aDbErrorNote ) + { + TBrowserDialogs::ErrorNoteL( _R(TEXT_CANNOT_ACCESS_DB) ); + } + + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::CommitL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::CommitL() + { + iDb.Commit(); + CleanupStack::Pop(); // DO NOT remove this hack. + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::AddObserverL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::AddObserverL +( MBrowserFavouritesModelObserver& aObserver ) + { + iObservers->AppendL( &aObserver ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::RemoveObserver +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::RemoveObserver +( MBrowserFavouritesModelObserver& aObserver ) + { + TInt i; + TInt count = iObservers->Count(); + for ( i = 0; i < count; i++ ) + { + if ( iObservers->At( i ) == &aObserver ) + { + iObservers->Delete( i ); + return; + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::AddL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::AddL + ( + CFavouritesItem& aItem, + TBool aDbErrorNote, + CBrowserFavouritesModel::TRenameMode aRenameMode /*=EAskIfRename*/ + ) + { + return AddUpdateL( aItem, KFavouritesNullUid, aDbErrorNote, aRenameMode ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::UpdateL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::UpdateL + ( + CFavouritesItem& aItem, + TInt aUid, + TBool aDbErrorNote, + CBrowserFavouritesModel::TRenameMode aRenameMode /*=EAskIfRename*/ + ) + { + return AddUpdateL( aItem, aUid, aDbErrorNote, aRenameMode ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::SetHomepageL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::SetHomepageL + ( + CFavouritesItem& aItem, + TBool aDbErrorNote, + CBrowserFavouritesModel::TRenameMode aRenameMode /*=EAskIfRename*/ + ) + { + return AddUpdateL + ( aItem, KFavouritesHomepageUid, aDbErrorNote, aRenameMode ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::SetLastVisitedL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::SetLastVisitedL + ( + CFavouritesItem& aItem, + TBool aDbErrorNote, + CBrowserFavouritesModel::TRenameMode aRenameMode /*=EAskIfRename*/ + ) + { + return AddUpdateL + ( aItem, KFavouritesLastVisitedUid, aDbErrorNote, aRenameMode ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::AnyFoldersL +// --------------------------------------------------------- +// +CBrowserFavouritesModel::TDbQuery CBrowserFavouritesModel::AnyFoldersL() + { + TDbQuery ret = EError; + if ( BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) == KErrNone ) + { + TInt count = 0; + if ( iDb.Count( count, KFavouritesRootUid, CFavouritesItem::EFolder ) + == KErrNone ) + { + ret = count ? EYes : ENo; + } + CommitL(); + } + return ret; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::AnyNonEmptyFoldersL +// --------------------------------------------------------- +// +CBrowserFavouritesModel::TDbQuery +CBrowserFavouritesModel::AnyNonEmptyFoldersL( CArrayFix& aUids ) + { + TDbQuery ret = EError; + if ( BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) == KErrNone ) + { + ret = ENo; + TInt itemCount; + TInt i; + TInt uidCount = aUids.Count(); + for ( i = 0; i < uidCount; i++ ) + { + if ( iDb.Count( itemCount, aUids.At( i ) ) == KErrNone ) + { + if ( itemCount ) + { + // We have a non-empty folder. + ret = EYes; + break; + } + } + else + { + // Error querying; quit. + ret = EError; + break; + } + } + CommitL(); + } + return ret; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::FolderInfoL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::FolderInfoL +( TInt aFolder, TInt& aFolderCount, TInt& aFolderIndex ) + { + TInt err = KErrNotFound; + + if(iApiProvider.CalledFromAnotherApp()) + { + err = KErrNone; + aFolderIndex = 0; + aFolderCount = 1; + return err; + } + + CFavouritesItemList* folders = GetFoldersSortedLC(); + // Iterate until we find the folder. + TInt i; + TInt actualCount = 0; + aFolderCount = actualCount = folders->Count(); + for ( i = 0; i < actualCount; i++ ) + { + if(folders->At( i )->IsHidden()) + { + aFolderCount--; + } + if ( folders->At( i )->Uid() == aFolder ) + { + aFolderIndex = i; + err = KErrNone; + } + } + if(aFolderIndex > aFolderCount) + { + aFolderIndex += (aFolderCount - actualCount); + } + CleanupStack::PopAndDestroy(); // folders + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::NextFolderL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::NextFolderL( TInt aFolder, TBool aForward ) + { + if ( AknLayoutUtils::LayoutMirrored() ) + { + aForward = !aForward; + } + TInt folder = KFavouritesNullUid; + + if(iApiProvider.CalledFromAnotherApp()) + { + return folder; + } + + CFavouritesItemList* folders = GetFoldersSortedLC(); + // Iterate until we find the folder. + TInt i; + TInt count = folders->Count(); + for ( i = 0; i < count; i++ ) + { + if ( folders->At( i )->Uid() == aFolder ) + { + i += aForward ? 1 : -1; + if ( i >= 0 && i < count ) + { + // Have the neighbour. + folder = folders->At( i )->Uid(); + + while(folders->At( i )->IsHidden()) + { + i += aForward ? 1 : -1; + if ( i < 0 || i >= count ) + { + folder = KFavouritesNullUid; + break; + } + else + { + // Have the neighbour. + folder = folders->At( i )->Uid(); + } + } + } + break; + } + } + CleanupStack::PopAndDestroy(); // folders + return folder; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::RenameQueryL +// --------------------------------------------------------- +// +TBool CBrowserFavouritesModel::RenameQueryL( CFavouritesItem& aItem, TBool aNewItem ) + { + TBool ret = EFalse; + TBuf buf = aItem.Name(); + CAknTextQueryDialog* dialog = CAknTextQueryDialog::NewL( buf ); + dialog->PrepareLC( _R(NAME_QUERY_OK_CANCEL) ); + dialog->SetPredictiveTextInputPermitted(ETrue); + HBufC* prompt; + if ( aNewItem ) + { + prompt = + StringLoader::LoadLC( StringResourceId( aItem, ENewPrompt ) ); + } + else + { + prompt = + StringLoader::LoadLC( StringResourceId( aItem, ERenamePrompt ) ); + } + dialog->SetPromptL( *prompt ); + CleanupStack::PopAndDestroy(); // prompt + TInt button = dialog->RunLD(); + if ( button ) + { + aItem.SetNameL( buf.Left(KFavouritesMaxName) ); + ret = ETrue; + } + return ret; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::SortL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::SortL( CFavouritesItemList& aList ) + { + TBuf name; + TInt i; + TInt count = aList.Count(); + + TInt resId = 0; + + for ( i = 0; i < count; i++ ) + { + resId = CBrowserFavouritesView::GetSeamlessFolderResourceID( + aList.At(i)->ContextId() ); + + if(resId) // a seamless link folder. Get the localised name. + { + HBufC* seamlessLinkName = CCoeEnv::Static()->AllocReadResourceLC( resId ); + name = seamlessLinkName->Des(); + CleanupStack::PopAndDestroy(); // seamlessLinkName + aList.At( i )->SetNameL( name ); + } + } + + aList.SortL( &CompareItemsL ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::MakeUniqueNameL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::MakeUniqueNameL +( CFavouritesItem& aItem ) + { + TInt err = BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ); + if ( !err ) + { + err = iDb.MakeUniqueName( aItem ); + CommitL(); + } + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::HandleFavouritesDbEventL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::HandleFavouritesDbEventL +( RDbNotifier::TEvent aEvent ) + { + switch ( aEvent ) + { + case RDbNotifier::ECommit: + { + // Database has changed, notify observers. + NotifyObserversL(); + break; + } + + case RDbNotifier::ERollback: + { + // Database corrupted, close now and wait until everyone closes it. + iState = ECorrupt; + iDb.Close(); + // But keep the notifier alive. + break; + } + + case RDbNotifier::EClose: + { + // Database is closed by all clients. + if ( iState == ECorrupt ) + { + // Database was closed by the model (by damage), not the user. + // Try to reopen it now; that will recover it. + iState = EClosed; + iNotifier->Cancel(); + if ( OpenDbL( /*aDbErrorNote=*/EFalse ) == KErrNone ) + { + // Succesfully reopened. Data may have changed. + NotifyObserversL(); + } + } + break; + } + + default: + { + break; + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::CBrowserFavouritesModel +// --------------------------------------------------------- +// +CBrowserFavouritesModel::CBrowserFavouritesModel( MApiProvider& aApiProvider ) + : + iApiProvider( aApiProvider ) + { + iState = EClosed; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::ConstructL() + { + iObservers = new (ELeave) CArrayPtrFlat + ( KGranularityObservers ); + iNotifier = new (ELeave) CActiveFavouritesDbNotifier( iDb, *this ); + User::LeaveIfError( iFavouritesSess.Connect() ); + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::TimedOpenDbL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::TimedOpenDbL() + { + TInt retriesLeft = KLocalRetryCount; + TInt err = ( iDb.Open( iFavouritesSess, GetDBName() )); + while ( err && retriesLeft-- ) + { + User::After( KRetryWait ); + err = ( iDb.Open( iFavouritesSess, GetDBName() )); + } + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::GetDBName +// --------------------------------------------------------- +// +const TDesC& CBrowserFavouritesModel::GetDBName() + { + //should be overridden by bookmarks model + return KBrowserSavedPages; //default value + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::TimedBeginL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::TimedBeginL( TBool /*aWrite*/ ) + { + TInt retriesLeft = KLocalRetryCount; + TInt err = iDb.Begin(); + if ( err == KErrNone ) + { + iDb.CleanupRollbackPushL(); + } + while ( err && retriesLeft-- ) + { + err = iDb.Begin() ; + if ( err == KErrNone ) + { + iDb.CleanupRollbackPushL(); + } + } + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::AddUpdateL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesModel::AddUpdateL + ( + CFavouritesItem& aItem, + TInt aUid, + TBool aDbErrorNote, + TRenameMode aRenameMode + ) + { + TBool done = EFalse; + TInt err = KErrNone; + + while ( !done ) + { + err = BeginL( /*aWrite=*/ETrue, aDbErrorNote ); + if ( err ) + { + // Database error. + done = ETrue; + } + else + { + // Database OK, try to add/update item... + switch ( aUid ) + { + { + case KFavouritesHomepageUid: + // Homepage update. + err = iDb.SetHomepage( aItem ); + break; + } + + case KFavouritesLastVisitedUid: + { + // Last Visited update. + err = iDb.SetLastVisited( aItem ); + break; + } + + case KFavouritesNullUid: + default: + { + // Check first if the item added has the same name as any of the special folders + + TBool itemExists = EFalse; + if (aItem.Type() == CFavouritesItem::EFolder) + { + #ifdef __RSS_FEEDS + HBufC* webFeedsBuf = StringLoader::LoadLC( R_BROWSER_APPS_FEEDS_LIST ); + TPtrC webFeeds = webFeedsBuf->Des(); + if(CompareIgnoreCase(aItem.Name(),webFeeds)) + { + itemExists = ETrue; + } + CleanupStack::PopAndDestroy(); + #endif + + if ( ( ADAPTIVEBOOKMARKS ) && + ( iApiProvider.Preferences().AdaptiveBookmarks() == + EWmlSettingsAdaptiveBookmarksOn )) + { + HBufC* recentUrlsBuf = StringLoader::LoadLC( R_BROWSER_ADAPTIVE_BOOKMARKS_FOLDER); + TPtrC recentUrls = recentUrlsBuf->Des(); + if(CompareIgnoreCase(aItem.Name(),recentUrls)) + { + itemExists = ETrue; + } + CleanupStack::PopAndDestroy(); + } + } + + if (( itemExists ) && (aItem.Type() == CFavouritesItem::EFolder)) + { + err = KErrAlreadyExists; + } + else + { + // New item addition. + if ( aUid == KFavouritesNullUid) + err = iDb.Add( aItem, aRenameMode == EAutoRename ); + else // Existing item update. + err = iDb.Update( aItem, aUid, aRenameMode == EAutoRename ); + } + break; + } + } + CommitL(); + + // ...and see the outcome. + switch( err ) + { + case KErrNone: + { + // All is well. + done = ETrue; + break; + } + case KErrAlreadyExists: + { + // The name is conflicting. + switch ( aRenameMode ) + { + case EAutoRename: + { + // We should never get here; + // this is handled by the Engine's AutoRename. + __ASSERT_DEBUG( EFalse, Util::Panic\ + ( Util::EFavouritesInternal ) ); + done = ETrue; + break; + } + case EDontRename: + { + // No rename is needed. + // Return with KErrAlreadyExists. + done = ETrue; + break; + } + case EAskIfRename: + default: + { + // Prompt the user for new name. + // Retry with new name, or return if Cancelled. + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_FLDR_NAME_ALREADY_USED), + aItem.Name() + ); + done = !RenameQueryL( aItem, EFalse ); + break; + } + } + break; + } + case KErrPathNotFound: + { + // The name is conflicting. + switch ( aRenameMode ) + { + case EAutoRename: + { + // We should never get here; + // this is handled by the Engine's AutoRename. + __ASSERT_DEBUG( EFalse, Util::Panic\ + ( Util::EFavouritesInternal ) ); + done = ETrue; + break; + } + case EDontRename: + { + // No rename is needed. + // Return with KErrAlreadyExists. + done = ETrue; + break; + } + case EAskIfRename: + default: + { + // Prompt the user for new name. + // Retry with new name, or return if Cancelled. + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R( TEXT_PRMPT_ILLEGAL_CHAR ), + aItem.Name() + ); + done = !RenameQueryL( aItem, EFalse ); + break; + } + } + break; + } + + case KErrNotFound: + { + // Update leaved with KErrNotFound meaning someone deleted entry while it was edited + // Add entry as new item instead. + if (aUid != KFavouritesNullUid) + { + aUid = KFavouritesNullUid; + } + break; + } + + default: + { + // Some error; quit. + done = ETrue; + break; + } + } + } + } + return err; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::GetFoldersSortedLC +// --------------------------------------------------------- +// +CFavouritesItemList* CBrowserFavouritesModel::GetFoldersSortedLC() + { + CFavouritesItemList* folders = new (ELeave) CFavouritesItemList(); + CleanupStack::PushL( folders ); + // Get all folders. + iDb.GetAll( *folders, KFavouritesRootUid, CFavouritesItem::EFolder ); + // Sort folders, + folders->SortL( &CompareItemsL ); + return folders; + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::NotifyObserversL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::NotifyObserversL() + { + TInt i; + TInt count = iObservers->Count(); + for ( i = 0; i < count; i++ ) + { + iObservers->At( i )->HandleFavouritesModelChangeL(); + } + } + +// --------------------------------------------------------- +// CBrowserBookmarksModel::ManualSortL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::ManualSortL(TInt aFolder, CBrowserBookmarksOrder* aBMOrder, CArrayFixFlat* aOrderArray, CFavouritesItemList* aItems) + { + if ( Database().GetData( aFolder ,*aBMOrder ) == KErrNone) + { + if( aOrderArray->Count() ) + { + TInt swapTo = 0; + CFavouritesItem* swappedItem = CFavouritesItem::NewL(); + CleanupStack::PushL(swappedItem); + for ( TInt i=0; iCount();i++ ) + { + TInt swapFrom = aItems->UidToIndex( ( *aOrderArray )[i] ); + if (swapFrom != KErrNotFound) + { + if ((swapFrom != swapTo) && (swapTo < aItems->Count() ) ) + { + (*swappedItem) = *( *aItems )[swapFrom]; + *( *aItems )[swapFrom] = *( *aItems )[swapTo]; + *( *aItems )[swapTo] = (*swappedItem); + } + swapTo++; + } + } + CleanupStack::PopAndDestroy(swappedItem); + } + else + { + SortL(*aItems); + } + } + else + { + SortL(*aItems); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::AddUidToLastPlaceL +// --------------------------------------------------------- +// +void CBrowserFavouritesModel::AddUidToLastPlaceL( + TInt aUid, + CArrayFixFlat* aOrderArray, + CBrowserBookmarksOrder* aCurrentOrder ) + { + if( aCurrentOrder ) + { + TInt index(0); + if( aOrderArray->Count() ) + { + index = aOrderArray->Count(); + } + aOrderArray->InsertL( index , aUid ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesModel::OpenFavouritesFile +// --------------------------------------------------------- +// + +TInt CBrowserFavouritesModel::OpenFavouritesFile ( RFavouritesFile & aFavFile, TInt aUid ) +{ +return aFavFile.Open( iDb, aUid ); +} + +// --------------------------------------------------------- +// CBrowserFavouritesModel::ReplaceFavouritesFile +// --------------------------------------------------------- +// + +TInt CBrowserFavouritesModel::ReplaceFavouritesFile ( RFavouritesFile & aFavFile, TInt aUid ) +{ +return aFavFile.Replace( iDb, aUid ); +} + +// --------------------------------------------------------------------------- +// CBrowserFavouritesModel::CompareIgnoreCase +// Compare two descriptors +// --------------------------------------------------------------------------- +// +TBool CBrowserFavouritesModel::CompareIgnoreCase( const TDesC& aFirst, + const TDesC& aSecond ) + { + // Get the standard method + TCollationMethod meth = *Mem::CollationMethodByIndex( 0 ); + meth.iFlags |= TCollationMethod::EFoldCase; + meth.iFlags |= TCollationMethod::EIgnoreNone; + + // Magic: Collation level 3 is used + return aFirst.CompareC( aSecond, 3, &meth ) == 0; + } + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1856 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CBrowserFavouritesView. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BrowserUiPrivateCRKeys.h" +#include "BrowserUtil.h" +#include "BrowserDialogs.h" +#include "BrowserFavouritesView.h" +#include "BrowserFavouritesFolderSelector.h" +#include "BrowserFavouritesContainer.h" +#include "BrowserFavouritesListbox.h" +#include "BrowserFavouritesListboxState.h" +#include "BrowserFavouritesModel.h" +#include "Browser.hrh" +#include "BrowserAppUi.h" +#include "BrowserApplication.h" +#include "BrowserFavouritesIncrementalDelete.h" +#include "BrowserFavouritesIncrementalMove.h" +#include "BrowserUIVariant.hrh" +#include "BrowserWindowManager.h" +#include "CommandVisibility.h" +#include "CommonConstants.h" +#include "CommsModel.h" +#include "Display.h" +#include "Preferences.h" +#include "logger.h" + +#include "eikon.hrh" + + +// MACROS + +/** +* Defining this macro shows "Unmark all", even if nothing is marked (except +* if there are no items at all). +*/ +//#define SHOW_UNMARK_ALL_ALWAYS +/** +* Defining this macro shows "Mark all", even if all is marked (except +* if there are no items at all). +*/ +//#define SHOW_MARK_ALL_ALWAYS + +/// Cosmetic purpose macro (resource names are overly too long). +#define _R(str) R_BROWSER_FAVOURITES_ ## str + +// CONSTANTS +/// Granularity of Uid lists used in managing multiple bookmarks. +LOCAL_C const TInt KGranularityUids = 4; + +/// Estimated FFS overhead for deleting (in bytes). +LOCAL_C const TInt KEstimatedDeleteFfsOverhead = 16 * 1024; + +// ==================== LOCAL FUNCTIONS ==================== + +/** +* Create a new empty list for Uids and push it on the cleanup stack. +* @return The constructed empty list. +*/ +LOCAL_C CArrayFix* NewUidListLC() + { + // Not inline - go for size, not speed. + CArrayFixFlat* list; + list = new (ELeave) CArrayFixFlat ( KGranularityUids ); + CleanupStack::PushL( list ); + return list; + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrowserFavouritesView::~CBrowserFavouritesView +// --------------------------------------------------------- +// +CBrowserFavouritesView::~CBrowserFavouritesView() + { + delete iFavViewRefresh; + delete iIncrementalOp; + delete iContainer; + delete iModel; + delete iSavedListboxState; + } + +// --------------------------------------------------------------------------- +// CBrowserFavouritesView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CBrowserFavouritesView::CommandSetResourceIdL() + { + // for 5.0, BrowserBookmarksView takes over cba-assignment duties + // this function should not be called. We now route though BrowserBookmarksView. + return R_AVKON_SOFTKEYS_EMPTY; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleCommandL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EWmlCmdBackFromFolder: + { + if ( ApiProvider().IsEmbeddedModeOn() ) + { + AppUi()->HandleCommandL( EWmlCmdCloseBrowser ); + } + else + { + CloseCurrentFolderL(); + } + break; + } + + case EWmlCmdOpenFolder: + { + OpenCurrentFolderL(); + break; + } + + case EWmlCmdOpenMarkedFolder: + { + OpenMarkedFolderL(); + break; + } + + case EWmlCmdFavourites: + { + ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + break; + } + + case EWmlCmdMark: + case EWmlCmdUnmark: + case EWmlCmdMarkAll: + case EWmlCmdUnmarkAll: + { + iContainer->Listbox()->HandleMarkableListCommandL( aCommand ); + iContainer->HandleCursorChangedL( iContainer->Listbox() ); + UpdateCbaL(); + break; + } + + case EWmlCmdDelete: + { + DeleteMarkedItemsL(); + break; + } + + case EWmlCmdNewFolder: + { + (void)AddNewFolderL(); + break; + } + + case EWmlCmdMoveToFolder: + { + MoveMarkedItemsL(); + break; + } + + + case EWmlCmdRename: + { + RenameCurrentItemL(); + break; + } + + case EWmlCmdSetPreferredBookmark: + { + SetPreferedCurrentItemL(); + break; + } + + case EWmlCmdSetUnPreferredBookmark: + { + SetUnPreferedCurrentItemL(); + break; + } + + case EWmlCmdPreferences: + { + iSaveStateOnDeactivate = ETrue; + AppUi()->HandleCommandL( aCommand ); + break; + } + default : + { + AppUi()->HandleCommandL( aCommand ); + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CBrowserFavouritesView::CBrowserFavouritesView +// ---------------------------------------------------------------------------- +// +CBrowserFavouritesView::CBrowserFavouritesView( MApiProvider& aApiProvider, + TInt aInitialFolderId ) + : CBrowserViewBase( aApiProvider ), + iPreferredHighlightUid( KFavouritesNullUid ), + iShowOkOptions( EFalse ), + iCurrentFolder( aInitialFolderId ), + iIsActivated( EFalse ), + iLastSelection( 0 ), + iUpdatePending( EFalse ), + iFavViewRefresh(0), + iRefresh( ETrue ) + + { + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::ConstructL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::ConstructL( TInt aViewResourceId ) + { + BaseConstructL( aViewResourceId ); + iModel = CreateModelL(); + iInitialFolder = iCurrentFolder; + // Ap model cannot be created without opening it; so that's not done here. + // DoActivateL / DoDecativateL does that. + Cba()->MakeVisible(EFalse); // avoid multiple redraws + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::GetItemsLC +// --------------------------------------------------------- +// +CFavouritesItemList* CBrowserFavouritesView::GetItemsLC( TInt aFolder ) + { + CFavouritesItemList* items = new (ELeave) CFavouritesItemList(); + CleanupStack::PushL( items ); + iModel->Database().GetAll( *items, aFolder ); + iModel->SortL( *items ); + return items; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::GetSeamlessFolderResourceID +// --------------------------------------------------------- +// +TInt CBrowserFavouritesView::GetSeamlessFolderResourceID( TInt aContextID ) + { + TInt resId = 0; + + switch( aContextID ) // Check if the item is a seamless link folder + { + case KFavouritesApplicationContextId: + { + resId = R_BROWSERBM_FOLDER_DOWNLOAD_APPLICATIONS; + break; + } + case KFavouritesImageContextId: + { + resId = R_BROWSERBM_FOLDER_DOWNLOAD_IMAGES; + break; + } + case KFavouritesAudioContextId: + { + resId = R_BROWSERBM_FOLDER_DOWNLOAD_TONES; + break; + } + case KFavouritesVideoContextId: + { + resId = R_BROWSERBM_FOLDER_DOWNLOAD_VIDEOS; + break; + } + case KFavouritesSkinContextId: + { + resId = R_BROWSERBM_FOLDER_DOWNLOAD_SKINS; + break; + } + case KFavouritesMusicContextId: + { + resId = R_BROWSERBM_FOLDER_DOWNLOAD_MUSIC; + break; + } + case KFavouritesServiceContextId: + { + resId = R_IS_RECOMMENDATIONS; + break; + } + default: + { + break; // not a seamless link folder. + } + } + + return resId; + } + + +// --------------------------------------------------------- +// CBrowserFavouritesView::GetSeamlessFolderTitleResourceID +// --------------------------------------------------------- +// +TInt CBrowserFavouritesView::GetSeamlessFolderTitleResourceID( TInt aContextID ) + { + TInt resId = 0; + + switch( aContextID ) // Check if the item is a seamless link folder + { + case KFavouritesApplicationContextId: + { + resId = R_BROWSERBM_FOLDER_TITLE_DOWNLOAD_APPLICATIONS; + break; + } + case KFavouritesImageContextId: + { + resId = R_BROWSERBM_FOLDER_TITLE_DOWNLOAD_IMAGES; + break; + } + case KFavouritesAudioContextId: + { + resId = R_BROWSERBM_FOLDER_TITLE_DOWNLOAD_TONES; + break; + } + case KFavouritesVideoContextId: + { + resId = R_BROWSERBM_FOLDER_TITLE_DOWNLOAD_VIDEOS; + break; + } + case KFavouritesSkinContextId: + { + resId = R_BROWSERBM_FOLDER_TITLE_DOWNLOAD_SKINS; + break; + } + case KFavouritesMusicContextId: + { + resId = R_BROWSERBM_FOLDER_TITLE_DOWNLOAD_MUSIC; + break; + } + default: + { + break; // not a seamless link folder. + } + } + + return resId; + } + + +// --------------------------------------------------------- +// CBrowserFavouritesView::IsSeamlessFolder +// --------------------------------------------------------- +// +TInt CBrowserFavouritesView::IsSeamlessFolder( TInt aContextID ) + { + return GetSeamlessFolderResourceID( aContextID ) != 0 ? ETrue : EFalse; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HighlightPreferredL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HighlightPreferredL() + { + if (( iContainer->Listbox()->HighlightUidNow( iPreferredHighlightUid ) ) && + ( iPreferredHighlightUid != KFavouritesNullUid )) + { + // Have a preferred uid... + // Successfully highlighted; clear preferred now. + iPreferredHighlightUid = KFavouritesNullUid; + iContainer->HandleCursorChangedL( iContainer->Listbox() ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::RefreshL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::RefreshL( TBool aDbErrorNote /*=EFalse*/ ) + { + // Do the refresh only if activated; otherwise ignore. + // (This is a sanity-check like functionality, but is really used. + // Bookmarks View observes changes in active and default AP-s, even if + // not activated (and tries to refresh); but this "activated-check" is + // made here, not in Bookmarks View, because it makes things more safe and + // "future-proof".) + if ( iIsActivated ) + { + iUpdatePending = ETrue; + if ( !iIncrementalOp ) + { + // During an incremental operation we should never do the update + // and refill the listbox because some of the operations holds + // pointers to listbox items. Update is pending then. + if ( iModel->BeginL( /*aWrite=*/EFalse, aDbErrorNote ) == + KErrNone ) + { + TInt folderExists; + iModel->Database().FolderExists( iCurrentFolder, folderExists ); + if ( folderExists ) + { + // Current folder is still OK. Refresh. + FillListboxL( iCurrentFolder, /*aKeepState=*/ETrue ); + } + else + { + // Cannot access current folder (maybe deleted). + // Go to root. + OpenFolderL( KFavouritesRootUid ); + } + iModel->CommitL(); + iUpdatePending = EFalse; + } + // iUpdatePending stays ETrue if unsuccessful. + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::DoActivateL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + iPreviousViewID = ApiProvider().LastActiveViewId( ); + ApiProvider().SetLastActiveViewId( Id() ); + ApiProvider().CommsModel().AddObserverL( *this ); + iContainer = CreateContainerL(); // can this be created during construct ? + iModel->AddObserverL( *this ); + AppUi()->AddToViewStackL( *this, iContainer ); + + ApiProvider().StartProgressAnimationL(); + + if ( iModel->BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) + == KErrNone ) + { + // Disable redraw to avoid flickering. + // (OpenFolderL and the listbox's SetStateL both + // wants to redraw the listbox. Do it once only.) + TBool redrawDisabled = + iContainer->Listbox()->View()->RedrawDisabled(); + iContainer->Listbox()->View()->SetDisableRedraw( ETrue ); + // Open folder first. + OpenFolderL( iCurrentFolder ); + iModel->CommitL(); + + // Now set back redraw and draw the listbox. + if ( (iLastSelection >=0 )) + { + if ( iLastSelection > iContainer->Listbox()->BottomItemIndex() ) + { + iLastSelection = 0; + } + iContainer->Listbox()->SetCurrentItemIndex( iLastSelection ); + } + + iContainer->Listbox()->View()->SetDisableRedraw( redrawDisabled ); + iContainer->Listbox()->DrawDeferred(); + } + else + { + // No folder is opened; update CBA and Navi Pane now. + if ( iLastSelection >=0 ) + { + iContainer->Listbox()->SetCurrentItemIndex( iLastSelection ); + UpdateGotoPaneL(); + } + UpdateCbaL(); + UpdateNaviPaneL(); + } + + if (iSavedListboxState) + { + iContainer->Listbox()->SetStateL(*iSavedListboxState); + } + iIsActivated = ETrue; + +#ifndef BRDO_PERF_IMPROVEMENTS_ENABLED_FF + // TODO: Remove this crapy refresh once favicon callback interface + // with engine is implemented. + if(!iFavViewRefresh) + iFavViewRefresh = CIdle::NewL( CActive::EPriorityIdle ); + iFavViewRefresh ->Start( TCallBack( RefeshFavoriteListBox, this ) ); +#endif + } + + +TInt CBrowserFavouritesView::RefeshFavoriteListBox(TAny* aFavouritesView) + { + __ASSERT_DEBUG(aFavouritesView, Util::Panic( Util::EUninitializedData )); + TRAP_IGNORE( + ((CBrowserFavouritesView*)aFavouritesView)->RefreshL(); + ); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CBrowserFavouritesView::ResetStateInDeActivation +// ---------------------------------------------------------------------------- +// +void CBrowserFavouritesView::ResetStateInDeActivation() + { + //Set iLastSelection to zero if there will be a folder change + if ( iCurrentFolder != iInitialFolder ) + { + iLastSelection = 0; + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::DoDeactivate +// --------------------------------------------------------- +// +void CBrowserFavouritesView::DoDeactivate() + { + iIsActivated = EFalse; + TRAP_IGNORE(ApiProvider().StopProgressAnimationL()); + + if(iFavViewRefresh) + { + iFavViewRefresh->Cancel(); + } + + if ( iContainer ) + { + iLastSelection = iContainer->Listbox()->CurrentItemIndex(); + } + + if ( !iSaveStateOnDeactivate ) + { + ResetStateInDeActivation(); // entering root directory + iSaveStateOnDeactivate = EFalse; + } + else + { + CBrowserFavouritesListboxState *temp = NULL; + TInt err( KErrNone ); + TInt tempUid( KFavouritesNullUid ); + + temp = new CBrowserFavouritesListboxState; + if ( iContainer && temp!=NULL ) + { + delete iSavedListboxState; + iSavedListboxState = temp; + // folder might be empty, no CurrentItem at all + if ( iContainer->Listbox()->CurrentItem() ) + { + tempUid = iContainer->Listbox()->CurrentItem()->Uid(); + } + iSavedListboxState->iHighlightUid = tempUid; + TRAP( err, { + iSavedListboxState->iMarkUids = iContainer->Listbox()->MarkedUidsLC(); + CleanupStack::Pop(); // Uid list; ownership is now in the state. + } ) + } + if ( !err ) + { + iSavedListboxState->iTopItemUid = tempUid; + } + else + { + delete iSavedListboxState; + } + } + + if ( !ApiProvider().ExitInProgress() ) + { + ApiProvider().CommsModel().RemoveObserver( *this ); + } + iModel->RemoveObserver( *this ); + + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + iModel->CloseDb(); + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleClientRectChange +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::DynInitMenuPaneL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::DynInitMenuPaneL +( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( iContainer && iContainer->Listbox() ) + { + TBrowserFavouritesSelectionState state = + iContainer->Listbox()->SelectionStateL(); + TCommandVisibility::TIndex index = + TCommandVisibility::Index( state, iShowOkOptions ); + DynInitMenuPaneL( aResourceId, aMenuPane, index, state ); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleForegroundEventL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleForegroundEventL( TBool aForeground ) + { + // If another thread made changes to database, sometimes we could not + // refresh when the notifcation comes in (most likely the other thread + // closes the database and that performs an automatic compact(?)). + // When coming foreground, check for missed updates. + // Also, when coming to foreground Refresh if Skin has changed + if ( aForeground && (iUpdatePending || iContainer->Listbox()->IsSkinUpdated())) + { + RefreshL(); + if (iContainer->Listbox()->IsSkinUpdated()) + { + iContainer->Listbox()->SetSkinUpdated(EFalse); + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleListBoxEventL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleListBoxEventL +( CEikListBox* aListBox, MEikListBoxObserver::TListBoxEvent aEventType ) + { + if ( aListBox == iContainer->Listbox() ) + { + switch ( aEventType ) + { + case MEikListBoxObserver::EEventEnterKeyPressed: + case MEikListBoxObserver::EEventItemDoubleClicked: +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + case MEikListBoxObserver::EEventItemSingleClicked: +#endif + { + if ( iContainer->Listbox()->CurrentItem() ) + { + if ( iContainer->Listbox()->CurrentItem()->IsFolder() ) + { + OpenCurrentFolderL(); + } + } + break; + } + + default: + { + break; + } + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::CloseCurrentFolderL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::CloseCurrentFolderL() + { + if ( iCurrentFolder != KFavouritesRootUid ) + { + // Folders are one level deep. Closing any folder takes us to root. + if ( iModel->BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) + == KErrNone ) + { + if ( iContainer && iContainer->Listbox() ) + { + // After closing, the highlight should be + // on the folder just being closed. + iPreferredHighlightUid = iCurrentFolder; + OpenFolderL( KFavouritesRootUid ); + } + iModel->CommitL(); + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::OpenCurrentFolderL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::OpenCurrentFolderL() + { + if ( iContainer && iContainer->Listbox() ) + { + const CFavouritesItem* folder = + iContainer->Listbox()->CurrentItem(); + if ( folder && folder->IsFolder() ) + { + if ( iModel->BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) + == KErrNone ) + { + OpenFolderL( folder->Uid() ); + iModel->CommitL(); + } + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::OpenMarkedFolderL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::OpenMarkedFolderL() + { + if ( iContainer && iContainer->Listbox() ) + { + const CFavouritesItem* folder = + iContainer->Listbox()->MarkedItemL(); + if ( folder && folder->IsFolder() ) + { + if ( iModel->BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) + == KErrNone ) + { + OpenFolderL( folder->Uid() ); + iModel->CommitL(); + } + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::DeleteMarkedItemsL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::DeleteMarkedItemsL() + { + CArrayPtr* items = + iContainer->Listbox()->SelectedItemsLC(); + // Permormance optimization: keep a separate list for folders. + // (Make the "non-empty folder" check only for folders; this speeds up + // things considerably when many items are selected.) + CArrayFix* uids = NewUidListLC(); + CArrayFix* folderUids = NewUidListLC(); + TInt i; + TInt count = items->Count(); + const CFavouritesItem* item = NULL; + + for ( i = 0; i < count; i++ ) + { + item = items->At( i ); + uids->AppendL( item->Uid() ); + if ( item->IsFolder() ) + { + folderUids->AppendL( item->Uid() ); + } + } + // Cannot delete the "items" pointer list, as other objects were pushed + // after it. But DO NOT USE it after this point! The call to ConfirmDeleteL + // allows other active objects to run, and the listbox may be updated. + // If listbox is updated, all pointers in "items" point to deleted objects. + + if ( ConfirmDeleteL( *uids, *folderUids ) ) + { + + if (count ==1) + { + CFavouritesItemList* allItems = GetItemsLC( KFavouritesRootUid ); + item = items->At(0); + iPreferredHighlightUid = item->Uid(); + TInt index = allItems->UidToIndex(iPreferredHighlightUid); + index++; + if (allItems->IndexToUid(index) != NULL) + { + iPreferredHighlightUid = allItems->IndexToUid(index); + } + else + { + iPreferredHighlightUid = allItems->IndexToUid(index-2); + } + CleanupStack::PopAndDestroy(); //allItems + } + + + CArrayFix* notDeletedUids = NewUidListLC(); + + // OOD handling. If disk space is low, we try to get some spare. + + CRepository* repository = CRepository::NewL( KCRUidBrowser ); + + TBool diskLow = Util::FFSSpaceBelowCriticalLevelL + ( /*aShowErrorNote=*/EFalse, KEstimatedDeleteFfsOverhead ); + if ( diskLow ) + { + // Using disk space requests is not supported by CenRep. + delete repository; + } + + if ( !iModel->BeginL + ( + /*aWrite=*/ETrue, + /*aDbErrorNote=*/ETrue, + /*aLffsCheck=*/EFalse + ) + ) + { + __ASSERT_DEBUG( !iIncrementalOp, Util::Panic + ( Util::EIncrementalOperationAlreadyRunning ) ); + // Seems we have to give lower priority to the delete operation, + // or else the wait note does not show up. + iIncrementalOp = CBrowserFavouritesIncrementalDelete::NewL + ( + *iModel, + *uids, + *notDeletedUids, + CActive::EPriorityStandard - 1 + ); + iIncrementalOp->ExecuteL(); + delete iIncrementalOp; + iIncrementalOp = NULL; + iModel->CommitL(); + + if ( diskLow ) + { + // Compact database now. + iModel->Database().Compact(); + // Make a manual refresh. When we get notification about the + // commit, database is most likely busy with compact, and + // the refresh is missed. + RefreshL(); + } + + // Everything that can be deleted, is deleted by now. + // Let the user know the outcome. + DisplayResultOfDeleteL( *uids, *notDeletedUids ); + // Refresh the view only in embedded mode because in standalone mode Refresh is called by + // HandleFavouritesModelChangeL causing the view to refresh twice and lose the cursor position + if ( ApiProvider().IsEmbeddedModeOn() ) + { + RefreshL(); + } + } + + for ( TInt ii = 0; ii< uids->Count(); ii++ ) + { + TInt prefUid; + iModel->Database().PreferredUid( iCurrentFolder, prefUid ); + if ( prefUid == uids->At( ii ) ) + { + iModel->Database().SetPreferredUid( iCurrentFolder,NULL ); + break; + } + } + + CleanupStack::PopAndDestroy(); // notDeletedUids + } + CleanupStack::PopAndDestroy( 3 ); // folderUids, uids, items + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::AddNewFolderL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesView::AddNewFolderL() + { + TInt uid = KFavouritesNullUid; + // Make an item and fill it with default values. + CFavouritesItem* folder = CFavouritesItem::NewLC(); + folder->SetType( CFavouritesItem::EFolder ); + folder->SetParentFolder( KFavouritesRootUid ); + iModel->SetNameToDefaultL( *folder ); + TInt err = iModel->MakeUniqueNameL( *folder ); + if ( !err ) + { + // We have the folder with a default unique name. + // Let the user rename it. + if ( iModel->RenameQueryL( *folder, ETrue )) + { + // Rename accepted. + err = iModel->AddL( *folder, /*aDbErrorNote=*/ETrue, + CBrowserFavouritesModel::EAskIfRename ); + if ( !err ) + { + // Succesfully created. Set highlight to new folder (by setting + // preferred highlight uid - we have not see the new folder + // yet, until db notification kicks in. + uid = iPreferredHighlightUid = folder->Uid(); + } + } + } + CleanupStack::PopAndDestroy(); // folder + return uid; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::MoveMarkedItemsL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::MoveMarkedItemsL() + { + TInt targetFolder = SelectTargetFolderL( iCurrentFolder ); + + // If we have the target folder, do the move. + if ( targetFolder != KFavouritesNullUid ) + { + CArrayFix* uids = iContainer->Listbox()->SelectedUidsLC(); + CArrayFix* unmovableUids = NewUidListLC(); + CArrayFix* conflictingNameUids = NewUidListLC(); + if ( !iModel->BeginL( /*aWrite=*/ETrue, /*aDbErrorNote=*/ETrue ) ) + { + __ASSERT_DEBUG( !iIncrementalOp, Util::Panic + ( Util::EIncrementalOperationAlreadyRunning ) ); + // Seems we have to give lower priority to the move operation, + // or else the wait note does not show up. + iIncrementalOp = CBrowserFavouritesIncrementalMove::NewL + ( + *iModel, + *uids, + *unmovableUids, + *conflictingNameUids, + targetFolder, + CActive::EPriorityStandard - 1 + ); + iIncrementalOp->ExecuteL(); + delete iIncrementalOp; + iIncrementalOp = NULL; + iModel->CommitL(); + // Everything that can be moved, is moved by now. + // If some items could not be moved, see why. + HandleMoveResultL + ( targetFolder, *uids, *unmovableUids, *conflictingNameUids ); + + for ( TInt ii = 0; ii< uids->Count(); ii++ ) + { + TInt prefUid; + iModel->Database().PreferredUid( iCurrentFolder, prefUid ); + if ( prefUid == uids->At( ii ) ) + { + iModel->Database().SetPreferredUid( iCurrentFolder,NULL ); + break; + } + } + + CBrowserBookmarksOrder* bmOrder = CBrowserBookmarksOrder::NewLC(); + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat(KGranularityHigh); + CleanupStack::PushL( orderArray ); + if ( Model().Database().GetData( CurrentFolder() ,*bmOrder ) == KErrNone) + { + if ( bmOrder->GetBookMarksOrder().Count() ) + { + orderArray->AppendL( &( bmOrder->GetBookMarksOrder()[0] ), bmOrder->GetBookMarksOrder().Count()); + TInt swapTo = 0; + TInt swappedItem; + for ( TInt i=0; iCount();i++ ) + { + TInt swapFrom=0; + while (swapFromCount() && ( (*uids)[swapFrom] != ( *orderArray )[i]) ) + { + swapFrom++; + } + if (swapFromCount()) + { + if ((swapFrom != swapTo) && (swapTo < uids->Count() ) ) + { + swappedItem = ( *uids )[swapFrom]; + ( *uids )[swapFrom] = ( *uids )[swapTo]; + ( *uids )[swapTo] = swappedItem; + } + swapTo++; + } + } + } + } + + orderArray->Reset(); + if ( Model().Database().GetData( targetFolder ,*bmOrder ) == KErrNone) + { + if ( bmOrder->GetBookMarksOrder().Count() ) + { + orderArray->AppendL( &( bmOrder->GetBookMarksOrder()[0] ), bmOrder->GetBookMarksOrder().Count()); + if ( orderArray->Count() ) + { + for ( TInt i = 0; i < uids->Count(); i++ ) + { + for (TInt j = 0; j < orderArray->Count(); j++ ) + { + if ( orderArray->At( j ) == uids->At( i )) + { + orderArray->Delete( j ); + } + } + Model().AddUidToLastPlaceL(uids->At( i ), orderArray, bmOrder); + } + bmOrder->SetBookMarksOrderL( *orderArray ); + Model().Database().SetData( targetFolder , *bmOrder ); + } + } + } + + CleanupStack::PopAndDestroy( ); //orderArray + CleanupStack::PopAndDestroy( ); //bmOrder + } + CleanupStack::PopAndDestroy( 3 ); // conflictingNameUids, + // unmovableUids, uids + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::RenameCurrentItemL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::RenameCurrentItemL() + { + if ( iContainer && iContainer->Listbox() ) + { + const CFavouritesItem* listboxItem = + iContainer->Listbox()->CurrentItem(); + if ( listboxItem ) + { + CFavouritesItem* item = CFavouritesItem::NewLC(); + *item = *listboxItem; + if ( iModel->RenameQueryL( *item, EFalse ) ) + { + iModel->UpdateL + ( + *item, + listboxItem->Uid(), + /*aDbErrorNote=*/ETrue, + CBrowserFavouritesModel::EAskIfRename + ); + + iPreferredHighlightUid = item->Uid(); + + // Show infonote "Unable to rename" if read-only item + if ( listboxItem->IsReadOnly() ) + { + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_PRMPT_CANT_RENAME), + listboxItem->Name() + ); + } + } + CleanupStack::PopAndDestroy(); // item + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::SetRootFolderForAdaptiveBookmarks +// --------------------------------------------------------- +// +void CBrowserFavouritesView::SetRootFolderForAdaptiveBookmarks() + { + iCurrentFolder = KFavouritesRootUid; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::OpenFolderL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::OpenFolderL( TInt aFolder ) + { + + CFavouritesItem* folder = CFavouritesItem::NewLC(); + if ( iModel->Database().Get( aFolder, *folder ) == KErrNone ) + { + iContainer->Listbox()->GetDefaultData().iPreferedId = NULL; + iContainer->Listbox()->GetDefaultData().iInSeamlessFolder = EFalse; + // Set title. + if ( aFolder == KFavouritesRootUid ) + { + UpdateNaviPaneL(); // remove NaviPane before setting title - SetTitleL redraws + if(ApiProvider().StartedUp()) + ApiProvider().Display().SetTitleL( RootTitleResourceId() ); + else + { + // Set title to be page title + CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, CEikonEnv::Static()->EikAppUi() )->StatusPane(); + CAknTitlePane* title = STATIC_CAST( CAknTitlePane*, sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + HBufC* name = CEikonEnv::Static()->AllocReadResourceLC( R_BROWSER_OPTION_BOOKMARKS ); + title->SetTextL( *name ); + CleanupStack::PopAndDestroy(); // name + } + } + else + { + // Next get localized title text if the folder is a seamless link folder. + TInt resId = CBrowserFavouritesView::GetSeamlessFolderTitleResourceID( + folder->ContextId() ); + HBufC* name; + + if (resId) + { + iContainer->Listbox()->GetDefaultData().iInSeamlessFolder = ETrue; + TInt prefUid; + iModel->Database().PreferredUid( aFolder, prefUid ); + iContainer->Listbox()->GetDefaultData().iPreferedId = prefUid; + name = iCoeEnv->AllocReadResourceLC( resId ); + folder->SetNameL(name->Des()); // set the localized name + CleanupStack::PopAndDestroy(); // name + } + + ApiProvider().Display().SetTitleL( folder->Name() ); + } + + iCurrentFolder = aFolder; + FillListboxL( aFolder, /*aKeepState=*/EFalse ); + + if(ApiProvider().StartedUp()) + { + Container()->Listbox()->ClearSelection(); + UpdateCbaL(); + } + + UpdateNaviPaneL(); + } + CleanupStack::PopAndDestroy(); // folder + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::OpenNextFolderL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::OpenNextFolderL( TBool aForward ) + { + __ASSERT_DEBUG( iCurrentFolder != KFavouritesRootUid, + Util::Panic( Util::ERootLevel ) ); + + if ( iModel->BeginL( /*aWrite=*/EFalse, /*aDbErrorNote=*/ETrue ) + == KErrNone ) + { + TInt nextFolder = iModel->NextFolderL( iCurrentFolder, aForward ); + if ( nextFolder != KFavouritesNullUid ) + { + OpenFolderL( nextFolder ); + } + iModel->CommitL(); + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::FillListboxL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::FillListboxL( TInt aFolder, TBool aKeepState ) + { + // During an incremental operation we should never update the listbox + // because some of them holds pointers to listbox items. + // + // If we have an incremental operation, we should never get here: + // 1) Any change notification (faves db, ap db, preferences) handling is + // skipped in RefreshL, where all change handling comes + // together. + // 2) All incremental operations have an empty CBA, so we cannot get here + // by user input either. + // But to make this safe from potential errors (e.g. user activity due to + // some error in wait notes, CBA, key handling etc., and also from bugs in + // this code), we double-check here. + // In release build do nothing (avoid the crash), in debug build panic. + if ( iIncrementalOp ) + { +#ifdef _DEBUG + Util::Panic( Util::ECannotUpdateDataInUse ); +#else + return; +#endif + } + + CBrowserFavouritesListbox* listbox = iContainer->Listbox(); + + // Disable redraw to avoid flickering. + TBool redrawDisabled = listbox->View()->RedrawDisabled(); + listbox->View()->SetDisableRedraw( ETrue ); + + // Change the data. + CFavouritesItemList* items = GetItemsLC( aFolder ); + + // Next take localized item names for seamless links. + TInt contextId; + TInt resId = 0; + HBufC* name; + + TBool browserService = ApiProvider().Preferences().ServiceFeature(); + TBool firstBoot = ApiProvider().Preferences().GetIntValue( KBrowserFirstBoot ); + TInt serviceUid = KErrNotFound; + + for(int i=0; iCount(); i++) + { + if (!items->At(i)->IsHidden()) + { + contextId = items->At(i)->ContextId(); + + if ( firstBoot && browserService ) + { + //This is the first boot and we need to move Service top of the bookmarks. + //Here we save uid for Service item. + if ( contextId == KFavouritesServiceContextId ) + { + serviceUid = items->IndexToUid( i ); + } + } + + resId = CBrowserFavouritesView::GetSeamlessFolderResourceID( + contextId ); + if(resId) + { + name = iCoeEnv->AllocReadResourceLC( resId ); + items->At(i)->SetNameL(name->Des()); + CleanupStack::PopAndDestroy(); // name + } + } + else + { + items->Delete(i); + i--; + } + } + + if ( firstBoot && browserService && serviceUid != KErrNotFound ) + { + //get current order array + CBrowserBookmarksOrder* currentOrder = CBrowserBookmarksOrder::NewLC(); + CArrayFixFlat* orderArray = new (ELeave) CArrayFixFlat( KGranularityHigh ); + CleanupStack::PushL( orderArray ); + + iModel->Database().GetData( KFavouritesRootUid, *currentOrder ); + orderArray->AppendL( &( currentOrder->GetBookMarksOrder()[0] ), currentOrder->GetBookMarksOrder().Count()); + + //First sort UI. Move Service + CFavouritesItem* serviceCopy = CFavouritesItem::NewLC(); + const CFavouritesItem* serviceItem = items->ItemByUid( serviceUid ); + if ( serviceItem ) + { + *serviceCopy = *serviceItem; + items->Delete( serviceUid ); + items->InsertL( 0, serviceCopy ); //ownership transfered + CleanupStack::Pop( serviceCopy ); + } + else + { + User::Leave( KErrNotFound ); + } + + //Next change order in db. Move Service + orderArray->InsertL( 0, orderArray->At( serviceUid ) ); + orderArray->Delete( serviceUid+1 ); + + //save changes to db + currentOrder->SetBookMarksOrderL( *orderArray ); + iModel->Database().SetData( KFavouritesRootUid, *currentOrder ); + + CleanupStack::PopAndDestroy( 2 ); //orderArray, currentOrder + //service moved to top of the bookmark list. We can set firstboot value to false + // so now we can set firstboot value to false. + CRepository* repository = CRepository::NewLC( KCRUidBrowser ); + User::LeaveIfError( repository->Set(KBrowserFirstBoot, EFalse) ); + CleanupStack::PopAndDestroy( repository ); + + // Set Search item to italics font + iContainer->Listbox()->ItalicizeRowItemL(0); + } + CleanupStack::Pop(); // items: passing ownership to listbox. + iContainer->Listbox()->SetDataL + ( items, /*ApiProvider().CommsModel(),*/ aKeepState ); + CAknColumnListBoxView *aknview = STATIC_CAST(CAknColumnListBoxView*, iContainer->Listbox()->View() ); + + if ( !items->Count() ) + { + iContainer->Listbox()->UpdateFilterL(); // ...and tell to listbox. + aknview->SetFindEmptyListState(EFalse); + } + else + { + aknview->SetFindEmptyListState(ETrue); + } + + if(ApiProvider().StartedUp()) + iContainer->SizeChanged(); // Needed to show/hide Find Pane! + iCurrentFolder = aFolder; + + HighlightPreferredL(); + iContainer->HandleCursorChangedL( listbox ); + listbox->View()->SetDisableRedraw( redrawDisabled ); + + if(ApiProvider().StartedUp()) + { + listbox->DrawDeferred(); + UpdateCbaL(); + UpdateNaviPaneL(); + } + } + +// ---------------------------------------------------------------------------- +// CBrowserFavouritesView::ConfirmDeleteL +// ---------------------------------------------------------------------------- +// +TBool CBrowserFavouritesView::ConfirmDeleteL +( CArrayFix& aUids, CArrayFix& aFolderUids ) + { + CBrowserFavouritesModel::TDbQuery anyNonEmptyFolders; + TInt ret = EFalse; + + anyNonEmptyFolders = iModel->AnyNonEmptyFoldersL( aFolderUids ); + switch ( anyNonEmptyFolders ) + { + case CBrowserFavouritesModel::EYes: + { + // At least one non-empty folder is selected. + ret = TBrowserDialogs::ConfirmQueryYesNoL( + _R(TEXT_DEL_FULL_FLDRS_QUERY) ); + break; + } + + case CBrowserFavouritesModel::ENo: + { + // No non-empty folders are selected. + TInt count = aUids.Count(); + switch ( count ) + { + case 0: + { + // Empty selection (???); + ret = EFalse; + break; + } + + case 1: + { + // One item is selected (item or empty folder). + // Get its name. + const CFavouritesItem* item = iContainer->Listbox()-> + ItemByUid( aUids.At( 0 ) ); + if ( item ) + { + ret = TBrowserDialogs::ConfirmQueryYesNoL( + _R(TEXT_QUERY_COMMON_CONF_DELETE), item->Name() ); + } + else + { + // Could not get item (maybe listbox has been updated). + ret = EFalse; + } + break; + } + + default: + { + // More items are selected (items or/and empty folders). + ret = TBrowserDialogs::ConfirmQueryYesNoL( + _R(TEXT_DEL_ITEMS_QUERY), count ); + break; + } + + } + break; + } + + case CBrowserFavouritesModel::EError: + default: + { + // Could not access database. + ret = EFalse; + break; + } + } + + return ret; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::DisplayResultOfDeleteL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::DisplayResultOfDeleteL +( const CArrayFix& /*aUids*/, const CArrayFix& aNotDeletedUids ) + { + switch ( aNotDeletedUids.Count() ) + { + case 0: + { + // All items deleted successfully. + // Display nothing. + break; + } + case 1: + { + // One item is not deleted. + const CFavouritesItem* item = iContainer->Listbox()-> + ItemByUid( aNotDeletedUids.At( 0 ) ); + if ( item ) + { + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_CANT_DELETE_ITEM), + item->Name() + ); + } + // else + // this item is not found in the listbox (so it does not exist, + // most likely got deleted somehow) - keep quiet. + break; + } + default: + { + // More items are not deleted. + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_CANT_DELETE_ITEMS), + aNotDeletedUids.Count() + ); + break; + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::SelectTargetFolderL +// --------------------------------------------------------- +// +TInt CBrowserFavouritesView::SelectTargetFolderL( TInt aExcludeFolder ) + { + TInt targetFolder = KFavouritesNullUid; + + switch ( iModel->AnyFoldersL() ) + { + case CBrowserFavouritesModel::EYes: + { + // Select from existing folders. + CBrowserFavouritesFolderSelector* selector = + CBrowserFavouritesFolderSelector::NewL + ( *iModel, ApiProvider(), aExcludeFolder ); + targetFolder = selector->ExecuteLD(); + break; + } + case CBrowserFavouritesModel::ENo: + { + break; + } + case CBrowserFavouritesModel::EError: + default: + { + // Some error; quit. + break; + } + } + return targetFolder; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleMoveResultL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleMoveResultL + ( + TInt aFolder, + const CArrayFix& /*aUids*/, + const CArrayFix& aUnmovableUids, + const CArrayFix& aConflictingNameUids + ) + { + // See if some items has to be renamed to do the move. + if ( aConflictingNameUids.Count() ) + { + if ( aConflictingNameUids.Count() == 1 ) + { + // One item needs to be renamed if the user wants to move them. + // Let the user know and ask if replace. + const CFavouritesItem* item = iContainer->Listbox()-> + ItemByUid( aConflictingNameUids.At( 0 ) ); + if ( item ) + { + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_FLDR_NAME_ALREADY_USED), + item->Name() + ); + RenameAndMoveItemsL( aConflictingNameUids, aFolder ); + } + } + else + { + // Some items needs to be renamed if the user wants to move them. + // Let the user know and ask for each if replace. + TBrowserDialogs::InfoNoteL( R_BROWSER_INFO_NOTE, + _R(TEXT_FLDR_NAMES_IN_USE_RENAME) ); + RenameAndMoveItemsL( aConflictingNameUids, aFolder ); + } + } + + // Check unmovable items. + if ( aUnmovableUids.Count() ) + { + if ( aUnmovableUids.Count() == 1 ) + { + // One item is not moved. + const CFavouritesItem* item = iContainer->Listbox()-> + ItemByUid( aUnmovableUids.At( 0 ) ); + if ( item ) + { + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_ITEM_CANNOT_BE_MOVED), + item->Name() + ); + } + } + else + { + // More items could not be moved. + TBrowserDialogs::InfoNoteL + ( + R_BROWSER_INFO_NOTE, + _R(TEXT_SOME_ITEMS_CANT_MOVE), + aUnmovableUids.Count() + ); + } + } + // else + // All is well: all moved succesfully. Display nothing. + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::RenameAndMoveItemsL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::RenameAndMoveItemsL +( const CArrayFix& aUids, TInt aFolder ) + { + TInt err = KErrNone; + TInt i; + TInt uid; + TInt count = aUids.Count(); + TInt itemErr; + + CFavouritesItem* item = CFavouritesItem::NewLC(); + + for ( i = 0; i < count && !err; i++ ) + { + // Get each item in turn from db (ignore if any of them is not found). + // Let the user rename each. Quit on the first Cancel from the user. + // All database manipulating methods, which are called here, retry on + // failure, so if we ever get an error value, that means that the user + // cancelled something. + uid = aUids.At( i ); + err = iModel->BeginL( /*aWrite=*/ETrue, /*aDbErrorNote=*/ETrue ); + if ( !err ) + { + // Check if we have the item. + itemErr = iModel->Database().Get( uid, *item ); + iModel->CommitL(); + if ( !itemErr ) + { + // We have this item. Ask the user to rename it. + if ( iModel->RenameQueryL( *item, EFalse) ) + { + // The user renamed the item: try to update and go on. + item->SetParentFolder( aFolder ); + err = iModel->UpdateL( *item, uid, /*aDbErrorNote=*/ETrue, + CBrowserFavouritesModel::EAskIfRename ); + } + else + { + // Cancelled. Quit. + err = KErrCancel; + } + } + } + } + CleanupStack::PopAndDestroy(); // item + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::UpdateNaviPaneL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::UpdateNaviPaneL() + { + if ( iCurrentFolder == KFavouritesRootUid ) + { + // In root folder show the tabs. + iContainer->ShowRootNaviPane(); + } + else + { + // In other folder, show "1/4" style text. + TInt folderIndex; + TInt folderCount; + TInt err; + err = iModel->FolderInfoL( iCurrentFolder, folderCount, folderIndex ); + if ( !err ) + { + iContainer->ShowFolderNaviPaneL( folderIndex, folderCount ); + } + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CBrowserFavouritesView::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) + { + // This method is called back from the container, to process the keypresses + // that cannot be handled by the container. Those are (currently) the + // left/right arrow keypresses, since the container does not know anything + // about what folder is open, which knowledge is required to process + // arrow presses. So we do that here. + // Any other key processing is still in the container. + TKeyResponse result = EKeyWasNotConsumed; + switch ( aKeyEvent.iCode ) + { + + case EKeyLeftArrow: // West + { + if ( iCurrentFolder != KFavouritesRootUid ) + { + // We are in some folder. Move between subfolders in the + // leftward direction. + if ( !ApiProvider().IsEmbeddedModeOn() ) + { + OpenNextFolderL( /*aForward=*/EFalse ); + } + //return EKeyWasConsumed anyway, since in embedded mode user can access only the launch folder + result = EKeyWasConsumed; + } + break; + } + + case EKeyRightArrow: // East + { + if ( iCurrentFolder != KFavouritesRootUid ) + { + // We are in some folder. Move between subfolders in the + // rightward direction. + if ( !ApiProvider().IsEmbeddedModeOn() ) + { + OpenNextFolderL( /*aForward=*/ETrue ); + } + //return EKeyWasConsumed anyway, since in embedded mode user can access only the launch folder + result = EKeyWasConsumed; + } + break; + } + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge + { // Here, "eat" all of the diagonals so they have no effect + result = EKeyWasConsumed; + break; + } + + + case EKeyBackspace: + case EKeyDelete: + { + TBrowserFavouritesSelectionState state = + iContainer->Listbox()->SelectionStateL(); + if ( state.AnyDeletable() ) + { + // We don't editing (not in Goto Pane), + // and have something to delete. In this case, Clear key + // deletes the selection (or highlighted items). + if ( ((iContainer->Listbox()->CurrentItem()->ContextId() == NULL ) && + (iContainer->Listbox()->CurrentItem()->Uid() != KFavouritesAdaptiveItemsFolderUid) || + state.AnyMarked() ) + ) + { + DeleteMarkedItemsL(); + } + result = EKeyWasConsumed; + } + break; + } + + case EKeyOK: + // OK key is handled through MSK handling + result = EKeyWasConsumed; + break; + + case EKeyEnter: + { + if ( !(aKeyEvent.iModifiers & EModifierShift) ) + { + TBrowserFavouritesSelectionState state = + iContainer->Listbox()->SelectionStateL(); + if ( state.IsEmpty() || state.AnyMarked() ) + { + // Selection key (alone) pressed when there are marked + // items or the list is empty. Bring up context sensitive + // (OK-Options) menu. + MenuBar( )-> + SetMenuTitleResourceId( OkOptionsMenuResourceId() ); + iShowOkOptions = ETrue; + // Call to menu activation is trapped - to make sure that + // iShowOkOptions and bad menu doesn't stick in. + TRAP_IGNORE( ProcessCommandL( EAknSoftkeyOptions ) ); + iShowOkOptions = EFalse; + MenuBar( )-> + SetMenuTitleResourceId( OptionsMenuResourceId() ); + + // Update CBA to include context menu MSK icon + UpdateCbaL(); + + result = EKeyWasConsumed; + } + } + break; + } + + default: + { + break; + } + } + + return result; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleFavouritesModelChangeL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleFavouritesModelChangeL() + { + // Change in favourites database. + if ( iRefresh ) + { + RefreshL(); + } + iRefresh = ETrue; + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::HandleCommsModelChangeL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::HandleCommsModelChangeL() + { + // Change in AP-s (CommsDb). + RefreshL( /*aDbErrorNote=*/EFalse ); + } + +void CBrowserFavouritesView::OpenFixedFolderL(TInt aUid) + { + OpenFolderL(aUid); + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::SetPreferedCurrentItemL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::SetPreferedCurrentItemL() + { + // check the current item is exist + if ( iContainer->Listbox()->CurrentItem() ) + { + iContainer->Listbox()->GetDefaultData().iPreferedId = + iContainer->Listbox()->CurrentItem()->Uid(); + iModel->Database().SetPreferredUid( + iCurrentFolder,iContainer->Listbox()->CurrentItem()->Uid() ); + iRefresh = ETrue; + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::SetUnPreferedCurrentItemL +// --------------------------------------------------------- +// +void CBrowserFavouritesView::SetUnPreferedCurrentItemL() + { + // check the current item is exist + if ( iContainer->Listbox()->CurrentItem() ) + { + iContainer->Listbox()->GetDefaultData().iPreferedId = NULL; + iModel->Database().SetPreferredUid( iCurrentFolder,NULL ); + iRefresh = ETrue; + } + } + +// --------------------------------------------------------- +// CBrowserFavouritesView::ConfigContextMenu +// --------------------------------------------------------- +// +void CBrowserFavouritesView::ConfigContextMenu() + { + // Config Context Sensitive Menu Resource and Type when items are marked + + MenuBar()->SetContextMenuTitleResourceId( OkOptionsMenuResourceId()); + MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); + MenuBar()->SetMenuTitleResourceId( OptionsMenuResourceId()); + MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); // adds task swapper menu item first + } + +void CBrowserFavouritesView::UpdateToolbarButtonsState() + { + LOG_ENTERFN("CBrowserFavouritesView::UpdateToolbarButtonsState"); + BROWSER_LOG( ( _L("Implementation is not required here") ) ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FavouritesSrc/CommandVisibility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FavouritesSrc/CommandVisibility.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of TCommandVisibility. +* +* +*/ + + +// INCLUDE FILES +#include +#include "Browser.hrh" +#include "CommandVisibility.h" +#include "BrowserFavouritesSelectionState.h" +#include "BrowserUtil.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TCommandVisibility::Apply +// --------------------------------------------------------- +// +void TCommandVisibility::Apply + ( + CEikMenuPane* aMenuPane, + TCommandVisibilityMap aCommandInfo, + TCommandVisibility::TIndex aIndex + ) + { + // Dim commands using the command visibility array. + TInt command; + TInt i = 0; + while ( ( command = aCommandInfo[i][ECommand] ) != + /*end of list*/EWmlNoCmd ) + { + if ( !(aCommandInfo[i][aIndex]) ) + { + aMenuPane->SetItemDimmed( command, ETrue ); + } + i++; + } + } + +// --------------------------------------------------------- +// TCommandVisibility::Apply +// --------------------------------------------------------- +// +TBool TCommandVisibility::Apply + ( + const TCommandVisibilityInfo& aCommandInfo, + TIndex aIndex + ) + { + return aCommandInfo[aIndex]; + } + +// --------------------------------------------------------- +// TCommandVisibility::Index +// --------------------------------------------------------- +// +TCommandVisibility::TIndex TCommandVisibility::Index + ( + const TBrowserFavouritesSelectionState& aSelectionState, + TBool aMarkedOnly + ) + { + TIndex index = EInvalid; + + if ( aMarkedOnly ) + { + // Consider only marked items (OK-Options menu). + if ( aSelectionState.IsEmpty() ) + { + // Empty ??? + index = ENothing; + } + else if ( aSelectionState.MarkedCount() == 1 ) + { + // One is marked. See if item or folder. + index = aSelectionState.iMarkedItemCount ? EOneItem : EOneFolder; + } + else + { + // More is marked. See if there are any folders. + index = aSelectionState.NoFoldersMarked() ? + EMoreItems : EItemsFolders; + } + } + else + { + // All items (Normal Options menu). + if ( aSelectionState.AnyMarked() ) + { + if ( aSelectionState.NoFoldersMarked() ) + { + if ( aSelectionState.MarkedCount() == 1 ) + { + index = EOneItem; + } + else + { + index = EMoreItems; + } + } + else + { + // More marked, including folders. + index = EItemsFolders; + } + } + else if ( aSelectionState.CurrentIsItem() ) + { + // A bookmark is highlighted. + index = EOneItem; + } + else if ( aSelectionState.CurrentIsFolder() ) + { + // A folder is highlighted. + index = EOneFolder; + } + else + { + __ASSERT_DEBUG( aSelectionState.IsEmpty(), \ + Util::Panic( Util::EFavouritesInternal ) ); + // No items at all. + index = ENothing; + } + } + + __ASSERT_DEBUG( index != EInvalid, + Util::Panic( Util::EUnExpected ) ); + + return index; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsClientUtilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsClientUtilities.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,759 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Manages the feed related views and implements the FeedsViewBridge. +* +*/ + +#ifndef FEEDS_CLIENT_UTILITIES_H +#define FEEDS_CLIENT_UTILITIES_H + +// INCLUDES +#include + +#include "Preferences.h" +#include "FeedsWaitDialog.h" +#include "FeedsFileSearchAgent.h" +#include "CommonConstants.h" +#include +#include +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CAknViewAppUi; +class CEikMenuPane; +class MApiProvider; +class CFeedsFolderView; +class CFeedsTopicView; +class CFeedsFeedView; +class CBrowserGotoPane; + +// CLASS DECLARATION + + +/** +* Manages the feed related views and implements the FeedsViewBridge. +* @lib FeedsViewBridge.lib +* @since 3.1 +*/ +class CFeedsClientUtilities: public CBase, + public MPreferencesObserver, + public MFeedsWaitDialogListener, + public MFeedsFileSearchAgentCallback, + public MFeedsApiObserver + { + public: // Constructors and destructor + + static CFeedsClientUtilities* NewL( CAknViewAppUi& aAppUI, MApiProvider& aApiProvider ); + + /** + * Destructor. + */ + ~CFeedsClientUtilities(); + + public: // from MPreferencesObserver + + /** + * Derived classes should implement this method, and act accordingly. + */ + void HandlePreferencesChangeL( const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ); + + public: //From MFeedsApiObserver + /** + * This function is called by CFeedsInterface class whenever + * request is completed + * + * @param aTrans Pointer to current transaction class + * @param aEvent event related to this call. + */ + virtual void RequestCompleted(CTransaction* aTrans,TInt aEvent); + + public: + /** + * Request to create a network connection. + * + * @since 7.1 + * @param aConnectionPtr A pointer to the new connection. If NULL, the + * proxy filter will automatically create a network connection. + * @param aSockSvrHandle A handle to the socket server. + * @param aNewConn A flag if a new connection was created. If the + * connection is not new, proxy filter optimization will not + * read the proxy again from CommsBd. + * @param aBearerType The bearer type of the new connection + * @return void + */ + void NetworkConnectionNeededL( TInt* aConnectionPtr, TInt& aSockSvrHandle, + TBool& aNewConn, TApBearerType& aBearerType ); + + public: + + /** + * Set Browser prefs to Feed engine + * @since 3.1 + * @param aValues Browser preferences + * @return void + */ + void SetPreferencesToFeedL( const TPreferencesValues& aValues ); + + /** + * Load Url in new window + * + * @since 3.1 + * @return void. + */ + void LoadUrlL( const TDesC& aUrl ); + + /** + * Shows the folder view, loading the folder list from the FeedsServer if need be. + * + * @since 3.1 + * @param aCalledFromView to recored from which view this was invoked. Default value + * is BrowserBookmarksViewId if this argument is not specified. + * @return void. + */ + void ShowFolderViewL(TUid aCalledFromView = KUidBrowserBookmarksViewId); + + /** + * Shows the topic view, loading the given feed associated with the given + * folder item. + * + * @since 3.1 + * @return void. + */ + void ShowTopicViewL(const CFeedsEntity& aFolderItem); + + /** + * Shows the folder view and subscribes to the given feed. + * + * @since 3.1 + * @param aTitle The feed's title. + * @param aUrl The feed's url. + * @return void. + */ + void SubscribeToL(const TDesC& aTitle, const TDesC& aUrl); + + /** + * Returns the feed related mime-types. This makes + * for a clean way to pass downloaded feeds content from the client to the FeedsServer + * (via CFeedsClientUtilities::HandleFeedL). + * + * @since 3.1 + * @return An array of supported mime-types. + */ + TPtrC SupportedMimeTypesL(); + + /** + * Returns Feeds Server related settings. + * + * @since 3.1 + * @return Feeds Server related settings. + */ + TInt FeedsServerSettingsL(TFeedsServerSetting& aSetting); + + /** + * Sets Feeds Server related settings. + * + * @since 3.1 + * @param aNewSettings The new settings. + * @return void. + */ + void SetFeedsServerSettingsL(const TFeedsServerSetting& aNewSetting); + + /** + * Sets a Browser Control related settings. These settings are directly passed to all + * Browser Control instances used by the CFeedsViewBridge. As such see the Browser + * Control documentation for infomation about the settings. + * + * @since 3.1 + * @param aSetting The setting to update + * @param aValue The new value of the setting + * @return void. + */ + void SetBrowserControlSettingL(TUint aSetting, TUint aValue); + + /** + * Called by RequestHandlerCompleted when the root FolderItem is either ready or an error occured. + * + * @since 3.1 + * @param aStatus The result code of the FetchRootFolderItemL method. + * @param aTrans The type of transaction that was made + * @return void. + */ + void FolderItemRequestCompleted(TInt aStatus, CTransaction::TTransactionType aTrans=CTransaction::ENone); + + /** + * Leaving method which is called by FolderItemRequestCompleted + * + * @since 3.2 + * @param aStatus The result code of the FetchRootFolderItemL method. + * @param aTrans The type of transaction that was made + * @return void. + */ + void FolderItemRequestCompletedL(TInt aStatus, CTransaction::TTransactionType aTransType=CTransaction::ENone); + + /** + * Called by RequestHandlerCompleted when the FolderItem has changed. The client + * should request an updated copy from the server. + * + * @since 3.1 + * @return void. + */ + void FolderItemChanged() {}; + + /** + * Called by RequestHandlerCompleted when the asynchronous request is complete. + * + * @since 3.1 + * @pram aStatus The completion status code. + * @return void. + */ + void FeedRequestCompleted(TInt aStatus); + + /** + * Leaving method which is called from FeedRequestCompleted + * + * @since 3.2 + * @pram aStatus The completion status code. + * @return void. + */ + void FeedRequestCompletedL(TInt aStatus); + + /** + * Notifies the observer that the feed has changed. This method is called + * when the feed is updated by the feeds server. + * + * @since 3.1 + * @return void. + */ + void FeedChanged() {}; + + /** + * Notifies the observer that the feed's item status has changed. + * This method is called when __another__ client updates the feed's + * item status (via UpdateFeedItemStatusL). + * + * @since 3.1 + * @return void. + */ + void FeedItemStatusChanged() {}; + + + public: // From MWaitDialogListener + /** + * Called when the user presses the cancel button. + * + * @since 3.0 + * @return void. + */ + void DialogDismissedL(); + + + public: // New Methods. + /** + * Searches for a FolderItem with the given name. If "this" + * isn't a folder it only checks whether or not it matches + * the given name. If "this" is a folder it also checks + * all embedded items + * + * @since 7.1 + * @param aName The title of the feed + * @param aFolder The folder to be searched + * @return void. + */ + + const CFeedsEntity* Search(const TDesC& aName,const CFeedsEntity& aFolder) const; + /** + * Searches for a FolderItem with the given id. If "this" + * isn't a folder it only checks whether or not it matches + * the given id. If "this" is a folder it also checks + * all embedded items + * + * @since 7.1 + * @param aFolderItemId The id of the folder item. + * @param aFolder The folder to be searched + * @return void. + */ + + const CFeedsEntity* Search(TInt aFolderItemId,const CFeedsEntity& aFolder) const; + + /** + * Get the root folder from the Feeds server. + * + * @since 3.1 + * @return void. + */ + void FetchRootFolderL(); + + /** + * Add a new folder item. + * + * @since 3.1 + * @param aTitle The title of the item. + * @param aUrl The url of the item. + * @param aIsFolder True if this is a folder. + * @param aParent The parent folder. + * @param aFreq The frequency for auto updating. + * @return void. + */ + void AddFolderItemL(const TDesC& aTitle, const TDesC& aUrl, + TBool aIsFolder, const CFeedsEntity& aParent, TInt aFreq); + + /** + * Change the folder item. If this is a folder then KNullDesC + * should be passed to the aUrl argument. + * + * @since 3.1 + * @param aFolderItem The item to update. + * @param aTitle The item's title.. + * @param aUrl The item's url or KNullDesC. + * @param aFreq The frequency for auto updating. + * @return void + */ + void ChangeFolderItemL(CFeedsEntity& aFolderItem, + const TDesC& aTitle, const TDesC& aUrl, TInt aFreq); + + /** + * Delete the folder items. + * + * @since 3.1 + * @param aFolderItem The folder item that's being deleted. + * @return void + */ + void DeleteFolderItemsL(RPointerArray& aFolderItems); + + /** + * Move the folder items to a different parent. + * + * @since 3.1 + * @param aFolderItem The folder item that's being moved. + * @param aParent The folder item's new parent. + * @return void + */ + void MoveFolderItemsToL(RPointerArray& aFolderItems, + const CFeedsEntity& aParent); + + /** + * Move the folder item to a different index. + * + * @since 3.1 + * @param aFolderItem The folder item that's being moved. + * @param aIndex The new index of the folder item (within its parent). + * @return void + */ + void MoveFolderItemsL(RPointerArray& aFolderItems, + TInt aIndex); + + /** + * Get the given feed from the Feeds server. + * + * @since 3.1 + * @param aFeedUrl The id of the feed to fetch. + * @param aForceUpdate When true the server will ignore the cache. + * @param aNoCache When true the server will not cache the feed. + * @return void. + */ + void FetchFeedL(const CFeedsEntity& aFeedEntity, TBool aForceUpdate = EFalse, + TBool aNoCache = EFalse); + + /** + * Updates the feed with the given id. + * + * @since 3.1 + * @param aFeedId The id of the feed to update. + * @return void. + */ + void UpdateFeedL(const CFeedsEntity& aFeedEntity); + + /** + * Updates the given feeds in the background. + * + * @since 3.1 + * @param aFolderItems The feeds to update. + * @return void. + */ + void UpdateFolderItemsL(const RPointerArray& + aFolderItems); + + /** + * Updates all of feeds in the background. + * + * @since 3.1 + * @return void. + */ + void UpdateFolderItemsL(); + + /** + * Handle the menu "Import Feeds" command. This will kick off the search + * for OMPL feeds files stored on the phone. Control will return via the + * FeedsFileSearchComplete callback. + * + * @since 3.2 + * @return void. + */ + void ImportFeedsL(); + + /** + * Given a filepath on the filesystem, begin import feeds from the file path + * This will set up the path and flags and allow the feeds folder to be + * activated before the import actually takes place. + * + * @since 3.2 + * @return void + * @param a filesystem path to import from + */ + void BeginImportOPMLFeedsFileL( TFileName& aFilepath ); + + /** + * Handle the menu "Export Feeds" command + * once items have been selected and a name chosen. + * + * @since 3.2 + * @return void + * @param folder items to export and a name to export to + */ + void ExportFeedsL(RPointerArray& aFolderItems, const TDesC &aExportFileName); + + /** + * Shows the folder view. + * + * @since 3.1 + * @return void. + */ + void ShowFolderViewLocalL(); + + /** + * Shows the topic view. + * + * @since 3.1 + * @param aInitialItem The initial item to show. + * @return void. + */ + void ShowTopicViewLocalL(TInt aInitialItem); + + /** + * Shows the feed view. + * + * @since 3.1 + * @param aInitialItem The initial item to show. + * @return void. + */ + void ShowFeedViewLocalL(TInt aInitialItem); + + + /** + * Returns the current root folder. + * + * @since 3.1 + * @return The current root folder.. + */ + const CFeedsEntity* CurrentRootFolder() ; + + /** + * Returns the current feed. + * + * @since 3.1 + * @return The current feed. + */ + CFeedsEntity* CurrentFeed() ; + + /** + * Add a menu item to the given menu. + * + * @since 3.1 + * @param aMenuPane The menu to add the item to. + * @param aCommand The item's command. + * @param aTitleId The item's title resouce-id. + * @return void. + */ + void AddItemL(CEikMenuPane& aMenuPane, TInt aCommand, TInt aTitleId); + + /** + * Add a sub-menu to the given menu. + * + * @since 3.1 + * @param aMenuPane The menu to add the item to. + * @param aCommand The cascade's command. + * @param aTitleId The item's title resouce-id. + * @param aCascade The cascade's resource id. + * @return void. + */ + void AddCascadeL(CEikMenuPane& aMenuPane, TInt aCommand, + TInt aTitleId, TInt aCascade); + + /** + * Sets the item's status (read/unread/new). + * + * @since 3.1 + * @param aItemIndex The index of the item to change. + * @param aStatus The new status. + * @return void. + */ + void SetItemStatusL(CFeedsEntity* aItem, TFeedItemStatus aStatus); + + /** + * Returns the item's status (read/unread/new). + * + * @since 3.1 + * @param aItemIndex The index of the item to change. + * @return The status. + */ + TFeedItemStatus ItemStatus(TInt aItemIndex); + + /** + * Writes the item status out to the server. + * + * @since 3.1 + * @return Void. + */ + void ItemStatusWriteToServerL(); + + /** + * Returns the Favicon to the given url or NULL if one isn't found. + * + * @since 3.1 + * @param aUrl The url of the Favicon. + * @return The associated Favicon or NULL. + */ + CGulIcon* FaviconL(const TDesC& aUrl); + + /** + * Connect to the server. + * + * @since 3.1 + * @param aGetRootFolder If true the root folder is also fetched. + * @return Void + */ + void ConnectToServerL(TBool aGetRootFolder = ETrue); + + /** + * Disconnect from the server. + * + * @since 3.1 + * @return Void + */ + void DisconnectFromServer(); + + /** + * Since the folder list isn't updated after it is fetched the FeedsClientUtilities + * tracks the last update times for feeds the user visits in the current session. + * This method returns the "last updated" timestamp of the given item. + * + * @since 3.1 + * @param aItem The folder item to get the last updated time. + * @return The timestamp. + */ + TTime FeedUpdatedTime(const CFeedsEntity& aItem); + + /** + * Resets the "last updated" cache. + * + * @since 3.1 + * @return Void. + */ + void ResetFeedUpdateTime(); + + /** + * Update the feed's "last updated" value in the cache. + * + * @since 3.1 + * @param aFeed The feed to udpate the last updated time. + * @return Void. + */ + void UpdateFeedUpdatedTimeL(const CFeedsEntity& aFeed); + + /** + * Initialize context-sensitive menu. + * @param aResourceId Resource id of the menu pane. + * @param aMenuPane Menu pane object being initialized. + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * Processes commands. + * + * @since 3.1 + * @param aViewId the view that calls this. + * @param aCommand the command to process. + * @return void. + */ + void HandleCommandL(TUid aViewId, TInt aCommand); + + /** + * Sets Feeds Server related settings. + * + * @since 3.1 + * @return void. + */ + void DisconnectManualUpdateConnectionL(); + + /** + * Disconnect connection used by FeedsView + * + * @since 3.1 + * @return void. + */ + void DisconnectFeedsViewL(); + + /** + * Set the View Id that called Feeds + * + * @since 3.1 + * @param View id of the view Feeds was called from. + */ + void SetCalledFromView(TUid aViewId); + + /** + * Get the View Id that called Feeds + * + * @since 3.1 + * @return the view id Feeds was called from. + */ + TUid CalledFromView(); + + public: // from MFeedsFileSearchAgentCallback + /** + * Callback to this class when the search agent CActive had + * completed its searching for feeds files + * + * @since 3.2 + * @return void + * @param the number of files found + */ + + void FeedsFileSearchCompleteL(TInt aCount); + + private: // New Methods. + /** + * C++ default constructor. aName and + * aSourceUrl are adopted by this method. + */ + CFeedsClientUtilities(CAknViewAppUi& aAppUI, MApiProvider& iApiProvider); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Ensures that the views and the connection to the FeedsServer are ready. + * + * @since 3.1 + * @param aGetRootFolder If true the root folder is also fetched. + * @return void. + */ + void LazyInitL(TBool aGetRootFolder); + + /** + * Show a server error. + * + * @since 3.1 + * @param aStatus The status code. + * @param aRequestType The type of request that was made + * @return void. + */ + void ShowServerError(TInt aStatus, CTransaction::TTransactionType aRequestType = CTransaction::ENone); + + /** + * Init a menu item + * @since 3.1 + * @param aMenuPane Menu pane to be initialized + * @param aCommandId The command ID + * @param aResourceId The resource ID + * @param aCascadeId The cascade ID + * @param aFlags Flags + * @return void + */ + void InitMenuItemL( CEikMenuPane* aMenuPane, + TInt aCommandId, + TInt aResourceId, + TInt aCascadeId = 0, + TInt aFlags = 0 ); + + /** + * Send the OPML using the Send UI + * + * @since 3.2 + * @param void. + * @return void. + */ + void SendOPMLFileL(void); + + /** + * Returns the INITIAL status of each of the items in the feed. + * The caller can then modify the values and call RFeed::UpdateFeedItemStatusL + * to request the feeds server to update the feed's item status. + * + * @since 7.1 + * @param aItemIds The ids of the items. + * @param aItemStatus The coresponding status of each of the items in the feed. + * @param aFeed The feed whose items' status has to fetched. + * @return void. + */ + void ItemStatusL(RArray& aItemIds, + RArray& aItemStatus, const CFeedsEntity& aFeed) const; + + + + private: // Data. + CAknViewAppUi& iAppUI; + MApiProvider& iApiProvider; + TUid iNextViewId; + TBool iIsUpdatingFeed; + CFeedsWaitDialog* iWaitDialog; + HBufC* iEnteredURL; + TInt iCbaResource; + + CFeedsFolderView* iFolderView; // not owned + CFeedsTopicView* iTopicView; // not owned + CFeedsFeedView* iFeedView; // not owned + + TBool iIsConnected; + RArray iItemIds; + RArray iItemStatus; + RArray iItemStatusOrig; + + HBufC* iMimeTypes; + + RArray iFeedUpdateTimeIds; + RArray iFeedUpdateTimeTimestamps; + + TDesC* iPendingFolderItemTitle; + TDesC* iPendingFolderItemUrl; + TDesC* iExportFileName; + + CFeedsFileSearchAgent* iSearchAgent; + CArrayFixFlat* iSearchOptList; + + TFileName iTempOPMLImportFilePath; + TBool iFeedImportRequested; + TBool iRequestCanceled; + TUid iCalledFromView; + TBool iIsWaitDialogDisplayed; + RFeedsInterface iFeedsInterface; + CTransaction::TTransactionType iCurrentRequest; + CTransaction::TTransactionType iCanceledRequest; + }; + +#endif // FEEDS_CLIENT_UTILITIES_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsEditFeedDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsEditFeedDialog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,280 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Encapsulates a edit feed dialog. +* +*/ + + +#ifndef FEEDS_EDIT_FEED_DIALOG_H +#define FEEDS_EDIT_FEED_DIALOG_H + + +// INCLUDES +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CAknViewAppUi; + +// CLASS DECLARATION + + +/** +* Encapsulates a edit feed dialog. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class MFeedsEditFeedDialogObserver + { + public: + /** + * Called when a feed's name and/or url is changed -- this is called + * after both IsValidFeedName and IsValidFeedUrl are called. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aUrl The feed's new url. + * @param aFreq The frequency for auto updating. + * @return void. + */ + virtual void UpdateFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) = 0; + + /** + * Called when a new feed is created -- this is called after both + * IsValidFeedName and IsValidFeedUrl are called. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aUrl The feed's new url. + * @param aFreq The frequency for auto updating. + * @return void. + */ + virtual void NewFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) = 0; + + /** + * Validates the Feed's updated name. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aIsEditing True if the edit dialog was opened to edit a feed. + * @return ETrue if the value is valid. + */ + virtual TBool IsFeedNameValidL(const TDesC* aName, TBool aIsEditing) = 0; + + /** + * Validates the Feed's updated url. + * + * @since 3.0 + * @param aUrl The feed's new url. + * @return ETrue if the value is valid. + */ + virtual TBool IsFeedUrlValidL(const TDesC* aUrl) = 0; + }; + + +class CFeedsEditFeedDialog: public CAknForm + { + public: + /** + * Two-phased constructor. + */ + static CFeedsEditFeedDialog* NewL(MFeedsEditFeedDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName, const TDesC& aUrl, TInt aFreq); + + /** + * Two-phased constructor. + */ + static CFeedsEditFeedDialog* NewL(MFeedsEditFeedDialogObserver& aObserver, + CAknViewAppUi* aAppUi); + + /** + * Destructor. + */ + virtual ~CFeedsEditFeedDialog(); + + public: + + /** + * Takes any action required when the current line is changed + * to aControlId + * + * @since 7.1 + * @param aControlId The control ID + * @return void + */ + void LineChangedL( TInt aControlId ); + + /** + * Handles the auto update freuency modification commands + * + * @since 7.1 + * @return void + */ + void HandleFreqCmdL(); + + /** + * Pops up a custom dialog to allow user to set setting items + * + * @since 7.1 + * @param aTitle The title of the field. + * @param aValues The values of the radio buttons. + * @param aCurentItem The currently selected item + * @return TInt The newly selected value from the radio buttons. + */ + TInt ShowRadioButtonSettingPageL(TDesC& aTitle, + CDesCArrayFlat* aValues, + TInt aCurrentItem ); + + /** + * Shows an information dialog, with an ok soft key. + * + * @since 7.1 + * @param aNoteText Text to display. + * @return void + */ + void ShowInfoDialogwithOkSoftKeyL( const TDesC& aNoteText ); + + + public: // From CAknForm + /** + * Called to setup the options menu with the dialog is active. + * + * @since ? + * @param aResourceId The resource id of the menu. + * @param aMenuPane The menu. + * @return void. + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** + * Called by the framework whenever the 'Save' menu item is selected. + * + * @since ? + * @return ETrue if the form data has been saved, otherwise EFalse. + */ + virtual TBool SaveFormDataL(); + + /** + * Called by the framework before the form is initialised. + * + * @since ? + * @return void. + */ + virtual void PreLayoutDynInitL(); + + /** + * Post-layout dialog initialisation. + * + * @since 7.1 + * @return void. + */ + void PostLayoutDynInitL(); + + /** + * From CCoeControl. + * Handles pointer events + * + * @since 7.1 + * @param Details of pointer event. + * @return void. + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + /** + * Handle button press. Same as base class method, except calling + * HandleFreqCmdL in the case of auto Update modifications. + * + * @since 7.1 + * @param aButtonId Button pressed. + * @return ETrue if the dialog should exit. + */ + TBool OkToExitL( TInt aButtonId ); + + + /** + * Called by the framework to process the options menu. + * + * @since ? + * @param aCommandId The command. + * @return void. + */ + virtual void ProcessCommandL(TInt aCommandId); + + /** + * Handle key events. + * + * @since 7.1 + * @param aKeyEvent Details of key event. + * @param aType Type of key event. + * @return EKeyWasConsumed if the key was handled else EKeyWasNotConsumed. + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType); + +#ifdef __SERIES60_HELP + /** + * Get help context for the control. + * + * @since ? + * @param aContext The context that is filled in. + * @return None. + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; +#endif // __SERIES60_HELP + + + private: // New methods + /** + * C++ default constructor. + */ + CFeedsEditFeedDialog (MFeedsEditFeedDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName, const TDesC& aUrl, TInt aFreq); + + /** + * Loads the form data before the form is displayed. + * + * @since ? + * @return ETrue if the form data has been saved, otherwise EFalse. + */ + void LoadFormValuesFromDataL(); + + + private: + MFeedsEditFeedDialogObserver& iObserver; + CAknViewAppUi* iAppUi; // not owned + TBool iIsNewFeed; + TBool iExitDialog; + + const TDesC& iName; + const TDesC& iUrl; + TInt iFreq; + TInt iPreviousFreq; + TInt iSelectedDlgLine; + TBool iActionCancelled; + TBool iDrag; + TPointerEvent iPointerEvent; + }; + +#endif // FEEDS_EDIT_FEED_DIALOG_H + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsEditFolderDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsEditFolderDialog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Encapsulates a edit folder dialog. +* +*/ + + +#ifndef FEEDS_EDIT_FOLDER_DIALOG_H +#define FEEDS_EDIT_FOLDER_DIALOG_H + + +// INCLUDES +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CAknViewAppUi; + +// CLASS DECLARATION + + +/** +* The observer interface for the edit folder dialog. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class MFeedsEditFolderDialogObserver + { + public: + /** + * Called when a folder's name is changed -- this is called + * after IsValidFolderName is called. + * + * @since 3.0 + * @param aName The folder's new name. + * @return void. + */ + virtual void UpdateFolderL(const TDesC& aName) = 0; + + /** + * Called when a new folder is created -- this is called + * after IsValidFolderName is called. + * + * @since 3.0 + * @param aName The folder's new name. + * @return void. + */ + virtual void NewFolderL(const TDesC& aName) = 0; + + /** + * Validates the folder's updated name. + * + * @since 3.0 + * @param aName The folder's new name. + * @param aIsEditing True if the edit dialog was opened to edit a folder. + * @return ETrue if the value is valid. + */ + virtual TBool IsFolderNameValidL(const TDesC* aName, TBool aIsEditing) = 0; + }; + + +/** +* Encapsulates a edit folder dialog. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsEditFolderDialog: public CAknForm + { + public: + /** + * Two-phased constructor. + */ + static CFeedsEditFolderDialog* NewL(MFeedsEditFolderDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName); + + /** + * Two-phased constructor. + */ + static CFeedsEditFolderDialog* NewL(MFeedsEditFolderDialogObserver& aObserver, + CAknViewAppUi* aAppUi); + + /** + * Destructor. + */ + virtual ~CFeedsEditFolderDialog(); + + + public: // From CAknForm + /** + * Called to setup the options menu with the dialog is active. + * + * @since ? + * @param aResourceId The resource id of the menu. + * @param aMenuPane The menu. + * @return void. + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** + * Called by the framework whenver the 'Save' menu item is selected. + * + * @since ? + * @return ETrue if the form data has been saved, otherwise EFalse. + */ + virtual TBool SaveFormDataL(); + + /** + * Called by the framework before the form is initialised. + * + * @since ? + * @return void. + */ + virtual void PreLayoutDynInitL(); + + /** + * Called by the framework to process the options menu. + * + * @since ? + * @param aCommandId The command. + * @return void. + */ + virtual void ProcessCommandL(TInt aCommandId); + + + private: // New methods + /** + * C++ default constructor. + */ + CFeedsEditFolderDialog(MFeedsEditFolderDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName); + + /** + * Loads the form data before the form is displayed. + * + * @since ? + * @return ETrue if the form data has been saved, otherwise EFalse. + */ + void LoadFormValuesFromDataL(); + + + private: + MFeedsEditFolderDialogObserver& iObserver; + CAknViewAppUi* iAppUi; // not owned + TBool iIsNewFolder; + TBool iExitDialog; + + const TDesC& iName; + }; + +#endif // FEEDS_EDIT_FOLDER_DIALOG_H + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsFeedContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsFeedContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A container to browse a given feed. +* +*/ + + +#ifndef FEED_CONTAINER_H +#define FEED_CONTAINER_H + + +// INCLUDES +#include +#include +#include +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CAknNavigationDecorator; +class CBrCtlInterface; +//class CBufFlat; +class CFeed; +class CFeedsFeedView; +//class CXmlEncoding; +class MApiProvider; +class CFeedsEntity; + +// CLASS DECLARATION + + +/** +* A container to browse a given feed. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsFeedContainer : public CCoeControl, public MBrCtlSpecialLoadObserver + { + public: + /** + * Two-phased constructor. + */ + static CFeedsFeedContainer* NewL( + CFeedsFeedView* aView, + MApiProvider& aApiProvider); + + /** + * Destructor. + */ + virtual ~CFeedsFeedContainer(); + + + public: // From CoeControl + /** + * Handles key event. + * + * @param aKeyEvent The key event. + * @param aType The type of the event. + * @return Indicates whether the key event was used by this control or not + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** + * HandlePointerEventL + * From CCoeControl + * + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); +#ifdef __SERIES60_HELP + /** + * Get help context for the control. + * + * @since ? + * @param aContext The context that is filled in. + * @return None. + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; +#endif // __SERIES60_HELP + + /** + * Sets this control as visible or invisible. + * + * @since ? + * @param aVisible ETrue to make the control visible, EFalse to make it invisible. + * @return Void + */ + virtual void MakeVisible(TBool aVisible); + + + protected: // From CoeControl + /** + * Called by framework when the view size is changed. + * + * @since ? + * @return void. + */ + virtual void SizeChanged(); + + /** + * Called by the framework when a display resource changes (i.e. skin or layout). + * + * @since ? + * @return void. + */ + virtual void HandleResourceChange(TInt aType); + + /** + * Returns number of components. + * + * @since ? + * @return Number of component controls. + */ + virtual TInt CountComponentControls() const; + + /** + * Returns pointer to particular component. + * + * @since ? + * @param aIndex Index whose control's pointer has to returned. + * @return Pointer to component control + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; + + + public: // From MBrCtlSpecialLoadObserver + /** + * Request to create a network connection. + * + * @since 2.8 + * @param aConnectionPtr A pointer to the new connection. If NULL, the + proxy filter will automatically create a network connection + * @param aSockSvrHandle A handle to the socket server. + * @param aNewConn A flag if a new connection was created. If the + connection is not new, proxy filter optimization will not + read the proxy again from CommsBd. + * @param aBearerType The bearer type of the new connection + * @return void + */ + virtual void NetworkConnectionNeededL(TInt* aConnectionPtr, TInt* aSockSvrHandle, + TBool* aNewConn, TApBearerType* aBearerType); + + /** + * Request the host applicaion to handle non-http request. + * + * @since 2.8 + * @param aUrl The non-http(s) or file URL + * @param aParamList Parameters to pass to the host application. + Contain referer header. It could be NULL + * @return ETrue is handled by the host application. EFlase if not + */ + virtual TBool HandleRequestL(RArray* aTypeArray, CDesCArrayFlat* aDesArray); + + /** + * Request the host applicaion to handle downloads + * + * @since 2.8 + * @param aTypeArray array of download parameter types + * @param aDesArray array of values associated with the types in the type array + * @return ETrue is handled by the host application. EFlase if not + */ + virtual TBool HandleDownloadL(RArray* aTypeArray, CDesCArrayFlat* aDesArray); + + public: // New methods. + /** + * Clears the navigation pane. + * + * @since 3.0 + * @return void + */ + void ClearNavigationPane(); + + /** + * Sets the current feed + * + * @since 3.0 + * @param aFeed The new feed. + * @param aInitialItem The initial item to show. + * @return Void + */ + void SetCurrentFeedL(CFeedsEntity& aFeed, TInt aInitialItem); + + /** + * Returns the current item's url. + * + * @since 3.0 + * @return void + */ + const TDesC& GetItemUrl(); + + /** + * Returns the index of the current item. + * + * @since 3.0 + * @return The index. + */ + TInt CurrentItem(); + + /** + * Returns the number of items. + * + * @since 5.0 + * @return The number of items + */ + TInt ItemCount() const; + + /** + * Shows the next item if possible. + * + * @since 3.0 + * @return The index. + */ + void ShowNextItemL(); + + /** + * Shows the prev item if possible. + * + * @since 3.0 + * @return The index. + */ + void ShowPrevItemL(); + + + private: // New methods. + /** + * C++ default constructor. + */ + CFeedsFeedContainer + ( CFeedsFeedView* aView, + MApiProvider& aApiProvider ); + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Handles the changes needed to the Navigation Pane. + * + * @since 3.0 + * @return void + */ + void UpdateNavigationPaneL(); + + /** + * Shows the given feed item. + * + * @since 3.0 + * @return void + */ + void ShowFeedItemL(); + + /** + * Loads the template html file. + * + * @since 3.1 + * @param aTemplateName The name of the template. + * @return void. + */ + void LoadTemplateL(const TDesC& aTemplateName); + + /** + * Loads and resolves the tokens in the template html file. + * + * @since 3.1 + * @param aTitle The title. + * @param aTimestamp The timestamp. + * @param aDescription The description. + * @param aUrl The url. + * @param aShowFullStory The "show full story" string. + * @param aShowPrev If ETrue the "prev" element is shown. + * @param aShowNext If ETrue the "next" element is shown. + * @return The resolved buffer. + */ + HBufC* ResolveTemplateL(const TDesC& aTitle, const TDesC& aTimestamp, + const TDesC& aDescription, const TDesC& aUrl, + const TDesC& aEnclosure); + + /** + * If need be copy the template from ROM. + * + * @since 3.1 + * @param aName The name of the template file. + * @return void + */ + void EnsureTemplateL(const TDesC& aName); + + /** + * Extract the given BrCtl parameter from the list. + * @param aParamTypeToFind Extract this parameter. + * @param aTypeArray array of download parameter types. + * @param aDesArray array of values associated with the types in the type array. + * @param aParamFound Output: ETrue if the parameter was found. + * @return A TPtrC pointer for the value. + * @since 3.1 + */ + TPtrC ExtractBrCtlParam( + TUint aParamTypeToFind, + RArray* aTypeArray, + CDesCArrayFlat* aDesArray, + TBool& aParamFound ) const; + + public: // Friends + friend class CFeedsFeedView; + + + protected: + CFeedsFeedView* iView; // not owned + MApiProvider& iApiProvider; // not owned + CBrCtlInterface* iBrowserControl; + CAknNavigationDecorator* iNaviPaneTabsGroup; + + HBufC* iTemplate; + TInt iTitleCount; + TInt iWebUrlCount; + TInt iDateCount; + TInt iDescriptionCount; + TInt iEnclosureCount; + TInt iShowPrevCount; + TInt iShowNextCount; + + CFeedsEntity* iFeed; + TInt iCurrentItem; + TPtrC iUrl; + }; + +#endif // FEED_CONTAINER_H + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsFeedView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsFeedView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a given feed. +* +*/ + + +#ifndef FEED_VIEW_H +#define FEED_VIEW_H + + +// INCLUDES +#include "BrowserAppViewBase.h" +#include "FeedsFeedContainer.h" +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class MApiProvider; + +// CLASS DECLARATION + + +/** +* A view to browse a given feed. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsFeedView: public CBrowserViewBase, + public MAknToolbarObserver + { + public: + /** + * Two-phased constructor. + */ + static CFeedsFeedView* NewL( MApiProvider& aApiProvider, TRect& aRect ); + + /** + * Destructor. + */ + virtual ~CFeedsFeedView(); + + public: // From CBrowserViewBase + + /** + * Return command set id, to be displayed. + * @return The command set's resource id. + */ + TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + /** + * @see CAknView + */ + void HandleClientRectChange(); + + public: // From CAknView + /** + * Returns the id of the view. + * + * @since ? + * @return the id. + */ + virtual TUid Id() const; + + /** + * Processes commands. + * + * @since ? + * @param aCommand the command to process. + * @return void. + */ + virtual void HandleCommandL(TInt aCommand); + + + protected: // From CAknView + /** + * Called when the view is activated. + * + * @since ? + * @param aPrevViewId the id of the prev view. + * @param aCustomMessageId The activation message id. + * @param aCustomMessage Activation params. + * @return void. + */ + virtual void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * Called when the view is deactivated. + * + * @since ? + * @return void. + */ + virtual void DoDeactivate(); + + /** + * Disables unrelated menu options. + * + * @since ? + * @param aResourceId The resource id of the menu. + * @param aMenuPane The menu. + * @return void. + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + public: // MAknToolbarObserver + /** + * Called when toolbar events occur + * + * @since 5.0 + * @return void + */ + void OfferToolbarEventL( TInt aCommand ) { HandleCommandL(aCommand); } + + public: // New Methods + + /** + * Sets the initial item once the view is activated. + * + * @since 3.1 + * @param aItemIndex The index of the inital item. + * @return void + */ + void SetInitialItem(TInt aItemIndex); + + /** + * Update the toolbar buttons' state + * + * @since 5.0 + * @return void + */ + void UpdateToolbarButtonsState(); + + /** + * Disconnect Browser Control + * + * @since 3.1 + * @return void + */ + void DisconnectL(); + + private: // New Methods + /** + * C++ default constructor. + */ + CFeedsFeedView( MApiProvider& aApiProvider ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(TRect& aRect); + + + public: // Friends + friend class CFeedsFeedContainer; + + + private: + CFeedsFeedContainer* iContainer; + TBool iContainerOnStack; + TInt iInitialItem; + TBool iPageScalerEnabled; + TBool iPenEnabled; + TRect iOrigRect; + }; + +#endif // FEED_VIEW_H + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsFileSearchAgent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsFileSearchAgent.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File search utility active agent for use within browser ui +* +*/ + + + +#ifndef CFEEDSFILESEARCHAGENT_H +#define CFEEDSFILESEARCHAGENT_H + +// INCLUDES + +#include +#include + +// CONSTANTS + +// MACROS + +// FUNCTION PROTOTYPES +#define FEEDS_FILE_SEARCH_AGENT_MAX_RESULTS 64 + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +// DATA TYPES + +// CLASS DECLARATION + +/** +* Encapsulate drive entry info +* @since 3.2 +*/ +class TDriveEntry + { +public: + TChar iLetter; + TInt iNumber; + }; + +/** +* Encapsulate File entry info +* @since 3.2 +*/ +class TFileEntry + { +public: + TFileName iPath; + TEntry iEntry; + }; + +typedef CArrayFixSeg CDriveEntryList; +typedef CArrayFixSeg CFileEntryList; + +/** +* A Callback mixin for search Agent +* @since 3.2 +*/ + +class MFeedsFileSearchAgentCallback + { + public: + virtual void FeedsFileSearchCompleteL(TInt aCount) = 0; + }; + +// CLASS DECLARATION + +/** +* An Active Agent used to search the filesystem for feeds files +* @since 3.2 +*/ + +class CFeedsFileSearchAgent : public CBase + { + public: // Constructor & destructor + + /** + * Two-phased constructor. + */ + static CFeedsFileSearchAgent* NewL(MFeedsFileSearchAgentCallback& aCallback); + + /** + * Destructor. + */ + virtual ~CFeedsFileSearchAgent(); + + public: // New Functions + + /** + * Once the search agent has been setup via its constructor, begin + * the search process + * @since 3.2 + * @return void + */ + void StartSearchingL(); + + /** + * After the search has completed, allows client to retrieve a + * File entry pointer corresponding to the passed-in index + * @since 3.2 + * @return File entry pointer or NULL if invalid index + */ + TFileEntry* GetFileEntry(const TInt aIndex); + + private: // Search Functions + + /** + * Populate the list of available drives on the phone within this class + * @since 3.2 + */ + void GetDriveListL(); + + /** + * Given a directory, search for a wildcard-included filename within + * that directory + * @since 3.2 + * @param a filename, a path + */ + TInt DoSearchFiles(const TDesC& aFileName, const TDesC& aPath); + + /** + * Given a directory, search recursively for a wildcard-included filename + * within the hierarchy below that directory + * @since 3.2 + * @param a filename, a path + */ + TInt DoSearchFilesRecursive(const TDesC& aFileName); + + private: + + /** + * C++ constructor. + */ + CFeedsFileSearchAgent(MFeedsFileSearchAgentCallback& aCallback); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + public: + /** + * This method is a call back; + * + * @since 7.1 + * @return The TBool. + */ + static TBool LazyCallBack(TAny* aPtr); + + /** + * This method Cancels the ongoing search; + * + * @since 7.1 + * @return Void. + */ + void CancelSearch(); + + /** + * This method Starts the search; + * + * @since 7.1 + * @return TBool. + */ + TBool StartSearchFile(); + + private: // Data + + RFs iFs; + + MFeedsFileSearchAgentCallback* iCallback; // not owned (callee owns) + CDriveEntryList* iDriveEntryList; // owned + + TInt iSearchDriveIndex; + + CFileEntryList* iFileEntryList; // owned + TBool iCancelSearch; + CIdle* iLazyCaller; + CDirScan* iScan; + }; + +#endif // CFEEDSFILESEARCHAGENT_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsFolderContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsFolderContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,674 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A container to browse a user's list of feeds. +* +*/ + + +#ifndef FEEDS_FOLDER_CONTAINER_H +#define FEEDS_FOLDER_CONTAINER_H + + +// INCLUDES +#include +#include +#include + +#include "FeedsEditFeedDialog.h" +#include "FeedsEditFolderDialog.h" + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CAknDoubleGraphicStyleListBox; +class CAknNavigationDecorator; +class CAknIconArray; +class CAknPopupList; +class CAknSingleGraphicPopupMenuStyleListBox; +class CFeedsFolderView; +class CFeedsEntity; +class CGulIcon; +class TAknsItemID; +class MApiProvider; + +// CLASS DECLARATION + + +/** +* A container to browse a user's list of feeds. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsFolderContainer : public CCoeControl, public MEikListBoxObserver, + public MFeedsEditFeedDialogObserver, public MFeedsEditFolderDialogObserver + { + private: + enum TIcons + { + EIconMark = 0, + EIconFolder, + EIconErrorFolder, + EIconFeed, + EIconFeedUnread, + EIconErrorFeed + }; + + + public: + /** + * Two-phased constructor. + */ + static CFeedsFolderContainer* NewL( + CFeedsFolderView* aView, + MApiProvider& aApiProvider, + const TRect& aRect); + + /** + * Destructor. + */ + virtual ~CFeedsFolderContainer(); + + + public: // From CoeControl + /** + * Handles key event. + * + * @param aKeyEvent The key event. + * @param aType The type of the event. + * @return Indicates whether the key event was used by this control or not + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +#ifdef __SERIES60_HELP + /** + * Get help context for the control. + * + * @since ? + * @param aContext The context that is filled in. + * @return None. + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; +#endif // __SERIES60_HELP + + + protected: // From CoeControl + /** + * Called by framework when the view size is changed. + * + * @since ? + * @return void. + */ + virtual void SizeChanged(); + + /** + * Called by the framework when a display resource changes (i.e. skin or layout). + * + * @since ? + * @return void. + */ + virtual void HandleResourceChange(TInt aType); + + /** + * Returns number of components. + * + * @since ? + * @return Number of component controls. + */ + virtual TInt CountComponentControls() const; + + /** + * Returns pointer to particular component. + * + * @since ? + * @param aIndex Index whose control's pointer has to returned. + * @return Pointer to component control + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; + + + public: // MEikListBoxObserver + /** + * Processes key events from the listbox. + * + * @since ? + * @param aListBox Listbox being observed. + * @param aEventType Event observed. + * @return void + */ + virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + + public: // From MFeedEditFeedDialogObserver + /** + * Called when a feed's name and/or url is changed -- this is called + * after both IsValidFeedName and IsValidFeedUrl are called. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aUrl The feed's new url. + * @param aFreq The frequency for auto updating. + * @return void. + */ + virtual void UpdateFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq); + + /** + * Called when a new feed is created -- this is called after both + * IsValidFeedName and IsValidFeedUrl are called. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aUrl The feed's new url. + * @param aFreq The frequency for auto updating. + * @return void. + */ + virtual void NewFeedL(const TDesC& aName, const TDesC& aUrl,TInt aFreq); + + /** + * Validates the Feed's updated name. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aIsEditing True if the edit dialog was opened to edit a feed. + * @return ETrue if the value is valid. + */ + virtual TBool IsFeedNameValidL(const TDesC* aName, TBool aIsEditing); + + /** + * Validates the Feed's updated url. + * + * @since 3.0 + * @param aUrl The feed's new url. + * @return ETrue if the value is valid. + */ + virtual TBool IsFeedUrlValidL(const TDesC* aUrl); + + + public: // From MFeedEditFolderDialogObserver + /** + * Called when a folder's name is changed -- this is called + * after IsValidFolderName is called. + * + * @since 3.0 + * @param aName The feed's new name. + * @return void. + */ + virtual void UpdateFolderL(const TDesC& aName); + + /** + * Called when a new folder is created -- this is called + * after IsValidFolderName is called. + * + * @since 3.0 + * @param aName The feed's new name. + * @return void. + */ + virtual void NewFolderL(const TDesC& aName); + + /** + * Validates the folder's updated name. + * + * @since 3.0 + * @param aName The feed's new name. + * @param aIsEditing True if the edit dialog was opened to edit a folder. + * @return ETrue if the value is valid. + */ + virtual TBool IsFolderNameValidL(const TDesC* aName, TBool aIsEditing); + + + public: // New methods + /** + * Called to notify the container that root folder has changed. + * + * @since 3.1 + * @param aRootFolder The new root folder. + * @return Void. + */ + void RootFolderChangedL(const CFeedsEntity& aRootFolder); + + /** + * Update the view's title. + * + * @since 3.0 + * @return void. + */ + void UpdateTitleL(); + + /** + * Returns the current folder-item. + * + * @since 3.0 + * @return The current folder-item.. + */ + CFeedsEntity* CurrentItem() const; + + + /** + * Returns the index of the current folder-item. + * + * @since 3.0 + * @return The index of the current folder-item.. + */ + TInt CurrentItemIndex() const; + + /** + * Updates the current folder-item. + * + * @since 3.0 + * @param aName The new name. + * @param aUrl The new url. + * @param aFreq The frequency for auto updating. + * @return void. + */ + void UpdateCurrentItemL(const TDesC* aName, const TDesC* aUrl, TInt aFreq); + + /** + * Add a new feed. + * + * @since 3.0 + * @param aName The new name. + * @param aUrl The new url. + * @param aFreq The frequency for auto updating. + * @return void. + */ + void AddNewFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq); + + /** + * Add a folder feed. + * + * @since 3.0 + * @param aName The new name. + * @return void. + */ + void AddNewFolderL(const TDesC& aName); + + /** + * Delete the current feed or folder + * + * @since 3.0 + * @return void. + */ + void DeleteCurrentItemL(); + + /** + * Returns an array containing the indexes of the marked items. + * + * @since 3.0 + * @return The array. + */ + const CArrayFix* MarkedItems(); + + /** + * Replaces the current folder with its parent. + * + * @since 3.0 + * @return Returns ETrue if iCurrentFolder != iRootFoler. + */ + TBool HandleShowParentFolderL(void); + + /** + * Refreshes the root folder. + * + * @since 3.0 + * @return void + */ + //void HandleRefreshRootFolderL(void); + + /** + * Handles selections and open commands + * + * @since 3.0 + * @return void + */ + void HandleSelectionL(void); + + /** + * Handles updating the current Feed. + * + * @since 3.1 + * @return void + */ + void HandleUpdateFeedL(TBool aUpdateAll = EFalse); + + /** + * Handles the add-feed command. + * + * @since 3.0 + * @return void. + */ + void HandleNewFeedL(); + + /** + * Handles the add-folder command. + * + * @since 3.0 + * @return void. + */ + void HandleNewFolderL(); + + /** + * Handles the edit command. + * + * @since 3.0 + * @return void. + */ + void HandleEditL(); + + /** + * Handles the delete command. + * + * @since 3.0 + * @return void. + */ + void HandleDeleteL(); + + /** + * Handles the move command. + * + * @since 3.0 + * @return void. + */ + void HandleMoveL(); + + /** + * Handles the move to folder command. + * + * @since 3.0 + * @return void. + */ + void HandleMoveToFolderL(); + + /** + * Handles the mark-related commands. + * + * @since 3.0 + * @param aCommand The command to process. + * @return void. + */ + void HandleMarkL(TInt aCommand); + + /** + * Handles the ok commands. + * + * @since 3.1 + * @return void. + */ + void HandleOkL(); + + /** + * Handles the cancel commands. + * + * @since 3.0 + * @return void. + */ + void HandleCancelL(); + + /** + * Handles the export command. + * + * @since 3.2 + * @return void. + */ + void HandleExportL(); + + /** + * Calculate the unread count based on delta. + * + * @since 3.1 + * @return the calculated value. + */ + TInt UnreadCountChangedL( TInt aUnreadCountDelta ); + + /** + * Set the unread count. + * + * @since 3.1 + * @return void. + */ + void SetUnreadCountL( TInt aUnreadCount ); + + /** + * Count the number of folders in a given feeds folder + * + * @since 5.0 + * @param folder to count + * @param total count folders + * @return void + */ + void CountFolderFolders(const CFeedsEntity* aFolder, TInt &aFolderCount); + + /** + * Update the toolbar buttons' state + * + * @since 5.0 + * @return void + */ + void UpdateToolbarButtonsState(); + + /** + * Recursive loop to find a feed + * + * @since 5.0 + * @return ETrue if feed item is found + */ + TBool SearchForFeedL(const CFeedsEntity* item); + +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + /** + * To know Whether any feed item selected for move + * + * @since 7.2 + * @return ETrue if feed item is selected for move + */ + TBool isMoveActive(){ return iMoveActive;} +#endif + + private: + /** + * C++ default constructor. + */ + CFeedsFolderContainer + ( CFeedsFolderView* aView, + MApiProvider& aApiProvider ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(const TRect& aRect); + + /** + * Inits the container. + * + * @since 3.0 + * @param aRect The drawing rect. + * @return void + */ + void InitContainerL(const TRect& aRect); + + /** + * Inits the array of needed icons. + * + * @since 3.0 + * @return void. + */ + void InitIconArrayL(); + + /** + * Loads and appends an icon to the icon array.. + * + * @since 3.0 + * @param aIcons The icon array. + * @param aID Item ID of the masked bitmap to be created. + * @param aFilename Filename to be used to construct the item, + * if no matching item was found in the currently active skin. + * @param aFileBitmapId ID of the bitmap in the file. + * Used only if no matching item was found in the currently + * active skin. + * @param aFileMaskId ID of the mask in the file. + * Used only if no matching item was found in the currently + * active skin. + * @return void. + */ + void AppendIconL(CArrayPtr* aIcons, const TAknsItemID& aID, + const TDesC& aFilename, const TInt aFileBitmapId, const TInt aFileMaskId); + + /** + * Sets the list-box's values. + * + * @since 3.0 + * @param aInitialSelection The index of the selection after the update. + * @return void + */ + void UpdateListBoxL(TInt aInitialSelection = 0); + + /** + * Inits the move-to-folder pop-up. + * + * @since 3.0 + * @param aListBox The pop-up's listbox. + * @param aPopupList The pop-up. + * @return void + */ + void MoveToFolderInitL(CAknSingleGraphicPopupMenuStyleListBox*& aListBox, + CAknPopupList*& aPopupList); + + /** + * Sets the move-to-folder list-box's values. + * + * @since 3.0 + * @param aListBoxRows Holds the values in the pop-up. + * @return void + */ + void MoveToFolderSetItemsL(CDesCArraySeg& aListBoxRows); + + void AddFoldersToListL(const CFeedsEntity& aFolder, CDesCArraySeg& aListBoxRows); + + /** + * Moves the marked items into the target-folder. + * + * @since 3.0 + * @param aTargetFolder The folder where the items will be moved. + * @return void + */ + void MoveToFolderMoveL(const CFeedsEntity& aTargetFolder); + + /** + * Show the feed in the TopicView. + * + * @since 3.0 + * @param aFolderItem The folder item to show. + * @return void + */ + void ShowFeedL(const CFeedsEntity& aFolderItem); + + /** + * Moves the current or marked items -- called after the move-cmd is confirmed. + * + * @since 3.0 + * @return void + */ + void PostHandleMoveL(); + + /** + * Updates the options softkey to reflect the current state. + * + * @since 3.0 + * @return void. + */ + void UpdateCbaL(); + + /** + * Changes the current folder. + * + * @since 3.1 + * @param aFolder The new current folder. + * @param aResetSelection If ETrue the current selection is set to the first item. + * @return void. + */ + void SetCurrentFolder(const CFeedsEntity* aFolder, + TBool aResetSelection = EFalse); + + /** + * Dynamically initializes the Mark/Unmark submenu. + * + * @since 3.2 + * @param aMenu Pointer to the Menu Pane + * @return - iListBox. + */ + + void DynInitMarkUnmarkMenuPane(CEikMenuPane* aMenuPane); + + /** + * Dim or Undim toolbar + * + * @since 5.0 + * @param aDim - is ETrue, then dim toolbar ; else undim toolbar + * @return - void + */ + + void DimToolbar(TBool aDim); + + /** + * Check for Marked items are folder or feed + * + * @since 5.0 + * @return - bool + */ + + TBool IsMarkedItemFolder(); + + /** + * Clears the navigation pane. + * + * @since 7.1 + * @return void + */ + void ClearNavigationPane(); + + /** + * Handles the changes needed to the Navigation Pane. + * + * @since 7.1 + * @return void + */ + void UpdateNavigationPaneL(); + public: + friend class CFeedsFolderView; + + + private: + CFeedsFolderView* iView; // not owned + MApiProvider& iApiProvider; // not owned + CAknDoubleGraphicStyleListBox* iListBox; + CDesCArraySeg* iListBoxRows; + CAknIconArray* iListBoxIcons; + TBool iOwnsListBoxIcons; + + TBool iMoveActive; + + const CFeedsEntity* iRootFolder; + const CFeedsEntity* iCurrentFolder; + TInt iCurrentFolderId; + RPointerArray iTargetFolderList; // pointers not owned + CAknNavigationDecorator* iNaviDecorator; + }; + +#endif // FEEDS_FOLDER_CONTAINER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsFolderView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsFolderView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a user's list of feeds. +* +*/ + + +#ifndef FEEDS_FOLDER_VIEW_H +#define FEEDS_FOLDER_VIEW_H + + +// INCLUDES +#include "BrowserAppViewBase.h" +#include "FeedsFolderContainer.h" +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class MApiProvider; + +// CLASS DECLARATION + +/** +* A view to browse a user's list of feeds. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsFolderView: public CBrowserViewBase, + public MAknToolbarObserver + { + public: + /** + * Two-phased constructor. + */ + static CFeedsFolderView* NewL( MApiProvider& aApiProvider, TRect& aRect ); + + /** + * Destructor. + */ + virtual ~CFeedsFolderView(); + + public: // From CBrowserViewBase + + /** + * Return command set id, to be displayed. + * @return The command set's resource id. + */ + TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + /** + * @see CAknView + */ + void HandleClientRectChange(); + + public: // From CAknView + /** + * Returns the id of the view. + * + * @since ? + * @return the id. + */ + virtual TUid Id() const; + + /** + * Processes commands. + * + * @since ? + * @param aCommand the command to process. + * @return void. + */ + virtual void HandleCommandL(TInt aCommand); + + + protected: // From CAknView + /** + * Called when the view is activated. + * + * @since ? + * @param aPrevViewId the id of the prev view. + * @param aCustomMessageId The activation message id. + * @param aCustomMessage Activation params. + * @return void. + */ + virtual void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * Called when the view is deactivated. + * + * @since ? + * @return void. + */ + virtual void DoDeactivate(); + + /** + * Disables unrelated menu options. + * + * @since ? + * @param aResourceId The resource id of the menu. + * @param aMenuPane The menu. + * @return void. + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + public: // MAknToolbarObserver + /** + * Called when toolbar events occur + * + * @since 5.0 + * @return void + */ + void OfferToolbarEventL( TInt aCommand ) { HandleCommandL(aCommand); } + + + public: // New Methods + /** + * Updates the options softkey to reflect the command set. + * + * @since 3.0 + * @param aCommandSet The new "command set". + * @return void. + */ + void UpdateCbaL(TInt aCommandSet); + + + /** + * Called to notify the view the that root folder has changed. + * + * @since 3.1 + * @param aRootFolder The new root folder. + * @return Void. + */ + void RootFolderChangedL(const CFeedsEntity& aRootFolder); + + /** + * Changes the current folder. + * + * @since 3.1 + * @param aFolder The new current folder. + * @param aResetSelection If ETrue the current selection is set to the first item. + * @return void. + */ + void SetCurrentFolder(const CFeedsEntity& aFolder, TBool aResetSelection = EFalse); + + /** + * Calculate the unread count based on delta. + * + * @since 3.1 + * @return the calculated value. + */ + TInt UnreadCountChangedL( TInt aUnreadCountDelta ); + + /** + * Set the unread count. + * + * @since 3.1 + * @return void. + */ + void SetUnreadCountL( TInt aUnreadCount ); + + + public: // Friends + friend class CFeedsFolderContainer; + + + private: + /** + * C++ default constructor. + */ + CFeedsFolderView( MApiProvider& aApiProvider ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(TRect& aRect); + + /** + * Check for any Marked Feeds Folders + * @since 3.2 + * @return ETrue if any feeds folders are currently marked + * otherwise, return EFalse + */ + TBool AnyFoldersMarked(); + + /** + * Check for any Marked items in Feeds view + * @since 3.2 + * @return ETrue anything is marked otherwise returns EFalse + */ + TBool AnyMarkedItems(); + + /** + * Check if current item is marked + * @since 5.0 + * @return ETrue if current item is marked, otherwise returns EFalse + */ + TBool IsCurrentItemMarked(); + + + + + private: + const CFeedsEntity* iRootFolder; + CFeedsFolderContainer* iContainer; + TBool iContainerOnStack; + TInt iInitialItem; + TBool iPenEnabled; + }; + +#endif // FEEDS_FOLDER_VIEW_H + +// End of File + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsTopicContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsTopicContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A container to browse a feed's topics. +* +*/ + + +#ifndef FEEDS_TOPIC_CONTAINER_H +#define FEEDS_TOPIC_CONTAINER_H + + +// INCLUDES +#include +#include +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CAknSingleGraphicStyleListBox; +class CAknNavigationDecorator; +class CItem; +class CFeedsEntity; +class CFeedsTopicView; +class MApiProvider; + +// CLASS DECLARATION + + +/** +* A container to browse a feed's topics. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsTopicContainer: public CCoeControl, public MEikListBoxObserver + { + public: + /** + * Two-phased constructor. + */ + static CFeedsTopicContainer* NewL( + CFeedsTopicView* aView, + MApiProvider& aApiProvider, + const TRect& aRect); + + /** + * Destructor. + */ + virtual ~CFeedsTopicContainer(); + + + public: // From CoeControl + /** + * Handles key event. + * + * @param aKeyEvent The key event. + * @param aType The type of the event. + * @return Indicates whether the key event was used by this control or not + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +#ifdef __SERIES60_HELP + /** + * Get help context for the control. + * + * @since ? + * @param aContext The context that is filled in. + * @return None. + */ + void virtual GetHelpContext(TCoeHelpContext& aContext) const; +#endif // __SERIES60_HELP + + + protected: // From CoeControl + /** + * Called by framework when the view size is changed. + * + * @since ? + * @return void. + */ + virtual void SizeChanged(); + + /** + * Called by the framework when a display resource changes (i.e. skin or layout). + * + * @since ? + * @return void. + */ + virtual void HandleResourceChange(TInt aType); + + /** + * Returns number of components. + * + * @since ? + * @return Number of component controls. + */ + virtual TInt CountComponentControls() const; + + /** + * Returns pointer to particular component. + * + * @since ? + * @param aIndex Index whose control's pointer has to returned. + * @return Pointer to component control + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; + + + public: // MEikListBoxObserver + /** + * Processes key events from the listbox. + * + * @since ? + * @param aListBox Listbox being observed. + * @param aEventType Event observed. + * @return void + */ + virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + + public: // New methods. + /** + * Sets the current feed + * + * @since 3.0 + * @param aFeed The new feed. + * @param aIndex The inital items to select. + * @return Void + */ + void SetCurrentFeedL(const CFeedsEntity& aFeed, TInt aIndex); + + /** + * Returns the index of the current item. + * + * @since 3.0 + * @return The index of the current item. + */ + TInt CurrentIndex() const; + + /** + * Returns the number of items. + * + * @since 3.0 + * @return The the current item. + */ + TInt ItemCount() const; + + /** + * Update the view's title. + * + * @since 3.0 + * @return void. + */ + void UpdateTitleL(); + + /** + * Handles selections and open commands + * + * @since 3.0 + * @return void + */ + void HandleOpenL(void); + + /** + * Handles updating the current Feed. + * + * @since 3.1 + * @return void + */ + void HandleUpdateFeedL(void); + + /** + * Clears the navigation pane. + * + * @since 3.1 + * @return void + */ + void ClearNavigationPane(); + + + private: + /** + * C++ default constructor. + */ + CFeedsTopicContainer + ( CFeedsTopicView* aView, + MApiProvider& aApiProvider ); + + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(const TRect& aRect); + + /** + * Inits the container. + * + * @since 3.0 + * @param aRect The drawing rect. + * @return void + */ + void InitContainerL(const TRect& aRect); + + /** + * Inits the array of needed icons. + * + * @since 3.0 + * @return void. + */ + void InitIconArrayL(); + + /** + * Loads and appends an icon to the icon array.. + * + * @since 3.0 + * @param aIcons The icon array. + * @param aID Item ID of the masked bitmap to be created. + * @param aFilename Filename to be used to construct the item, + * if no matching item was found in the currently active skin. + * @param aFileBitmapId ID of the bitmap in the file. + * Used only if no matching item was found in the currently + * active skin. + * @param aFileMaskId ID of the mask in the file. + * Used only if no matching item was found in the currently + * active skin. + * @return void. + */ + void AppendIconL(CArrayPtr* aIcons, const TAknsItemID& aID, + const TDesC& aFilename, const TInt aFileBitmapId, const TInt aFileMaskId); + + /** + * Sets the list-box's values. + * + * @since 3.0 + * @return void + */ + void UpdateListBoxL(); + + /** + * Handles the changes needed to the Navigation Pane. + * + * @since 3.1 + * @return void + */ + void UpdateNavigationPaneL(); + + public: // Friends + friend class CFeedsTopicView; + + protected: + CFeedsTopicView* iView; // not owned + MApiProvider& iApiProvider; // not owned + CAknSingleGraphicStyleListBox* iListBox; + CDesCArraySeg* iListBoxRows; + CAknNavigationDecorator* iNaviDecorator; + + const CFeedsEntity* iFeed; + }; + +#endif // FEEDS_TOPIC_CONTAINER_H + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsTopicView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsTopicView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a feed's topics. +* +*/ + + +#ifndef FEEDS_TOPIC_VIEW_H +#define FEEDS_TOPIC_VIEW_H + + +// INCLUDES +#include "BrowserAppViewBase.h" + +#include "FeedsTopicContainer.h" +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class MApiProvider; + +// CLASS DECLARATION + + +/** +* A view to browse a feed's topics. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsTopicView: public CBrowserViewBase, + public MAknToolbarObserver + { + public: + /** + * Two-phased constructor. + */ + static CFeedsTopicView* NewL( MApiProvider& aApiProvider, TRect& aRect ); + + /** + * Destructor. + */ + virtual ~CFeedsTopicView(); + + public: // From CBrowserViewBase + + /** + * Return command set id, to be displayed. + * @return The command set's resource id. + */ + TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + /** + * @see CAknView + */ + void HandleClientRectChange(); + + public: // From CAknView + /** + * Returns the id of the view. + * + * @since ? + * @return the id. + */ + virtual TUid Id() const; + + /** + * Processes commands. + * + * @since ? + * @param aCommand the command to process. + * @return void. + */ + virtual void HandleCommandL(TInt aCommand); + + + protected: // From CAknView + /** + * Called when the view is activated. + * + * @since ? + * @param aPrevViewId the id of the prev view. + * @param aCustomMessageId The activation message id. + * @param aCustomMessage Activation params. + * @return void. + */ + virtual void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * Called when the view is deactivated. + * + * @since ? + * @return void. + */ + virtual void DoDeactivate(); + + /** + * Disables unrelated menu options. + * + * @since ? + * @param aResourceId The resource id of the menu. + * @param aMenuPane The menu. + * @return void. + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + public: // MAknToolbarObserver + /** + * Called when toolbar events occur + * + * @since 5.0 + * @return void + */ + void OfferToolbarEventL( TInt aCommand ) { HandleCommandL(aCommand); } + + public: // New Methods + + /** + * Sets the current feed + * + * @since 3.0 + * @param aFeed The new feed. + * @param aIndex The inital items to select. + * @return Void + */ + void SetCurrentFeedL(const CFeedsEntity& aFeed, TInt aIndex); + + /** + * Sets the initial item once the view is activated. + * + * @since 3.1 + * @param aItemIndex The index of the inital item. + * @return void + */ + void SetInitialItem(TInt aItemIndex); + + /** + * Update the toolbar buttons' state + * + * @since 5.0 + * @return void + */ + void UpdateToolbarButtonsState(); + + private: // New Methods + /** + * C++ default constructor. + */ + CFeedsTopicView( MApiProvider& aApiProvider ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(TRect& aRect); + + + public: // Friends + friend class CTopicContainer; + + + private: + CFeedsTopicContainer* iContainer; + TBool iContainerOnStack; + TInt iInitialItem; + TBool iPenEnabled; + }; + +#endif // FEEDS_TOPIC_VIEW_H + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsInc/FeedsWaitDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsInc/FeedsWaitDialog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Encapsulates a wait or progress dialog. +* +*/ + +#ifndef FEEDS_WAIT_DIALOG_H +#define FEEDS_WAIT_DIALOG_H + + +// INCLUDES +#include +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + + +/** +* Observer interface for the WaitDialog +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class MFeedsWaitDialogListener + { + public: + /** + * Called when the user presses the cancel button. + * + * @since 3.0 + * @return void. + */ + virtual void DialogDismissedL() = 0; + }; + + +/** +* Encapsulates a wait or progress dialog. +* @lib FeedsEngine.lib +* @since 3.0 +*/ +class CFeedsWaitDialog: public CBase, public MProgressDialogCallback + { + public: + /** + * Two-phased constructor. + */ + static CFeedsWaitDialog* NewL(MFeedsWaitDialogListener& aListener); + + /** + * Destructor. + */ + virtual ~CFeedsWaitDialog(); + + + public: // From MProgressDialogCallback + /** + * Called when the user presses the cancel button. + * + * @since ? + * @param aButtonId The id of the pressed button. + * @return void. + */ + virtual void DialogDismissedL(TInt aButtonId); + + + public: // New methods + /** + * Displays a WaitDialog. + * + * @since 3.0 + * @param aLabelId The label's resource id. + * @return void. + */ + void ShowWaitDialogL(TInt aLabelId); + + /** + * Displays a ProgressDialog. + * + * @since 3.0 + * @param aLabelId The label's resource id. + * @return void. + */ + void ShowProgressDialogL(TInt aLabelId); + + /** + * Updates the dialog's label. + * + * @since 3.0 + * @param aLabelId The label's resource id. + * @return void. + */ + void UpdateLabelL(TInt aLabelId); + + /** + * For progress dialogs this method set the max progress value. + * + * @since 3.0 + * @param aMaxValue The progress dialog's max value. + * @return void. + */ + void SetMaxProgressL(TInt aMaxValue); + + /** + * For progress dialogs this method updates the progress. + * + * @since 3.0 + * @param aIncrement The amount the progress changed. + * @return void. + */ + void UpdateProgressL(TInt aIncrement); + + /** + * Closes the dialog. + * + * @since 3.0 + * @return void. + */ + void Close(); + + + private: + /** + * C++ default constructor. + */ + CFeedsWaitDialog(MFeedsWaitDialogListener& aListener); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + private: + MFeedsWaitDialogListener& iListener; + + CAknWaitDialog* iWaitDialog; + CAknProgressDialog* iProgressDialog; + CEikProgressInfo* iProgressInfo; + }; + +#endif // FEEDS_WAIT_DIALOG_H + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsClientUtilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsClientUtilities.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1873 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Manages the feed related views and implements the FeedsViewBridge. +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "Browser.hrh" +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include "BrowserWindow.h" +#include "BrowserWindowManager.h" +#include "BrowserUIVariant.hrh" +#include "Preferences.h" +#include "BrowserGotoPane.h" +#include "BrowserAdaptiveListPopup.h" +#include "FeedsFeedView.h" +#include "FeedsFolderView.h" +#include "BrowserDialogs.h" +#include "FeedsTopicView.h" +#include "BrowserUtil.h" +#include "BrowserSpecialLoadObserver.h" + +#include "FeedsClientUtilities.h" + +#include "BrowserBmOTABinSender.h" + +// CONSTANTS +_LIT(KSupportedMimeTypes, "application/rss+xml;application/atom+xml;text/xml;application/xml"); +const TInt KLastUpdateGranularity = 10; + +const TInt KWmlSettingsAutomaticUpdatingNotSet = 32767; + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsClientUtilities* CFeedsClientUtilities::NewL(CAknViewAppUi& aAppUI, MApiProvider& aApiProvider) + { + CFeedsClientUtilities* self = new (ELeave) CFeedsClientUtilities(aAppUI, aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::CFeedsClientUtilities +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsClientUtilities::CFeedsClientUtilities(CAknViewAppUi& aAppUI, MApiProvider& aApiProvider): + iAppUI(aAppUI), iApiProvider(aApiProvider), iIsUpdatingFeed(EFalse), iWaitDialog(0), + iEnteredURL(0), iFolderView(0), iTopicView(0), iFeedView(0), + iIsConnected(EFalse), iItemIds(20), iItemStatus(20), iMimeTypes(0), + iFeedUpdateTimeIds(KLastUpdateGranularity), iFeedUpdateTimeTimestamps(KLastUpdateGranularity), + iPendingFolderItemTitle(NULL), iPendingFolderItemUrl(NULL), iExportFileName(NULL), + iSearchAgent(NULL), + iSearchOptList(NULL), + iFeedImportRequested(EFalse), + iRequestCanceled(EFalse), + iIsWaitDialogDisplayed(EFalse), + iFeedsInterface(*this,0), + iCanceledRequest(CTransaction::ENone) + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ConstructL() + { + iApiProvider.Preferences().AddObserverL( this ); + + // Set up MimeTypes + iMimeTypes = HBufC::NewL( KSupportedMimeTypes().Length() + 1 ); + TPtr ptr( iMimeTypes->Des() ); + ptr.Append( KSupportedMimeTypes() ); + ptr.ZeroTerminate(); + + iWaitDialog = CFeedsWaitDialog::NewL(*this); + } + +// ----------------------------------------------------------------------------- +// CFolderItem::Search +// +// Searches for a FolderItem with the given name. If "this" +// isn't a folder it only checks whether or not it matches +// the given name. If "this" is a folder it also checks +// all embedded items. +// ----------------------------------------------------------------------------- +// +const CFeedsEntity* CFeedsClientUtilities::Search(const TDesC& aName,const CFeedsEntity& aFolder) const + { + TPtrC title; + if (aFolder.GetType() == EFolder) + { + aFolder.GetStringValue(EFolderAttributeTitle,title); + } + else + { + aFolder.GetStringValue(EFeedAttributeTitle,title); + } + if (aName.CompareF(title) == 0) + { + return &aFolder; + } + if (aFolder.GetType() == EFolder) + { + for(TInt i=0;iGetStatusCode(); + +switch (aTrans->Type()) + { + case CTransaction::EFetchRootFolderItem: + FolderItemRequestCompleted(status, CTransaction::EFetchRootFolderItem); + + break; + + case CTransaction::EWatchForChanges: + break; + + case CTransaction::EExportOPML: + case CTransaction::EImportOPML: + FolderItemRequestCompleted(status, aTrans->Type()); + break; + + case CTransaction::EAddFolderItem: + case CTransaction::EDeleteFolderItem: + case CTransaction::EChangeFolderItem: + case CTransaction::EMoveFolderItem: + case CTransaction::EMoveFolderItemTo: + case CTransaction::EUpdateFolderItem: + FolderItemRequestCompleted(status, aTrans->Type()); + break; + + case CTransaction::EChangeSettings: + break; + + case CTransaction::EFetchFeed: + FeedRequestCompleted(status); + break; + case CTransaction::EUpdateItemStatus: + break; + + default: + FolderItemRequestCompleted(status, aTrans->Type()); + break; + } +} + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::NetworkConnectionNeededL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::NetworkConnectionNeededL( + TInt* aConnectionPtr, TInt& aSockSvrHandle, + TBool& aNewConn, TApBearerType& aBearerType ) + { + iApiProvider.SpecialLoadObserver().NetworkConnectionNeededL( + aConnectionPtr, &aSockSvrHandle, &aNewConn, &aBearerType ); + //Wait dialog is shown only in the case of a new connection. + if ( aNewConn ) + { + iWaitDialog->ShowWaitDialogL(R_FEEDS_UPDATING_FEED); + iIsWaitDialogDisplayed = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::HandlePreferencesChangeL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::HandlePreferencesChangeL( + const TPreferencesEvent aEvent, + TPreferencesValues& aValues, + TBrCtlDefs::TBrCtlSettings aSettingType ) + { + // no specific TBrCtlDefs::TBrCtlSettings are defined for FeedsSettings + // so we trigger for an Unknown setting + if( (EPreferencesItemChange == aEvent || EPreferencesDeactivate == aEvent) && + (TBrCtlDefs::ESettingsUnknown == aSettingType ) ) + { + SetPreferencesToFeedL( aValues ); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SetPreferencesToFeedL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SetPreferencesToFeedL( const TPreferencesValues& aValues ) + { + if ( iIsWaitDialogDisplayed ) + { + return; + } + TFeedsServerSetting setting; + + // always set to 32767 in the case of feed level auto updating. + //setting.iAutoUpdate = KWmlSettingsAutomaticUpdatingNotSet; + setting.iAutoUpdate = EFalse; + setting.iAutoUpdateFreq = KWmlSettingsAutomaticUpdatingNotSet; + setting.iAutoUpdateWhileRoaming = aValues.iAutomaticUpdatingWhileRoaming; + + TUint32 autoUpdatingAP( 0 ); +#ifndef __WINSCW__ + if (aValues.iAutomaticUpdatingAP != KWmlNoDefaultAccessPoint) + { + autoUpdatingAP = Util::IapIdFromWapIdL( iApiProvider, aValues.iAutomaticUpdatingAP ); + } +#endif //__WINSCW__ + setting.iAutoUpdateAP = autoUpdatingAP; + + SetFeedsServerSettingsL( setting ); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::DisconnectManualUpdateConnectionL() +// +// Disconnect connection provided by client for manual update. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::DisconnectManualUpdateConnectionL() + { + if ( iIsConnected ) + { + // Ensure that the connection is available. + ConnectToServerL(EFalse); + + // Pass the updated settings to the server. + iFeedsInterface.DisconnectManualUpdateConnectionL(); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::DisconnectFeedsViewL() +// +// Disconnect connection used by FeedsView. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::DisconnectFeedsViewL() + { + if( iFeedView ) + { + iFeedView->DisconnectL(); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::LoadUrlL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::LoadUrlL( const TDesC& aUrl ) + { + + if( iApiProvider.IsPageLoaded() && + iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) && + !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows )) + { + // there is already a window, so create a new one if not over the max number of windows allowed + if(iApiProvider.WindowMgr().WindowCount() == iApiProvider.WindowMgr().MaxWindowCount()) + { + // Show warning to user + TBrowserDialogs::ErrorNoteL( R_BROWSER_NOTE_MAX_WINDOWS ); + return; + } + + if(iApiProvider.WindowMgr().WindowCount() < iApiProvider.WindowMgr().MaxWindowCount()) + { + CBrowserWindow *win = iApiProvider.WindowMgr().CreateWindowL( 0, &KNullDesC ); + if (win != NULL) + { + CleanupStack::PushL( win ); + iApiProvider.WindowMgr().SwitchWindowL( win->WindowId() ); + CleanupStack::Pop(); // win + } + } + } + + iApiProvider.WindowMgr().CurrentWindow()->SetHasFeedsContent(ETrue); + iApiProvider.FetchL( aUrl ); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ShowFolderViewL +// +// Shows the folder view, loading the folder list from the FeedsServer if need be. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ShowFolderViewL(TUid aCalledFromView /*= KUidBrowserBookmarksViewId*/) + { + + if ( iIsWaitDialogDisplayed ) + { + return; + } + // Record the view from which feeds was launched. + // If this function is not called with an argument, + // its default value "KUidBrowserBookmarksViewId" is used. + // This is specified in the header FeedsClientUtilities.h + SetCalledFromView(aCalledFromView); + + // Ensure that "this" is ready for uses. + LazyInitL(EFalse); + + // Show wait dialog. + iWaitDialog->ShowWaitDialogL(R_FEEDS_OPENING_FEED); + iIsWaitDialogDisplayed = ETrue; + + // Set the view to show once the folder is ready. + iNextViewId = KUidBrowserFeedsFolderViewId; + iIsUpdatingFeed = EFalse; + + // Get the root folder. + FetchRootFolderL(); + iCurrentRequest = CTransaction::EFetchRootFolderItem; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ShowTopicViewL +// +// Shows the topic view, loading the given feed associated with the given folder item. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ShowTopicViewL(const CFeedsEntity& aFolderItem) + { + TTime timestamp; + + if ( iIsWaitDialogDisplayed ) + { + return; + } + + // Ensure that "this" is ready for uses. + LazyInitL(EFalse); + + // Show wait dialog. + timestamp = aFolderItem.GetTimeValue(EFeedAttributeTimestamp,timestamp); + if ( timestamp.Int64() == 0 ) + { + if ( iApiProvider.Connection().Connected() ) + { + iWaitDialog->ShowWaitDialogL(R_FEEDS_UPDATING_FEED); + } + } + else + { + iWaitDialog->ShowWaitDialogL(R_FEEDS_OPENING_FEED); + } + iIsWaitDialogDisplayed = ETrue; + + // Set the view to show once the feed is ready. + iNextViewId = KUidBrowserFeedsTopicViewId; + iIsUpdatingFeed = EFalse; + + // Fetch the feed. + FetchFeedL(aFolderItem); + iCurrentRequest = CTransaction::EFetchFeed; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SupportedMimeTypesL +// +// Returns the feed related mime-types supported by the bridge. This makes +// for a clean way to pass downloaded feeds content from the client to the FeedsServer +// (via CFeedsClientUtilities::HandleFeedL). +// ----------------------------------------------------------------------------- +// +TPtrC CFeedsClientUtilities::SupportedMimeTypesL() + { + return iMimeTypes->Des(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SubscribeToL +// +// Shows the folder view and subscribes to the given feed. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SubscribeToL(const TDesC& aTitle, const TDesC& aUrl) + { + SetCalledFromView(KUidBrowserContentViewId); + + // If the root folder is available then Add the feed. + if (iFeedsInterface.RootFolder() != NULL) + { + // Ensure that "this" is ready for uses. + LazyInitL( EFalse ); + CFeedsMap* temp = CFeedsMap::NewL(); + temp->SetStringAttribute(EFeedAttributeTitle,aTitle); + temp->SetStringAttribute(EFeedAttributeLink,aUrl); + temp->SetIntegerAttribute(EFeedAttributeAutoUpdateFreq,0); + + // Set the next view to show after the new add folder item is added. + iNextViewId = KUidBrowserFeedsFolderViewId; + + iFeedsInterface.AddL(EFeed,*temp, *(iFeedsInterface.RootFolder())); + + delete temp; + // Ensure the Folder View shows the root-folder when AddFolderItemL completes. + iFolderView->SetCurrentFolder(*(iFeedsInterface.RootFolder()), ETrue); + } + + // Otherwise queue the folder item until the root folder is fetched (see above). + else + { + // Ensure that "this" is ready for uses. ETrue is passed to ensure that + // the root folder will be fetched if it isn't already available. + LazyInitL( ETrue ); + + delete iPendingFolderItemTitle; + iPendingFolderItemTitle = NULL; + delete iPendingFolderItemUrl; + iPendingFolderItemUrl = NULL; + + iPendingFolderItemTitle = aTitle.AllocL(); + TRAPD(err, iPendingFolderItemUrl = aUrl.AllocL()); + if (err != KErrNone) + { + delete iPendingFolderItemTitle; + iPendingFolderItemTitle = NULL; + + User::Leave(err); + } + } + } + + + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FeedsServerSettings +// +// Returns Feeds Server related settings. +// ----------------------------------------------------------------------------- +// +TInt CFeedsClientUtilities::FeedsServerSettingsL(TFeedsServerSetting& aSetting) + { + // Ensure that the connection is available. + ConnectToServerL(EFalse); + + return iFeedsInterface.GetSettingsL(aSetting); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SetFeedsServerSettings +// +// Sets Feeds Server related settings. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SetFeedsServerSettingsL(const TFeedsServerSetting& aNewSetting) + { + // Ensure that the connection is available. + ConnectToServerL(EFalse); + + // Pass the updated settings to the server. + iFeedsInterface.SetSettingsL(aNewSetting); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SetBrowserControlSettingL +// +// Sets a Browser Control related settings. These settings are directly passed to all +// Browser Control instances used by the CFeedsViewBridge. As such see the Browser +// Control documentation for infomation about the settings. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SetBrowserControlSettingL(TUint aSetting, TUint aValue) + { + // Pass the setting to the Feed View's Browser Control. + iApiProvider.BrCtlInterface().SetBrowserSettingL(aSetting, aValue); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FolderItemRequestCompleted +// +// Called by RequestHandlerCompleted when the root FolderItem is either ready +// or an error occured. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::FolderItemRequestCompleted(TInt aStatus, CTransaction::TTransactionType aTransType/*=ENone*/) + { + TRAP_IGNORE( FolderItemRequestCompletedL(aStatus, aTransType) ); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FolderItemRequestCompletedL +// +// Called by FolderItemRequestCompleted. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::FolderItemRequestCompletedL(TInt aStatus, CTransaction::TTransactionType aTransType/*=ENone*/) + { + if (aTransType == iCanceledRequest) + { + iCanceledRequest = CTransaction::ENone; + return; + } + + iWaitDialog->Close(); + + iIsWaitDialogDisplayed = EFalse; + + // Show the view if everything went ok. + if (aStatus == KErrNone) + { + switch(aTransType) + { + case CTransaction::EExportOPML: + //launch send ui + SendOPMLFileL(); + break; + + case CTransaction::EImportOPML: + // Delete temp file here if it exists + if(iTempOPMLImportFilePath.Length() > 0) + { + RFs tempRFs; + if (tempRFs.Connect() != KErrNone) + { + break; + } + CleanupClosePushL(tempRFs); + tempRFs.Delete( iTempOPMLImportFilePath ); + tempRFs.Close(); + CleanupStack::PopAndDestroy(); // cleanup tempRFs and reset temp file import path + iTempOPMLImportFilePath = _L(""); + } + + // Again show folder view to trigger a redraw + ShowFolderViewL(); + break; + + default: + // if an import OPML was requested, do that now + if(iFeedImportRequested) + { + // clear flag + iFeedImportRequested = EFalse; + + // show wait dialog + iWaitDialog->ShowWaitDialogL(R_FEEDS_WAIT_IMPORTING_FEEDS); + iIsWaitDialogDisplayed = ETrue; + + + if(iTempOPMLImportFilePath.Length()) + { + iFeedsInterface.ImportOPMLL( iTempOPMLImportFilePath ); + } + iCurrentRequest = CTransaction::EImportOPML; + } + + // Set the updated folder + iFolderView->RootFolderChangedL(*(iFeedsInterface.RootFolder())); + + // Show it. + if (iNextViewId == KUidBrowserFeedsFolderViewId) + { + ShowFolderViewLocalL(); + } + + // If the user tried to subscribe to a feed before it was connected + // to the server then add the item now. + if (iPendingFolderItemTitle != NULL) + { + TRAPD(err, SubscribeToL(*iPendingFolderItemTitle, *iPendingFolderItemUrl)); + if (err == KErrNone) + { + delete iPendingFolderItemTitle; + iPendingFolderItemTitle = NULL; + delete iPendingFolderItemUrl; + iPendingFolderItemUrl = NULL; + } + // Don't reset next-view; iNextViewId is EFolderViewId after above SubscribeToL() call + + // Otherwise try to add the folder item next time. + } + else if(iNextViewId == KUidBrowserFeedsFolderViewId) + { + // Reset next-view. + iNextViewId = KUidBrowserNullViewId; + } + + // Reset the "last updated" cache now that a new folder list is available. + ResetFeedUpdateTime(); + } + } + // Otherwise show an error. + else + { + // If the server terminated, reconnect to it. + if (aStatus == KErrServerTerminated) + { + DisconnectFromServer(); + ConnectToServerL(); + + } + + ShowServerError(aStatus, aTransType); + + // This happens when user subscribe to a feed from content view + // If it failed, we want to show the content view. + if (aStatus == KErrAlreadyExists) + { + // Set content view as the last view id. + iApiProvider.SetLastActiveViewId( KUidBrowserContentViewId ); + + // Show the view. + // We already started switching to the feeds folder view and shut off full screen + // This will force the DoActivate on the ContentView and set back to full screen + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserFeedsFolderViewId ); + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + } + + // Reset next-view. + iNextViewId = KUidBrowserNullViewId; + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FeedRequestCompleted +// +// Called when the asynchronous request is complete. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::FeedRequestCompleted(TInt aEvent) + { + TRAP_IGNORE( FeedRequestCompletedL(aEvent) ); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FeedRequestCompletedL +// +// Called when the asynchronous request is complete. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::FeedRequestCompletedL(TInt aStatus) + { + if (CTransaction::EFetchFeed == iCanceledRequest) + { + iCanceledRequest = CTransaction::ENone; + return; + } + // Close the wait dialog. + iWaitDialog->Close(); + iIsWaitDialogDisplayed = EFalse; + + // Show the view if everything went ok. + if (aStatus == KErrNone) + { + // Extract out the intial item status -- later on, iItemStatusOrig is + // used to determine which item status' change. + RArray ignore(20); + + iItemIds.Reset(); + iItemStatus.Reset(); + iItemStatusOrig.Reset(); + + CleanupClosePushL(ignore); + ItemStatusL(iItemIds, iItemStatus, *(iFeedsInterface.Feed())); + ItemStatusL(ignore, iItemStatusOrig, *(iFeedsInterface.Feed())); + CleanupStack::PopAndDestroy(/*ignore*/); + + // update folder view for unread count + TInt unreadCount = 0; + for (TInt i = 0; i < iItemStatus.Count(); i++) + { + if ( iItemStatus[i] == EItemStatusUnread || iItemStatus[i] == EItemStatusNew ) + { + unreadCount++; + } + } + iFolderView->SetUnreadCountL( unreadCount ); + + // The method was called because of a updated feed. In general, update + // the current view to reflect the updated feed. + if (iIsUpdatingFeed) + { + if (iApiProvider.LastActiveViewId() == KUidBrowserFeedsTopicViewId) + { + iTopicView->SetCurrentFeedL(*(CurrentFeed()), 0); + } + } + + // Otherwise, this is a newly requested feed, so show the next + // view now that it is available. + else + { + if (iNextViewId == KUidBrowserFeedsFeedViewId) + { + ShowFeedViewLocalL(0); + } + else if (iNextViewId == KUidBrowserFeedsTopicViewId) + { + ShowTopicViewLocalL(0); + } + } + + // Update the feed's "last updated" value in the cache. + UpdateFeedUpdatedTimeL(*(iFeedsInterface.Feed())); + } + + // Otherwise show an error. + else + { + // If the server terminated, reconnect to it. + if (aStatus == KErrServerTerminated) + { + DisconnectFromServer(); + ConnectToServerL(); + + } + + ShowServerError(aStatus); + } + + // Reset updating feed. + iIsUpdatingFeed = EFalse; + + // Reset next-view. + iNextViewId = KUidBrowserNullViewId; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::DialogDismissedL +// +// Called when the user presses the cancel button. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::DialogDismissedL() + { + // Cancel all activities that can be cancelled. + iIsWaitDialogDisplayed = EFalse; + + + // If there is an ongoing search by the search agent, make sure + // it's cancelled and search agent destroyed + if(iSearchAgent != NULL) + { + iSearchAgent->CancelSearch(); + delete(iSearchAgent); + iSearchAgent = NULL; + } + else + { + iCanceledRequest = iCurrentRequest; + iFeedsInterface.CancelAllL(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FetchRootFolderL +// +// Get the root folder from the Feeds server. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::FetchRootFolderL() + { + iFeedsInterface.GetRootFolderL(); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::AddFolderItemL +// +// Add a new folder item. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::AddFolderItemL(const TDesC& aTitle, const TDesC& aUrl, + TBool aIsFolder, const CFeedsEntity& aParent, TInt aFreq) + { + + CFeedsMap* temp = CFeedsMap::NewL(); + + temp->SetStringAttribute(EFeedAttributeTitle,aTitle); + temp->SetStringAttribute(EFeedAttributeLink,aUrl); + temp->SetIntegerAttribute(EFeedAttributeAutoUpdateFreq,aFreq); + + // Set the next view to show after the new add folder item is added. + iNextViewId = KUidBrowserFeedsFolderViewId; + + iFeedsInterface.AddL(aIsFolder?EFolder:EFeed,*temp, aParent); + + delete temp; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ChangeFolderItemL +// +// Change the folder item. If this is a folder then KNullDesC should be passed +// to the aUrl argument. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ChangeFolderItemL(CFeedsEntity& aFolderItem, + const TDesC& aTitle, const TDesC& aUrl,TInt aFreq) + { + CFeedsMap* temp = CFeedsMap::NewL(); + temp->SetStringAttribute(EFeedAttributeTitle,aTitle); + temp->SetStringAttribute(EFeedAttributeLink,aUrl); + temp->SetIntegerAttribute(EFeedAttributeAutoUpdateFreq,aFreq); + // Set the next view to show after the new add folder item is added. + iNextViewId = KUidBrowserFeedsFolderViewId; + + aFolderItem.ChangeValueL(*temp); + delete temp; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::DeleteFolderItemsL +// +// Delete the folder items. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::DeleteFolderItemsL(RPointerArray& aFolderItems) + { + iFeedsInterface.DeleteL(aFolderItems); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::MoveFolderItemsToL +// +// Move the folder items to a different parent. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::MoveFolderItemsToL(RPointerArray& aFolderItems, + const CFeedsEntity& aParent) + { + iFeedsInterface.MoveToFolderL(aFolderItems, aParent); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::MoveFolderItemsL +// +// Move the folder item to a different index. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::MoveFolderItemsL(RPointerArray& aFolderItems, + TInt aIndex) + { + iFeedsInterface.MoveL(aFolderItems, aIndex); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FetchFeedL +// +// Get the given feed from the Feeds server. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::FetchFeedL(const CFeedsEntity& aFeedEntity, TBool aForceUpdate, + TBool aNoCache) + { + // Fetch the new feed. + iFeedsInterface.FetchL(aFeedEntity, aForceUpdate, aNoCache); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::UpdateFeedL +// +// Updates the feed with the given id. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::UpdateFeedL(const CFeedsEntity& aFeedEntity) + { + if(iIsWaitDialogDisplayed) + { + return; + } + // Show wait dialog iff connection is already established. + if(iApiProvider.Connection().Connected()) + { + iWaitDialog->ShowWaitDialogL(R_FEEDS_UPDATING_FEED); + iIsWaitDialogDisplayed = ETrue; + } + + iIsUpdatingFeed = ETrue; + + // Fetch the feed. + FetchFeedL(aFeedEntity, ETrue); + iCurrentRequest = CTransaction::EFetchFeed; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::UpdateFolderItemsL +// +// Updates the given feeds in the background. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::UpdateFolderItemsL(const RPointerArray& + aFolderItems) + { + if (iIsWaitDialogDisplayed) + { + return; + } + // Show wait dialog iff connection is already established. + if (iApiProvider.Connection().Connected()) + { + iWaitDialog->ShowWaitDialogL(R_FEEDS_UPDATING_FEED); + iIsWaitDialogDisplayed = ETrue; + } + + // Fetch the feeds. + iFeedsInterface.UpdateL(aFolderItems); + iCurrentRequest = CTransaction::EUpdateFolderItem; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::UpdateFolderItemsL +// +// Updates all of feeds in the background. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::UpdateFolderItemsL() + { + if (iIsWaitDialogDisplayed) + { + return; + } + + // Show wait dialog iff connection is already established. + if (iApiProvider.Connection().Connected()) + { + iWaitDialog->ShowWaitDialogL(R_FEEDS_UPDATING_ALL_WAIT_DIALOG); + iIsWaitDialogDisplayed = ETrue; + } + + // Fetch the feeds. + RPointerArray aFolderItem; + aFolderItem.Append((iFeedsInterface.RootFolder())); + + iFeedsInterface.UpdateL(aFolderItem); + iCurrentRequest = CTransaction::EUpdateFolderItem; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ImportFeeds +// +// Import feeds from OPML file +// ----------------------------------------------------------------------------- +// + +void CFeedsClientUtilities::ImportFeedsL() + { + if (iIsWaitDialogDisplayed) + { + return; + } + + // construct search agent + if(NULL != iSearchAgent) + { + delete(iSearchAgent); + iSearchAgent = NULL; + } + iSearchAgent = CFeedsFileSearchAgent::NewL(*this); + + iWaitDialog->ShowWaitDialogL(R_FEEDS_WAIT_SEARCHING_FOR_FEEDS); + iIsWaitDialogDisplayed = ETrue; + + // Start search + if(NULL != iSearchAgent) + { + iSearchAgent->StartSearchingL(); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FeedsFileSearchCompleteL +// +// Implemented from the MFeedsFileSearchAgentCallback mixin, this +// callback is called when the search for files in the filesystem has completed +// ----------------------------------------------------------------------------- +// + +void CFeedsClientUtilities::FeedsFileSearchCompleteL(TInt aCount) + { + TFileEntry * fileEntry; + TInt i; + + iWaitDialog->Close(); + iIsWaitDialogDisplayed = EFalse; + + // If nothing is found, indicate that, cleanup and quit + if(aCount == 0) + { + HBufC* note = StringLoader::LoadLC(R_FEEDS_NO_FEEDS_FOUND_ON_DEVICE); + iApiProvider.DialogsProvider().DialogAlertL(_L(""),*note); + CleanupStack::PopAndDestroy( note ); + } + else + { + // + // construct results dialog box to show search results + // + if(NULL != iSearchOptList) + { + delete(iSearchOptList); + iSearchOptList = NULL; + } + + iSearchOptList = new( ELeave ) CArrayFixFlat(aCount); + + HBufC* title = StringLoader::LoadLC(R_FEEDS_POPUP_TITLE_FEEDS_FILES_FOUND); + + // loop through the search results + for(i = 0; i < aCount; i++) + { + if(iSearchAgent) + { + // grab file found from the search agent results and add it + // as an option + fileEntry = iSearchAgent->GetFileEntry(i); + if(NULL != fileEntry) + { + TBrCtlSelectOptionData t(fileEntry->iEntry.iName, EFalse, EFalse, EFalse); + iSearchOptList->AppendL(t); + } + } + } + + TBool ret(iApiProvider.DialogsProvider().DialogSelectOptionL( *title, + ESelectTypeNone, *iSearchOptList)); + + CleanupStack::PopAndDestroy(title); + + // + // If the user selects an option, import it + // + if ( ret ) + { + for( i = 0; i < aCount; i++) + { + if( (*iSearchOptList)[i].IsSelected() ) + { + if(iSearchAgent) + { + fileEntry = iSearchAgent->GetFileEntry(i); + if(NULL != fileEntry) + { + BeginImportOPMLFeedsFileL(fileEntry->iPath); + } + } + break; + } + } + } + + } + + // destroy the search agent + delete(iSearchAgent); + iSearchAgent = NULL; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::BeginImportOPMLFeedsFileL +// +// Given a path, save it in the class, show the root folder view and set +// a flag to indicate we're importing. When the root folder is done opening, +// then begin the actual import +// ----------------------------------------------------------------------------- +// + +void CFeedsClientUtilities::BeginImportOPMLFeedsFileL( TFileName& aFilepath ) + { + // save path + iTempOPMLImportFilePath = aFilepath; + + // Switch to feeds view, setting the flag will import + // from the tempOPMLImportFilePath when the view is ready + iFeedImportRequested = ETrue; + ShowFolderViewL(); + + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ExportFeeds +// +// Export feeds to OPML file +// ----------------------------------------------------------------------------- +// + +void CFeedsClientUtilities::ExportFeedsL(RPointerArray& aFolderItems, const TDesC &aExportFileName) + { + if (iIsWaitDialogDisplayed) + { + return; + } + + iWaitDialog->ShowWaitDialogL(R_FEEDS_WAIT_PROCESSING); + iIsWaitDialogDisplayed = ETrue; + + if (iExportFileName) + { + delete iExportFileName; + iExportFileName = NULL; + } + + iExportFileName = aExportFileName.AllocL(); + iFeedsInterface.ExportFoldersL(aFolderItems, aExportFileName); + iCurrentRequest = CTransaction::EExportOPML; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ShowFolderViewLocalL +// +// Shows the folder view. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ShowFolderViewLocalL() + { + // Set this as the last view id -- this is used in ShowLastViewL. + iApiProvider.SetLastActiveViewId(KUidBrowserFeedsFolderViewId); + + // Show the view. + iApiProvider.SetViewToBeActivatedIfNeededL(KUidBrowserFeedsFolderViewId); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ShowTopicViewLocalL +// +// Shows the topic view. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ShowTopicViewLocalL(TInt aInitialItem) + { + // Set this as the last view id -- this is used in ShowLastViewL. + iApiProvider.SetLastActiveViewId(KUidBrowserFeedsTopicViewId); + + // Set the inital item. + if (iTopicView == NULL) + { + TRect rect(iAppUI.ClientRect()); + iTopicView = CFeedsTopicView::NewL( iApiProvider, rect ); + iAppUI.AddViewL( iTopicView ); // transfer ownership to CAknViewAppUi + } + + iTopicView->SetInitialItem(aInitialItem); + + // Show the view. + iApiProvider.SetViewToBeActivatedIfNeededL(KUidBrowserFeedsTopicViewId); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ShowFeedViewLocalL +// +// Shows the feed view. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ShowFeedViewLocalL(TInt aInitialItem) + { + // Set this as the last view id -- this is used in ShowLastViewL. + iApiProvider.SetLastActiveViewId(KUidBrowserFeedsFeedViewId); + + // Set the inital item. + if (iFeedView == NULL) + { + TRect rect(iAppUI.ClientRect()); + iFeedView = CFeedsFeedView::NewL( iApiProvider, rect ); + iAppUI.AddViewL( iFeedView ); // transfer ownership to CAknViewAppUi + } + + iFeedView->SetInitialItem(aInitialItem); + + // Show the view. + iApiProvider.SetViewToBeActivatedIfNeededL(KUidBrowserFeedsFeedViewId); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::CurrentRootFolder +// +// Returns the current root folder. +// ----------------------------------------------------------------------------- +// +const CFeedsEntity* CFeedsClientUtilities::CurrentRootFolder() + { + return iFeedsInterface.RootFolder(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::CurrentFeed +// +// Returns the current feed. +// ----------------------------------------------------------------------------- +// +CFeedsEntity* CFeedsClientUtilities::CurrentFeed() + { + return iFeedsInterface.Feed(); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::AddItemL +// +// Add a menu item to the given menu. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::AddItemL(CEikMenuPane& aMenuPane, TInt aCommand, + TInt aTitleId) + { + CEikMenuPaneItem::SData item; + HBufC* buf = NULL; + + buf = StringLoader::LoadLC(aTitleId); + item.iText.Copy(*buf); + CleanupStack::PopAndDestroy(buf); + buf = NULL; + + item.iCommandId = aCommand; + item.iFlags = 0; + item.iCascadeId = 0; + aMenuPane.AddMenuItemL(item); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::AddCascadeL +// +// Add a sub-menu to the given menu. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::AddCascadeL(CEikMenuPane& aMenuPane, TInt aCommand, + TInt aTitleId, TInt aCascade) + { + CEikMenuPaneItem::SData item; + HBufC* buf = NULL; + + buf = StringLoader::LoadLC(aTitleId); + item.iText.Copy(*buf); + CleanupStack::PopAndDestroy(buf); + buf = NULL; + + item.iCommandId = aCommand; + item.iFlags = 0; + item.iCascadeId = aCascade; + aMenuPane.AddMenuItemL(item); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SetItemStatus +// +// Sets the item's status (read/unread/new). +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SetItemStatusL(CFeedsEntity* aItem, TFeedItemStatus aStatus) + { + TInt ret; + CFeedsMap* temp = CFeedsMap::NewL(); + temp->SetIntegerAttribute(EItemAttributeStatus,aStatus); + ret = aItem->ChangeValueL(*temp); + delete temp; + + if (ret != KErrNone) + { + ShowServerError(ret); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ItemStatus +// +// Returns the item's status (read/unread/new). +// ----------------------------------------------------------------------------- +// +TFeedItemStatus CFeedsClientUtilities::ItemStatus(TInt aItemId) + { + TInt pos; + TFeedItemStatus status = EItemStatusUndefined; + + if ((pos = iItemIds.Find(aItemId)) != KErrNotFound) + { + status = iItemStatus[pos]; + } + else + { + // TODO: panic + } + + return status; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ItemStatusWriteToServerL +// +// Writes the item status out to the server. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ItemStatusWriteToServerL() + { + RArray ids(20); + RArray status(20); + TInt unreadCountDelta = 0; + TInt unreadCount = 0; + + if (iItemStatus.Count() == 0) + { + return; + } + + CleanupClosePushL(ids); + CleanupClosePushL(status); + + // Build new status arrays that only contains items that changed. + for (TInt i = 0; i < iItemStatus.Count(); i++) + { + if (iItemStatus[i] != iItemStatusOrig[i]) + { + // update orig, since the old orig doesn't hold true any more + // important to do so: + // because this method will be called whenever deactivateView of FeedsView is called + iItemStatusOrig[i] = iItemStatus[i]; + + ids.AppendL(iItemIds[i]); + status.AppendL(iItemStatus[i]); + + // In current UI, status can only change from New -> Read, or Unread -> Read + if ( iItemStatus[i] == EItemStatusRead ) + { + unreadCountDelta--; + } + } + } + + // update folder view + unreadCount = iFolderView->UnreadCountChangedL( unreadCountDelta ); + + // Write the item status out to the server. + iFeedsInterface.UpdateFeedItemStatusL(ids, status, unreadCount); + CleanupStack::PopAndDestroy(/*status*/); + CleanupStack::PopAndDestroy(/*ids*/); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FaviconL +// +// Returns the Favicon to the given url or NULL if one isn't found. +// ----------------------------------------------------------------------------- +// +CGulIcon* CFeedsClientUtilities::FaviconL(const TDesC& aUrl) + { + CGulIcon* icon = NULL; + + // TODO: Do this if access to the database is too slow. + // First search the local cache. + + // If not found extract it from the Feeds View's Browser Control and add + // it to the local cache. + + // Get the favicon from the Browser Control. + icon = iApiProvider.WindowMgr().CurrentWindow()->BrCtlInterface().GetBitmapData(aUrl, TBrCtlDefs::EBitmapFavicon); + if (icon != NULL) + { + icon->SetMask(NULL); + } + + return icon; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::LazyInitL +// +// Ensures that the views and the connection to the FeedsServer are ready. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::LazyInitL(TBool aGetRootFolder) + { + // Create Views + if(iFolderView == NULL) + { + TRect rect(iAppUI.ClientRect()); + iFolderView = CFeedsFolderView::NewL( iApiProvider, rect ); + iAppUI.AddViewL( iFolderView ); // transfer ownership to CAknViewAppUi + } + + + + // Connect to the server. + ConnectToServerL(aGetRootFolder); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ShowServerError +// +// Show a server error. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ShowServerError(TInt aStatus, CTransaction::TTransactionType aRequestType/*=ENone*/) + { + TInt labelId; + + // Determine which label to use. + switch(aStatus) + { + case KErrNoMemory: + labelId = R_FEEDS_OUT_OF_MEMORY; + break; + // Few errors wont be shown as pop up dialog as they will appear in list box main pane + case KErrCorrupt: + // A pop up error note should be displayed if import is requested, + // else error will be displayed in main pane itself + if (aRequestType == CTransaction::EImportOPML) + { + labelId = R_FEEDS_MALFORMED_FEED_ERROR; + break; + } + case KErrNotSupported: + case KErrTimedOut: + case KErrBadName: + return; + + case -KErrNotSupported: + // Show the special http not supported on WINSCW error + TRAP_IGNORE(TBrowserDialogs::InfoNoteL(R_BROWSER_INFO_NOTE, R_FEEDS_HTTP_UNSUPPORTED_WINSCW)); + return; + + case KErrAlreadyExists: + labelId = R_FEEDS_NAME_ALREADY_IN_USE; + break; + + + case KErrArgument: + // A pop up error note should be displayed if import is requested, + // else error will be displayed in main pane itself + if (aRequestType == CTransaction::EImportOPML) + { + labelId = R_FEEDS_MALFORMED_FEED_ERROR; + break; + } + + case KErrNotFound: + // A pop up error note should be displayed if import is requested, + // else will be handled in default case. + if (aRequestType == CTransaction::EImportOPML) + { + labelId = R_FEEDS_FILE_NOT_FOUND_ERROR; + break; + } + default: + if (aStatus > 0) // All network errors + { + // Error will shown in listbox main pane + return; + } + + // Otherwise. + else + { + labelId = R_FEEDS_GENERAL_ERROR; + } + break; + } + + // Show the error dialog. + if (aStatus != KErrCancel) + { + TRAP_IGNORE(TBrowserDialogs::InfoNoteL(R_BROWSER_INFO_NOTE, labelId)); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ConnectToServerL +// +// Connect to the server. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ConnectToServerL(TBool aGetRootFolder) + { + if (!iIsConnected) + { + User::LeaveIfError(iFeedsInterface.Connect()); + iIsConnected = ETrue; + } + + if (aGetRootFolder) + { + // Set this to no-view so the folder view isn't shown after it's fetched. + iNextViewId = KUidBrowserNullViewId; + + FetchRootFolderL(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::DisconnectFromServer +// +// Disconnect from the server. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::DisconnectFromServer() + { + if( !iIsConnected ) + { + //Nothing connected, return, this is causing crash. + return; + } + iFeedsInterface.Close(); + + iIsConnected = EFalse; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::FeedUpdatedTime +// +// Since the folder list isn't updated after it is fetched the FeedsClientUtilities +// tracks the last update times for feeds the user visits in the current session. +// This method returns the "last updated" timestamp of the given item. +// ----------------------------------------------------------------------------- +// +TTime CFeedsClientUtilities::FeedUpdatedTime(const CFeedsEntity& aItem) + { + TTime timestamp; + TInt pos; + + + // Search the cache for the feed's url. + if ((pos = iFeedUpdateTimeIds.Find(aItem.GetId())) != KErrNotFound) + { + timestamp = iFeedUpdateTimeTimestamps[pos]; + } + + // Otherwise return the item's timestamp. + else + { + aItem.GetTimeValue(EFeedAttributeTimestamp,timestamp); + } + + // Return the cached value. + return timestamp; + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ResetFeedUpdateTime +// +// Resets the "last updated" cache. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ResetFeedUpdateTime() + { + // Reset the arrays. + iFeedUpdateTimeIds.Reset(); + iFeedUpdateTimeTimestamps.Reset(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::UpdateFeedUpdatedTimeL +// +// Update the feed's "last updated" value in the cache. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::UpdateFeedUpdatedTimeL(const CFeedsEntity& aFeed) + { + TInt pos; + TInt err; + + // TODO: Use the feed's id instead of the url. This would require the + // packed folder to store the feed id as well. + + // Search the cache for the feed's url and if found then update the timestamp. + if ((pos = iFeedUpdateTimeIds.Find(aFeed.GetId())) != KErrNotFound) + { + TTime time; + aFeed.GetTimeValue(EFeedAttributeTimestamp,time); + iFeedUpdateTimeTimestamps[pos] = time; + } + + // Otherwise add a new slot. + else + { + User::LeaveIfError(iFeedUpdateTimeIds.Append(aFeed.GetId())); + TTime time; + aFeed.GetTimeValue(EFeedAttributeTimestamp,time); + + err = iFeedUpdateTimeTimestamps.Append(time); + + // Ensure the arrays don't get out of sync if the second append fails. + if (err != KErrNone) + { + iFeedUpdateTimeIds.Remove(iFeedUpdateTimeIds.Count() - 1); + User::LeaveIfError(err); + } + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::InitMenuItemL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::InitMenuItemL( CEikMenuPane* aMenuPane, + TInt aCommandId, + TInt aResourceId, + TInt aCascadeId, + TInt aFlags ) + { + CEikMenuPaneItem::SData item; + item.iCommandId = aCommandId; + item.iFlags = aFlags; + item.iCascadeId = aCascadeId; + HBufC* buf = StringLoader::LoadLC( aResourceId ); + item.iText.Copy( *buf ); + CleanupStack::PopAndDestroy( buf ); // buf + buf = NULL; + + aMenuPane->AddMenuItemL( item ); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SendOPMLFileL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SendOPMLFileL( ) + { + RFs rfs; + + _LIT(KPath, "C:\\system\\temp\\"); + TBuf path(KPath); + + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + + path.Append(*iExportFileName); + + MBmOTABinSender& sender = iApiProvider.BmOTABinSenderL(); + + sender.ResetAndDestroy(); + sender.SendOPMLFileL(path); + + CleanupStack::PopAndDestroy(/*rfs*/); + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::HandleCommandL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::HandleCommandL( TUid aViewId, TInt aCommand ) + { + switch (aCommand) + { + case EWmlCmdBackToPage: + { + iApiProvider.SetViewToReturnOnClose( aViewId ); + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + break; + } + + case EFeedsImport: + ImportFeedsL(); + break; + + default: + // pass common commands to app ui + iAppUI.HandleCommandL( aCommand ); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::DynInitMenuPaneL() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::DynInitMenuPaneL( + TInt aResourceId, + CEikMenuPane* aMenuPane ) + { + + // Option menu items common to all three feeds views + if ((aResourceId == R_FEEDS_FOLDER_VIEW_MENU) || + (aResourceId == R_FEEDS_FEED_VIEW_MENU) || + (aResourceId == R_FEEDS_TOPIC_VIEW_MENU)) + { + // browser prefs + InitMenuItemL( aMenuPane, EWmlCmdPreferences, R_WMLBROWSER_SETTINGS_TITLE ); + + // Help + InitMenuItemL( aMenuPane, EAknCmdHelp, R_BROWSER_MENU_ITEM_HELP, R_FEEDS_HELP_SUBMENU ); + + // exit + InitMenuItemL( aMenuPane, EWmlCmdUserExit, R_BROWSER_MENU_ITEM_EXIT ); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::SetCalledFromView() +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::SetCalledFromView(TUid aViewId) + { + iCalledFromView = aViewId; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::CalledFromView() +// ----------------------------------------------------------------------------- +// +TUid CFeedsClientUtilities::CalledFromView() + { + return iCalledFromView; + } + +// ----------------------------------------------------------------------------- +// CFeedsClientUtilities::ItemStatusL +// +// Returns the INITIAL status of each of the items in the feed. +// The caller can then modify the values and call UpdateFeedItemStatusL +// to request the feeds server to update the feed's item status. +// ----------------------------------------------------------------------------- +// +void CFeedsClientUtilities::ItemStatusL(RArray& aItemIds, + RArray& aItemStatus, const CFeedsEntity& aFeed) const + { + TInt status; + + aItemIds.Reset(); + aItemStatus.Reset(); + + for(TInt index=0 ; index< aFeed.GetChildren().Count() ; index++) + { + CFeedsEntity *feedEntity = aFeed.GetChildren()[index]; + + feedEntity->GetIntegerValue(EItemAttributeStatus,status); + + User::LeaveIfError(aItemIds.Append(feedEntity->GetId())); + User::LeaveIfError(aItemStatus.Append((TFeedItemStatus)status)); + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsEditFeedDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsEditFeedDialog.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,697 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Encapsulates a edit feed dialog. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include +#include +#include "BrowserApplication.h" +#endif // __SERIES60_HELP + +#include "BrowserAppUi.h" +#include "BrowserAppViewBase.h" +#include "Browser.hrh" +#include +#include + +#include "FeedsEditFeedDialog.h" +#define pixelOffset 36 + +//Constants +const TInt KAutoUpdatingOff = 0; +const TInt KFifteen = 15; +const TInt KOneHour = 60; +const TInt KFourHour = 240; +const TInt KDay = 1440; +const TInt KWeek = 10080; + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFeedDialog* CFeedsEditFeedDialog::NewL(MFeedsEditFeedDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName, const TDesC& aUrl, TInt aFreq) + { + CFeedsEditFeedDialog* self = new (ELeave) CFeedsEditFeedDialog(aObserver, aAppUi, aName, aUrl, aFreq); + CleanupStack::PushL(self); + self->ConstructL(); + self->iSelectedDlgLine = 0; + CleanupStack::Pop(self); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFeedDialog* CFeedsEditFeedDialog::NewL(MFeedsEditFeedDialogObserver& aObserver, CAknViewAppUi* aAppUi) + { + CFeedsEditFeedDialog* self = new (ELeave) CFeedsEditFeedDialog(aObserver, aAppUi, KNullDesC, KNullDesC,0); + + CleanupStack::PushL(self); + self->iIsNewFeed = ETrue; + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::CFeedsEditFeedDialog +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFeedDialog::CFeedsEditFeedDialog (MFeedsEditFeedDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName, const TDesC& aUrl, TInt aFreq) + :iObserver(aObserver), iAppUi(aAppUi), iName(aName), iUrl(aUrl),iFreq(aFreq), iActionCancelled(EFalse) + { + iPreviousFreq = iFreq; + } + + + +// ---------------------------------------------------- +// CFeedsEditFeedDialog::OfferKeyEventL +// Keyevent process. +// ---------------------------------------------------- +// +TKeyResponse CFeedsEditFeedDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + if ((aKeyEvent.iScanCode == EStdKeyDevice3) || (aKeyEvent.iScanCode == EStdKeyEnter)) + { + if ((aType == EEventKey) && (iSelectedDlgLine == EFeedsEditAutomaticUpdatingId)) + { + HandleFreqCmdL(); + return EKeyWasConsumed; + } + } + return CAknForm::OfferKeyEventL(aKeyEvent, aType); + } + +// --------------------------------------------------------- +// CFeedsEditFeedDialog::HandlePointerEventL +// --------------------------------------------------------- +// +void CFeedsEditFeedDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + CAknForm::HandlePointerEventL(aPointerEvent); + if ((iSelectedDlgLine != IdOfFocusControl()) && (aPointerEvent.iType == TPointerEvent::EButton1Up)) + { + LineChangedL(IdOfFocusControl()); + } + else + { + if ( aPointerEvent.iType == TPointerEvent::EButton1Down) + { + iPointerEvent = aPointerEvent; + } + else if ( aPointerEvent.iType == TPointerEvent::EDrag ) + { + if((Abs(iPointerEvent.iPosition.iX - aPointerEvent.iPosition.iX) > pixelOffset ) || + (Abs(iPointerEvent.iPosition.iY - aPointerEvent.iPosition.iY) > pixelOffset )) + { + iDrag = ETrue; + } + } + else if ((iSelectedDlgLine == EFeedsEditAutomaticUpdatingId) && (aPointerEvent.iType == TPointerEvent::EButton1Up)) + { + if(!iDrag) + { + HandleFreqCmdL(); + } + else + { + iDrag = EFalse; + } + } + } + } + +// --------------------------------------------------------- +// CFeedsEditFeedDialog::OkToExitL +// --------------------------------------------------------- +// + +TBool CFeedsEditFeedDialog::OkToExitL( TInt aButtonId ) + { + if (aButtonId == EAknSoftkeyOptions) + { + DisplayMenuL(); + return EFalse; + } + else + if ((aButtonId == EAknSoftkeyChange) && (iSelectedDlgLine == EFeedsEditAutomaticUpdatingId)) + { + HandleFreqCmdL(); + return EFalse; + } + else + { + return CAknForm::OkToExitL(aButtonId); + } + } + +// --------------------------------------------------------- +// CFeedsEditFeedDialog::HandleFreqCmdL +// Handles the auto update freuency modification commands +// --------------------------------------------------------- +// +void CFeedsEditFeedDialog::HandleFreqCmdL() + { + TInt currentlySelected = KAutoUpdatingOff; + + // options array + CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat(1); + + CleanupStack::PushL( values ); + HBufC* text = iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEEDS_OFF); + values->AppendL(text->Des()); + CleanupStack::Pop(); + + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_15MIN); + values->AppendL(text->Des()); + CleanupStack::Pop(); + + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_HOURLY); + values->AppendL(text->Des()); + CleanupStack::Pop(); + + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_4HOURS); + values->AppendL(text->Des()); + CleanupStack::Pop(); + + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_DAILY); + values->AppendL(text->Des()); + CleanupStack::Pop(); + + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_WEEKLY); + values->AppendL(text->Des()); + CleanupStack::Pop(); + + switch(iFreq) + { + case KAutoUpdatingOff: + currentlySelected = EFeedsEditAutomaticUpdatingOff; + break; + case KFifteen: + currentlySelected = EFeedsEditAutomaticUpdating15min; + break; + case KOneHour: + currentlySelected = EFeedsEditAutomaticUpdatingHourly; + break; + case KFourHour: + currentlySelected = EFeedsEditAutomaticUpdating4hours; + break; + case KDay: + currentlySelected = EFeedsEditAutomaticUpdatingDaily; + break; + case KWeek: + currentlySelected = EFeedsEditAutomaticUpdatingWeekly; + break; + } + + HBufC* title; + title=iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEED); + currentlySelected = ShowRadioButtonSettingPageL(*title,values,currentlySelected); + CleanupStack::PopAndDestroy(); // title + + if(!iActionCancelled) + { + switch(currentlySelected) + { + case EFeedsEditAutomaticUpdatingOff: + iFreq = KAutoUpdatingOff; + break; + case EFeedsEditAutomaticUpdating15min: + iFreq = KFifteen; + break; + case EFeedsEditAutomaticUpdatingHourly: + iFreq = KOneHour; + break; + case EFeedsEditAutomaticUpdating4hours: + iFreq = KFourHour; + break; + case EFeedsEditAutomaticUpdatingDaily: + iFreq = KDay; + break; + case EFeedsEditAutomaticUpdatingWeekly: + iFreq = KWeek; + break; + } + CAknPopupField *freqControl = + static_cast< CAknPopupField* >( Control( EFeedsEditAutomaticUpdatingId ) ); + switch(iFreq) + { + case KAutoUpdatingOff: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEEDS_OFF); + break; + case KFifteen: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_15MIN); + break; + case KOneHour: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_HOURLY); + break; + case KFourHour: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_4HOURS); + break; + case KDay: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_DAILY); + break; + case KWeek: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_WEEKLY); + break; + } + freqControl->SetEmptyTextL(text->Des()); + CleanupStack::Pop(); + SetChangesPending(ETrue); + } + CleanupStack::PopAndDestroy(values); + } + +// --------------------------------------------------------- +// CFeedsEditFeedDialog::PostLayoutDynInitL +// --------------------------------------------------------- +// + +void CFeedsEditFeedDialog::PostLayoutDynInitL() + { + //Call the Base class LineChangedL() before the form is actually drawn + // Call the LineChangedL to avoid the line clicking error for the first line + LineChangedL(EFeedsEditDialogUrlId); + // Call the base class PostLayoutDynInitL() + CAknForm::PostLayoutDynInitL(); + } + +// --------------------------------------------------------- +// CFeedsEditFeedDialog::LineChangedL +// Takes any action required when the current line is changed +// to aControlId. +// --------------------------------------------------------- +// +void CFeedsEditFeedDialog::LineChangedL( TInt aControlId ) + { + iSelectedDlgLine = aControlId; + //get the reference to the buttomgroup container + CEikButtonGroupContainer& cba = ButtonGroupContainer(); + //add the 'Change' command + //cba.SetCommandSetL(R_EDIT_FEEDS_CBA_OPTIONS_AUTO_UPDATE_CONTEXT_MENU); + + //now we check where is the control, as 'Change' command is not to be + //shown for the first two form lines + if((aControlId == EFeedsEditDialogUrlId) || + (aControlId == EFeedsEditDialogNameId)) + { + // make the 'Change' button invisible + cba.MakeCommandVisible(EAknSoftkeyChange, EFalse); + CEikEdwin* edwin = NULL; + edwin = static_cast(ControlOrNull(EFeedsEditDialogUrlId)); + if(edwin) + edwin->SetAknEditorFlags(EAknEditorFlagNoT9 | EAknEditorFlagUseSCTNumericCharmap); + } + else if(aControlId == EFeedsEditAutomaticUpdatingId) + { + // make the 'Change' Button visible + cba.MakeCommandVisible(EAknSoftkeyChange, ETrue); + } + else + { + //blank implementation + } + // draw the CBA + cba.DrawNow(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::~CFeedsEditFeedDialog +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFeedDialog::~CFeedsEditFeedDialog() + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::PreLayoutDynInitL +// +// Called to setup the options menu with the dialog is active. +// ----------------------------------------------------------------------------- +// +void CFeedsEditFeedDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane); + + if (aResourceId == R_AVKON_FORM_MENUPANE) + { + aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue); + + aMenuPane->AddMenuItemsL(R_FEEDS_HELP_EXIT_FEED_MENU); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::SaveFormDataL +// +// Called by the framework whenver the 'Save' menu item is selected. +// ----------------------------------------------------------------------------- +// +TBool CFeedsEditFeedDialog::SaveFormDataL() + { + CEikEdwin* textEditorName; + CEikEdwin* textEditorUrl; + + HBufC* name = NULL; + HBufC* url = NULL; + TBool valid = EFalse; + + // Extract the new name. + textEditorName = static_cast(ControlOrNull(EFeedsEditDialogNameId)); + name = textEditorName->GetTextInHBufL(); + CleanupStack::PushL(name); + + // Extract the url name. + textEditorUrl = static_cast(ControlOrNull(EFeedsEditDialogUrlId)); + url = textEditorUrl->GetTextInHBufL(); + CleanupStack::PushL(url); + + // Notify the observer. + valid = iObserver.IsFeedNameValidL(name, !iIsNewFeed); + + // If invalid force the user to reentry it. + if (!valid) + { + // Change Focus and select the name field. + TryChangeFocusToL( EFeedsEditDialogNameId ); + textEditorName->SelectAllL(); + + iExitDialog = EFalse; + } + + // Otherwise, check the url too. + else + { + valid = iObserver.IsFeedUrlValidL(url); + + // If invalid force the user to reentry it. + if (!valid) + { + // Set focus to url field + TryChangeFocusToL( EFeedsEditDialogUrlId ); + // Position focus to end of char, but not highlight the whole url field + textEditorUrl->SetSelectionL( textEditorUrl->TextLength(), textEditorUrl->TextLength() ); + textEditorUrl->DrawDeferred(); + iExitDialog = EFalse; + } + + // Otherwise pass the new values to the observer. + else + { + if (iIsNewFeed) + { + iObserver.NewFeedL(*name, *url, iFreq); + } + else + { + // If the setting is changed from Off to other values, a confirmation + // query with text: 'Enabling automatic updating may increase your monthly + // phone bill' is shown. + if ((iPreviousFreq == EFeedsEditAutomaticUpdatingOff) && + (iFreq != EFeedsEditAutomaticUpdatingOff) && (iPreviousFreq != iFreq)) + { + HBufC* note = StringLoader::LoadLC( R_FEEDS_DATAQUERY_AUTOUPDATEWARN ); + if(iPreviousFreq == 0) + { + ShowInfoDialogwithOkSoftKeyL(note->Des()); + } + CleanupStack::PopAndDestroy(); // note + iPreviousFreq = iFreq; + } + iObserver.UpdateFeedL(*name, *url, iFreq); + } + + iExitDialog = ETrue; + } + } + + // Clean up. + CleanupStack::PopAndDestroy(url); + CleanupStack::PopAndDestroy(name); + + return valid; + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::PreLayoutDynInitL +// +// Called by the framework before the form is initialised. +// ----------------------------------------------------------------------------- +// +void CFeedsEditFeedDialog::PreLayoutDynInitL() + { + CEikEdwin* textEditor = NULL; + + CAknForm::PreLayoutDynInitL(); + + // Get the name field + textEditor = static_cast(ControlOrNull(EFeedsEditDialogNameId)); + + // If the name was set then set it. + if (iName.Length() > 0) + { + textEditor->SetTextL(&iName); + } + + // Otherwise use the default name. + else + { + HBufC* text = NULL; + + // Load the label + text = CCoeEnv::Static()->AllocReadResourceAsDes16L(R_FEEDS_NEW_FEED_ITEM); + CleanupStack::PushL(text); + + textEditor->SetTextL(text); + SetFormFlag(EUnsavedEdit, ETrue); + + CleanupStack::PopAndDestroy(text); + } + + // Get the url field + textEditor = static_cast(ControlOrNull(EFeedsEditDialogUrlId)); + + textEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | EAknEditorNumericInputMode ); + + textEditor->SetAknEditorFlags + ( + EAknEditorFlagLatinInputModesOnly | + EAknEditorFlagUseSCTNumericCharmap + ); + textEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase | EAknEditorLowerCase ); + + // If the url was set then set it. + if (iUrl.Length() > 0) + { + textEditor->SetTextL(&iUrl); + } + + // Otherwise use the url. + else + { + HBufC* text = NULL; + + // Load the label + text = CCoeEnv::Static()->AllocReadResourceAsDes16L(R_FEEDS_NEW_FEED_URL_ITEM); + CleanupStack::PushL(text); + + textEditor->SetTextL(text); + SetFormFlag(EUnsavedEdit, ETrue); + + CleanupStack::PopAndDestroy(text); + } + CAknPopupField *freqControl = + static_cast< CAknPopupField* >( Control( EFeedsEditAutomaticUpdatingId ) ); + HBufC* text = NULL; + switch(iFreq) + { + case KAutoUpdatingOff: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEEDS_OFF); + break; + case KFifteen: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_15MIN); + break; + case KOneHour: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_HOURLY); + break; + case KFourHour: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_4HOURS); + break; + case KDay: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_DAILY); + break; + case KWeek: + text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_WEEKLY); + break; + } + freqControl->SetEmptyTextL(text->Des()); + CleanupStack::Pop(); + } + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::ProcessCommandL +// +// Called by the framework to process the options menu. +// ----------------------------------------------------------------------------- +// +void CFeedsEditFeedDialog::ProcessCommandL(TInt aCommandId) + { + switch (aCommandId) + { + case EAknCmdExit: + { + // Custom added commands. Forward to view. + // Note that we respond to EAknCmdExit, not CEikCmdExit; it's + // because we don't get it through the AppUi framework (instead, + // we forward it there now). + CBrowserAppUi::Static()->ActiveView()->ProcessCommandL( aCommandId ); + break; + } + + case EEikCmdExit: + break; + +#ifdef __SERIES60_HELP + case EAknFepCmdPredHelp: + case EAknCmdHelp: + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), + iAppUi->AppHelpContextL()); + + break; +#endif //__SERIES60_HELP + case EWmlCmdAboutProduct: + { + iAppUi->HandleCommandL( aCommandId ); + break; + } + default: + // Standard form commands. + CAknForm::ProcessCommandL(aCommandId); + + if (iExitDialog) + { + TryExitL(EAknSoftkeyBack); + } + break; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::GetHelpContext +// +// Get help context for the control. +// ----------------------------------------------------------------------------- +// +#ifdef __SERIES60_HELP +void CFeedsEditFeedDialog::GetHelpContext(TCoeHelpContext& aContext) const + { + // This must be the Browser's uid becasue the help texts are under Browser topics. + aContext.iMajor = KUidBrowserApplication; + + if (iIsNewFeed) + { + aContext.iContext = KOSS_HLP_RSS_ADD; + } + else + { + aContext.iContext = KOSS_HLP_RSS_EDIT; + } + } +#endif // __SERIES60_HELP + +// ----------------------------------------------------------------------------- +// CFeedsEditFeedDialog::ShowRadioButtonSettingPageL +// ----------------------------------------------------------------------------- +// +TInt CFeedsEditFeedDialog::ShowRadioButtonSettingPageL( + TDesC& aTitle, + CDesCArrayFlat* aValues, + TInt aCurrentItem ) + { + + // index must be turned upside down, because options list is upside down + //TInt newItem = aCurrentItem = aValues->Count() - 1 - aCurrentItem; + TInt newItem = aCurrentItem; + + // We have everything to create dialog + CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( + R_RADIO_BUTTON_SETTING_PAGE, newItem, aValues ); + + CleanupStack::PushL( dlg ); + dlg->SetSettingTextL( aTitle ); + CleanupStack::Pop(); // dlg + iActionCancelled = EFalse; + if ( !dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) + { + // Changes confirmed + newItem = aCurrentItem; + iActionCancelled = ETrue; + } + //iActionCancelled = EFalse; + + // index must be re-turned upside down, because options list is upside down + return newItem; + } + +// --------------------------------------------------------- +// CFeedsEditFeedDialog::ShowInfoDialogwithOkSoftKeyL +// --------------------------------------------------------- +// +void CFeedsEditFeedDialog::ShowInfoDialogwithOkSoftKeyL( const TDesC& aNoteText ) + { + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(CAknNoteDialog::EConfirmationTone,CAknNoteDialog::ENoTimeout); + dlg->SetTextL( aNoteText ); + dlg->PrepareLC( R_FEEDS_EDIT_AUTOUPDATE_INFORMATION_NOTE_DIALOG ); + dlg->RunLD(); + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsEditFolderDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsEditFolderDialog.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,260 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Encapsulates a edit folder dialog. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SERIES60_HELP +#include +#endif + +#include "BrowserAppUi.h" +#include "BrowserAppViewBase.h" +#include "FeedsEditFolderDialog.h" + +#include "Browser.hrh" +#include + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFolderDialog* CFeedsEditFolderDialog::NewL(MFeedsEditFolderDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName) + { + CFeedsEditFolderDialog* self = new (ELeave) CFeedsEditFolderDialog(aObserver, aAppUi, aName); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFolderDialog* CFeedsEditFolderDialog::NewL(MFeedsEditFolderDialogObserver& aObserver, + CAknViewAppUi* aAppUi) + { + CFeedsEditFolderDialog* self = new (ELeave) CFeedsEditFolderDialog(aObserver, aAppUi, KNullDesC); + + CleanupStack::PushL(self); + self->iIsNewFolder = ETrue; + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::CFeedsEditFolderDialog +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFolderDialog::CFeedsEditFolderDialog(MFeedsEditFolderDialogObserver& aObserver, + CAknViewAppUi* aAppUi, + const TDesC& aName): + iObserver(aObserver), iAppUi(aAppUi), iName(aName) + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::~CFeedsEditFolderDialog +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsEditFolderDialog::~CFeedsEditFolderDialog() + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::PreLayoutDynInitL +// +// Called to setup the options menu with the dialog is active. +// ----------------------------------------------------------------------------- +// +void CFeedsEditFolderDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane); + + if (aResourceId == R_AVKON_FORM_MENUPANE) + { + aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue); + + aMenuPane->AddMenuItemsL(R_FEEDS_HELP_EXIT_FEED_MENU); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::SaveFormDataL +// +// Called by the framework whenver the 'Save' menu item is selected. +// ----------------------------------------------------------------------------- +// +TBool CFeedsEditFolderDialog::SaveFormDataL() + { + CEikEdwin* textEditor; + HBufC* name = NULL; + TBool valid = EFalse; + + // Extract the new name. + textEditor = static_cast(ControlOrNull(EFeedsEditDialogNameId)); + name = textEditor->GetTextInHBufL(); + CleanupStack::PushL(name); + + // Notify the observer. + valid = iObserver.IsFolderNameValidL(name, !iIsNewFolder); + + // If invalid force the user to reentry it. + if (!valid) + { + // Focus and select the name field. + textEditor = static_cast(ControlOrNull(EFeedsEditDialogNameId)); + + textEditor->SetFocus(ETrue); + textEditor->SelectAllL(); + + iExitDialog = EFalse; + } + + // Otherwise pass the new values to the observer. + else + { + if (iIsNewFolder) + { + iObserver.NewFolderL(*name); + } + else + { + iObserver.UpdateFolderL(*name); + } + + iExitDialog = ETrue; + } + + // Clean up. + CleanupStack::PopAndDestroy(name); + + return valid; + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::PreLayoutDynInitL +// +// Called by the framework before the form is initialised. +// ----------------------------------------------------------------------------- +// +void CFeedsEditFolderDialog::PreLayoutDynInitL() + { + CEikEdwin* textEditor = NULL; + + CAknForm::PreLayoutDynInitL(); + + // Get the name field + textEditor = static_cast(ControlOrNull(EFeedsEditDialogNameId)); + + // If the name was set then set it. + if (iName.Length() > 0) + { + textEditor->SetTextL(&iName); + } + + // Otherwise use the default name. + else + { + HBufC* text = NULL; + + // Load the label + text = CCoeEnv::Static()->AllocReadResourceAsDes16L(R_FEEDS_NEW_FOLDER_ITEM); + CleanupStack::PushL(text); + + textEditor->SetTextL(text); + SetFormFlag(EUnsavedEdit, ETrue); + + CleanupStack::PopAndDestroy(text); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsEditFolderDialog::ProcessCommandL +// +// Called by the framework to process the options menu. +// ----------------------------------------------------------------------------- +// +void CFeedsEditFolderDialog::ProcessCommandL(TInt aCommandId) + { + switch (aCommandId) + { + case EAknCmdExit: + { + // Custom added commands. Forward to view. + // Note that we respond to EAknCmdExit, not CEikCmdExit; it's + // because we don't get it through the AppUi framework (instead, + // we forward it there now). + CBrowserAppUi::Static()->ActiveView()->ProcessCommandL( aCommandId ); + break; + } + + case EEikCmdExit: + break; + +#ifdef __SERIES60_HELP + case EAknCmdHelp: + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), + iAppUi->AppHelpContextL()); + + break; +#endif //__SERIES60_HELP + case EWmlCmdAboutProduct: + { + iAppUi->HandleCommandL( aCommandId ); + break; + } + default: + // Standard form commands. + CAknForm::ProcessCommandL(aCommandId); + + if (iExitDialog) + { + TryExitL(EAknSoftkeyBack); + } + break; + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsFeedContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsFeedContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1131 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a given feed. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include +#include "BrowserApplication.h" +#endif // __SERIES60_HELP + +#include "Browser.hrh" +#include +#include "FeedsFeedContainer.h" +#include "FeedsFeedView.h" +#include +#include "ApiProvider.h" +#include "BrowserSpecialLoadObserver.h" +#include "Display.h" +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +#include "BrowserAppUi.h" +#include +#include +#include +#include + +#include "eikon.hrh" + + +_LIT(KFeedsSchema, "feeds:"); +_LIT(KFeedsNavSchema, "feedsnav:"); +_LIT(KNext, "next"); +_LIT(KTemplate, "feeds_view_template.html"); +_LIT(KTokenTitle, "#Title#"); +_LIT(KTokenWebUrl, "#WebUrl#"); +_LIT(KTokenDate, "#Date#"); +_LIT(KTokenDescription, "#Description#"); +_LIT(KTokenEnclosure, "#Enclosure#"); +_LIT(KTokenShowPrev, "#ShowPrev#"); +_LIT(KTokenShowNext, "#ShowNext#"); +_LIT(KTokenTextDir, "#dir#"); +_LIT(KLTRTextDir, "\"ltr\""); +_LIT(KRTLTextDir, "\"rtl\""); + +const TInt KDateSize = 30; // Size of Date strings +const TInt KTimeSize = 30; // Size of Time strings + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFeedContainer* CFeedsFeedContainer::NewL(CFeedsFeedView* aView, + MApiProvider& aApiProvider) + { + CFeedsFeedContainer* self = new (ELeave) CFeedsFeedContainer(aView, aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::CFeedsFeedContainer +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFeedContainer::CFeedsFeedContainer(CFeedsFeedView* aView, + MApiProvider& aApiProvider ) : + iView( aView ), + iApiProvider( aApiProvider ), + iBrowserControl(0) + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::ConstructL() + { + EnsureTemplateL(KTemplate); + LoadTemplateL(KTemplate); + + CreateWindowL(); + SetMopParent( iView ); + //SetRect(aRect); + ActivateL(); + + TRect rect(Position(), Size()); + + iBrowserControl = CreateBrowserControlL(this, rect, + TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw, + TBrCtlDefs::ECommandIdBase, NULL, NULL, this, NULL, NULL, NULL, NULL); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::~CFeedsFeedContainer +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsFeedContainer::~CFeedsFeedContainer() + { + delete iTemplate; + delete iNaviPaneTabsGroup; + delete iBrowserControl; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::OfferKeyEventL +// +// Handles key event. +// ----------------------------------------------------------------------------- +// +TKeyResponse CFeedsFeedContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + + TKeyResponse response = EKeyWasConsumed; + + if (aType == EEventKey) + { + switch (aKeyEvent.iCode) + { + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftArrow: // West + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge + { + ShowPrevItemL(); + } + return response; + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyRightArrow: // East + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge + { + ShowNextItemL(); + } + return response; + + } + } + + response = iBrowserControl->OfferKeyEventL(aKeyEvent, aType); + if(iBrowserControl->FocusedElementType() != TBrCtlDefs::EElementAnchor && iView->Toolbar() ) + { + iView->Toolbar()->SetItemDimmed(EFeedsSeeFullStory, ETrue, ETrue); + } + else + { + iView->Toolbar()->SetItemDimmed(EFeedsSeeFullStory, EFalse, ETrue); + } + // now "simulate" another key event for proper handling of middle-softkey + if ( (aKeyEvent.iScanCode == EStdKeyDevice3) && (aType == EEventKeyDown) ) + { + TKeyEvent keyEvent; + keyEvent.iCode = 0xf845; + keyEvent.iModifiers = 1; + keyEvent.iRepeats = 0; + keyEvent.iCode = EKeyDevice3; + keyEvent.iScanCode = EStdKeyDevice3; + response = iBrowserControl->OfferKeyEventL( keyEvent, EEventKey ); + } + return response; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::GetHelpContext +// +// Get help context for the control. +// ----------------------------------------------------------------------------- +// +#ifdef __SERIES60_HELP +void CFeedsFeedContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + // This must be the Browser's uid becasue the help texts are under Browser topics. + aContext.iMajor = KUidBrowserApplication; + aContext.iContext = KOSS_HLP_RSS_ARTICLE; + } +#endif // __SERIES60_HELP + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::MakeVisible +// +// Sets this control as visible or invisible. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::MakeVisible(TBool aVisible) + { + if (iBrowserControl) + { + iBrowserControl->MakeVisible(aVisible); + } + + CCoeControl::MakeVisible(aVisible); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::SizeChanged +// +// Called by framework when the view size is changed. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::SizeChanged() + { + if (iBrowserControl) + { + iBrowserControl->SetRect(Rect()); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::HandleResourceChange +// +// Called by the framework when a display resource changes (i.e. skin or layout). +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::HandleResourceChange(TInt aType) + { + CCoeControl::HandleResourceChange(aType); + iBrowserControl->HandleResourceChange(aType); + + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + + if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect)) + { + SetRect(rect); + } + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::CountComponentControls +// +// Returns number of components. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFeedContainer::CountComponentControls() const + { + TInt ctrls = 0; + if ( iBrowserControl ) + { + ctrls++;// Brctl + } + return ctrls; + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::NetworkConnectionNeededL +// +// Request to create a network connection. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::NetworkConnectionNeededL(TInt* aConnectionPtr, + TInt* aSockSvrHandle, TBool* aNewConn, TApBearerType* aBearerType) + { + iApiProvider.SpecialLoadObserver().NetworkConnectionNeededL(aConnectionPtr, aSockSvrHandle, + aNewConn, aBearerType); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::HandleRequestL +// +// Request the host applicaion to handle non-http request. +// ----------------------------------------------------------------------------- +// +TBool CFeedsFeedContainer::HandleRequestL(RArray* aTypeArray, CDesCArrayFlat* aDesArray) + { + HBufC* url = NULL; + TBool handled = ETrue; + + // The 2 arrays must be in sync. Each element in iTypeArray + // identifies the type of the corresponding element in iDesArray. + if (aTypeArray->Count() != aDesArray->Count()) + { + User::Leave(KErrArgument); + } + + // Get the url. + for (TInt i = 0; i < aTypeArray->Count(); i++) + { + if ((*aTypeArray)[i] == EParamRequestUrl) + { + url = HBufC::NewLC((*aDesArray)[i].Length()); + url->Des().Copy((*aDesArray)[i]); + break; + } + } + + // Leave if the url wasn't found. + if (url == NULL) + { + User::Leave(KErrArgument); + } + + // Handle the "feeds:" schema + if (url->Find(KFeedsSchema) == 0) + { + // Extract the real url from the "feed" url. + TPtrC loadUrl(url->Ptr() + KFeedsSchema().Length(), + url->Length() - KFeedsSchema().Length()); + + // Handle the "feeds_nav:" schema. + if (loadUrl.Find(KFeedsNavSchema) == 0) + { + // Get the direction + TPtrC dir(loadUrl.Ptr() + KFeedsNavSchema().Length(), + loadUrl.Length() - KFeedsNavSchema().Length()); + + if (dir.FindF(KNext) == 0) + { + ShowNextItemL(); + } + else + { + ShowPrevItemL(); + } + } + else + { + // Otherwise dispatch the url to the client. + iApiProvider.FeedsClientUtilities().LoadUrlL(loadUrl); + } + } + // Otherwise, send request to SchemeHandler through default BrCtlSpecialLoadObserver + else + { + handled = iApiProvider.SpecialLoadObserver().HandleRequestL( aTypeArray, aDesArray ); + } + + CleanupStack::PopAndDestroy(url); + return handled; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::HandleDownloadL +// +// Called when the browser control wants the host application (us) to handle +// downloaded content +// ----------------------------------------------------------------------------- +// +TBool CFeedsFeedContainer::HandleDownloadL(RArray* aTypeArray, + CDesCArrayFlat* aDesArray) + { + HBufC* url = NULL; + TBool handled = EFalse; + + // + // Pass first to the main special load observer to be handled. + // If it's not handled, continue here + // + handled = iApiProvider.SpecialLoadObserver().HandleDownloadL( aTypeArray, aDesArray ); + + if (!handled) + { + // The 2 arrays must be in sync. Each element in iTypeArray + // identifies the type of the corresponding element in iDesArray. + if (aTypeArray->Count() != aDesArray->Count()) + { + User::Leave(KErrArgument); + } + + // Get the url. + for (TInt i = 0; i < aTypeArray->Count(); i++) + { + if ((*aTypeArray)[i] == EParamRequestUrl) + { + url = HBufC::NewLC((*aDesArray)[i].Length()); + url->Des().Copy((*aDesArray)[i]); + break; + } + } + + TPtrC pUrl(url->Des()); + + // Leave if the url wasn't found. + if (url == NULL) + { + User::Leave(KErrArgument); + } + else + { + // Otherwise dispatch the url to the client. + iApiProvider.FeedsClientUtilities().SubscribeToL(KNullDesC, pUrl); + handled = ETrue; + } + + CleanupStack::PopAndDestroy(url); + } + return handled; + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ComponentControl +// +// Returns pointer to particular component. +// ----------------------------------------------------------------------------- +// +CCoeControl* CFeedsFeedContainer::ComponentControl(TInt aIndex) const + { + CCoeControl *ctrl = NULL; + + switch (aIndex) + { + case 0: + { + ctrl = iBrowserControl; + break; + } + + default: + break; + } + + return ctrl; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::SetCurrentFeedL +// +// Sets the current feed +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::SetCurrentFeedL(CFeedsEntity& aFeed, TInt aInitialItem) + { + iFeed = &aFeed; + iCurrentItem = aInitialItem; + + // Update the view. + if (iView->iContainerOnStack) + { + // Only do this if it's view is active. + TPtrC title; + iFeed->GetStringValue(EFeedAttributeTitle,title); + if (title.Length() > 0) + { + iApiProvider.Display().SetTitleL( title ); + } + else + { + iApiProvider.Display().SetTitleL( KNullDesC ); + } + } + + ShowFeedItemL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::GetItemUrl +// +// Returns the current item's url. +// ----------------------------------------------------------------------------- +// +const TDesC& CFeedsFeedContainer::GetItemUrl() + { + iFeed->GetChildren()[iCurrentItem]->GetStringValue(EItemAttributeLink,iUrl); + return iUrl; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::CurrentItem +// +// Returns the index of the current item. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFeedContainer::CurrentItem() + { + return iCurrentItem; + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ItemCount +// +// Returns the number of items. +// ----------------------------------------------------------------------------- +TInt CFeedsFeedContainer::ItemCount() const + { + return iFeed->GetChildren().Count(); + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ShowNextItemL +// +// Shows the next item if possible. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::ShowNextItemL() + { + if (iFeed->GetChildren().Count() <= 1) + { + return; + } + + if ((iCurrentItem + 1) < iFeed->GetChildren().Count()) + { + iCurrentItem++; + } + else + { + iCurrentItem = 0; + } + if (iView->Toolbar()) + iView->Toolbar()->SetItemDimmed(EFeedsSeeFullStory, EFalse, ETrue); + ShowFeedItemL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ShowPrevItemL +// +// Shows the prev item if possible. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::ShowPrevItemL() + { + if (iFeed->GetChildren().Count() <= 1) + { + return; + } + + if ((iCurrentItem - 1) >= 0) + { + iCurrentItem--; + } + else + { + iCurrentItem = iFeed->GetChildren().Count() - 1; + } + if (iView->Toolbar()) + iView->Toolbar()->SetItemDimmed(EFeedsSeeFullStory, EFalse, ETrue); + ShowFeedItemL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::Clear +// +// Clears the navigation pane. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::ClearNavigationPane() + { + delete iNaviPaneTabsGroup; + iNaviPaneTabsGroup = NULL; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::UpdateNavigationPaneL +// +// Handles the changes needed to the Navigation Pane. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::UpdateNavigationPaneL() + { + const TInt KTabId = 88888; + const TInt KMaxNaviText = 25; // format is "/". + _LIT(KFormat, "%d/%d"); + + CAknNavigationControlContainer* naviPane = NULL; + TBuf buf; + CAknTabGroup* tabGroup = NULL; + TInt itemCount = 0; + + if (iFeed) + { + itemCount = iFeed->GetChildren().Count(); + } + + // Get the navigation sub-pane. + CAknViewAppUi* appUi; + TUid uid; + + // Get the title sub-pane. + appUi = static_cast(CCoeEnv::Static()->AppUi()); + + uid.iUid = EEikStatusPaneUidNavi; + + CEikStatusPaneBase::TPaneCapabilities subPane = appUi->StatusPane()-> + PaneCapabilities(uid); + + // Set the title if the pane belongs to the app. + if (subPane.IsPresent() && subPane.IsAppOwned()) + { + naviPane = (CAknNavigationControlContainer*) appUi->StatusPane()->ControlL(uid); + } + else + { + User::Leave(KErrNotSupported); + } + + // Ensure the tab group was created. + if (!iNaviPaneTabsGroup) + { + iNaviPaneTabsGroup = naviPane->CreateTabGroupL(); + } + + // Format Navi Pane text "index/count" style. + buf.Format(KFormat, iCurrentItem + 1, itemCount); + + // Update the tab-group. + tabGroup = static_cast(iNaviPaneTabsGroup->DecoratedControl()); + + // Already created, replacd the tab. + if (tabGroup->TabCount() != NULL) + { + tabGroup->ReplaceTabL(KTabId, buf); + } + + // Otherwise add the tab. + else + { + tabGroup->AddTabL(KTabId, buf); + } + + tabGroup->SetTabFixedWidthL(EAknTabWidthWithOneTab); + tabGroup->SetActiveTabById(KTabId); + + // If not yet pushed, this will do the push; if already there, this brings + // it to top and draws. + naviPane->PushL(*iNaviPaneTabsGroup); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ShowFeedItemL +// +// Shows the given feed item. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::ShowFeedItemL() + { + _LIT(KSchema, "data:"); + _LIT8(KType, "text/html"); + + const TInt KInt64Length = 25; + + HBufC* link = NULL; + HBufC* htmlTemplate = NULL; + HBufC* enclosureStr = NULL; + TDataType datatype(KType); + TUid uid; + CFeedsEntity* item = iFeed->GetChildren()[iCurrentItem]; + HBufC* enclosure = NULL; + TInt enclosureLen = 0; + + // Mark the item as read. + iApiProvider.FeedsClientUtilities().SetItemStatusL(iFeed->GetChildren()[iCurrentItem], EItemStatusRead); + + // Load the localized strings. + enclosureStr = StringLoader::LoadLC(R_FEEDS_ENCLOSURE); + + // Convert the item's UTC timestamp into a localized string. + TBuf timestamp; + TBuf temp; + TTime ts; + + item->GetTimeValue(EItemAttributeTimestamp,ts); + + // Translate from UTC to local time. + TTime local; + TTime utc; + TTimeIntervalSeconds delta; + + local.HomeTime(); + utc.UniversalTime(); + utc.SecondsFrom(local, delta); + ts -= delta; + + // Create the localized time string. + //Set time + HBufC* timeFormat = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO ); + ts.FormatL( timestamp, *timeFormat ); + CleanupStack::PopAndDestroy( timeFormat );//timeFormat + // + timestamp.Append(_L(" ")); + //Set date + HBufC* dateFormat = iEikonEnv->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO ); + ts.FormatL( temp, *dateFormat ); + CleanupStack::PopAndDestroy( dateFormat );//dateFormat + // + timestamp.Append(temp); + + // Create the enclosure string, which is a a series of the following string. + // + _LIT(KEnclosureMarkup, ""); + + TBuf16 size; + TInt64 sizeInt; + TReal64 sizeReal; + TRealFormat format; + TPtrC url; + TPtrC contentType; + TPtrC len; + TPtrC title; + TPtrC desc; + + format.iType = KRealFormatFixed; + format.iPlaces = 2; + + // Determine how large the enclosure string needs to be. + for (TInt i = 0; i < item->GetChildren().Count(); i++) + { + CFeedsEntity* en = item->GetChildren()[i]; + + en->GetStringValue(EEnclosureAttributeContentType,contentType); + en->GetStringValue(EEnclosureAttributeSize,len); + en->GetStringValue(EEnclosureAttributeLink,url); + en->GetStringValue(EEnclosureAttributeTitle,title); + TLex16 lex(len); + // Convert the enclosure size to mega-bytes. + lex.Val(sizeInt); + sizeReal = sizeInt / 1000000.0; + + size.Zero(); + size.AppendNum(sizeReal, format); + + enclosureLen += KEnclosureMarkup().Length(); + enclosureLen += url.Length(); + enclosureLen += enclosureStr->Length(); + enclosureLen += size.Length(); + enclosureLen += contentType.Length(); + } + + // Allocate the enclosure string. + enclosure = HBufC::NewLC(enclosureLen); + + // Construct the enclosure string. + for (TInt i = 0; i < item->GetChildren().Count(); i++) + { + CFeedsEntity* en = item->GetChildren()[i]; + + en->GetStringValue(EEnclosureAttributeContentType,contentType); + en->GetStringValue(EEnclosureAttributeSize,len); + en->GetStringValue(EEnclosureAttributeLink,url); + en->GetStringValue(EEnclosureAttributeTitle,title); + TLex16 lex(len); + + // Convert the enclosure size to mega-bytes. + lex.Val(sizeInt); + sizeReal = sizeInt / 1000000.0; + + size.Zero(); + size.AppendNum(sizeReal, format); + + enclosure->Des().AppendFormat(KEnclosureMarkup, &(url), enclosureStr, + &size, &(contentType)); + } + + // Load and prepare the html template. + item->GetStringValue(EItemAttributeTitle,title); + item->GetStringValue(EItemAttributeDescription,desc); + item->GetStringValue(EItemAttributeLink,url); + + htmlTemplate = ResolveTemplateL(title, timestamp, desc, + url, *enclosure); + + + CleanupStack::PushL(htmlTemplate); + iFeed->GetStringValue(EFeedAttributeTitle,title); + // Load the htmlTemplate in the browser control. + uid.iUid = KCharacterSetIdentifierUcs2; + + link = HBufC::NewLC(KSchema().Length() + title.Length()); + link->Des().Copy(KSchema); + link->Des().Append(title); + + TPtrC8 ptr((const TUint8*) htmlTemplate->Ptr(), htmlTemplate->Size()); + iBrowserControl->LoadDataL(*link, ptr, datatype, uid); + + CleanupStack::PopAndDestroy(link); + CleanupStack::PopAndDestroy(htmlTemplate); + CleanupStack::PopAndDestroy(enclosure); + CleanupStack::PopAndDestroy(enclosureStr); + + // Update the nav-pane. + UpdateNavigationPaneL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::LoadTemplateL +// +// Loads the template html file. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::LoadTemplateL(const TDesC& aTemplateName) + { + RFs rfs; + RFile file; + TInt size; + TBuf path; + TUint encoding; + HBufC8* buff; + CXmlEncoding* xmlEncoding = NULL; + TInt loc; + + // Build the path to the file and open the file. + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + + path.Append(_L("\\")); + path.Append(aTemplateName); + + User::LeaveIfError(file.Open(rfs, path, EFileRead)); + CleanupClosePushL(file); + + // Read the file into the buffer. + User::LeaveIfError(file.Size(size)); + + buff = HBufC8::NewL(size); + CleanupStack::PushL(buff); + + TPtr8 ptr((TUint8*) buff->Ptr(), size); + User::LeaveIfError(file.Read(ptr, size)); + + // Convert the buffer to ucs2 and clean up. + xmlEncoding = CXmlEncoding::NewL(); + CleanupStack::PushL(xmlEncoding); + + if (!xmlEncoding->DetermineCharEncodingL(ptr, KNullDesC, encoding)) + { + User::Leave(KErrCorrupt); + } + + iTemplate = xmlEncoding->ConvertToUcs2L(encoding, ptr); + + CleanupStack::PopAndDestroy(xmlEncoding); + CleanupStack::PopAndDestroy(buff); + CleanupStack::PopAndDestroy(/*file*/); + CleanupStack::PopAndDestroy(/*rfs*/); + + // Count the number of token. These counts are used in ResolveTemplate + // to determine how big the resolved buffer should be. + TPtrC findPtr; + + iTitleCount = 0; + iWebUrlCount = 0; + iDateCount = 0; + iDescriptionCount = 0; + iEnclosureCount = 0; + iShowPrevCount = 0; + iShowNextCount = 0; + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find(KTokenTitle())) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenTitle().Length())); + iTitleCount++; + } + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find(KTokenWebUrl())) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenWebUrl().Length())); + iWebUrlCount++; + } + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find(KTokenDate())) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenDate().Length())); + iDateCount++; + } + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find(KTokenDescription())) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenDescription().Length())); + iDescriptionCount++; + } + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find((KTokenEnclosure))) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenEnclosure().Length())); + iEnclosureCount++; + } + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find((KTokenShowPrev))) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenShowPrev().Length())); + iShowPrevCount++; + } + + findPtr.Set(*iTemplate); + while ((loc = findPtr.Find((KTokenShowNext))) != KErrNotFound) + { + findPtr.Set(findPtr.Mid(loc + KTokenShowNext().Length())); + iShowNextCount++; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::ResolveTemplateL +// +// Loads and resolves the tokens in the template html file. +// ----------------------------------------------------------------------------- +// +HBufC* CFeedsFeedContainer::ResolveTemplateL(const TDesC& aTitle, + const TDesC& aTimestamp, const TDesC& aDescription, const TDesC& aUrl, + const TDesC& aEnclosure) + { + HBufC* ucs2Buff; + TInt loc; + + // Create and init the resolved buffer. + ucs2Buff = HBufC::NewLC(iTemplate->Length() + (aTitle.Length() * iTitleCount) + + (aTimestamp.Length() * iDateCount) + (aDescription.Length() * iDescriptionCount) + + (aUrl.Length() * iWebUrlCount) + + (aEnclosure.Length() * iEnclosureCount) + iShowPrevCount + iShowNextCount); + + ucs2Buff->Des().Copy(*iTemplate); + + // Resolve the tokens. + TPtr ucs2Ptr(ucs2Buff->Des()); + + // Add the text direction information here + TBool found(EFalse); + TBidiText::TDirectionality dir = TBidiText::TextDirectionality(aTitle, &found); + TBuf<5> textDirection; + if ( dir == TBidiText::ERightToLeft ) + { + textDirection.Copy(KRTLTextDir); + } + else + { + textDirection.Copy(KLTRTextDir); + } + + // replace the text direction string + if ((loc = ucs2Ptr.Find(KTokenTextDir())) != KErrNotFound) + { + ucs2Ptr.Replace(loc, textDirection.Length(), textDirection); + } + + // Replace the title tokens. + while ((loc = ucs2Ptr.Find(KTokenTitle())) != KErrNotFound) + { + ucs2Ptr.Replace(loc, KTokenTitle().Length(), aTitle); + } + + // Replace the url tokens. + while ((loc = ucs2Ptr.Find(KTokenWebUrl())) != KErrNotFound) + { + ucs2Ptr.Replace(loc, KTokenWebUrl().Length(), aUrl); + } + + // Replace the date tokens. + while ((loc = ucs2Ptr.Find(KTokenDate())) != KErrNotFound) + { + ucs2Ptr.Replace(loc, KTokenDate().Length(), aTimestamp); + } + + // Replace the description tokens. + while ((loc = ucs2Ptr.Find(KTokenDescription())) != KErrNotFound) + { + ucs2Ptr.Replace(loc, KTokenDescription().Length(), aDescription); + } + + // Replace the enclosure tokens. + while ((loc = ucs2Ptr.Find(KTokenEnclosure())) != KErrNotFound) + { + ucs2Ptr.Replace(loc, KTokenEnclosure().Length(), aEnclosure); + } + + CleanupStack::Pop(ucs2Buff); + return ucs2Buff; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedContainer::EnsureTemplateL +// +// If need be copy the template from ROM. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedContainer::EnsureTemplateL(const TDesC& aName) + { + TInt err; + RFs defaultRfs; + TUint attValue = 0; + TBuf path; + + // Open a connection to the working drive. + User::LeaveIfError(defaultRfs.Connect()); + CleanupClosePushL(defaultRfs); + User::LeaveIfError(defaultRfs.SetSessionPath(_L("c:\\"))); + + // Build the path to the file. + path.Append(_L("\\")); + path.Append(aName); + + // Test whether or not the folder file is present. + err = defaultRfs.Att(path, attValue); + + // The file is there, just return. + if (err == KErrNone) + { + CleanupStack::PopAndDestroy(/*defaultRfs*/); + return; + } + + // If the file is missing copy it from ROM. + if ((err == KErrNotFound) || (err == KErrPathNotFound)) + { + RFs romRfs; + RFile file; + RFile romFile; + TInt size; + HBufC8* buffer = NULL; + + // Open an rfs for the z drive. + User::LeaveIfError(romRfs.Connect()); + CleanupClosePushL(romRfs); + User::LeaveIfError(romRfs.SetSessionPath(_L("z:\\"))); + + // Create the destination file. + User::LeaveIfError(file.Create(defaultRfs, path, EFileWrite)); + CleanupClosePushL(file); + + // Open the source file. + User::LeaveIfError(romFile.Open(romRfs, path, EFileRead)); + CleanupClosePushL(romFile); + + // Copy the file. + User::LeaveIfError(romFile.Size(size)); + buffer = HBufC8::NewLC(size); + TPtr8 bufferPtr(buffer->Des()); + + User::LeaveIfError(romFile.Read(bufferPtr, size)); + User::LeaveIfError(file.Write(bufferPtr, size)); + + // Clean up + CleanupStack::PopAndDestroy(buffer); + CleanupStack::PopAndDestroy(/*romFile*/); + CleanupStack::PopAndDestroy(/*file*/); + CleanupStack::PopAndDestroy(/*romRfs*/); + CleanupStack::PopAndDestroy(/*defaultRfs*/); + } + } + +// --------------------------------------------------------- +// CFeedsFeedContainer::ExtractBrCtlParam() +// --------------------------------------------------------- +// +TPtrC CFeedsFeedContainer::ExtractBrCtlParam + ( TUint aParamTypeToFind, + RArray* aTypeArray, + CDesCArrayFlat* aDesArray, + TBool& aParamFound ) const + { + // initialize output parameter + aParamFound = EFalse; + TPtrC16 retParamValue; + + for ( TInt j = 0; j < aTypeArray->Count(); j++ ) + { + const TUint paramType = (*aTypeArray)[j]; + if ( aParamTypeToFind == paramType ) + { + // That's we need + retParamValue.Set( aDesArray->MdcaPoint(j) ); + aParamFound = ETrue; // Indicate it in the out param + break; // break the loop - we found it + } + } + return retParamValue; + } + +void CFeedsFeedContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + iBrowserControl->HandlePointerEventL(aPointerEvent); + if(iBrowserControl->FocusedElementType()!= TBrCtlDefs::EElementAnchor && iView->Toolbar() ) + { + iView->Toolbar()->SetItemDimmed(EFeedsSeeFullStory, ETrue, ETrue); + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsFeedView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsFeedView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,355 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a given feed. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include + +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include "Browser.hrh" +#include +#include "BrowserUtil.h" +#include +#include +#include "FeedsFeedContainer.h" +#include "FeedsFeedView.h" + +#include "Logger.h" + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFeedView* CFeedsFeedView::NewL( MApiProvider& aApiProvider, TRect& aRect ) + + { + CFeedsFeedView* self = new (ELeave) CFeedsFeedView(aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(aRect); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::CFeedsFeedView +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFeedView::CFeedsFeedView(MApiProvider& aApiProvider) +: CBrowserViewBase( aApiProvider ),iPageScalerEnabled(EFalse),iPenEnabled(EFalse) + { + iPenEnabled = AknLayoutUtils::PenEnabled(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::ConstructL(TRect& aRect) + { + // this is here in case content view wasn't activated yet on browser startup. + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + + BaseConstructL(R_FEEDS_FEED_VIEW); + + iContainer = CFeedsFeedContainer::NewL( this, ApiProvider() ); + iContainer->SetRect( aRect ); + iOrigRect.iTl = aRect.iTl; + iOrigRect.iBr = aRect.iBr; + iContainer->MakeVisible(EFalse); + + if(iPenEnabled) + { + Toolbar()->SetToolbarObserver(this);; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::~CFeedsFeedView +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsFeedView::~CFeedsFeedView() + { + DoDeactivate(); + + delete iContainer; + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::Id +// +// Returns the id of the view. +// ----------------------------------------------------------------------------- +// +TUid CFeedsFeedView::Id() const + { + return KUidBrowserFeedsFeedViewId; + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::HandleCommandL +// +// Processes commands. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::HandleCommandL(TInt aCommand) + { + TBool handled = EFalse; + + // Handle softkeys and other Symbian commands first. + switch (aCommand) + { + case EAknSoftkeyBack: + iApiProvider.FeedsClientUtilities().ShowTopicViewLocalL(iContainer->CurrentItem()); + handled = ETrue; + break; + + case EAknSoftkeyNext: + iContainer->ShowNextItemL(); + handled = ETrue; + break; + +#ifdef __SERIES60_HELP + case EAknCmdHelp: + { + iApiProvider.SetLastActiveViewId(Id()); + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), + AppUi()->AppHelpContextL()); + handled = ETrue; + break; + } +#endif //__SERIES60_HELP + } + + if (handled) + { + return; + } + + switch (aCommand) + { + case EFeedsBack: + iApiProvider.FeedsClientUtilities().ShowTopicViewLocalL(iContainer->CurrentItem()); + break; + + case EFeedsShowNextItem: + iContainer->ShowNextItemL(); + break; + + case EFeedsShowPrevItem: + iContainer->ShowPrevItemL(); + break; + + case EFeedsSeeFullStory: + iContainer->iBrowserControl->HandleCommandL((TBrCtlDefs::ECommandIdBase + TBrCtlDefs::ECommandOpen)); + break; + + default: + iApiProvider.FeedsClientUtilities().HandleCommandL(Id(),aCommand); + break; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::DoActivateL +// +// Called when the view is activated. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) + { + // fix bug RFON-7FJS2Z: need to activate status pane going back from full story page to feeds view + StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); + StatusPane()->MakeVisible( ETrue ); + //Take Button group pointer + CEikButtonGroupContainer* pButtonGroupContainer = CEikButtonGroupContainer::Current(); + if (!iContainerOnStack) + { + AppUi()->AddToViewStackL(*this, iContainer); + //Make button group invisible in order to let container have correct Rect. + //Patch is based on comments received from AVKON + if(pButtonGroupContainer) pButtonGroupContainer->MakeVisible(EFalse); + iContainer->SetRect(iOrigRect); + if(iContainer->iBrowserControl->BrowserSettingL(TBrCtlDefs::ESettingsPageOverview)) + { + TRAP_IGNORE(iContainer->iBrowserControl->SetBrowserSettingL(TBrCtlDefs::ESettingsPageOverview, EFalse)); + iPageScalerEnabled = ETrue; + } + TRAP_IGNORE(iContainer->iBrowserControl->HandleCommandL( + (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandGainFocus)); + + iContainer->MakeVisible(ETrue); + //Again make Button group visible + if(pButtonGroupContainer) pButtonGroupContainer->MakeVisible(ETrue); + iContainerOnStack = ETrue; + // resize screen after calling SetRect. This way looks better + iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + } + + // Set the current feed. + iContainer->SetCurrentFeedL(*(iApiProvider.FeedsClientUtilities().CurrentFeed()), iInitialItem); + + iApiProvider.SetLastActiveViewId(Id()); + UpdateToolbarButtonsState(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::DoDeactivate +// +// Called when the view is deactivated. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::DoDeactivate() + { + if (iContainerOnStack) + { + iContainer->ClearNavigationPane(); + + if(iPageScalerEnabled) + { + TRAP_IGNORE(iContainer->iBrowserControl->SetBrowserSettingL(TBrCtlDefs::ESettingsPageOverview, ETrue)); + iPageScalerEnabled = EFalse; + } + TRAP_IGNORE(iContainer->iBrowserControl->HandleCommandL( + (TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandLoseFocus)); + + AppUi()->RemoveFromViewStack(*this, iContainer); + iContainer->MakeVisible(EFalse); + + iInitialItem = iContainer->CurrentItem(); + iContainerOnStack = EFalse; + + // when exit from feeds view, viewMgr might be deleted already + if ( !ApiProvider().ExitInProgress() ) + { + TRAP_IGNORE(iApiProvider.FeedsClientUtilities().ItemStatusWriteToServerL()); + } + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::DynInitMenuPaneL +// +// Disables unrelated menu options. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + __ASSERT_DEBUG( (aMenuPane != NULL), Util::Panic( Util::EUninitializedData )); + + // Handle the main menu. + if (aResourceId == R_FEEDS_FEED_VIEW_MENU) + { + // Back to Page (if page loaded) + if ( iApiProvider.IsPageLoaded() ) + { + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdBackToPage, R_BROWSER_MENU_ITEM_BACK_TO_PAGE ); + } + } + + iApiProvider.FeedsClientUtilities().DynInitMenuPaneL(aResourceId, aMenuPane ); + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::SetInitialItem +// +// Sets the initial item once the view is activated. +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::SetInitialItem(TInt aItemIndex) + { + iInitialItem = aItemIndex; + } + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::UpdateToolbarButtonsState +// +// Updates the state of the toolbar buttons depending on the situation +// ----------------------------------------------------------------------------- +// + +void CFeedsFeedView::UpdateToolbarButtonsState() + { + if ( iContainer->ItemCount() > 1 ) + { + Toolbar()->SetItemDimmed(EFeedsShowPrevItem, EFalse, ETrue); + Toolbar()->SetItemDimmed(EFeedsShowNextItem, EFalse, ETrue); + } + else + { + Toolbar()->SetItemDimmed(EFeedsShowPrevItem, ETrue, ETrue); + Toolbar()->SetItemDimmed(EFeedsShowNextItem, ETrue, ETrue); + } + Toolbar()->SetItemDimmed(EFeedsSeeFullStory, EFalse, ETrue); + } + +// --------------------------------------------------------------------------- +// CFeedsFeedView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CFeedsFeedView::CommandSetResourceIdL() + { + // It is never called, but this function have to be implemented + return KWmlEmptyResourceId; + } + +// --------------------------------------------------------- +// CFeedsFeedView::HandleClientRectChange +// --------------------------------------------------------- +// +void CFeedsFeedView::HandleClientRectChange() + { + if( iContainer ) + { + iContainer->MakeVisible(EFalse); + iContainer->SetRect(ClientRect()); + iContainer->MakeVisible(ETrue); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFeedView::DisconnectL +// ----------------------------------------------------------------------------- +// +void CFeedsFeedView::DisconnectL() + { + if( iContainer ) + { + iContainer->iBrowserControl->HandleCommandL( TBrCtlDefs::ECommandDisconnect + TBrCtlDefs::ECommandIdBase ); + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsFileSearchAgent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsFileSearchAgent.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,426 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES + +#include "FeedsFileSearchAgent.h" +#include + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS + +// MACROS + +// LOCAL CONSTANTS AND MACROS + +// MODULE DATA STRUCTURES + +// LOCAL FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// ============================= LOCAL FUNCTIONS =============================== + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::CFileSearchAgent +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CFeedsFileSearchAgent::CFeedsFileSearchAgent(MFeedsFileSearchAgentCallback& aCallback) + : iCallback(&aCallback), iCancelSearch(EFalse) + { + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsFileSearchAgent::ConstructL() + { + TDriveList driveList; + TChar driveLetter; + + // we'll keep two lists. one for the drives in the system, the + // other for the list of found files + iDriveEntryList = new(ELeave) CDriveEntryList(KMaxDrives); + iFileEntryList = new(ELeave) CFileEntryList(FEEDS_FILE_SEARCH_AGENT_MAX_RESULTS); + // Create a directory scan object. + iScan = CDirScan::NewL(iFs); + iLazyCaller = CIdle::NewL(CActive::EPriorityIdle ); + + // Connect to fs for FS ops, etc + User::LeaveIfError(iFs.Connect()); + + // populate list of drives + GetDriveListL(); + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFileSearchAgent* CFeedsFileSearchAgent::NewL(MFeedsFileSearchAgentCallback& aCallback) + { + CFeedsFileSearchAgent* self = new( ELeave ) CFeedsFileSearchAgent(aCallback); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::~CFeedsFileSearchAgent() +// Destructor +// ----------------------------------------------------------------------------- +// +CFeedsFileSearchAgent::~CFeedsFileSearchAgent() + { + CancelSearch(); + iFs.Close(); + delete iScan; + delete iLazyCaller; + delete iDriveEntryList; + delete iFileEntryList; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::StartSearchingL +// +// +// ----------------------------------------------------------------------------- +// +void CFeedsFileSearchAgent::StartSearchingL() + { + iSearchDriveIndex = -1; + + // Return control to the CIdle + // The searching work will be done in LazyCallBack. + iLazyCaller->Start(TCallBack(CFeedsFileSearchAgent::LazyCallBack,this)); + + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::GetFileEntry +// +// +// ----------------------------------------------------------------------------- +// +TFileEntry* CFeedsFileSearchAgent::GetFileEntry(const TInt aIndex) + { + // for a client, return a pointer to a file that was found given + // it's index within the list of found files + if(aIndex >= iFileEntryList->Count()) + { + return NULL; + } + else + { + return &(iFileEntryList->At(aIndex)); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::GetDriveListL +// +// +// ----------------------------------------------------------------------------- +// +void CFeedsFileSearchAgent::GetDriveListL() + { + TDriveList driveList; + + // Setup List of drives + // DriveList will return an array of 26 bytes. + // nonzero entries means there is media present in + // that drive letter. + User::LeaveIfError(iFs.DriveList(driveList)); + for (TInt i=0; iAppendL(driveEntry); + } + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::DoSearchFilesL +// +// Searches a given path or paths for a filename and add it to this class' list +// of found files. The filename can contain wildcards. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFileSearchAgent::DoSearchFiles(const TDesC& aFileName, const TDesC& aPath) + { + TFindFile fileFinder(iFs); + CDir* dir = NULL; + + // given a semicolon-separated lists of paths to search in, + // look for the filename (that can include wildcards) found in that path or paths + // This first search will allocate memory for dir and will contain the list of + // files found within the first path given + TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir); + + while(err == KErrNone) + { + // For the current path given, + // loop through list of found items within that path + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + // create and setup TParse object, useful for later extracting parts + // of the found files used by clients of this class + TParse parsedName; + parsedName.Set(entry.iName, &fileFinder.File(), NULL); + + // as a sanity check, + // make sure the drive, path are valid and + // that the drive found matches the path given + if(parsedName.Drive().Length() && aPath.Length() && parsedName.Drive()[0] == aPath[0]) + { + // the wildcard search may have found directories that match + // exlude these from our list because we use this function to + // record files only + if(!entry.IsDir()) + { + // Create a fileEntry based upon the found file + // FullName will be the complete path specifier for the file + // while entry will be just the name within the directory + TFileEntry fileEntry; + fileEntry.iPath = parsedName.FullName(); + fileEntry.iEntry = entry; + + // copy this entry into to our list of found files + TRAP(err, iFileEntryList->AppendL(fileEntry)); + + // If we have exceeded our maximum number of possible entries, + // or we're cancelling an ongoing search + // then stop adding to the list + if(iFileEntryList->Count() >= FEEDS_FILE_SEARCH_AGENT_MAX_RESULTS || + iCancelSearch) + { + // cleanup dir + if(dir != NULL) + { + delete(dir); + dir = NULL; + } + return err; + } + } + } + } + + // + // We have completed looking at the results for this dir. Look + // At the results where we left off, for the next path given. + // If there is no next path, KErrNotFound will be returned, we'll + // complete the search cycle. + // + if(dir != NULL) + { + delete(dir); + dir = NULL; + } + err = fileFinder.FindWild(dir); + } + + // Cleanup the final instance of dir that has been allocated + if(dir != NULL) + { + delete(dir); + dir = NULL; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::DoSearchFilesRecursive +// +// Starting from a given path, search the filesystem recursively for a given +// filename. The filename may contain wildcards. +// ----------------------------------------------------------------------------- +// + +TInt CFeedsFileSearchAgent::DoSearchFilesRecursive(const TDesC& aFileName) + { + TInt err(KErrNone); + CDir* dir = NULL; + + // Find the entries from the next directory in the hierarchy + // or NULL/error if there are none + TRAP(err, iScan->NextL(dir)); + + // done, break out of loop + if(!dir || (err != KErrNone) ) + { + return KErrGeneral; + } + + // loop through the number of found directories + for(TInt i=0; i < dir->Count(); i++) + { + TEntry entry = (*dir)[i]; + + // The search will find directories as well as files. We're + // only interested here in directories. + if(entry.IsDir()) + { + // From the scan, get the full path including the drive letter + // being scanned. + TFileName path(iScan->FullPath()); + + if(path.Length()) + { + // If valid, append a slash to the end of the directory, + // and then search for the desired filename given this path + path.Append(entry.iName); + path.Append(_L("\\")); + DoSearchFiles(aFileName,path); + } + } + } + + // Delete the dir that was allocated in this iteration + if(dir != NULL) + { + delete(dir); + dir = NULL; + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::LazyCallBack +// +// This function calls StartSearchFile instead of calling it from StartSearchingL function +// To ensure it doesn't called if user has cancelled the request +// ----------------------------------------------------------------------------- +// +TBool CFeedsFileSearchAgent::LazyCallBack(TAny* aPtr) + { + CFeedsFileSearchAgent* ptr = (CFeedsFileSearchAgent*)aPtr; + // if we've cancelled the search + // then stop adding to the list + if(!ptr->iCancelSearch) + { + return ptr->StartSearchFile(); + } + else + { + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::StartSearchFile +// +// starts the search of *.OPML Files. +// ----------------------------------------------------------------------------- +// +TBool CFeedsFileSearchAgent::StartSearchFile() + { + // Quit looping and don't try to scan if we've already exceeded the number of + // possible file entries + // or if we've cancelled the search + if(iFileEntryList->Count() >= FEEDS_FILE_SEARCH_AGENT_MAX_RESULTS || + iCancelSearch) + { + TRAP_IGNORE(iCallback->FeedsFileSearchCompleteL( iFileEntryList->Count() )); + return EFalse; + } + TInt retVal = KErrGeneral; + if(iSearchDriveIndex != -1) + { + retVal = DoSearchFilesRecursive( _L("*.opml")); + } + if(retVal != KErrNone) + { + iSearchDriveIndex++; + if(iSearchDriveIndex < iDriveEntryList->Count()) + { + TDriveEntry driveEntry = iDriveEntryList->At(iSearchDriveIndex); + TBuf<5> driveRoot; + + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":\\")); + + // Search the base of the drive and also search recursively + // through it's folder hierarchy. + DoSearchFiles(_L("*.opml"),driveRoot); + TRAP_IGNORE(iScan->SetScanDataL(driveRoot, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst)); + return ETrue; + } + else + { + TRAP_IGNORE(iCallback->FeedsFileSearchCompleteL( iFileEntryList->Count() )); + return EFalse; + } + } + else + { + return ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFileSearchAgent::CancelSearch. +// +// Cancel the ongoing search. +// ----------------------------------------------------------------------------- +// +void CFeedsFileSearchAgent::CancelSearch() + { + if(iLazyCaller->IsActive()) + { + iLazyCaller->Cancel(); + } + iCancelSearch = ETrue; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsFolderContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsFolderContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,2283 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a user's list of feeds. +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include +#include "BrowserApplication.h" +#endif // __SERIES60_HELP + +#include "Browser.hrh" +#include +#include +#include +#include + +#include +#include + +#include +#include "FeedsFolderContainer.h" +#include "FeedsFolderView.h" +#include "ApiProvider.h" +#include "Display.h" +#include "BrowserAppUi.h" +#include "BrowserDialogs.h" +#include "BrowserUtil.h" +#include +// It's also the size of the icon array without favicon +const TInt KFirstFaviconIndex = 6; +const TInt KDateSize = 30; // Size of Date strings +const TInt KTimeSize = 30; // Size of Time strings + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFolderContainer* CFeedsFolderContainer::NewL( CFeedsFolderView* aView, + MApiProvider& aApiProvider, const TRect& aRect) + + { + CFeedsFolderContainer* self = new (ELeave) CFeedsFolderContainer(aView, aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(aRect); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::CFeedsFolderContainer +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFolderContainer::CFeedsFolderContainer(CFeedsFolderView* aView, + MApiProvider& aApiProvider ) : + iView( aView ), + iApiProvider( aApiProvider ), + iOwnsListBoxIcons(ETrue) + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::ConstructL(const TRect& aRect) + { + // Set up the control. + CreateWindowL(); + SetMopParent( iView ); + InitContainerL(aRect); + SetRect(aRect); + ActivateL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::~CFeedsFolderContainer +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsFolderContainer::~CFeedsFolderContainer() + { + iTargetFolderList.Close(); + if (iOwnsListBoxIcons) + { + delete iListBoxIcons; + } + + delete iListBox; + delete iListBoxRows; + if(iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::OfferKeyEventL +// +// Handles key event. +// ----------------------------------------------------------------------------- +// +TKeyResponse CFeedsFolderContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + TKeyResponse isConsumed = EKeyWasConsumed; + + if (aType != EEventKey) + { + return EKeyWasNotConsumed; + } + + // handle # key press by marking current unmarked item or unmarking current marked item. + if ((aType == EEventKey) && (aKeyEvent.iScanCode == EStdKeyHash)) + { + + // Check if current item is marked + const CArrayFix* markedIndexes = MarkedItems(); + TInt i; + TBool currentMarked = EFalse; + + // check to see if there are any items in the list, if not ignore the # + if (iListBoxRows->Count() > 0) + { + for ( i = 0; i < MarkedItems()->Count(); i++ ) + { + if ( CurrentItemIndex() == (*markedIndexes)[i] ) + { + currentMarked = ETrue; + break; + } + } + + if (currentMarked) + { + HandleMarkL( EAknCmdUnmark ); + } + else + { + HandleMarkL( EAknCmdMark ); + } + UpdateCbaL(); + } + + return EKeyWasConsumed; + } + + // If a move is active process the move. + else if (iMoveActive && ((aKeyEvent.iCode == EKeyOK) || (aKeyEvent.iCode == EKeyEnter))) + { + PostHandleMoveL(); + + iMoveActive = EFalse; + UpdateCbaL(); + // Undim Toolbar + DimToolbar(EFalse); + + return isConsumed; + } + + // If the C-Key was pressed then delete the current item. + else if (aKeyEvent.iCode == EKeyBackspace) + { + HandleDeleteL(); + return isConsumed; + } + + isConsumed = EKeyWasNotConsumed; + // For handling Enter key in emulator / Keyboard ( Enter key should behave similar to MSK ) + if(EStdKeyEnter == aKeyEvent.iScanCode && EEventKey == aType && AknLayoutUtils::MSKEnabled()) + { + CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); + if(myCba != NULL) + { + TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); + if(EAknSoftkeyContextOptions == cmdId) + { + iView->MenuBar()->TryDisplayContextMenuBarL(); + isConsumed = EKeyWasConsumed; + } + else if(iListBox->Model()->ItemTextArray()->MdcaCount() == 0) + { + iView->HandleCommandL(cmdId); + isConsumed = EKeyWasConsumed; + } + } + } + // Otherwise let the listbox handle it. + if(isConsumed != EKeyWasConsumed) + { + isConsumed = iListBox->OfferKeyEventL(aKeyEvent, aType); + + // Toolbar buttons should be updated when focus moves from feed to folder or vice versa + if((aType == EEventKey) && ((aKeyEvent.iScanCode == EStdKeyUpArrow)||(aKeyEvent.iScanCode == EStdKeyDownArrow)) ) + { + UpdateToolbarButtonsState(); + } + } + return isConsumed; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::GetHelpContext +// +// Get help context for the control. +// ----------------------------------------------------------------------------- +// +#ifdef __SERIES60_HELP +void CFeedsFolderContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + // This must be the Browser's uid becasue the help texts are under Browser topics. + aContext.iMajor = KUidBrowserApplication; + aContext.iContext = KOSS_HLP_RSS_MAIN; + } +#endif // __SERIES60_HELP + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::SizeChanged +// +// Called by framework when the view size is changed. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::SizeChanged() + { + iListBox->SetRect(Rect()); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleResourceChange +// +// Called by the framework when a display resource changes (i.e. skin or layout). +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleResourceChange(TInt aType) + { + CCoeControl::HandleResourceChange(aType); + iListBox->HandleResourceChange(aType); + + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + + if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect)) + { + SetRect(rect); + } + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::CountComponentControls +// +// Returns number of components. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFolderContainer::CountComponentControls() const + { + return 1; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::ComponentControl +// +// Returns pointer to particular component. +// ----------------------------------------------------------------------------- +// +CCoeControl* CFeedsFolderContainer::ComponentControl(TInt aIndex) const + { + switch (aIndex) + { + case 0: + return iListBox; + + default: + return NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleListBoxEventL +// +// Processes key events from the listbox. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, + TListBoxEvent aEventType) + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + if (aEventType == MEikListBoxObserver::EEventEmptyListClicked) + { + return; + } +#endif + // An item was selected. + if ((aEventType == MEikListBoxObserver::EEventEnterKeyPressed) || + (aEventType == MEikListBoxObserver::EEventItemDoubleClicked) +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + || (aEventType == MEikListBoxObserver::EEventItemSingleClicked) +#endif + ) + { + if ( iMoveActive ) + { + HandleOkL(); + } + else + { + HandleSelectionL(); + } + } + // Toolbar buttons status should be changed when focus is moved from feed to folder or viceversa + else if ( (aEventType == MEikListBoxObserver::EEventItemClicked) +#ifdef BRDO_TOUCH_ENABLED_FF + ||(aEventType == MEikListBoxObserver::EEventFlickStopped) +#endif // BRDO_TOUCH_ENABLED_FF + ) + { + UpdateToolbarButtonsState(); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::SearchForFeed +// +// Recursive loop to find a feed +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderContainer::SearchForFeedL(const CFeedsEntity* aCurrent) + { + TBool isFeed = EFalse; + + __ASSERT_DEBUG( (aCurrent != NULL), Util::Panic( Util::EUninitializedData )); + + for (int i = 0; i < (aCurrent->GetChildren().Count()); i++) + { + const CFeedsEntity* item = aCurrent->GetChildren()[i]; + + if ( !(item->GetType() == EFolder )) + { + return ETrue; + } + else + { + // is folder empty? + if ( item->GetChildren().Count() == 0 ) + { + continue; + } + else + { + isFeed = SearchForFeedL(item); // recursive + + if ( isFeed ) + { + return ETrue; + } + } + } + + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateToolbarButtons +// +// Updates the state of the toolbar buttons depending on the situation +// ----------------------------------------------------------------------------- +// + +void CFeedsFolderContainer::UpdateToolbarButtonsState() + { + TBool isFeed = EFalse; + TBool feedInFocus = EFalse; + + + if (iMoveActive || !iCurrentFolder) + { + return; + } + + + TInt num = iCurrentFolder->GetChildren().Count(); + + if ( iCurrentFolder->GetChildren().Count() == 0 ) + { + iView->Toolbar()->SetItemDimmed(EFeedsUpdate, ETrue, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsUpdateAll, ETrue, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsOpen, ETrue, ETrue); + } + else + { + TRAP_IGNORE( + { + isFeed = SearchForFeedL(iRootFolder); + }); + + // if feed is not in focus in the current view, then dim the 'update' button + const CFeedsEntity* fItem = NULL; + // Get the current item. + fItem = CurrentItem(); + if ( !(fItem->GetType() == EFolder )) + { + feedInFocus = ETrue; + } + + if ( isFeed && feedInFocus ) + { + iView->Toolbar()->SetItemDimmed(EFeedsUpdate,IsMarkedItemFolder()?ETrue:EFalse, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsUpdateAll, EFalse, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsOpen, EFalse, ETrue); + } + else if ( isFeed && !feedInFocus ) + { + iView->Toolbar()->SetItemDimmed(EFeedsUpdate, ETrue, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsUpdateAll, EFalse, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsOpen, EFalse, ETrue); + } + else + { + iView->Toolbar()->SetItemDimmed(EFeedsUpdate, ETrue, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsUpdateAll, ETrue, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsOpen, EFalse, ETrue); + } + } + } + + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateFeedL +// +// Called when a feed's name and/or url is changed -- this is called after both +// IsValidFeedName and IsValidFeedUrl are called. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) + { + UpdateCurrentItemL(&aName, &aUrl, aFreq); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::NewFeedL +// +// Called when a new feed is created -- this is called after both +// IsValidFeedName and IsValidFeedUrl are called. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::NewFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) + { + AddNewFeedL(aName, aUrl, aFreq); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::IsFeedNameValidL +// +// Validates the Feed's updated name. +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderContainer::IsFeedNameValidL(const TDesC* aName, TBool aIsEditing) + { + TBool valid = ETrue; + TInt pos(0); + + // If aName is NULL show an info dialog and reject it. + if (aName == NULL) + { + TBrowserDialogs::ErrorNoteL( R_FEEDS_TITLE_NEEDED ); + valid = EFalse; + } + + //If aName contains single quote character, then show an info dialog and reject it + else if ((pos = aName->Locate('\'')) != KErrNotFound) + { + TBrowserDialogs::ErrorNoteL( R_FEEDS_TITLE_SINGLE_QUOTE_NOT_ALLOWED ); + valid = EFalse; + } + + // If the name is a duplicate show an info dialog and reject it. + else + { + const CFeedsEntity* otherItem; + + // Reject it if _some other_ item has the same name. + if ((iRootFolder != NULL) && ((otherItem = iApiProvider.FeedsClientUtilities().Search(*aName,*iRootFolder)) != NULL)) + { + if (!((otherItem == CurrentItem()) && aIsEditing)) + { + TBrowserDialogs::ErrorNoteL( R_FEEDS_NAME_ALREADY_IN_USE ); + valid = EFalse; + } + } + } + + return valid; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::IsFeedUrlValidL +// +// Validates the Feed's updated url. +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderContainer::IsFeedUrlValidL(const TDesC* aUrl) + { + TBool valid = ETrue; + + // If aUrl is NULL show an info dialog and reject it. + if (aUrl == NULL) + { + valid = EFalse; + } + + // Otherwise if the user didn't change the default url (i.e. "http://" + // then reject it too. + else + { + HBufC* defaultUrl = NULL; + + // Load the label + defaultUrl = CCoeEnv::Static()->AllocReadResourceAsDes16L(R_FEEDS_NEW_FEED_URL_ITEM); + if (defaultUrl->Compare(*aUrl) == 0) + { + valid = EFalse; + } + + delete defaultUrl; + } + + // Show the error. + if (!valid) + { + TBrowserDialogs::ErrorNoteL( R_FEEDS_ADDRESS_NEEDED ); + } + + return valid; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateFolderL +// +// Called when a folder's name is changed -- this is called +// after IsValidFolderName is called. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateFolderL(const TDesC& aName) + { + UpdateCurrentItemL(&aName, NULL,0); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::NewFolderL +// +// Called when a new folder is created -- this is called +// after IsValidFolderName is called. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::NewFolderL(const TDesC& aName) + { + AddNewFolderL(aName); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::IsFolderNameValidL +// +// Validates the folder's updated name. +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderContainer::IsFolderNameValidL(const TDesC* aName, TBool aIsEditing) + { + // IsFeedNameValidL does the same thing... + return IsFeedNameValidL(aName, aIsEditing); + } + + +// ----------------------------------------------------------------------------- +// CFolderView::RootFolderChangedL +// +// Called to notify the view the that root folder has changed. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::RootFolderChangedL(const CFeedsEntity& aRootFolder) + { + // Set the new root folder. + iRootFolder = &aRootFolder; + + // Restore the previous current folder. + SetCurrentFolder(iApiProvider.FeedsClientUtilities().Search(iCurrentFolderId,aRootFolder)); + + // Update the list box to reflect the new root folder. + UpdateListBoxL(CurrentItemIndex()); + + // Update the Cba to reflect the new state. + UpdateCbaL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateTitleL +// +// Update the view's title. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateTitleL() + { + + TPtrC title; + // Set the view's title. + if (iCurrentFolder != NULL && iCurrentFolder != iRootFolder) + { + if (iCurrentFolder->GetStringValue(EFolderAttributeTitle,title) != KErrNotFound && title.Length() != 0) + { + iApiProvider.Display().SetTitleL(title); + } + else + { + iApiProvider.Display().SetTitleL(KNullDesC); + } + } + else + { + iApiProvider.Display().SetTitleL(R_FEEDS_FOLDER_VIEW_TITLE); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::CurrentItem +// +// Returns the current folder-item. +// ----------------------------------------------------------------------------- +// +CFeedsEntity* CFeedsFolderContainer::CurrentItem() const + { + CFeedsEntity* item = NULL; + TInt index; + + index = iListBox->CurrentItemIndex(); + if (index >= 0) + { + item = iCurrentFolder->GetChildren()[index]; + } + + return item; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::CurrentItemIndex +// +// Returns the index of the current folder-item. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFolderContainer::CurrentItemIndex() const + { + return iListBox->CurrentItemIndex(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateCurrentItemL +// +// Updates the current folder-item. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateCurrentItemL(const TDesC* aName, const TDesC* aUrl, TInt aFreq) + { + TPtrC name(KNullDesC); + TPtrC url(KNullDesC); + + if (aName != NULL) + { + name.Set(*aName); + } + if (aUrl != NULL) + { + url.Set(*aUrl); + } + + // Update the folder item. + CFeedsEntity *aCurrentItem = CurrentItem(); + __ASSERT_DEBUG( (aCurrentItem != NULL), Util::Panic( Util::EUninitializedData ) ); + iApiProvider.FeedsClientUtilities().ChangeFolderItemL(*(aCurrentItem), name, url, aFreq); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::AddNewFeedL +// +// Add a new feed. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::AddNewFeedL(const TDesC& aName, const TDesC& aUrl, TInt aFreq) + { + // Add the new feed. + iApiProvider.FeedsClientUtilities().AddFolderItemL(aName, aUrl, EFalse, *iCurrentFolder, aFreq); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::AddNewFolderL +// +// Add a new folder. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::AddNewFolderL(const TDesC& aName) + { + // Add the new folder. + iApiProvider.FeedsClientUtilities().AddFolderItemL(aName, KNullDesC, ETrue, *iCurrentFolder, 0); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::DeleteItemL +// +// Delete the current feed or folder +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::DeleteCurrentItemL() + { + RPointerArray markedItems(10); + const CArrayFix* markedIndexes = NULL; + const CFeedsEntity* folder = NULL; + + CleanupClosePushL(markedItems); + + // Get the array of marked items. + markedIndexes = MarkedItems(); + if ((markedIndexes == NULL) || (markedIndexes->Count() == 0)) + { + iListBox->View()->SelectItemL(CurrentItemIndex()); + markedIndexes = MarkedItems(); + } + + // Copy the marked items into a temp array. + for (TInt i = 0; i < markedIndexes->Count(); i++) + { + folder = iCurrentFolder->GetChildren()[(*markedIndexes)[i]]; + User::LeaveIfError(markedItems.Append(folder)); + } + + // Delete the items. + iApiProvider.FeedsClientUtilities().DeleteFolderItemsL(markedItems); + + // Clean up + CleanupStack::PopAndDestroy(/*markedItems*/); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HasMarkedItem +// +// Returns an array containing the indexes of the marked items. +// ----------------------------------------------------------------------------- +// +const CArrayFix* CFeedsFolderContainer::MarkedItems() + { + return iListBox->View()->SelectionIndexes(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleShowParentFolderL +// +// Replaces the current folder with its parent. +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderContainer::HandleShowParentFolderL(void) + { + TBool handled = ETrue; + + if (iCurrentFolder && ( iCurrentFolder != iRootFolder)) + { + const CFeedsEntity* oldItem = NULL; + + // Refresh the list-box with the parent's contents. + oldItem = iCurrentFolder; + SetCurrentFolder(iCurrentFolder->GetParent()); + UpdateListBoxL(); + + // Restore the old selection. + __ASSERT_DEBUG( (oldItem != NULL), Util::Panic( Util::EUninitializedData )); + TInt index = 0; + for(TInt i=0;iGetChildren().Count();i++) + { + if(iCurrentFolder->GetChildren()[i] == oldItem) + { + index = i; + } + } + iListBox->SetCurrentItemIndex(index); + iListBox->DrawDeferred(); + + // Update the Cba to reflect the new state. + UpdateCbaL(); + } + else + { + handled = EFalse; + } + + return handled; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleSelectionL +// +// Processes key events from the listbox. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleSelectionL(void) + { + TInt index; + const CFeedsEntity* item; + + index = iListBox->CurrentItemIndex(); + item = const_cast(iCurrentFolder->GetChildren()[index]); + User::LeaveIfNull((void*) item); + + // If a folder was selected - show it. + if (item->GetType() == EFolder) + { + SetCurrentFolder(item); + UpdateListBoxL(); + UpdateCbaL(); + UpdateToolbarButtonsState(); + } + + // Otherwise show the Feed. + else + { + ShowFeedL(*item); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleUpdateFeedL +// +// Handles updating the current Feed. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleUpdateFeedL(TBool aUpdateAll) + { + // Update the selected items if "Update" was selected. + if (!aUpdateAll) + { + const CArrayFix* markedIndexes = NULL; + RPointerArray folderItems(10); + + CleanupClosePushL(folderItems); + + // Get the marked indexes. + markedIndexes = MarkedItems(); + + // If nothing is marked then use the current item. + if ((markedIndexes == NULL) || (markedIndexes->Count() == 0)) + { + folderItems.AppendL(iCurrentFolder->GetChildren()[ + CurrentItemIndex()]); + } + + // Otherwise copy the marked items into a temp array. + else + { + for (TInt i = 0; i < markedIndexes->Count(); i++) + { + folderItems.AppendL(iCurrentFolder->GetChildren()[ + (*markedIndexes)[i]]); + } + } + + // Update the items. + iApiProvider.FeedsClientUtilities().UpdateFolderItemsL(folderItems); + + // Clean up + CleanupStack::PopAndDestroy(/*folderItems*/); + } + + // Otherwise update all of the items in the current FolderList. + else + { + iApiProvider.FeedsClientUtilities().UpdateFolderItemsL(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleNewFeedL +// +// Handles the add-feed command. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleNewFeedL() + { + // Display the edit feed folder + CFeedsEditFeedDialog* dialog = NULL; + + dialog = CFeedsEditFeedDialog::NewL(*this, iView->AppUi()); + + DimToolbar(ETrue); + // Note: The result is handled in the MEditFeedDialogObserver methods. + dialog->ExecuteLD(R_FEEDS_EDIT_FEED_DIALOG); + dialog = NULL; + DimToolbar(EFalse); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleNewFolderL +// +// Handles the add-folder command. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleNewFolderL() + { + // Display the edit feed folder + CFeedsEditFolderDialog* dialog = NULL; + + dialog = CFeedsEditFolderDialog::NewL(*this, iView->AppUi()); + + DimToolbar(ETrue); + // Note: The result is handled in the MEditFolderDialogObserver methods. + dialog->ExecuteLD(R_FEEDS_EDIT_FOLDER_DIALOG); + dialog = NULL; + + DimToolbar(EFalse); + + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleEditL +// +// Handles the edit command. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleEditL() + { + const CFeedsEntity* item = NULL; + + // Get the current item. + item = CurrentItem(); + TPtrC title; + TPtrC url; + TInt freq; + + if(item->GetType() == EFolder) + { + item->GetStringValue(EFolderAttributeTitle,title); + } + else + { + item->GetStringValue(EFeedAttributeTitle,title); + item->GetStringValue(EFeedAttributeLink,url); + item->GetIntegerValue(EFeedAttributeAutoUpdateFreq,freq); + } + + __ASSERT_DEBUG( (item != NULL), Util::Panic( Util::EUninitializedData )); + + DimToolbar(ETrue); + + // Display the edit feed dialog + if (!(item->GetType() == EFolder)) + { + CFeedsEditFeedDialog* dialog = NULL; + + dialog = CFeedsEditFeedDialog::NewL(*this, iView->AppUi(), title, url, freq); + + __ASSERT_DEBUG( (dialog != NULL), Util::Panic( Util::EUninitializedData )); + + // Note: The result is handled in the MEditFeedDialogObserver methods. + dialog->ExecuteLD(R_FEEDS_EDIT_FEED_DIALOG); + dialog = NULL; + } + + // Display the edit folder dialog. + else + { + CFeedsEditFolderDialog* dialog = NULL; + + dialog = CFeedsEditFolderDialog::NewL(*this, iView->AppUi(), title); + + __ASSERT_DEBUG( (dialog != NULL), Util::Panic( Util::EUninitializedData )); + + // Note: The result is handled in the MEditFolderDialogObserver methods. + dialog->ExecuteLD(R_FEEDS_EDIT_FOLDER_DIALOG); + dialog = NULL; + } + + DimToolbar(EFalse); + + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleDelete +// +// Handles the delete command. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleDeleteL() + { + TBool deleteIt = EFalse; + TBool clearOnCancel = EFalse; + const CArrayFix* markedIndexes = NULL; + + // Return if there are no items in the folder + if (CurrentItem() == NULL) + { + return; + } + + // Get the marked items. + markedIndexes = MarkedItems(); + + // If none are marked then mark the current one. + if ((markedIndexes == NULL) || (markedIndexes->Count() == 0)) + { + iListBox->View()->SelectItemL(CurrentItemIndex()); + clearOnCancel = ETrue; + markedIndexes = MarkedItems(); + } + + + // Multiple items are being deleted. + if (markedIndexes->Count() > 1) + { + if(TBrowserDialogs::ConfirmQueryYesNoL(R_FEEDS_DELETE_MULTIPLE_FEED)) + { + deleteIt = ETrue; + } + } + + // Otherwise only a single item is being deleted. + else + { + const CFeedsEntity* item = NULL; + + // Get the item. + item = iCurrentFolder->GetChildren()[((*markedIndexes)[0])]; + + TPtrC title; + if (item->GetType() == EFolder) + { + item->GetStringValue(EFolderAttributeTitle,title); + } + else + { + item->GetStringValue(EFeedAttributeTitle,title); + } + if(TBrowserDialogs::ConfirmQueryYesNoL(R_FEEDS_DELETE_FEED, title)) + { + deleteIt = ETrue; + } + } + + // Delete it + if (deleteIt) + { + DeleteCurrentItemL(); + } + else if (clearOnCancel) + { + iListBox->View()->ClearSelection(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleMove +// +// Handles the move command. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleMoveL() + { + const CArrayFix* markedItems = NULL; + + // Set the move flag. + iMoveActive = ETrue; + + // If nothing was marked then mark the current item. + markedItems = MarkedItems(); + if ((markedItems == NULL) || (markedItems->Count() == 0)) + { + iListBox->View()->SelectItemL(CurrentItemIndex()); + } + + UpdateCbaL(); + // Dim Toolbar + DimToolbar(ETrue); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleMoveToFolderL +// +// Handles the move to folder command. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleMoveToFolderL() + { + CAknSingleGraphicPopupMenuStyleListBox* listBox = NULL; + CAknPopupList* popupList = NULL; + const CFeedsEntity* targetFolder = NULL; + + // Construct the basic Pop-up + MoveToFolderInitL(listBox, popupList); + CleanupStack::PushL(listBox); + + // Show the pop-up. + if (popupList->ExecuteLD()) + { + TInt selected; + + selected = listBox->CurrentItemIndex(); + + if (selected >= 0) + { + targetFolder = iTargetFolderList[selected]; + } + } + + CleanupStack::PopAndDestroy(listBox); + + // Moved the marked items into the targeted folder. + if (targetFolder != NULL) + { + MoveToFolderMoveL(*targetFolder); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleMarkL +// +// Handles the mark-related commands. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleMarkL(TInt aCommand) + { + AknSelectionService::HandleMarkableListProcessCommandL(aCommand, iListBox); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleOkL +// +// Handles the ok commands. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleOkL() + { + // If a move is active process the move. + if (iMoveActive) + { + PostHandleMoveL(); + + iMoveActive = EFalse; + UpdateCbaL(); + // Un-Dim Toolbar + DimToolbar(EFalse); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleCancelL +// +// Handles the cancel commands. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleCancelL() + { + if (iMoveActive) + { + // Clear the move state and update the Cba. + iMoveActive = EFalse; + // Remove the marks. + iListBox->View()->ClearSelection(); + UpdateCbaL(); + // Un-Dim Toolbar + DimToolbar(EFalse); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::HandleExportL +// +// Handles the export commands. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::HandleExportL() + { + RPointerArray markedItems(10); + const CArrayFix* markedIndexes = NULL; + const CFeedsEntity* folder = NULL; + + CleanupClosePushL(markedItems); + + // Get the array of marked items. + markedIndexes = MarkedItems(); + if ((markedIndexes == NULL) || (markedIndexes->Count() == 0)) + { + iListBox->View()->SelectItemL(CurrentItemIndex()); + markedIndexes = MarkedItems(); + } + + // Copy the marked items into an array. + for (TInt i = 0; i < markedIndexes->Count(); i++) + { + folder = iCurrentFolder->GetChildren()[((*markedIndexes)[i])]; + User::LeaveIfError(markedItems.Append(folder)); + } + + _LIT(KOpmlExt, ".opml"); + HBufC* prompt = StringLoader::LoadLC( R_FEEDS_NAME_EXPORTED_FILE ); + TBuf retString; + retString.Copy( KNullDesC ); + + TInt result = TBrowserDialogs::DialogPromptReqL( + prompt->Des(), + &retString, + EFalse, + KFavouritesMaxBookmarkNameDefine ); + + if( result ) + { + // only append .opml if user has not already done so + TInt dotPos = retString.LocateReverse( '.' ); + + if ( dotPos != KErrNotFound ) + { + // dot found, now check extension + TInt extLength = retString.Length() - dotPos; + HBufC* ext = retString.Right( extLength ).AllocL(); + CleanupStack::PushL( ext ); + + // if not .opml append extension + if ( ext->CompareF( KOpmlExt ) != 0) + { + retString.Append(KOpmlExt); + } + + CleanupStack::PopAndDestroy(); // ext buffer + } + else + { + // no dot, definitely append + retString.Append(KOpmlExt); + } + + // Pass folder array to feeds utilities to export + iApiProvider.FeedsClientUtilities().ExportFeedsL(markedItems, retString); + } + + CleanupStack::PopAndDestroy(); // prompt + + // Clean up + CleanupStack::PopAndDestroy(/*markedItems*/); + + // Clear the selection + iListBox->View()->ClearSelection(); + UpdateCbaL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::ShowFeedL +// +// Show the feed in the TopicView. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::ShowFeedL(const CFeedsEntity& aFolderItem) + { + iApiProvider.FeedsClientUtilities().ShowTopicViewL(aFolderItem); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::InitContainerL +// +// Inits the container. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::InitContainerL(const TRect& aRect) + { + // Init the basic list-box + iListBox = new (ELeave) CAknDoubleGraphicStyleListBox; + iListBox->ConstructL(this, EAknListBoxMarkableList); + iListBox->SetContainerWindowL(*this); + iListBox->SetRect(aRect.Size()); + iListBox->SetListBoxObserver(this); + + HBufC* emptyText = iCoeEnv->AllocReadResourceLC(R_FEEDS_NO_FEEDS); + iListBox->View()->SetListEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + + // Init the list-box's model. + iListBoxRows = new (ELeave) CDesCArraySeg(10); + iListBox->Model()->SetItemTextArray(iListBoxRows); + iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); + + // Add scrollbars. + iListBox->ActivateL(); + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto); + + // Add the needed icons. + InitIconArrayL(); + + // Enable marquee. + iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + + UpdateCbaL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::InitIconArrayL +// +// Inits the array of needed icons. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::InitIconArrayL() + { + _LIT(KDirAndFile,"z:browser.mbm"); + + TParse* fp = NULL; + + // Build the path to the feeds resource file. + fp = new (ELeave) TParse(); + CleanupStack::PushL(fp); + + User::LeaveIfError(fp->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL)); + TBuf iconFile= fp->FullName(); + CleanupStack::PopAndDestroy(fp); + + // Create the icon array. + iListBoxIcons = new (ELeave) CAknIconArray( KFirstFaviconIndex ); + + // Add the mark icon. + AppendIconL(iListBoxIcons, KAknsIIDQgnIndiMarkedAdd, KAvkonBitmapFile(), + EMbmAvkonQgn_indi_marked_add, EMbmAvkonQgn_indi_marked_add_mask); + + // Add the folder icon. + AppendIconL(iListBoxIcons, KAknsIIDQgnPropFolderRss, iconFile, + EMbmBrowserQgn_prop_folder_rss, EMbmBrowserQgn_prop_folder_rss_mask); + + // Add the folder error icon + AppendIconL(iListBoxIcons, KAknsIIDQgnPropFolderRssError, iconFile, + EMbmBrowserQgn_prop_folder_rss_error, EMbmBrowserQgn_prop_folder_rss_error_mask); + + // Add the feed icon for feed having unread count as 0. + AppendIconL(iListBoxIcons, KAknsIIDQgnPropFileRss, iconFile, + EMbmBrowserQgn_prop_file_rss, EMbmBrowserQgn_prop_file_rss_mask); + + // Add the feed icon for feed having unread count as non-0. + AppendIconL(iListBoxIcons, KAknsIIDQgnPropFileRssNew, iconFile, + EMbmBrowserQgn_prop_file_rss_new, EMbmBrowserQgn_prop_file_rss_new_mask); + + // Add the feed error icon + AppendIconL(iListBoxIcons, KAknsIIDQgnPropFileRssError, iconFile, + EMbmBrowserQgn_prop_file_rss_error, EMbmBrowserQgn_prop_file_rss_error_mask); + + // Set the icons and cleanup + iListBox->ItemDrawer()->ColumnData()->SetIconArray(iListBoxIcons); + iOwnsListBoxIcons = EFalse; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::AppendIconL +// +// Loads and appends an icon to the icon array. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::AppendIconL(CArrayPtr* aIcons, + const TAknsItemID& aID, const TDesC& aFilename, const TInt aFileBitmapId, + const TInt aFileMaskId) + { + CGulIcon* newIcon; + CFbsBitmap* newIconBmp; + CFbsBitmap* newIconMaskBmp; + + __ASSERT_DEBUG( (aIcons != NULL), Util::Panic( Util::EUninitializedData )); + + + // Create the bitmaps: the bitmaps are left on the cleanup stack. + AknsUtils::CreateIconL(AknsUtils::SkinInstance(), aID, newIconBmp, + newIconMaskBmp, aFilename, aFileBitmapId, aFileMaskId); + + CleanupStack::PushL(newIconBmp); + CleanupStack::PushL(newIconMaskBmp); + + newIcon = CGulIcon::NewL(newIconBmp, newIconMaskBmp); + CleanupStack::Pop(newIconMaskBmp); + CleanupStack::Pop(newIconBmp); + CleanupStack::PushL(newIcon); + + aIcons->AppendL(newIcon); + CleanupStack::Pop(newIcon); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateListBoxL +// +// Sets the list-box's values. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateListBoxL(TInt aInitialSelection) + { + //0\t\1st Line of text\t2nd Line of text\t0 + TBuf<255> listBoxtxt; + + if (iCurrentFolder == NULL) + { + return; + } + + // Clear the list. + iListBoxRows->Reset(); + + // Delete the old favicons. + iListBoxIcons->Delete(KFirstFaviconIndex, iListBoxIcons->Count() - KFirstFaviconIndex); + + // Remove the marks. + iListBox->View()->ClearSelection(); + + if (iView->iContainer->IsVisible()) + { + // Update the title. + UpdateTitleL(); + } + + // Add the feeds. + for (int i = 0; i < iCurrentFolder->GetChildren().Count(); i++) + { + const CFeedsEntity* item = NULL; + TInt iconIndex; + + item = iCurrentFolder->GetChildren()[i]; + TPtrC itemName; + TInt statusCode; + + if (item->GetType() == EFolder) + { + item->GetStringValue(EFolderAttributeTitle,itemName); + } + else + { + item->GetStringValue(EFeedAttributeTitle,itemName); + } + item->GetIntegerValue(EFolderAttributeStatus, statusCode); + + // Set the name. + TInt len; + + len = itemName.Length(); + if (len > 253) + { + len = 253; + } + + // Build the item's string. + if (item->GetType() == EFolder) + { + if (statusCode == KErrNone) + { + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t"), EIconFolder, &itemName); + listBoxtxt.Append(KNullDesC()); + } + else + { + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t"), EIconErrorFolder, &itemName); + listBoxtxt.Append(KNullDesC()); + } + } + else + { + if(statusCode == KErrNone) + { + CGulIcon* favicon = NULL; + iconIndex = EIconFeed; + + // Convert the item's timestamp into a localized string. + TBuf timestamp; + TBuf temp; + TTime date; + TInt unreadCount; + item->GetIntegerValue(EFolderAttributeUnreadCount,unreadCount); + + // Since the folder list isn't updated after it is fetched + // the FeedsClientUtilities tracks the update times for feeds + // the user visits in the current session. + date = iApiProvider.FeedsClientUtilities().FeedUpdatedTime(*item); + + // If the date isn't zero then format the date + if (date.Int64() != 0) + { + // Translate from UTC to local time. + TTime local; + TTime utc; + TTimeIntervalSeconds delta; + + local.HomeTime(); + utc.UniversalTime(); + utc.SecondsFrom(local, delta); + date -= delta; + + //Set time + HBufC* timeFormat = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO ); + date.FormatL( timestamp, *timeFormat ); + CleanupStack::PopAndDestroy( timeFormat );//timeFormat + // + timestamp.Append(_L(" ")); + //Set date + HBufC* dateFormat = iEikonEnv->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO ); + date.FormatL( temp, *dateFormat ); + CleanupStack::PopAndDestroy( dateFormat );//dateFormat + // + timestamp.Append(temp); + // Convert to locale specific numbers + if (TBidiText::ERightToLeft == AknTextUtils::CurrentScriptDirectionality ()) + { + AknTextUtils::DisplayTextLanguageSpecificNumberConversion(timestamp); + } + } + + // If there is a favicon for this url then add it to the icon list + // set the icon's index. + TPtrC url; + item->GetStringValue(EFeedAttributeLink,url); + favicon = iApiProvider.FeedsClientUtilities().FaviconL(url); + // favicon exist, no matter unread count is 0 or not, use favicon + if (favicon != NULL) + { + iListBoxIcons->AppendL(favicon); + iconIndex = iListBoxIcons->Count() - 1; + } + // no favicon, and unread count > 0, use unread icon + else if (unreadCount > 0) + { + iconIndex = EIconFeedUnread; + } + // else: no favicon, and unread count == 0, use read icon + + // Add the line. + listBoxtxt.Zero(); + + if (unreadCount > 0) + { + listBoxtxt.AppendFormat(_L("%d\t%S(%d)\t%S"), iconIndex, &itemName, unreadCount, ×tamp); + } + else + { + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, ×tamp); + } + + listBoxtxt.Append(KNullDesC()); + } + else if(((statusCode >= 20400 )&& (statusCode < 20500 )) || (statusCode == KErrBadName)) + { + iconIndex = EIconErrorFeed; + HBufC* text = NULL; + + text = iCoeEnv->AllocReadResourceL(R_FEEDS_INVALID_URL); + TPtr txtPtr = text->Des(); + CleanupStack::PushL(text); + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, &txtPtr); + listBoxtxt.Append(KNullDesC()); + CleanupStack::PopAndDestroy(); + } + else if( statusCode == KErrNotSupported) + { + iconIndex = EIconErrorFeed; + HBufC* text = NULL; + + text = iCoeEnv->AllocReadResourceL(R_FEEDS_UNSUPPORTED_FEED); + TPtr txtPtr = text->Des(); + CleanupStack::PushL(text); + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, &txtPtr); + listBoxtxt.Append(KNullDesC()); + CleanupStack::PopAndDestroy(); + } + else if ( statusCode == KErrTimedOut) + { + iconIndex = EIconErrorFeed; + HBufC* text = NULL; + + text = iCoeEnv->AllocReadResourceL(R_FEEDS_NETWORK_ERROR); + TPtr txtPtr = text->Des(); + CleanupStack::PushL(text); + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, &txtPtr); + listBoxtxt.Append(KNullDesC()); + CleanupStack::PopAndDestroy(); + } + else if ( statusCode == KErrCorrupt) + { + iconIndex = EIconErrorFeed; + HBufC* text = NULL; + + text = iCoeEnv->AllocReadResourceL(R_FEEDS_MALFORMED_FEED); + TPtr txtPtr = text->Des(); + CleanupStack::PushL(text); + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, &txtPtr); + listBoxtxt.Append(KNullDesC()); + CleanupStack::PopAndDestroy(); + } + else if(statusCode> 0) + { + iconIndex = EIconErrorFeed; + HBufC* text = NULL; + + text = iCoeEnv->AllocReadResourceL(R_FEEDS_NETWORK_ERROR); + TPtr txtPtr = text->Des(); + CleanupStack::PushL(text); + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, &txtPtr); + listBoxtxt.Append(KNullDesC()); + CleanupStack::PopAndDestroy(); + } + else + { + iconIndex = EIconErrorFeed; + HBufC* text = NULL; + + text = iCoeEnv->AllocReadResourceL(R_FEEDS_GENERAL_ERROR_MAIN_PANE); + TPtr txtPtr = text->Des(); + CleanupStack::PushL(text); + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("%d\t%S\t%S"), iconIndex, &itemName, &txtPtr); + listBoxtxt.Append(KNullDesC()); + CleanupStack::PopAndDestroy(); + } + } + + // Add the row. + iListBoxRows->AppendL(listBoxtxt); + } + + // Restore the selection -- the best it can that is. + if (iCurrentFolder->GetChildren().Count() > 0) + { + if (aInitialSelection > (iCurrentFolder->GetChildren().Count() - 1)) + { + aInitialSelection = iCurrentFolder->GetChildren().Count() - 1; + } + if (aInitialSelection < 0) + { + aInitialSelection = 0; + } + + iListBox->SetCurrentItemIndex(aInitialSelection); + } + + iListBox->HandleItemAdditionL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::MoveToFolderInitL +// +// Inits the move-to-folder pop-up. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::MoveToFolderInitL(CAknSingleGraphicPopupMenuStyleListBox*& + aListBox, CAknPopupList*& aPopupList) + { + CDesCArraySeg* listBoxRows = NULL; + CTextListBoxModel* listboxModel = NULL; + HBufC* title = NULL; + CArrayPtr* icons = NULL; + + // Construct the basic Pop-up + aListBox = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox(); + CleanupStack::PushL(aListBox); + + aPopupList = CAknPopupList::NewL(aListBox, + R_FEEDS_FOLDER_VIEW_CBA_MOVETOFOLDER_MOVECANCEL); + CleanupStack::PushL(aPopupList); + + aListBox->ConstructL(aPopupList, EAknListBoxSelectionList | EAknListBoxLoopScrolling); + + // Set the title. + title = CCoeEnv::Static()->AllocReadResourceLC(R_FEEDS_FOLDER_VIEW_MOVE_TO_PRMPT); + aPopupList->SetTitleL(*title); + CleanupStack::PopAndDestroy(title); + + // Construct the list-box's model. + listBoxRows = new (ELeave) CDesCArraySeg(10); + + listboxModel = aListBox->Model(); + listboxModel->SetItemTextArray(listBoxRows); + listboxModel->SetOwnershipType(ELbmOwnsItemArray); + + // Add scrollbars. + aListBox->CreateScrollBarFrameL(ETrue); + aListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EAuto); + + // Enable item marqueeing. + aListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + + // Add the folders to the list-box. + MoveToFolderSetItemsL(*listBoxRows); + aListBox->HandleItemAdditionL(); + + // Set the icons + icons = new (ELeave) CAknIconArray(1); + CleanupStack::PushL(icons); + + // Add the folder icon. + AppendIconL(icons, KAknsIIDQgnPropFolderSmall, KAvkonBitmapFile(), + EMbmAvkonQgn_prop_folder_small, EMbmAvkonQgn_prop_folder_small_mask); + + // Set the icons and cleanup + aListBox->ItemDrawer()->ColumnData()->SetIconArray(icons); + CleanupStack::Pop(icons); + + CleanupStack::Pop(aPopupList); + CleanupStack::Pop(aListBox); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::MoveToFolderSetItemsL +// +// Sets the move-to-folder list-box's values. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::MoveToFolderSetItemsL(CDesCArraySeg& aListBoxRows) + { + iTargetFolderList.Reset(); + //0\t\1st Line of text\t2nd Line of text\t0 + TBuf<255> listBoxtxt; + + // If need be add an entry for the root-level. + if (iCurrentFolder != iRootFolder) + { + TDesC* text = NULL; + + text = CCoeEnv::Static()->AllocReadResourceLC(R_FEEDS_TEXT_FLDR_ROOT_LEVEL); + + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("0\t%S"), text); + aListBoxRows.AppendL(listBoxtxt); + iTargetFolderList.Append(iRootFolder); + + CleanupStack::PopAndDestroy(text); + } + + if (iRootFolder) + { + AddFoldersToListL(*iRootFolder,aListBoxRows); + } + } + +// Recursive loop to find all folders +void CFeedsFolderContainer::AddFoldersToListL(const CFeedsEntity& aFolder, CDesCArraySeg& aListBoxRows) + { + TBuf<255> listBoxtxt; + + for (int i = 0; i < aFolder.GetChildren().Count(); i++) + { + const CFeedsEntity* item = NULL; + + item = aFolder.GetChildren()[i]; + + + // Skip all feeds and current folder + if (!(item->GetType()==EFolder) || iCurrentFolder == item) + { + if(iCurrentFolder == item) + { + AddFoldersToListL(*item,aListBoxRows);// recursive + } + continue; + } + + TPtrC itemName; + item->GetStringValue(EFolderAttributeTitle,itemName); + + // Set the name. + TInt len; + + len = itemName.Length(); + if (len > 253) + { + len = 253; + } + + listBoxtxt.Zero(); + listBoxtxt.AppendFormat(_L("0\t%S"), &itemName); + aListBoxRows.AppendL(listBoxtxt); + iTargetFolderList.Append(item);// save pointers to items to make selection easier + + AddFoldersToListL(*item,aListBoxRows);// recursive + } + + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::MoveToFolderMoveL +// +// Moves the marked items into the target-folder. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::MoveToFolderMoveL(const CFeedsEntity& aTargetFolder) + { + RPointerArray markedItems(10); + RPointerArray removedItems(10); + const RPointerArray& folderItems = aTargetFolder.GetChildren(); + const CArrayFix* markedIndexes = NULL; + const CFeedsEntity* folder = NULL; + + CleanupClosePushL(markedItems); + CleanupClosePushL(removedItems); + // Get the array of marked items. + markedIndexes = MarkedItems(); + if ((markedIndexes == NULL) || (markedIndexes->Count() == 0)) + { + iListBox->View()->SelectItemL(CurrentItemIndex()); + markedIndexes = MarkedItems(); + } + + // Copy the marked items into a temp array. + for (TInt i = 0; i < markedIndexes->Count(); i++) + { + folder = iCurrentFolder->GetChildren()[((*markedIndexes)[i])]; + // if the target folder already has some feed + if(folderItems.Count() > 0) + { + TPtrC item; + TPtrC url; + folder->GetStringValue(EFeedAttributeTitle, item); + const CFeedsEntity* otherItem = iApiProvider.FeedsClientUtilities().Search(item, aTargetFolder); + if(!(otherItem == CurrentItem())&& otherItem != NULL) + { + otherItem->GetStringValue(EFeedAttributeLink, url); + iApiProvider.FeedsClientUtilities().AddFolderItemL(item,url,EFalse,aTargetFolder,0); + User::LeaveIfError(removedItems.Append(folder)); + } + else + { + // feed not present in target folder + User::LeaveIfError(markedItems.Append(folder)); + } + } + // if the target folder is empty + else + { + // Move the items. + User::LeaveIfError(markedItems.Append(folder)); + } + } + if(removedItems.Count()) + { + iApiProvider.FeedsClientUtilities().DeleteFolderItemsL(removedItems); + } + if(markedItems.Count()) + { + // Move the items. + iApiProvider.FeedsClientUtilities().MoveFolderItemsToL(markedItems, aTargetFolder); + } + // Clean up + CleanupStack::PopAndDestroy(/*removedItems*/); + CleanupStack::PopAndDestroy(/*markedItems*/); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::PostHandleMoveL +// +// Moves the current or marked items -- called after the move-cmd is confirmed. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::PostHandleMoveL() + { + const CArrayFix* markedIndexes = NULL; + RPointerArray markedItems(10); + TInt targetIndex; + + CleanupClosePushL(markedItems); + + // Get the marked indexes. + markedIndexes = MarkedItems(); + + // Return if there is nothing to do. + if ((markedIndexes == NULL) || (markedIndexes->Count() == 0)) + { + return; + } + + // Get the target index. + targetIndex = CurrentItemIndex(); + + // Copy the marked items into a temp array. + for (TInt i = 0; i < markedIndexes->Count(); i++) + { + User::LeaveIfError(markedItems.Append( + iCurrentFolder->GetChildren()[((*markedIndexes)[i])])); + } + + // Move the items. + iApiProvider.FeedsClientUtilities().MoveFolderItemsL(markedItems, targetIndex); + + // Clean up + CleanupStack::PopAndDestroy(/*markedItems*/); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateCba +// +// Updates the options softkey to reflect the current state. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateCbaL() + { + TInt commandSet; + + // Set default menu type and resource + iView->MenuBar()->SetMenuTitleResourceId( R_FEEDS_FOLDER_VIEW_MENUBAR); + iView->MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); + + if ((MarkedItems() != NULL) && (MarkedItems()->Count() > 0)) + { + // Change menu configuration to context-sensitive menu if any items are marked + iView->MenuBar()->SetContextMenuTitleResourceId( R_FEEDS_FOLDER_MENU_BAR_CONTEXT_MENU); + iView->MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); + iView->MenuBar()->SetMenuTitleResourceId( R_FEEDS_FOLDER_VIEW_MENUBAR); + iView->MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); + + // normally, we use the back rsk unless we launched directly into feeds (in which case, exit) + if ( !iApiProvider.BrowserWasLaunchedIntoFeeds() ) + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_BACK_CONTEXT_MENU; + } + else + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_EXIT_CONTEXT_MENU; + } + } + else if (iCurrentFolder && (iCurrentFolder->GetChildren().Count() > 0)) + { + // normally, we use the back rsk unless we launched directly into feeds (in which case, exit) + if ( !iApiProvider.BrowserWasLaunchedIntoFeeds() ) + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_BACK_OPEN; + } + else + { + if ( iCurrentFolder == iRootFolder ) + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_EXIT_OPEN; + } + else + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_BACK_OPEN; + } + } + UpdateToolbarButtonsState(); + } + else + { + // normally, we use the back rsk unless we launched directly into feeds (in which case, exit) + if ( !iApiProvider.BrowserWasLaunchedIntoFeeds() ) + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_BACK_ADDFEED; + } + else + { + commandSet = R_FEEDS_FOLDER_VIEW_CBA_OPTIONS_EXIT_ADDFEED; + } + } + + if (iMoveActive) + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + commandSet = R_AVKON_SOFTKEYS_OK_CANCEL__OK; +#else + commandSet = R_AVKON_SOFTKEYS_CANCEL; +#endif + } + + iView->UpdateCbaL(commandSet); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::SetCurrentFolder +// +// Changes the current folder. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::SetCurrentFolder(const CFeedsEntity* aFolder, + TBool aResetSelection) + { + iCurrentFolder = aFolder; + + if (aFolder != NULL) + { + iCurrentFolderId = aFolder->GetId(); + } + else + { + iCurrentFolderId = -1; + } + + if (aResetSelection && (iListBox != NULL)) + { + iListBox->SetCurrentItemIndex(0); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::CountFolderFolders +// +// Count the number of subfolders within a folder +// +// ----------------------------------------------------------------------------- +void CFeedsFolderContainer::CountFolderFolders(const CFeedsEntity* aFolder, TInt& aFolderCount) + { + if (aFolder) + { + for(TInt index = 0; index < aFolder->GetChildren().Count(); index++) + { + if ((aFolder->GetChildren()[index])->GetType() == EFolder) + { + aFolderCount++; + CountFolderFolders(aFolder->GetChildren()[index], aFolderCount); + } + } + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UnreadCountChangedL +// +// Calculate the unread count based on delta, return the calculated value. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFolderContainer::UnreadCountChangedL( TInt aUnreadCountDelta ) + { + TInt unreadCount = 0; + TInt index; + CFeedsEntity* item = NULL; + + index = iListBox->CurrentItemIndex(); + item = const_cast(iCurrentFolder->GetChildren()[index]); + User::LeaveIfNull((void*) item); + + // If it's a feed - update its unread count. + if (item->GetType() != EFolder) + { + // calculate how many are unread for the current feed + item->GetIntegerValue(EFolderAttributeUnreadCount, unreadCount ); + unreadCount += aUnreadCountDelta; + if (unreadCount < 0) + { + unreadCount = 0; + } + CFeedsMap* map = CFeedsMap::NewL(); + map->SetIntegerAttribute(EFolderAttributeUnreadCount,unreadCount); + + // item->ChangeValue(*map); + delete map; + } + return unreadCount; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::SetUnreadCountL +// +// Set the unread count. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::SetUnreadCountL( TInt aUnreadCount ) +{ + TInt index; + CFeedsEntity* item = NULL; + + index = iListBox->CurrentItemIndex(); + item = const_cast(iCurrentFolder->GetChildren()[index]); + User::LeaveIfNull((void*) item); + + // If it's a feed - update its unread count. + if (item->GetType() == EFalse) + { + CFeedsMap* map = CFeedsMap::NewL(); + map->SetIntegerAttribute(EFolderAttributeUnreadCount,aUnreadCount); + + // item->ChangeValue(*map); + delete map; + } +} + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::DynInitMarkUnmarkMenuPane +// +// Dynamically Initialize the Mark/Unmark sub-menu +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::DynInitMarkUnmarkMenuPane( CEikMenuPane *aMenuPane ) +{ + AknSelectionService::HandleMarkableListDynInitMenuPane(R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION, aMenuPane, iListBox); +} + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::DimToolbar +// +// Dim or UnDim Toolbar +// if aDim is ETrue, then dim toolbar +// else undim toolbar +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::DimToolbar(TBool aDim) +{ + iView->Toolbar()->SetItemDimmed(EFeedsNewFeed, aDim, ETrue); + iView->Toolbar()->SetItemDimmed(EFeedsUpdateAll, aDim, ETrue); + iView->Toolbar()->SetItemDimmed(EWmlCmdPreferences, aDim, ETrue); + iView->Toolbar()->DrawNow(); +} + + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::IsMarkedItemFolder +// +// To Check Marked items contains Folder or Feed +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderContainer::IsMarkedItemFolder() +{ + const CArrayFix* markedIndexes = NULL; + + // Get the marked items. + markedIndexes = MarkedItems(); + + // Check for Folder is marked or not + for(TInt i=0 ; i< markedIndexes->Count(); i++) + { + if(iCurrentFolder->GetChildren()[(*markedIndexes)[i]] -> GetType() == EFolder) + { + return ETrue; + } + + } + return EFalse; +} + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::ClearNavigationPane +// +// Clears the navigation pane. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::ClearNavigationPane() + { + if (iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderContainer::UpdateNavigationPaneL +// +// Handles the changes needed to the Navigation Pane. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderContainer::UpdateNavigationPaneL() + { + CAknNavigationControlContainer* naviPane = NULL; + + // Get the navigation sub-pane. + CAknViewAppUi* appUi; + TUid uid; + TBuf<1> string; + + string.Append(_L(" ")); + + // Get the title sub-pane. + appUi = static_cast(CCoeEnv::Static()->AppUi()); + + uid.iUid = EEikStatusPaneUidNavi; + + CEikStatusPaneBase::TPaneCapabilities subPane = appUi->StatusPane()-> + PaneCapabilities(uid); + + // Set the title if the pane belongs to the app. + if (subPane.IsPresent() && subPane.IsAppOwned()) + { + naviPane = (CAknNavigationControlContainer*) appUi->StatusPane()->ControlL(uid); + } + else + { + User::Leave(KErrNotSupported); + } + + // Ensure the NaviDecorator was created. + if (!iNaviDecorator) + { + iNaviDecorator = naviPane->CreateNavigationLabelL( string ); + } + + + // If not yet pushed, this will do the push; if already there, this brings + // it to top and draws. + naviPane->PushL(*iNaviDecorator); + } + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsFolderView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsFolderView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,748 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a user's list of feeds. +* +*/ + + + +#include + +#include +#include +#include +#include +#include +#include + +#include "Browser.hrh" +#include + +#include "BrowserAppUi.h" +#include "CommonConstants.h" +#include +#include +#include "FeedsFolderContainer.h" +#include "FeedsFolderView.h" +#include "Display.h" + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFolderView* CFeedsFolderView::NewL( MApiProvider& aApiProvider, TRect& aRect ) + { + CFeedsFolderView* self = new (ELeave) CFeedsFolderView(aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(aRect); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::CFeedsFolderView +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsFolderView::CFeedsFolderView(MApiProvider& aApiProvider): +CBrowserViewBase( aApiProvider ),iPenEnabled(EFalse) + { + iPenEnabled = AknLayoutUtils::PenEnabled(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::ConstructL(TRect& aRect) + { + BaseConstructL(R_FEEDS_FOLDER_VIEW); + +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + iContainer = CFeedsFolderContainer::NewL( this, ApiProvider(), aRect ); + iContainer->MakeVisible(EFalse); +#endif + + if(iPenEnabled) + { + Toolbar()->SetToolbarObserver(this); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::~CFeedsFolderView +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsFolderView::~CFeedsFolderView() + { + DoDeactivate(); + + delete iContainer; + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::Id +// +// Returns the id of the view. +// ----------------------------------------------------------------------------- +// +TUid CFeedsFolderView::Id() const + { + return KUidBrowserFeedsFolderViewId; + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::HandleCommandL +// +// Processes commands. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::HandleCommandL(TInt aCommand) + { + TBool handled = EFalse; + + // Handle softkeys and some standard commands first. + switch (aCommand) + { + case EAknSoftkeyBack: + if (!iContainer->HandleShowParentFolderL()) + { + // If we are in embedded mode (perhaps someone imported a feed from the messaging app) + // then we want to close the browser vs. returning to the bookmark view + if (iApiProvider.IsEmbeddedModeOn()) + { + AppUi()->HandleCommandL( EWmlCmdCloseBrowser ); + } + // Go back to content view only if we came from there. Note that ContentView can be + // on the history if another application launched a URL. + else if(((ApiProvider().GetPreviousViewFromViewHistory() == KUidBrowserContentViewId) + && (ApiProvider().FeedsClientUtilities().CalledFromView() == KUidBrowserContentViewId)) + ||(ApiProvider().GetPreviousViewFromViewHistory() == KUidBrowserFeedsTopicViewId) + && (ApiProvider().FeedsClientUtilities().CalledFromView() != KUidBrowserBookmarksViewId)) + { + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); + } + else + { + iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); + } + } + handled = ETrue; + break; + case EAknSoftkeyOk: + iContainer->HandleOkL(); + handled = ETrue; + break; + + case EAknSoftkeyCancel: + iContainer->HandleCancelL(); + handled = ETrue; + break; + + case EAknCmdMark: + case EAknCmdUnmark: + case EAknMarkAll: + case EAknUnmarkAll: + iContainer->HandleMarkL(aCommand); + handled = ETrue; + iContainer->UpdateCbaL(); + iContainer->UpdateToolbarButtonsState(); + break; + +#ifdef __SERIES60_HELP + case EAknCmdHelp: + { + iApiProvider.SetLastActiveViewId(Id()); + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), + AppUi()->AppHelpContextL()); + handled = ETrue; + break; + } +#endif //__SERIES60_HELP + + + case EEikCmdExit: + case EAknSoftkeyExit: + AppUi()->HandleCommandL(aCommand); + handled = ETrue; + break; + } + + if (handled) + { + return; + } + + // Handle menu commands. + switch (aCommand) + { + case EFeedsOpen: + case EFeedsActivate: + iContainer->HandleSelectionL(); + break; + + case EFeedsUpdate: + iContainer->HandleUpdateFeedL(); + break; + + case EFeedsUpdateAll: + iContainer->HandleUpdateFeedL(ETrue); + break; + + case EFeedsNewFeed: + iContainer->HandleNewFeedL(); + iContainer->UpdateToolbarButtonsState(); + break; + + case EFeedsNewFolder: + iContainer->HandleNewFolderL(); + iContainer->UpdateToolbarButtonsState(); + break; + + case EFeedsEdit: + case EFeedsRename: + iContainer->HandleEditL(); + iContainer->UpdateToolbarButtonsState(); + break; + + case EFeedsDelete: + iContainer->HandleDeleteL(); + break; + + case EFeedsMove: + iContainer->HandleMoveL(); + break; + + case EFeedsMoveToFolder: + iContainer->HandleMoveToFolderL(); + break; + + case EFeedsExport: + iContainer->HandleExportL(); + break; + + case EWmlCmdDownloads: + ApiProvider().BrCtlInterface().HandleCommandL( + (TInt)TBrCtlDefs::ECommandShowDownloads + + (TInt)TBrCtlDefs::ECommandIdBase ); + break; + + default: + iApiProvider.FeedsClientUtilities().HandleCommandL(Id(),aCommand); + break; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::DoActivateL +// +// Called when the view is activated. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) + { + StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); + StatusPane()->MakeVisible( ETrue ); + ApiProvider().Display().ClearMessageInfo(); + + if (!iContainer) + { + iContainer = CFeedsFolderContainer::NewL( this, ApiProvider(), ClientRect() ); + + // Set the root folder. + if (iRootFolder != NULL) + { + iContainer->RootFolderChangedL(*iRootFolder); + } + } + + if (!iContainerOnStack) + { + AppUi()->AddToViewStackL(*this, iContainer); + iContainer->SetRect(ClientRect()); + iContainer->MakeVisible(ETrue); + iContainerOnStack = ETrue; + // resize screen after calling SetRect. This way looks better + iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + } + + iApiProvider.SetLastActiveViewId(Id()); + iContainer->UpdateTitleL(); + iContainer->UpdateNavigationPaneL(); + iContainer->UpdateListBoxL(iInitialItem); + + iContainer->UpdateCbaL(); + + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::DoDeactivate +// +// Called when the view is deactivated. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::DoDeactivate() + { + if (iContainerOnStack) + { + AppUi()->RemoveFromViewStack(*this, iContainer); + iContainer->MakeVisible(EFalse); + iContainer->ClearNavigationPane(); + iContainerOnStack = EFalse; + + iInitialItem = iContainer->CurrentItemIndex(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::DynInitMenuPaneL +// +// Disables unrelated menu options. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + const CFeedsEntity* item = NULL; + + // Get the current item. + item = iContainer->CurrentItem(); + + // Handle the main menu. + if (aResourceId == R_FEEDS_FOLDER_VIEW_MENU) + { + // Dynamically build the menu. + + // Downloads (only if download menu not empty (ie, ongoing downloads) + if (ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads )) + { + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdDownloads, R_FEEDS_OPTIONS_GO_DOWNLOADS); + } + + iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsGoto, + R_FEEDS_OPTIONS_GOTO, R_FEEDS_OPTIONS_GOTO_SUBMENU); + +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsFeedsActions, + R_FEEDS_OPTIONS_FEEDSACTIONS, R_FEEDS_OPTIONS_FEEDSACTIONS_SUBMENU); + + iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsEdit, + R_FEEDS_OPTIONS_EDIT, R_FEEDS_OPTIONS_EDIT_SUBMENU); + + // these items only visible for non-empty folder + if (item != NULL) + { + // Mark/Unmark submenu - only for non-empty folder + iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsMarkUnmark, + R_FEEDS_OPTIONS_MARKUNMARK, R_FEEDS_OPTIONS_MARKUNMARK_SUBMENU); + } +#else + // ie, privacy submenu + //iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsClear, + // R_FEEDS_OPTIONS_CLEAR, R_FEEDS_OPTIONS_CLEAR_SUBMENU); + + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EFeedsUpdateAll, R_FEEDS_UPDATE_ALL); + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EFeedsNewFeed, R_FEEDS_NEW_FEED); + if(iContainer->iCurrentFolder && ( iContainer->iCurrentFolder == iRootFolder) ) + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EFeedsNewFolder, R_OPTIONS_ORG_NEW_FOLDER); + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EFeedsImport, R_OPTIONS_IMPORT_FEEDS); + if( item && iContainer->iCurrentFolder && !iContainer->isMoveActive() ) + { + if ( (item->GetType() == EFolder) ) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsRename, R_FLDR_RENAME); + aMenuPane->SetItemSpecific(EFeedsRename,ETrue); + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMove, R_OPTIONS_ORG_MOVE); + aMenuPane->SetItemSpecific(EFeedsMove,ETrue); + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsDelete, R_FEEDS_DELETE); + aMenuPane->SetItemSpecific(EFeedsDelete,ETrue); + } + else + { + // Update (only if feed has focus) + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsUpdate, R_FEEDS_UPDATE); + aMenuPane->SetItemSpecific(EFeedsUpdate,ETrue); + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsExport, R_OPTIONS_EXPORT_FEEDS); + aMenuPane->SetItemSpecific(EFeedsExport,ETrue); + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsEdit, R_FEEDS_EDIT); + aMenuPane->SetItemSpecific(EFeedsEdit,ETrue); + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsDelete, R_FEEDS_DELETE); + aMenuPane->SetItemSpecific(EFeedsDelete,ETrue); + + if ( iContainer && + iContainer->iCurrentFolder && + iContainer->iCurrentFolder->GetChildren().Count() >= 2 ) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMove, R_OPTIONS_ORG_MOVE); + aMenuPane->SetItemSpecific(EFeedsMove,ETrue); + } + if (!(item->GetType() == EFolder)) + { + TInt folderCount = 0; + iContainer->CountFolderFolders(iContainer->iRootFolder, folderCount); + if(iContainer && (folderCount> 0) && !iContainer->IsMarkedItemFolder()) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMoveToFolder, R_OPTIONS_ORG_MOVE_TO_FOLDER); + aMenuPane->SetItemSpecific(EFeedsMoveToFolder,ETrue); + } + } + } + } +#endif + + iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsClear, + R_FEEDS_OPTIONS_CLEAR, R_CLEAR_SUBMENU); + } + else if(aResourceId == R_FEEDS_OPTIONS_GOTO_SUBMENU) + { + // Back to Page (if page loaded) + if ( iApiProvider.IsPageLoaded() ) + { + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdBackToPage, R_BROWSER_MENU_ITEM_BACK_TO_PAGE ); + } + + // Bookmarks view (if browser wasn't launched directly into feeds) + if ( !iApiProvider.BrowserWasLaunchedIntoFeeds() ) + { + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdFavourites, R_BROWSER_MENU_ITEM_FAVOURITES ); + } + } + else if(aResourceId == R_FEEDS_OPTIONS_FEEDSACTIONS_SUBMENU) + { + if(iContainer && + iContainer->iCurrentFolder && + iContainer->iCurrentFolder->GetChildren().Count() > 0) + { + if (!(item->GetType() == EFolder) && !iContainer->IsMarkedItemFolder()) + { + // Update (only if feed has focus) + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsUpdate, R_FEEDS_UPDATE); + } + + // Update All (only for non-empty views/folders) + if(iContainer->SearchForFeedL(iRootFolder)) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsUpdateAll, R_FEEDS_UPDATE_ALL); + } + + + // Send (only for non-empty views/folders) + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsExport, R_OPTIONS_EXPORT_FEEDS); + } + + // Import Feeds + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsImport, R_OPTIONS_IMPORT_FEEDS); + + // Create Feed + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsNewFeed, R_FEEDS_NEW_FEED); + } + else if(aResourceId == R_FEEDS_OPTIONS_EDIT_SUBMENU) + { + if (item != NULL) + { + TInt markedcount = (iContainer && iContainer->MarkedItems()) ? iContainer->MarkedItems()->Count() : 0; + + // "Edit Feed" or "Rename Folder" depending upon which has focus + if (markedcount < 1)// don't allow edit/rename if feed(s)/folder(s) are marked + { + if (item->GetType() == EFolder) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsRename, R_FLDR_RENAME); + } + else + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsEdit, R_FEEDS_EDIT); + } + } + + // Delete (only if editable item has focus) + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsDelete, R_FEEDS_DELETE); + + // move + if ( iContainer && + iContainer->iCurrentFolder && + iContainer->iCurrentFolder->GetChildren().Count() >= 2 ) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMove, R_OPTIONS_ORG_MOVE); + } + + // move to folder only if a feed has focus and there are folders available + if (!(item->GetType() == EFolder)) + { + TInt folderCount = 0; + iContainer->CountFolderFolders(iContainer->iRootFolder, folderCount); + + if(iContainer && (folderCount> 0) && !iContainer->IsMarkedItemFolder()) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMoveToFolder, R_OPTIONS_ORG_MOVE_TO_FOLDER); + } + } + } + + // Create Folder + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsNewFolder, R_OPTIONS_ORG_NEW_FOLDER); + } + else if( (aResourceId == R_FEEDS_OPTIONS_MARKUNMARK_SUBMENU) || (aResourceId == R_FEEDS_FOLDER_VIEW_MARK_UNMARK_MENU ) ) + { + // Mark (or unmark) + if(IsCurrentItemMarked()) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknCmdUnmark, R_OPTIONS_LIST_UNMARK_ONE); + } + else + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknCmdMark, R_OPTIONS_LIST_MARK_ONE); + } + + // Mark All + if ( iContainer && iContainer->iCurrentFolder && + iContainer->iCurrentFolder->GetChildren().Count() != iContainer->MarkedItems()->Count() ) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknMarkAll, R_OPTIONS_LIST_MARK_ALL); + } + + // Unmark ALL + if (AnyMarkedItems()) + { + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknUnmarkAll, R_OPTIONS_LIST_UNMARK_ALL); + } + } + else if(aResourceId == R_FEEDS_OPTIONS_CLEAR_SUBMENU) + { + + + } + else if(aResourceId == R_FEEDS_FOLDER_MENU_PANE_CONTEXT_MENU) + { + // move + if ( iContainer && + iContainer->iCurrentFolder && + iContainer->iCurrentFolder->GetChildren().Count() < 2 ) + { + aMenuPane->SetItemDimmed(EFeedsMove,ETrue); + } + aMenuPane->SetItemDimmed(EFeedsMoveToFolder,ETrue); + + if (!(item->GetType() == EFolder)) + { + TInt folderCount = 0; + iContainer->CountFolderFolders(iContainer->iRootFolder, folderCount); + + if(iContainer && (folderCount> 0) && !iContainer->IsMarkedItemFolder()) + { + aMenuPane->SetItemDimmed(EFeedsMoveToFolder,EFalse); + } + } + else + { + aMenuPane->SetItemDimmed(EFeedsUpdate, ETrue); + } + } + iApiProvider.FeedsClientUtilities().DynInitMenuPaneL(aResourceId, aMenuPane ); + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::UpdateCbaL +// +// Updates the options softkey to reflect the command set. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::UpdateCbaL(TInt aCommandSet) + { + if (Cba()) + { + Cba()->SetCommandSetL(aCommandSet); + Cba()->DrawDeferred(); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::RootFolderChangedL +// +// Called to notify the view the that root folder has changed. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::RootFolderChangedL(const CFeedsEntity& aRootFolder) + { + iRootFolder = &aRootFolder; + + if (iContainer != NULL) + { + iContainer->RootFolderChangedL(aRootFolder); + iContainer->UpdateToolbarButtonsState(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::SetCurrentFolder +// +// Changes the current folder. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::SetCurrentFolder(const CFeedsEntity& aFolder, TBool aResetSelection) + { + if (iContainer != NULL) + { + iContainer->SetCurrentFolder(&aFolder, aResetSelection); + } + + if (aResetSelection) + { + iInitialItem = 0; + } + } + +// --------------------------------------------------------------------------- +// CFeedsFolderView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CFeedsFolderView::CommandSetResourceIdL() + { + // It is never called, but this function have to be implemented + return KWmlEmptyResourceId; + } + +// --------------------------------------------------------- +// CFeedsFolderView::HandleClientRectChange +// --------------------------------------------------------- +// +void CFeedsFolderView::HandleClientRectChange() + { + if( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::UnreadCountChangedL +// +// Calculate the unread count based on delta, return the calculated value. +// ----------------------------------------------------------------------------- +// +TInt CFeedsFolderView::UnreadCountChangedL( TInt aUnreadCountDelta ) +{ + TInt unreadCount = 0; + + if (iContainer != NULL) + { + unreadCount = iContainer->UnreadCountChangedL( aUnreadCountDelta ); + } + + return unreadCount; +} + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::SetUnreadCount +// +// Set the unread count. +// ----------------------------------------------------------------------------- +// +void CFeedsFolderView::SetUnreadCountL( TInt aUnreadCount ) +{ + if (iContainer != NULL) + { + iContainer->SetUnreadCountL( aUnreadCount ); + } +} + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::AnyFoldersMarked +// +// returns ETrue if any Feeds folders are marked otherwise returns EFalse +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderView::AnyFoldersMarked() +{ + const CArrayFix* markedIndexes = iContainer->MarkedItems(); + const CFeedsEntity* markedItem = NULL; + TInt i; + + for ( i = 0; i < markedIndexes->Count(); i++ ) + { + // Get the item. + markedItem = iContainer->iCurrentFolder->GetChildren()[(*markedIndexes)[i]]; + if ( markedItem != NULL && markedItem->GetType() == EFolder ) + { + return ETrue; + } + } + + return EFalse; +} + + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::AnyMarkedItems +// +// returns ETrue anything is marked otherwise returns EFalse +// ----------------------------------------------------------------------------- +// +TBool CFeedsFolderView::AnyMarkedItems() +{ + const CArrayFix* markedIndexes = iContainer->MarkedItems(); + + if (markedIndexes->Count() > 0 ) + { + return ETrue; + } + else + { + return EFalse; + } +} + +// ----------------------------------------------------------------------------- +// CFeedsFolderView::IsItemMarked +// +// returns ETrue if item is marked, otherwise returns EFalse +// ----------------------------------------------------------------------------- +// + +TBool CFeedsFolderView::IsCurrentItemMarked() +{ + // Get the current item's index + TInt currIndex = iContainer->CurrentItemIndex(); + const CArrayFix* markedIndexes = iContainer->MarkedItems(); + + if (markedIndexes->Count() > 0) + { + TKeyArrayFix key(0, ECmpTInt); + TInt pos = 0; + TInt retVal = markedIndexes->Find(currIndex,key,pos); + if( retVal == KErrNone) + { + return ETrue; + } + } + return EFalse; +} diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsTopicContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsTopicContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,622 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a feed's topics. +* +*/ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include +#include "BrowserApplication.h" +#endif // __SERIES60_HELP + +#include +#include "Browser.hrh" +#include +#include +#include +#include +#include "FeedsTopicContainer.h" +#include "FeedsTopicView.h" + +#include "ApiProvider.h" +#include "Display.h" + + +const TInt KDateSize = 30; // Size of Date strings +const TInt KTimeSize = 30; // Size of Time strings + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsTopicContainer* CFeedsTopicContainer::NewL(CFeedsTopicView* aView, + MApiProvider& aApiProvider, const TRect& aRect) + { + CFeedsTopicContainer* self = new (ELeave) CFeedsTopicContainer(aView, aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(aRect); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::CFeedsTopicContainer +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsTopicContainer::CFeedsTopicContainer(CFeedsTopicView* aView, + MApiProvider& aApiProvider ) : + iView( aView ), + iApiProvider( aApiProvider ) + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::ConstructL(const TRect& aRect) + { + CreateWindowL(); + SetMopParent( iView ); + InitContainerL(aRect); + ActivateL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::~CFeedsTopicContainer +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsTopicContainer::~CFeedsTopicContainer() + { + delete iListBox; + delete iListBoxRows; + delete iNaviDecorator; + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::OfferKeyEventL +// +// Handles key event. +// ----------------------------------------------------------------------------- +// +TKeyResponse CFeedsTopicContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if (aType != EEventKey) + { + return EKeyWasNotConsumed; + } + + if (( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) && + ( aKeyEvent.iModifiers & EModifierShift ) ) + { + return EKeyWasConsumed; + } + + return iListBox->OfferKeyEventL(aKeyEvent, aType); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::GetHelpContext +// +// Get help context for the control. +// ----------------------------------------------------------------------------- +// +#ifdef __SERIES60_HELP +void CFeedsTopicContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + // This must be the Browser's uid becasue the help texts are under Browser topics. + aContext.iMajor = KUidBrowserApplication; + aContext.iContext = KOSS_HLP_RSS_ARTICLELST; + } +#endif // __SERIES60_HELP + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::SizeChanged +// +// Called by framework when the view size is changed. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::SizeChanged() + { + iListBox->SetRect(Rect()); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::HandleResourceChange +// +// Called by the framework when a display resource changes (i.e. skin or layout). +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::HandleResourceChange(TInt aType) + { + CCoeControl::HandleResourceChange(aType); + iListBox->HandleResourceChange(aType); + + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + + if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect)) + { + SetRect(rect); + } + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::CountComponentControls +// +// Returns number of components. +// ----------------------------------------------------------------------------- +// +TInt CFeedsTopicContainer::CountComponentControls() const + { + return 1; + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::ComponentControl +// +// Returns pointer to particular component. +// ----------------------------------------------------------------------------- +// +CCoeControl* CFeedsTopicContainer::ComponentControl(TInt aIndex) const + { + switch (aIndex) + { + case 0: + return iListBox; + + default: + return NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::HandleListBoxEventL +// +// Processes key events from the listbox. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + // An item was selected. + if ((aEventType == MEikListBoxObserver::EEventEnterKeyPressed) || + (aEventType == MEikListBoxObserver::EEventItemDoubleClicked) +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + || (aEventType == MEikListBoxObserver::EEventItemSingleClicked) +#endif + ) + { + HandleOpenL(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::SetCurrentFeedL +// +// Sets the current feed +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::SetCurrentFeedL(const CFeedsEntity& aFeed, TInt aIndex) + { + // If the feed changes ignore aIndex. + if (iFeed != &aFeed) + { + aIndex = 0; + } + + iFeed = &aFeed; + + // Update the view. + UpdateTitleL(); + UpdateListBoxL(); + UpdateNavigationPaneL(); + + iListBox->SetCurrentItemIndex(aIndex); + iListBox->DrawDeferred(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::CurrentIndex +// +// Returns the current item. +// ----------------------------------------------------------------------------- +TInt CFeedsTopicContainer::CurrentIndex() const + { + return iListBox->CurrentItemIndex(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::ItemCount +// +// Returns the number of items. +// ----------------------------------------------------------------------------- +// +TInt CFeedsTopicContainer::ItemCount() const + { + return iFeed->GetChildren().Count(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::UpdateTitleL +// +// Update the view's title. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::UpdateTitleL() + { + + // Set the view's title + TPtrC title; + iFeed->GetStringValue(EFeedAttributeTitle,title); + iApiProvider.Display().SetTitleL(title); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::HandleOpenL +// +// Handle the open command. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::HandleOpenL() + { + TInt index; + + // Get the index of the item to show. + index = iListBox->CurrentItemIndex(); + + // Show the FeedView. + iApiProvider.FeedsClientUtilities().ShowFeedViewLocalL(index); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::HandleUpdateFeedL +// +// Handles updating the current Feed. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::HandleUpdateFeedL(void) + { + iApiProvider.FeedsClientUtilities().UpdateFeedL(*iFeed); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::InitContainerL +// +// Inits the container. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::InitContainerL(const TRect& aRect) + { + iListBox = new (ELeave) CAknSingleGraphicStyleListBox; + //iListBox = new (ELeave) CAknDoubleGraphicStyleListBox; + //iListBox = new (ELeave) CAknSingleStyleListBox; + + // below flags equals EAknListBoxMarkableList without the EAknListBoxShiftEnterMarks + // so the shift key press is not handled by avkon + iListBox->ConstructL(this, (EAknGenericListBoxFlags | EAknListBoxMultipleSelection)); + iListBox->SetContainerWindowL(*this); + iListBox->SetRect(aRect.Size()); + iListBox->SetListBoxObserver(this); + + iListBoxRows = new (ELeave) CDesCArraySeg(10); + iListBox->Model()->SetItemTextArray(iListBoxRows); + iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); + + iListBox->ActivateL(); + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto); + + // Add the needed icons. + InitIconArrayL(); + + // Enable marquee. + iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::InitIconArrayL +// +// Inits the array of needed icons. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::InitIconArrayL() + { + _LIT(KDirAndFile,"z:browser.mbm"); + + TParse* fp = NULL; + CArrayPtr* icons = NULL; + + // Build the path to the feeds resource file. + fp = new (ELeave) TParse(); + CleanupStack::PushL(fp); + + User::LeaveIfError(fp->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL)); + TBuf iconFile= fp->FullName(); + CleanupStack::PopAndDestroy(fp); + + // Create the icon array. + icons = new (ELeave) CAknIconArray(1); + CleanupStack::PushL(icons); + + // Add the unread icon + AppendIconL(icons, KAknsIIDQgnPropFileRssUnread, iconFile, + EMbmBrowserQgn_prop_file_rss_unread, EMbmBrowserQgn_prop_file_rss_unread_mask); + + // Add the read icon + AppendIconL(icons, KAknsIIDQgnPropFileRssRead, iconFile, + EMbmBrowserQgn_prop_file_rss_read, EMbmBrowserQgn_prop_file_rss_read_mask); + + // Set the icons and cleanup + iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons); + CleanupStack::Pop(icons); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::AppendIconL +// +// Loads and appends an icon to the icon array. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::AppendIconL(CArrayPtr* aIcons, + const TAknsItemID& aID, const TDesC& aFilename, const TInt aFileBitmapId, + const TInt aFileMaskId) + { + CGulIcon* newIcon; + CFbsBitmap* newIconBmp; + CFbsBitmap* newIconMaskBmp; + + // Create the bitmaps: the bitmaps are left on the cleanup stack. + AknsUtils::CreateIconL(AknsUtils::SkinInstance(), aID, newIconBmp, + newIconMaskBmp, aFilename, aFileBitmapId, aFileMaskId); + + CleanupStack::PushL(newIconBmp); + CleanupStack::PushL(newIconMaskBmp); + + newIcon = CGulIcon::NewL(newIconBmp, newIconMaskBmp); + CleanupStack::Pop(newIconMaskBmp); + CleanupStack::Pop(newIconBmp); + CleanupStack::PushL(newIcon); + + aIcons->AppendL(newIcon); + CleanupStack::Pop(newIcon); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::UpdateListBoxL +// +// Sets the list-box's values. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::UpdateListBoxL() + { + TBuf<255> listBoxtxt; + + // Clear the list. + iListBoxRows->Reset(); + + if (iFeed == NULL) + { + return; + } + + // Add the items. + for (int i = 0; i < iFeed->GetChildren().Count(); i++) + { + CFeedsEntity* item = iFeed->GetChildren()[i]; + TPtrC title; + TPtrC desc; + TDesC* itemName; + TInt status; + + item->GetStringValue(EItemAttributeTitle,title); + item->GetStringValue(EItemAttributeDescription,desc); + item->GetIntegerValue(EItemAttributeStatus,status); + // Get the title. + itemName = &(title); + + // If the title is missing use the description instead. + if (itemName->Length() == 0) + { + itemName = &(desc); + } + + // Ensure the title isn't too long. + TInt len = itemName->Length(); + if (len > 253) + { + len = 253; + } + + // Format: icon-index\t\1st Line of text\t2nd Line of text\t0 + listBoxtxt.Zero(); + + switch (status) + { + // unread and new item all share the same unread icon + case EItemStatusNew: + listBoxtxt.Append(_L("0\t")); + break; + + case EItemStatusUnread: + listBoxtxt.Append(_L("0\t")); + break; + + default: + listBoxtxt.Append(_L("1\t")); + break; + } + + listBoxtxt.Append(itemName->Ptr(), len); + listBoxtxt.Append(KNullDesC()); + + iListBoxRows->AppendL(listBoxtxt); + } + + iListBox->SetCurrentItemIndex(0); + iListBox->HandleItemAdditionL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::Clear +// +// Clears the navigation pane. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::ClearNavigationPane() + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicContainer::UpdateNavigationPaneL +// +// Handles the changes needed to the Navigation Pane. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicContainer::UpdateNavigationPaneL() + { + CAknNavigationControlContainer* naviPane = NULL; + + if (!iFeed) + { + return; + } + + // Convert the feed's timestamp into a localized string. + TBuf timestamp; + TBuf temp; + TTime date; + iFeed->GetTimeValue(EFeedAttributeTimestamp,date); + + // Translate from UTC to local time. + TTime local; + TTime utc; + TTimeIntervalSeconds delta; + + local.HomeTime(); + utc.UniversalTime(); + utc.SecondsFrom(local, delta); + date -= delta; + + //Set time + HBufC* timeFormat = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO ); + date.FormatL( timestamp, *timeFormat ); + CleanupStack::PopAndDestroy( timeFormat );//timeFormat + // + timestamp.Append(_L(" ")); + //Set date + HBufC* dateFormat = iEikonEnv->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO ); + date.FormatL( temp, *dateFormat ); + CleanupStack::PopAndDestroy( dateFormat );//dateFormat + // + timestamp.Append(temp); + AknTextUtils::LanguageSpecificNumberConversion(timestamp); + + // Get the navigation sub-pane. + CAknViewAppUi* appUi; + TUid uid; + + // Get the title sub-pane. + appUi = static_cast(CCoeEnv::Static()->AppUi()); + + uid.iUid = EEikStatusPaneUidNavi; + + CEikStatusPaneBase::TPaneCapabilities subPane = appUi->StatusPane()-> + PaneCapabilities(uid); + + // Set the title if the pane belongs to the app. + if (subPane.IsPresent() && subPane.IsAppOwned()) + { + naviPane = (CAknNavigationControlContainer*) appUi->StatusPane()->ControlL(uid); + } + else + { + User::Leave(KErrNotSupported); + } + + // Ensure the NaviDecorator was created. + if (!iNaviDecorator) + { + iNaviDecorator = naviPane->CreateNavigationLabelL( timestamp ); + } + else + { + CAknNaviLabel* naviLabel = static_cast(iNaviDecorator->DecoratedControl()); + if(naviLabel) + { + naviLabel->SetTextL(timestamp); + } + } + + + // If not yet pushed, this will do the push; if already there, this brings + // it to top and draws. + naviPane->PushL(*iNaviDecorator); + } + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsTopicView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsTopicView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,331 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A view to browse a feed's topics. +* +*/ + + + +#include +#include +#include +#include +#include +#include + +#include "Browser.hrh" +#include +#include +#include +#include "BrowserAppUi.h" +#include "CommonConstants.h" + +#include "FeedsTopicView.h" +#include "FeedsTopicContainer.h" + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsTopicView* CFeedsTopicView::NewL( MApiProvider& aApiProvider, TRect& aRect ) + { + CFeedsTopicView* self = new (ELeave) CFeedsTopicView(aApiProvider); + + CleanupStack::PushL(self); + self->ConstructL(aRect); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::CFeedsTopicView +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsTopicView::CFeedsTopicView(MApiProvider& aApiProvider): + CBrowserViewBase( aApiProvider ),iPenEnabled(EFalse) + { + iPenEnabled = AknLayoutUtils::PenEnabled(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::ConstructL(TRect& aRect) + { + BaseConstructL(R_FEEDS_TOPIC_VIEW); + +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + iContainer = CFeedsTopicContainer::NewL( this, ApiProvider(), aRect ); + iContainer->MakeVisible(EFalse); + + if(iPenEnabled) + { + Toolbar()->SetToolbarObserver(this); + } +#endif + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::~CFeedsTopicView +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsTopicView::~CFeedsTopicView() + { + DoDeactivate(); + + delete iContainer; + } + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::Id +// +// Returns the id of the view. +// ----------------------------------------------------------------------------- +// +TUid CFeedsTopicView::Id() const + { + return KUidBrowserFeedsTopicViewId; + } + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::HandleCommandL +// +// Processes commands. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::HandleCommandL(TInt aCommand) + { + TBool handled = EFalse; + + // Handle softkeys and other Symbian commands first. + switch (aCommand) + { + case EAknSoftkeyBack: + iApiProvider.FeedsClientUtilities().ShowFolderViewLocalL(); + handled = ETrue; + break; + +#ifdef __SERIES60_HELP + case EAknCmdHelp: + { + iApiProvider.SetLastActiveViewId(Id()); + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), + AppUi()->AppHelpContextL()); + handled = ETrue; + break; + } +#endif //__SERIES60_HELP + } + + if (handled) + { + return; + } + + // Handle menu commands. + switch (aCommand) + { + case EFeedsOpen: + if ((iApiProvider.FeedsClientUtilities().CurrentFeed()->GetChildren().Count()) > 0) + { + iContainer->HandleOpenL(); + } + break; + + case EFeedsUpdate: + iContainer->HandleUpdateFeedL(); + break; + + case EFeedsBackToPage: + iApiProvider.FeedsClientUtilities().HandleCommandL(Id(), EWmlCmdBackToPage ); + break; + + default: + iApiProvider.FeedsClientUtilities().HandleCommandL(Id(),aCommand); + break; + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::DoActivateL +// +// Called when the view is activated. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) + { + +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + if (!iContainer) + { + iContainer = CFeedsTopicContainer::NewL( this, ApiProvider(), ClientRect() ); + iContainer->MakeVisible(EFalse); + } + Toolbar()->SetToolbarVisibility(EFalse,EFalse); +#endif + // If need be, add the container to the control stack. + if (!iContainerOnStack) + { + AppUi()->AddToViewStackL(*this, iContainer); + iContainer->SetRect(ClientRect()); + iContainer->MakeVisible(ETrue); + iContainerOnStack = ETrue; + // resize screen after calling SetRect. This way looks better + iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + } + + // Set the current feed. + iContainer->SetCurrentFeedL(*(iApiProvider.FeedsClientUtilities().CurrentFeed()), iInitialItem); + iApiProvider.SetLastActiveViewId(Id()); + UpdateToolbarButtonsState(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::DoDeactivate +// +// Called when the view is deactivated. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::DoDeactivate() + { + if (iContainerOnStack) + { + AppUi()->RemoveFromViewStack(*this, iContainer); + iContainer->MakeVisible(EFalse); + iContainer->ClearNavigationPane(); + iContainerOnStack = EFalse; + + iInitialItem = iContainer->CurrentIndex(); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::DynInitMenuPaneL +// +// Disables unrelated menu options. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + + + if (aResourceId == R_FEEDS_TOPIC_VIEW_MENU) + { + // Refresh (same as update?) + iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsUpdate, R_FEEDS_UPDATE); + + // Back to Page (if page loaded) + if ( iApiProvider.IsPageLoaded() ) + { + iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdBackToPage, R_BROWSER_MENU_ITEM_BACK_TO_PAGE ); + } + } + + iApiProvider.FeedsClientUtilities().DynInitMenuPaneL(aResourceId, aMenuPane ); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::SetCurrentFeedL +// +// Sets the current feed +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::SetCurrentFeedL(const CFeedsEntity& aFeed, TInt aIndex) + { + iContainer->SetCurrentFeedL(aFeed, aIndex); + } + + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::SetInitialItem +// +// Sets the initial item once the view is activated. +// ----------------------------------------------------------------------------- +// +void CFeedsTopicView::SetInitialItem(TInt aItemIndex) + { + iInitialItem = aItemIndex; + } + +// ----------------------------------------------------------------------------- +// CFeedsTopicView::UpdateToolbarButtonsState +// +// Updates the state of the toolbar buttons depending on the situation +// ----------------------------------------------------------------------------- +// + +void CFeedsTopicView::UpdateToolbarButtonsState() + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + Toolbar()->SetToolbarVisibility(EFalse,EFalse); + return; +#else + if (iApiProvider.IsPageLoaded()) + { + Toolbar()->SetItemDimmed(EFeedsBackToPage, EFalse, ETrue); + } + else + { + Toolbar()->SetItemDimmed(EFeedsBackToPage, ETrue, ETrue); + } + if ((iApiProvider.FeedsClientUtilities().CurrentFeed()->GetChildren().Count()) > 0) + { + Toolbar()->SetItemDimmed(EFeedsOpen, EFalse, ETrue); + } + else + { + Toolbar()->SetItemDimmed(EFeedsOpen, ETrue, ETrue); + } +#endif + } + +// --------------------------------------------------------------------------- +// CFeedsTopicView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CFeedsTopicView::CommandSetResourceIdL() + { + // It is never called, but this function have to be implemented + return KWmlEmptyResourceId; + } + +// --------------------------------------------------------- +// CFeedsTopicView::HandleClientRectChange +// --------------------------------------------------------- +// +void CFeedsTopicView::HandleClientRectChange() + { + if( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/FeedsSrc/FeedsWaitDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/FeedsSrc/FeedsWaitDialog.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Encapsulates a wait or progress dialog. +* +*/ + + +#include "Browser.hrh" +#include + +#include +#include +#include +#include + +#include "FeedsWaitDialog.h" + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFeedsWaitDialog* CFeedsWaitDialog::NewL(MFeedsWaitDialogListener& aListener) + { + CFeedsWaitDialog* self = new (ELeave) CFeedsWaitDialog(aListener); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::CFeedsWaitDialog +// +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CFeedsWaitDialog::CFeedsWaitDialog(MFeedsWaitDialogListener& aListener): + iListener(aListener) + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::ConstructL() + { + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::~CFeedsWaitDialog +// +// Deconstructor. +// ----------------------------------------------------------------------------- +// +CFeedsWaitDialog::~CFeedsWaitDialog() + { + delete iWaitDialog; + delete iProgressDialog; + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::DialogDismissedL +// +// Called when the user presses the cancel button. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::DialogDismissedL(TInt /*aButtonId*/) + { + iListener.DialogDismissedL(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::ShowWaitDialogL +// +// Displays a WaitDialog. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::ShowWaitDialogL(TInt aLabelId) + { + iWaitDialog = new (ELeave) CAknWaitDialog( + reinterpret_cast(&iWaitDialog)); + iWaitDialog->PrepareLC(R_FEEDS_WAIT_NOTE_DIALOG); + + UpdateLabelL(aLabelId); + iWaitDialog->SetCallback(this); + iWaitDialog->RunLD(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::ShowProgressDialogL +// +// Displays a ProgressDialog. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::ShowProgressDialogL(TInt aLabelId) + { + iProgressDialog = new (ELeave) CAknProgressDialog( + reinterpret_cast(&iProgressDialog)); + iProgressDialog->PrepareLC(R_FEEDS_PROGRESS_NOTE_DIALOG); + + UpdateLabelL(aLabelId); + iProgressDialog->SetCallback(this); + iProgressInfo = iProgressDialog->GetProgressInfoL(); + iProgressDialog->RunLD(); + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::UpdateLabelL +// +// Updates the dialog's label. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::UpdateLabelL(TInt aLabelId) + { + HBufC* label = NULL; + + // Load the label's resource. + label = StringLoader::LoadLC(aLabelId); + + // Set the label. + if (iWaitDialog != NULL) + { + iWaitDialog->SetTextL(*label); + } + else if (iProgressDialog != NULL) + { + iProgressDialog->SetTextL(*label); + } + + CleanupStack::PopAndDestroy(label); + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::SetMaxProgressL +// +// For progress dialogs this method set the max progress value. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::SetMaxProgressL(TInt aMaxValue) + { + if (iProgressDialog != NULL) + { + iProgressInfo->SetFinalValue(aMaxValue); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::UpdateProgressL +// +// For progress dialogs this method updates the progress. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::UpdateProgressL(TInt aIncrement) + { + if (iProgressDialog != NULL) + { + iProgressInfo->IncrementAndDraw(aIncrement); + } + } + + +// ----------------------------------------------------------------------------- +// CFeedsWaitDialog::Close +// +// Closes the dialog. +// ----------------------------------------------------------------------------- +// +void CFeedsWaitDialog::Close() + { + if (iWaitDialog != NULL) + { + //iWaitDialog->ProcessFinishedL(); + delete iWaitDialog; + iWaitDialog = NULL; + } + else if (iProgressDialog != NULL) + { + //iProgressDialog->ProcessFinishedL(); + delete iProgressDialog; + iProgressDialog = NULL; + } + } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/32browsericons.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/32browsericons.txt Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,97 @@ +/c8,8 qgn_indi_find_goto.bmp\ +/c8,1 qgn_prop_wml_bm_tab2.bmp\ +/c8,1 qgn_prop_wml_pages_tab2.bmp\ +/c8,1 qgn_prop_wml_home.bmp\ +/c8,1 qgn_prop_wml_bm_last.bmp\ +/c8,1 qgn_prop_wml_bm.bmp\ +/c8,1 qgn_prop_wml_page.bmp\ +/c8,1 qgn_indi_wml_csd_add.bmp\ +/c8,1 qgn_indi_wml_hscsd_add.bmp\ +/c8,1 qgn_indi_wml_gprs_add.bmp\ +/c8,1 qgn_prop_folder.bmp\ +/c8,1 qgn_prop_wml_folder_link_seamless.bmp\ +/c8,1 qgn_prop_wml_folder_adap.bmp\ +/c8,1 qgn_prop_wml_bm_adap.bmp\ +/c8,1 qgn_prop_psln_active.bmp\ +/c8,8 qgn_prop_folder_tab1.bmp\ +/c8,8 qgn_menu_wml_02.bmp\ +/c8,8 qgn_menu_wml_03.bmp\ +/c8,8 qgn_menu_wml_04.bmp\ +/c8,8 qgn_menu_wml_05.bmp\ +/c8,8 qgn_menu_wml_06.bmp\ +/c8,8 qgn_menu_wml_07.bmp\ +/c8,8 qgn_menu_wml_08.bmp\ +/c8,8 qgn_menu_wml_09.bmp\ +/c8,8 qgn_menu_wml_10.bmp\ +/c8,8 qgn_menu_wml_11.bmp\ +/c8,8 qgn_menu_wml_12.bmp\ +/c8,8 qgn_menu_wml_13.bmp\ +/c8,8 qgn_menu_wml_14.bmp\ +/c8,8 qgn_menu_wml_15.bmp\ +/c8,8 qgn_menu_wml_16.bmp\ +/c8,1 qgn_indi_wait_wml_csd_1.bmp\ +/c8,1 qgn_indi_wait_wml_csd_2.bmp\ +/c8,1 qgn_indi_wait_wml_csd_3.bmp\ +/c8,1 qgn_indi_wait_wml_csd_4.bmp\ +/c8,1 qgn_indi_wait_wml_csd_5.bmp\ +/c8,1 qgn_indi_wait_wml_csd_6.bmp\ +/c8,1 qgn_indi_wait_wml_csd_7.bmp\ +/c8,1 qgn_indi_wait_wml_hscsd_2.bmp\ +/c8,1 qgn_indi_wait_wml_hscsd_3.bmp\ +/c8,1 qgn_indi_wait_wml_hscsd_4.bmp\ +/c8,1 qgn_indi_wait_wml_hscsd_5.bmp\ +/c8,1 qgn_indi_wait_wml_hscsd_6.bmp\ +/c8,1 qgn_indi_wait_wml_gprs_2.bmp\ +/c8,1 qgn_indi_wait_wml_gprs_3.bmp\ +/c8,1 qgn_indi_wait_wml_gprs_4.bmp\ +/c8,1 qgn_indi_wait_wml_gprs_5.bmp\ +/c8,1 qgn_indi_wait_wml_gprs_6.bmp\ +/c8,8 qgn_menu_wml_lst.bmp\ +/c8,1 qgn_prop_file_rss.bmp\ +/c8,1 qgn_prop_file_rss_new.bmp\ +/c8,1 qgn_prop_folder_rss.bmp\ +/c8,1 qgn_prop_file_rss_unread.bmp\ +/c8,1 qgn_prop_file_rss_read.bmp\ +/c8,1 qgn_indi_button_decrease.bmp\ +/c8,1 qgn_indi_browser_tb_go.bmp\ +/c8,1 qgn_indi_browser_tb_home.bmp\ +/c8,8 qgn_indi_browser_tb_help.svg\ +/c8,8 qgn_indi_browser_tb_switch_win.svg\ +/c8,8 qgn_indi_browser_tb_save_page.svg\ +/c8,8 qgn_indi_browser_tb_view_images.svg\ +/c8,8 qgn_indi_browser_tb_view_pages.svg\ +/c8,8 qgn_indi_browser_tb_bm.svg\ +/c8,8 qgn_indi_browser_tb_rotate.svg\ +/c8,8 qgn_indi_browser_tb_settings.svg\ +/c8,8 qgn_indi_browser_tb_zoom_out.svg\ +/c8,8 qgn_indi_browser_tb_zoom_in.svg\ +/c8,8 qgn_indi_browser_tb_find_kw.svg\ +/c8,8 qgn_indi_browser_tb_save_bm.svg\ +/c8,8 qgn_indi_browser_tb_goto.svg\ +/c8,8 qgn_indi_browser_tb_tb.svg\ +/c8,8 qgn_indi_browser_tb_key_map.svg\ +/c8,8 qgn_indi_browser_tb_page.svg\ +/c8,8 qgn_indi_browser_tb_reload.svg\ +/c8,8 qgn_indi_browser_tb_find.svg\ +/c8,8 qgn_indi_browser_tb_rss.svg\ +/c8,8 qgn_indi_browser_tb_back.svg\ +/c8,8 qgn_indi_browser_tb_forward.svg\ +/c8,8 qgn_indi_browser_feeds_tb_back_to_web.svg\ +/c8,8 qgn_indi_browser_feeds_tb_next.svg\ +/c8,8 qgn_indi_browser_feeds_tb_open_detail.svg\ +/c8,8 qgn_indi_browser_feeds_tb_open_full.svg\ +/c8,8 qgn_indi_browser_feeds_tb_open_topic.svg\ +/c8,8 qgn_indi_browser_feeds_tb_previous.svg\ +/c8,8 qgn_indi_browser_feeds_tb_update.svg\ +/c8,8 qgn_indi_browser_feeds_tb_update_all.svg\ +/c8,8 qgn_indi_browser_tb_find_kw_next.svg\ +/c8,8 qgn_indi_browser_tb_find_kw_prev.svg\ +/c8,8 qgn_indi_browser_tb_feeds.svg\ +/c8,8 qgn_indi_browser_bm_tb_new.svg\ +/c8,8 qgn_indi_browser_tb_delete.svg\ +/c8,8 qgn_indi_button_exit_fs.svg\ +/c8,8 qgn_indi_browser_tb_history_back.svg\ +/c8,8 qgn_indi_browser_tb_history_fw.svg\ +/c8,8 qgn_prop_folder_rss_error.svg\ +/c8,8 qgn_prop_file_rss_error.svg + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/72browsericons.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/72browsericons.txt Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,101 @@ +-c8,8 qgn_indi_find_goto +-c8,1 qgn_prop_wml_bm_tab2 +-c8,1 qgn_prop_wml_pages_tab2 +-c8,1 qgn_prop_wml_home +-c8,1 qgn_prop_wml_bm_last +-c8,1 qgn_prop_wml_bm +-c8,1 qgn_prop_wml_page +-c8,1 qgn_indi_wml_csd_add +-c8,1 qgn_indi_wml_hscsd_add +-c8,1 qgn_indi_wml_gprs_add +-c8,1 qgn_prop_folder +-c8,1 qgn_prop_wml_folder_link_seamless +-c8,1 qgn_prop_wml_folder_adap +-c8,1 qgn_prop_wml_bm_adap +-c8,1 qgn_prop_psln_active +-c8,8 qgn_prop_folder_tab1 +-c8,8 qgn_menu_wml_02 +-c8,8 qgn_menu_wml_03 +-c8,8 qgn_menu_wml_04 +-c8,8 qgn_menu_wml_05 +-c8,8 qgn_menu_wml_06 +-c8,8 qgn_menu_wml_07 +-c8,8 qgn_menu_wml_08 +-c8,8 qgn_menu_wml_09 +-c8,8 qgn_menu_wml_10 +-c8,8 qgn_menu_wml_11 +-c8,8 qgn_menu_wml_12 +-c8,8 qgn_menu_wml_13 +-c8,8 qgn_menu_wml_14 +-c8,8 qgn_menu_wml_15 +-c8,8 qgn_menu_wml_16 +-c8,1 qgn_indi_wait_wml_csd_1 +-c8,1 qgn_indi_wait_wml_csd_2 +-c8,1 qgn_indi_wait_wml_csd_3 +-c8,1 qgn_indi_wait_wml_csd_4 +-c8,1 qgn_indi_wait_wml_csd_5 +-c8,1 qgn_indi_wait_wml_csd_6 +-c8,1 qgn_indi_wait_wml_csd_7 +-c8,1 qgn_indi_wait_wml_hscsd_2 +-c8,1 qgn_indi_wait_wml_hscsd_3 +-c8,1 qgn_indi_wait_wml_hscsd_4 +-c8,1 qgn_indi_wait_wml_hscsd_5 +-c8,1 qgn_indi_wait_wml_hscsd_6 +-c8,1 qgn_indi_wait_wml_gprs_2 +-c8,1 qgn_indi_wait_wml_gprs_3 +-c8,1 qgn_indi_wait_wml_gprs_4 +-c8,1 qgn_indi_wait_wml_gprs_5 +-c8,1 qgn_indi_wait_wml_gprs_6 +-c8,8 qgn_menu_wml_lst +-c8,1 qgn_prop_file_rss +-c8,1 qgn_prop_file_rss_new +-c8,1 qgn_prop_folder_rss +-c8,1 qgn_prop_file_rss_unread +-c8,1 qgn_prop_file_rss_read +-c8,1 qgn_indi_button_decrease +-c8,1 qgn_indi_browser_tb_go +-c8,1 qgn_indi_browser_tb_home +-c8,8 qgn_indi_browser_tb_help +-c8,8 qgn_indi_browser_tb_switch_win +-c8,8 qgn_indi_browser_tb_save_page +-c8,8 qgn_indi_browser_tb_view_images +-c8,8 qgn_indi_browser_tb_view_pages +-c8,8 qgn_indi_browser_tb_bm +-c8,8 qgn_indi_browser_tb_rotate +-c8,8 qgn_indi_browser_tb_settings +-c8,8 qgn_indi_browser_tb_zoom_out +-c8,8 qgn_indi_browser_tb_zoom_in +-c8,8 qgn_indi_browser_tb_find_kw +-c8,8 qgn_indi_browser_tb_save_bm +-c8,8 qgn_indi_browser_tb_goto +-c8,8 qgn_indi_browser_tb_tb +-c8,8 qgn_indi_browser_tb_key_map +-c8,8 qgn_indi_browser_tb_page +-c8,8 qgn_indi_browser_tb_reload +-c8,8 qgn_indi_browser_tb_find +-c8,8 qgn_indi_browser_tb_rss +-c8,8 qgn_indi_browser_tb_back +-c8,8 qgn_indi_browser_tb_forward +-c8,8 qgn_indi_browser_feeds_tb_back_to_web +-c8,8 qgn_indi_browser_feeds_tb_next +-c8,8 qgn_indi_browser_feeds_tb_open_detail +-c8,8 qgn_indi_browser_feeds_tb_open_full +-c8,8 qgn_indi_browser_feeds_tb_open_topic +-c8,8 qgn_indi_browser_feeds_tb_previous +-c8,8 qgn_indi_browser_feeds_tb_update +-c8,8 qgn_indi_browser_feeds_tb_update_all +-c8,8 qgn_indi_browser_tb_find_kw_next +-c8,8 qgn_indi_browser_tb_find_kw_prev +-c8,8 qgn_indi_browser_tb_feeds +-c8,8 qgn_indi_browser_bm_tb_new +-c8,8 qgn_indi_browser_tb_delete +-c8,8 qgn_indi_button_exit_fs +-c8,8 qgn_indi_browser_tb_history_back +-c8,8 qgn_indi_browser_tb_history_fw +-c8,8 qgn_prop_folder_rss_error +-c8,8 qgn_prop_file_rss_error +-c8,8 qgn_indi_browser_tb_send_url +-c8,8 qgn_indi_browser_tb_goto_and_search.svg +-c8,8 qgn_prop_browser_info_small.svg +-c8,8 qgn_indi_browser_tb_exit.svg +-c8,8 qgn_indi_browser_tb_downloads.svg diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/BrowserCommon.mmpi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/BrowserCommon.mmpi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include + +TARGETTYPE exe + +EPOCSTACKSIZE 0x14000 + +// There is no need to set a custom heap size as a custom allocator is used so the default values of 1 KB for +// minimum and 1 MB for maximum should be used instead. These will be used for a short time at startup for +// the default heap, which in turn is used to create the custom allocator. no gain in functionality +//EPOCHEAPSIZE 0x5000 0x1000000 + +VENDORID VID_DEFAULT +CAPABILITY CAP_APPLICATION NetworkControl -Location + +EpocAllowDllData + +MACRO AVERELL2_LOADERCLI_MISSING +#define AVERELL2_LOADERCLI_MISSING + +MACRO HTTP_SECURITY_WARNINGS +#define HTTP_SECURITY_WARNINGS + +SOURCEPATH . + +USERINCLUDE ../BrowserAppInc +USERINCLUDE ../SrcData +USERINCLUDE ../FavouritesInc +USERINCLUDE ../SettingsInc +USERINCLUDE ../launcher2/inc + +#ifdef __RSS_FEEDS +USERINCLUDE ../FeedsInc +#endif //__RSS_FEEDS + +APP_LAYER_SYSTEMINCLUDE +OS_LAYER_ESTLIB_SYSTEMINCLUDE + + +#include "browserlogger.inc" + +SOURCE ../BrowserAppSrc/BrowserAppEntryPoint.cpp +SOURCE ../BrowserAppSrc/BrowserApplication.cpp +SOURCE ../BrowserAppSrc/BrowserAsyncExit.cpp +SOURCE ../BrowserAppSrc/BrowserAppUi.cpp +SOURCE ../BrowserAppSrc/BrowserAppDocument.cpp +SOURCE ../BrowserAppSrc/BrowserAppViewBase.cpp +SOURCE ../BrowserAppSrc/BrowserContentView.cpp +SOURCE ../BrowserAppSrc/BrowserContentViewContainer.cpp +SOURCE ../BrowserAppSrc/BrowserContentViewZoomModeTimer.cpp +SOURCE ../BrowserAppSrc/BrowserContentViewToolbar.cpp +SOURCE ../BrowserAppSrc/BrowserDownloadUtil.cpp + +SOURCE ../BrowserAppSrc/BrowserDialogs.cpp +SOURCE ../BrowserAppSrc/BrowserPreferences.cpp +SOURCE ../BrowserAppSrc/BrowserUtil.cpp +SOURCE ../BrowserAppSrc/BrowserDisplay.cpp +SOURCE ../BrowserAppSrc/BrowserCommsModel.cpp +SOURCE ../BrowserAppSrc/BrowserGotoPane.cpp +SOURCE ../BrowserAppSrc/BrowserProgressIndicator.cpp +SOURCE ../BrowserAppSrc/BrowserBmOTABinSender.cpp +SOURCE ../BrowserAppSrc/BrowserDownloadIndicatorTimer.cpp + +SOURCE ../BrowserAppSrc/BrowserAppServer.cpp +SOURCE ../BrowserAppSrc/BrowserLauncherService.cpp + +SOURCE ../BrowserAppSrc/BrowserWindow.cpp +SOURCE ../BrowserAppSrc/BrowserWindowManager.cpp + +SOURCE ../BrowserAppSrc/BrowserShortcutKeyMap.cpp + +SOURCE ../BrowserAppSrc/WlanObserver.cpp + +// Favourites View (common parts of Bookmarks View) +SOURCE ../FavouritesSrc/BrowserFavouritesView.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesContainer.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesModel.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesListbox.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesListboxState.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesListboxModel.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesFolderSelector.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesListboxView.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesListboxItemDrawer.cpp +SOURCE ../FavouritesSrc/CommandVisibility.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesListboxIconHandler.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesFolderListboxIconHandler.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesIncrementalDelete.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesIncrementalMove.cpp +SOURCE ../FavouritesSrc/BrowserFavouritesIncrementalOp.cpp + +SOURCE ../FavouritesSrc/BrowserFaviconScaler.cpp +SOURCE ../FavouritesSrc/BrowserFaviconHandler.cpp + +// Bookmarks View +SOURCE ../FavouritesSrc/BrowserBookmarksView.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksContainer.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksModel.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksEditDialog.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksGotoPane.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksEditFormApModel.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksListboxIconHandler.cpp +SOURCE ../FavouritesSrc/BrowserBookmarksOrder.cpp + +// Settings View +SOURCE ../SettingsSrc/BrowserSettingsDlg.cpp +SOURCE ../SettingsSrc/SettingsContainer.cpp +SOURCE ../SettingsSrc/SettingsView.cpp + +SOURCE ../BrowserAppSrc/BrowserCommandLineParser.cpp + +SOURCE ../BrowserAppSrc/SessionAndSecurity.cpp + +//adaptive popup +SOURCE ../FavouritesSrc/BrowserAdaptiveListPopup.cpp + +SOURCE ../BrowserAppSrc/BrowserLoadObserver.cpp +SOURCE ../BrowserAppSrc/BrowserSpecialLoadObserver.cpp +SOURCE ../BrowserAppSrc/BrowserSoftkeysObserver.cpp + +// Multiple Windows Support +SOURCE ../BrowserAppSrc/BrowserDialogsProviderProxy.cpp +SOURCE ../BrowserAppSrc/BrowserDialogsProviderBlocker.cpp +SOURCE ../BrowserAppSrc/BrowserWindowFocusNotifier.cpp +SOURCE ../BrowserAppSrc/BrowserPopupEngine.cpp + +// PushMtm Support +SOURCE ../BrowserAppSrc/BrowserPushMtmObserver.cpp + +SOURCE ../BrowserAppSrc/Logger.cpp + +LIBRARY euser.lib apparc.lib cone.lib eikcore.lib egul.lib +LIBRARY eikcoctl.lib avkon.lib eikdlg.lib +LIBRARY eikctl.lib fbscli.lib bafl.lib +LIBRARY apgrfx.lib +LIBRARY CommonEngine.lib +LIBRARY CommonUI.LIB +LIBRARY apengine.lib +LIBRARY favouritesengine.lib +LIBRARY SYSUTIL.LIB +LIBRARY ConnectionManager.lib +LIBRARY APSETTINGSHANDLERUI.LIB +LIBRARY FEPBASE.lib + +LIBRARY efsrv.lib +LIBRARY sendui.lib +LIBRARY esock.lib +LIBRARY etext.lib + + +LIBRARY Form.lib +LIBRARY inetprotutil.lib +LIBRARY AknSkins.lib // Skins support +LIBRARY featmgr.lib // feature mannger support +LIBRARY charconv.lib +LIBRARY recenturlstore.lib +LIBRARY cookiemanager.lib +LIBRARY estor.lib +LIBRARY CdlEngine.lib +LIBRARY BrowserDialogsProvider.lib +LIBRARY ecom.lib // for schemeHandler +LIBRARY ws32.lib // window ordinalposition +#if defined( WINS ) +LIBRARY commdb.lib +#endif +LIBRARY apmime.lib + +#ifdef __SERIES60_HELP +LIBRARY hlplch.lib // for "Help" options menu +#endif // __SERIES60_HELP + +#if defined( I__BROWSER_LOG_ENABLED) || defined (I__BROWSER_PERF_LOG_ENABLED ) +LIBRARY flogger.lib +#endif + +LIBRARY Centralrepository.lib +LIBRARY BrowserLauncher.lib +LIBRARY ServiceHandler.lib +LIBRARY AknLayout2.lib +LIBRARY BitmapTransforms.lib +LIBRARY gdi.lib +LIBRARY bitgdi.lib +LIBRARY aknicon.lib +LIBRARY memman.lib diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/BrowserLogger.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/BrowserLogger.inc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,23 @@ +/* +* This file enables or disables the logger +* functionality in Browser Application. +* File included into mmp files. +*/ + +// define this macro to enable browser log +// #define __BROWSER_LOG_ENABLE + +// define this macro to enable browser performance log +//#define __BROWSER_PERF_LOG_ENABLE + + +// debug mode always activates log +#if defined( __BROWSER_LOG_ENABLE ) || defined( _DEBUG ) + MACRO I__BROWSER_LOG_ENABLED + #define I__BROWSER_LOG_ENABLED +#endif + +#if defined( __BROWSER_PERF_LOG_ENABLE ) + MACRO I__BROWSER_PERF_LOG_ENABLED + #define I__BROWSER_PERF_LOG_ENABLED +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/BrowserNG.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/BrowserNG.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build mmp file +* +* +*/ + +#include +#include + +TARGET BrowserNG.exe +UID 0x100039CE 0x10008D39 + +// ----------- +#include "BrowserCommon.mmpi" + +SOURCE ../BrowserAppSrc/BrowserWindowSelectionContainer.cpp +SOURCE ../BrowserAppSrc/BrowserWindowSelectionView.cpp +SOURCE ../BrowserAppSrc/BrowserInitialContainer.cpp +SOURCE ../BrowserAppSrc/BrowserInitialView.cpp +#ifdef __RSS_FEEDS + // Utils from FeedsServer + SOURCE ../FeedsSrc/FeedsWaitDialog.cpp + SOURCE ../FeedsSrc/FeedsClientUtilities.cpp + SOURCE ../FeedsSrc/FeedsFeedContainer.cpp + SOURCE ../FeedsSrc/FeedsFeedView.cpp + SOURCE ../FeedsSrc/FeedsFolderContainer.cpp + SOURCE ../FeedsSrc/FeedsFolderView.cpp + SOURCE ../FeedsSrc/FeedsTopicContainer.cpp + SOURCE ../FeedsSrc/FeedsTopicView.cpp + SOURCE ../FeedsSrc/FeedsEditFolderDialog.cpp + SOURCE ../FeedsSrc/FeedsEditFeedDialog.cpp + SOURCE ../FeedsSrc/FeedsFileSearchAgent.cpp +#endif + +START RESOURCE ../SrcData/BrowserNG.rss +DEPENDS avkon.rsg +TARGETPATH APP_RESOURCE_DIR +HEADER +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +END + +START RESOURCE ../SrcData/BrowserNG_reg.rss +DEPENDS browserng.rsg +DEPENDS avkon.rsg +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + +#ifdef __RSS_FEEDS + LIBRARY FeedsServerApi.lib +#endif // __RSS_FEEDS + +LIBRARY cmmanager.lib +LIBRARY browserengine.lib +LIBRARY edbms.lib +LIBRARY hal.lib + + +#ifdef BRDO_APP_GALLERY_SUPPORTED_FF +LIBRARY MGXMediaFileAPI.lib +#endif + +LIBRARY oommonitor.lib +#ifdef RD_UI_TRANSITION_EFFECTS_LIST +LIBRARY aknlistloadertfx.lib +#endif //RD_UI_TRANSITION_EFFECTS_LIST +LIBRARY aknpictograph.lib +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif // RD_TACTILE_FEEDBACK +LIBRARY AknLayout2Scalable.lib +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +LIBRARY iaupdateapi.lib +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build information file +* +* +*/ + +#include +#include "../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +PRJ_PLATFORMS + +DEFAULT + +// Help exports +#include "../help/group/bld.inf" + +PRJ_EXPORTS +#ifdef __S60_32__ +../rom/browser_stub_32.sis /epoc32/release/armv5/urel/browser_stub.sis +../data/qgn_indi_browser_bm_tb_new.svg /epoc32/s60/icons/qgn_indi_browser_bm_tb_new.svg +../data/qgn_indi_browser_feeds_tb_back_to_web.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_back_to_web.svg +../data/qgn_indi_browser_feeds_tb_next.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_next.svg +../data/qgn_indi_browser_feeds_tb_open_detail.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_open_detail.svg +../data/qgn_indi_browser_feeds_tb_open_full.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_open_full.svg +../data/qgn_indi_browser_feeds_tb_open_topic.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_open_topic.svg +../data/qgn_indi_browser_feeds_tb_previous.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_previous.svg +../data/qgn_indi_browser_feeds_tb_update.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_update.svg +../data/qgn_indi_browser_feeds_tb_update_all.svg /epoc32/s60/icons/qgn_indi_browser_feeds_tb_update_all.svg +../data/qgn_indi_browser_tb_delete.svg /epoc32/s60/icons/qgn_indi_browser_tb_delete.svg +../data/qgn_indi_browser_tb_find_kw_next.svg /epoc32/s60/icons/qgn_indi_browser_tb_find_kw_next.svg +../data/qgn_indi_browser_tb_find_kw_prev.svg /epoc32/s60/icons/qgn_indi_browser_tb_find_kw_prev.svg +../data/qgn_indi_browser_tb_history_back.svg /epoc32/s60/icons/qgn_indi_browser_tb_history_back.svg +../data/qgn_indi_browser_tb_history_fw.svg /epoc32/s60/icons/qgn_indi_browser_tb_history_fw.svg +../data/qgn_indi_browser_tb_view_images.svg /epoc32/s60/icons/qgn_indi_browser_tb_view_images.svg +../data/qgn_indi_browser_tb_view_pages.svg /epoc32/s60/icons/qgn_indi_browser_tb_view_pages.svg +../data/qgn_indi_button_exit_fs.svg /epoc32/s60/icons/qgn_indi_button_exit_fs.svg +../data/qgn_prop_file_rss_error.svg /epoc32/s60/icons/qgn_prop_file_rss_error.svg +../data/qgn_prop_folder_rss_error.svg /epoc32/s60/icons/qgn_prop_folder_rss_error.svg + +../data/A_H/qgn_indi_browser_tb_back.bmp /epoc32/s60/icons/A_H/qgn_indi_browser_tb_back.bmp +../data/A_H/qgn_indi_browser_tb_back_mask_soft.bmp /epoc32/s60/icons/A_H/qgn_indi_browser_tb_back_mask_soft.bmp +../data/A_H/qgn_indi_browser_tb_rss.bmp /epoc32/s60/icons/A_H/qgn_indi_browser_tb_rss.bmp +../data/A_H/qgn_indi_browser_tb_rss_mask_soft.bmp /epoc32/s60/icons/A_H/qgn_indi_browser_tb_rss_mask_soft.bmp +../data/A_H/qgn_prop_folder_rss.svg /epoc32/s60/icons/A_H/qgn_prop_folder_rss.svg +../data/A_H/qgn_prop_folder_rss_error.svg /epoc32/s60/icons/A_H/qgn_prop_folder_rss_error.svg +#else +../rom/browser_stub.sis /epoc32/release/armv5/urel/browser_stub.sis +#endif +../SrcData/feeds_view_template.html /epoc32/winscw/c/feeds_view_template.html +../SrcData/feeds_view_template.html /epoc32/data/c/feeds_view_template.html + +../SrcData/backup_registration.xml /epoc32/data/z/private/10008d39/backup_registration.xml +../SrcData/backup_registration.xml /epoc32/release/winscw/udeb/z/private/10008d39/backup_registration.xml +../SrcData/backup_registration.xml /epoc32/release/winscw/urel/z/private/10008d39/backup_registration.xml +../loc/browserhp.loc APP_LAYER_LOC_EXPORT_PATH(browserhp.loc) +../loc/feeds.loc APP_LAYER_LOC_EXPORT_PATH(feeds.loc) +../loc/wmlbrowser.loc APP_LAYER_LOC_EXPORT_PATH(wmlbrowser.loc) + +../Rom/BrowserLauncher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(BrowserLauncher.iby) +../Rom/BrowserUi.iby CORE_APP_LAYER_IBY_EXPORT_PATH(BrowserUi.iby) +../Rom/BrowserResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(BrowserResources.iby) + +// factory browser bookmarks confml file +../conf/BrowserBookmarks.confml APP_LAYER_CONFML(BrowserBookmarks.confml) +// genconfml file for processing of bookmarks confml file +../conf/BookmarkItems.gcfml APP_LAYER_GCFML(BookmarkItems.gcfml) +// default feeds confml file +../conf/Feeds.confml APP_LAYER_CONFML(Feeds.confml) +// genconfml file for processing of Feeds.confml into OPML file for default feeds +../conf/Feeds_OPML.gcfml APP_LAYER_GCFML(Feeds_OPML.gcfml) + +../conf/browserui.confml APP_LAYER_CONFML(browserui.confml) +../conf/browserui_101F861B.crml APP_LAYER_CRML(browserui_101F861B.crml) +../conf/browserui_10008D39.crml APP_LAYER_CRML(browserui_10008D39.crml) + +#ifdef __SERIES60_32__ + +PRJ_MMPFILES +gnumakefile browsericonsdc.mk +#ifdef __SCALABLE_ICONS + gnumakefile browserngaifsvgiconsdc.mk +#else // __SCALABLE_ICONS + gnumakefile browseraificonsdc.mk +#endif // __SCALABLE_ICONS + +../launcher2/group/Browserlauncher.mmp +BrowserNG.mmp + +#else +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE browser.mif +OPTION HEADERFILE browser.mbg +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF +OPTION SOURCEFILE 72browsericons.txt +#else +OPTION SOURCEFILE browsericons.txt +#endif +END +START EXTENSION s60/mifconv +OPTION TARGETFILE browserng_aif.mif +OPTION SOURCES -c8,8 qgn_menu_browserng +END + +PRJ_MMPFILES + +../launcher2/group/Browserlauncher.mmp +BrowserNG.mmp + +#endif + +PRJ_TESTMMPFILES diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/browseraificonsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/browseraificonsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,68 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\browserng_aif.mbm + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_wml_lst.bmp \ + /c8,8 qgn_menu_wml_cxt.bmp + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/browseraifsvgiconsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/browseraifsvgiconsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\browser_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_wml.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/browsericons.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/browsericons.txt Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,99 @@ +-c8,8 qgn_indi_find_goto +-c8,1 qgn_prop_wml_bm_tab2 +-c8,1 qgn_prop_wml_pages_tab2 +-c8,1 qgn_prop_wml_home +-c8,1 qgn_prop_wml_bm_last +-c8,1 qgn_prop_wml_bm +-c8,1 qgn_prop_wml_page +-c8,1 qgn_indi_wml_csd_add +-c8,1 qgn_indi_wml_hscsd_add +-c8,1 qgn_indi_wml_gprs_add +-c8,1 qgn_prop_folder +-c8,1 qgn_prop_wml_folder_link_seamless +-c8,1 qgn_prop_wml_folder_adap +-c8,1 qgn_prop_wml_bm_adap +-c8,1 qgn_prop_psln_active +-c8,8 qgn_prop_folder_tab1 +-c8,8 qgn_menu_wml_02 +-c8,8 qgn_menu_wml_03 +-c8,8 qgn_menu_wml_04 +-c8,8 qgn_menu_wml_05 +-c8,8 qgn_menu_wml_06 +-c8,8 qgn_menu_wml_07 +-c8,8 qgn_menu_wml_08 +-c8,8 qgn_menu_wml_09 +-c8,8 qgn_menu_wml_10 +-c8,8 qgn_menu_wml_11 +-c8,8 qgn_menu_wml_12 +-c8,8 qgn_menu_wml_13 +-c8,8 qgn_menu_wml_14 +-c8,8 qgn_menu_wml_15 +-c8,8 qgn_menu_wml_16 +-c8,1 qgn_indi_wait_wml_csd_1 +-c8,1 qgn_indi_wait_wml_csd_2 +-c8,1 qgn_indi_wait_wml_csd_3 +-c8,1 qgn_indi_wait_wml_csd_4 +-c8,1 qgn_indi_wait_wml_csd_5 +-c8,1 qgn_indi_wait_wml_csd_6 +-c8,1 qgn_indi_wait_wml_csd_7 +-c8,1 qgn_indi_wait_wml_hscsd_2 +-c8,1 qgn_indi_wait_wml_hscsd_3 +-c8,1 qgn_indi_wait_wml_hscsd_4 +-c8,1 qgn_indi_wait_wml_hscsd_5 +-c8,1 qgn_indi_wait_wml_hscsd_6 +-c8,1 qgn_indi_wait_wml_gprs_2 +-c8,1 qgn_indi_wait_wml_gprs_3 +-c8,1 qgn_indi_wait_wml_gprs_4 +-c8,1 qgn_indi_wait_wml_gprs_5 +-c8,1 qgn_indi_wait_wml_gprs_6 +-c8,8 qgn_menu_wml_lst +-c8,1 qgn_prop_file_rss +-c8,1 qgn_prop_file_rss_new +-c8,1 qgn_prop_folder_rss +-c8,1 qgn_prop_file_rss_unread +-c8,1 qgn_prop_file_rss_read +-c8,1 qgn_indi_button_decrease +-c8,1 qgn_indi_browser_tb_go +-c8,1 qgn_indi_browser_tb_home +-c8,8 qgn_indi_browser_tb_help +-c8,8 qgn_indi_browser_tb_switch_win +-c8,8 qgn_indi_browser_tb_save_page +-c8,8 qgn_indi_browser_tb_view_images +-c8,8 qgn_indi_browser_tb_view_pages +-c8,8 qgn_indi_browser_tb_bm +-c8,8 qgn_indi_browser_tb_rotate +-c8,8 qgn_indi_browser_tb_settings +-c8,8 qgn_indi_browser_tb_zoom_out +-c8,8 qgn_indi_browser_tb_zoom_in +-c8,8 qgn_indi_browser_tb_find_kw +-c8,8 qgn_indi_browser_tb_save_bm +-c8,8 qgn_indi_browser_tb_goto +-c8,8 qgn_indi_browser_tb_tb +-c8,8 qgn_indi_browser_tb_key_map +-c8,8 qgn_indi_browser_tb_page +-c8,8 qgn_indi_browser_tb_reload +-c8,8 qgn_indi_browser_tb_find +-c8,8 qgn_indi_browser_tb_rss +-c8,8 qgn_indi_browser_tb_back +-c8,8 qgn_indi_browser_tb_forward +-c8,8 qgn_indi_browser_feeds_tb_back_to_web +-c8,8 qgn_indi_browser_feeds_tb_next +-c8,8 qgn_indi_browser_feeds_tb_open_detail +-c8,8 qgn_indi_browser_feeds_tb_open_full +-c8,8 qgn_indi_browser_feeds_tb_open_topic +-c8,8 qgn_indi_browser_feeds_tb_previous +-c8,8 qgn_indi_browser_feeds_tb_update +-c8,8 qgn_indi_browser_feeds_tb_update_all +-c8,8 qgn_indi_browser_tb_find_kw_next +-c8,8 qgn_indi_browser_tb_find_kw_prev +-c8,8 qgn_indi_browser_tb_feeds +-c8,8 qgn_indi_browser_bm_tb_new +-c8,8 qgn_indi_browser_tb_delete +-c8,8 qgn_indi_button_exit_fs +-c8,8 qgn_indi_browser_tb_history_back +-c8,8 qgn_indi_browser_tb_history_fw +-c8,8 qgn_prop_folder_rss_error +-c8,8 qgn_prop_file_rss_error +-c8,8 qgn_indi_browser_tb_send_url +-c8,8 qgn_indi_browser_tb_goto_and_search.svg +-c8,8 qgn_prop_browser_info_small.svg diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/browsericonsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/browsericonsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,70 @@ +# +# Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +HEADERDIR=\epoc32\include +ICONTARGETFILENAME=$(TARGETDIR)\browser.mif +HEADERFILENAME=$(HEADERDIR)\browser.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) /f32browsericons.txt + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Group/browserngaifsvgiconsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Group/browserngaifsvgiconsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\browserng_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_browserng.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/BWinsCw/BROWSERLAUNCHERU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/BWinsCw/BROWSERLAUNCHERU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,14 @@ +EXPORTS + ??0CLauncherServerBase@@QAE@XZ @ 1 NONAME ; CLauncherServerBase::CLauncherServerBase(void) + ??1CBrowserLauncher@@UAE@XZ @ 2 NONAME ; CBrowserLauncher::~CBrowserLauncher(void) + ?Cancel@CBrowserLauncher@@QAEXXZ @ 3 NONAME ; void CBrowserLauncher::Cancel(void) + ?LaunchBrowserEmbeddedL@CBrowserLauncher@@QAEXABVTDesC16@@PAVMDownloadedContentHandler@@PAVMAknServerAppExitObserver@@PAVTBrowserOverriddenSettings@@@Z @ 4 NONAME ; void CBrowserLauncher::LaunchBrowserEmbeddedL(class TDesC16 const &, class MDownloadedContentHandler *, class MAknServerAppExitObserver *, class TBrowserOverriddenSettings *) + ?LaunchBrowserEmbeddedL@CBrowserLauncher@@QAEXHPAVMDownloadedContentHandler@@PAVMAknServerAppExitObserver@@PAVTBrowserOverriddenSettings@@@Z @ 5 NONAME ; void CBrowserLauncher::LaunchBrowserEmbeddedL(int, class MDownloadedContentHandler *, class MAknServerAppExitObserver *, class TBrowserOverriddenSettings *) + ?LaunchBrowserSyncEmbeddedL@CBrowserLauncher@@QAEHABVTDesC16@@PAVMDownloadedContentHandler@@PAVTBrowserOverriddenSettings@@@Z @ 6 NONAME ; int CBrowserLauncher::LaunchBrowserSyncEmbeddedL(class TDesC16 const &, class MDownloadedContentHandler *, class TBrowserOverriddenSettings *) + ?LaunchBrowserSyncEmbeddedL@CBrowserLauncher@@QAEHHPAVMDownloadedContentHandler@@PAVTBrowserOverriddenSettings@@@Z @ 7 NONAME ; int CBrowserLauncher::LaunchBrowserSyncEmbeddedL(int, class MDownloadedContentHandler *, class TBrowserOverriddenSettings *) + ?NewL@CBrowserLauncher@@SAPAV1@H@Z @ 8 NONAME ; class CBrowserLauncher * CBrowserLauncher::NewL(int) + ?NewL@CBrowserLauncher@@SAPAV1@XZ @ 9 NONAME ; class CBrowserLauncher * CBrowserLauncher::NewL(void) + ?NewLC@CBrowserLauncher@@SAPAV1@H@Z @ 10 NONAME ; class CBrowserLauncher * CBrowserLauncher::NewLC(int) + ?NewLC@CBrowserLauncher@@SAPAV1@XZ @ 11 NONAME ; class CBrowserLauncher * CBrowserLauncher::NewLC(void) + ?ServiceL@CLauncherServerBase@@UAEXABVRMessage2@@@Z @ 12 NONAME ; void CLauncherServerBase::ServiceL(class RMessage2 const &) + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/EABI/BROWSERLAUNCHERU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/EABI/BROWSERLAUNCHERU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,24 @@ +EXPORTS + _ZN16CBrowserLauncher22LaunchBrowserEmbeddedLERK7TDesC16P25MDownloadedContentHandlerP25MAknServerAppExitObserverP26TBrowserOverriddenSettings @ 1 NONAME + _ZN16CBrowserLauncher22LaunchBrowserEmbeddedLEiP25MDownloadedContentHandlerP25MAknServerAppExitObserverP26TBrowserOverriddenSettings @ 2 NONAME + _ZN16CBrowserLauncher26LaunchBrowserSyncEmbeddedLERK7TDesC16P25MDownloadedContentHandlerP26TBrowserOverriddenSettings @ 3 NONAME + _ZN16CBrowserLauncher26LaunchBrowserSyncEmbeddedLEiP25MDownloadedContentHandlerP26TBrowserOverriddenSettings @ 4 NONAME + _ZN16CBrowserLauncher4NewLEi @ 5 NONAME + _ZN16CBrowserLauncher4NewLEv @ 6 NONAME + _ZN16CBrowserLauncher5NewLCEi @ 7 NONAME + _ZN16CBrowserLauncher5NewLCEv @ 8 NONAME + _ZN16CBrowserLauncher6CancelEv @ 9 NONAME + _ZN16CBrowserLauncherD0Ev @ 10 NONAME + _ZN16CBrowserLauncherD1Ev @ 11 NONAME + _ZN16CBrowserLauncherD2Ev @ 12 NONAME + _ZN19CLauncherServerBase8ServiceLERK9RMessage2 @ 13 NONAME + _ZN19CLauncherServerBaseC2Ev @ 14 NONAME + _ZTI19CLauncherServerBase @ 15 NONAME ; ## + _ZTI22RLauncherClientService @ 16 NONAME ; ## + _ZTI23CLauncherReceiveHandler @ 17 NONAME ; ## + _ZTI25CBrowserLauncherExtension @ 18 NONAME ; ## + _ZTV19CLauncherServerBase @ 19 NONAME ; ## + _ZTV22RLauncherClientService @ 20 NONAME ; ## + _ZTV23CLauncherReceiveHandler @ 21 NONAME ; ## + _ZTV25CBrowserLauncherExtension @ 22 NONAME ; ## + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/group/BrowserLauncher.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/group/BrowserLauncher.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file +* +*/ + +#include +#include + +TARGET BrowserLauncher.dll +TARGETTYPE dll +UID 0x1000008d 0x101F8559 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#if defined(ARMCC) + DEFFILE ../EABI/BROWSERLAUNCHERU_EKA2.def +#elif defined( WINSCW ) + DEFFILE ../BWinsCw/BROWSERLAUNCHERU_EKA2.def +#endif + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../Inc +USERINCLUDE ../../BrowserAppInc +USERINCLUDE ../../SettingsInc +USERINCLUDE ../../FeedsInc +USERINCLUDE ../../SrcData + +#include "../../Group/BrowserLogger.inc" + +SOURCEPATH ../Src +SOURCE BrowserLauncher.cpp +SOURCE BrowserLauncherExtension.cpp +SOURCE LauncherReceiveHandler.cpp +SOURCE LauncherServerBase.cpp +SOURCE LauncherClientService.cpp +SOURCE ../../BrowserAppSrc/Logger.cpp + +LIBRARY euser.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY favouritesengine.lib +LIBRARY efsrv.lib +LIBRARY APPARC.lib +LIBRARY eikcore.lib +LIBRARY estor.lib +LIBRARY servicehandler.lib +LIBRARY centralrepository.lib +LIBRARY sysutil.lib + +#if defined( I__BROWSER_LOG_ENABLED ) +LIBRARY flogger.lib +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build information file +* +* +*/ + +#include +PRJ_PLATFORMS + +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +BrowserLauncher.mmp + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/inc/BrowserLauncherExtension.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/inc/BrowserLauncherExtension.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: BrowserLauncherExtension +* +*/ + + + +#ifndef BROWSERLAUNCHEREXTENSION_H +#define BROWSERLAUNCHEREXTENSION_H + +// INCLUDES +#include +#include +#include +#include "LauncherClientService.h" + +// FORWARD DECLARATIONS +class CBrowserLauncher; +class CLauncherCommandAbsorbingControl; +//class MLaunchedServerObserver; + +// CLASS DECLARATION + +/** +* Browser Launcher extension class. +*/ +class CBrowserLauncherExtension : public CActive, + public MLaunchedServerObserver + { + public: // Constructors and destructor + + static CBrowserLauncherExtension* NewL( CBrowserLauncher& aLauncher ); + virtual ~CBrowserLauncherExtension(); + + public: // New functions + + /** + * Wait for the Browser to finish the asynchronous execution. + * This method uses CActiveSchedulerWait! + * @return Exit code. + */ + TInt WaitBrowserToFinish(); + + /** + * Set the packed laucher data. Ownership transferred. + */ + void SetPackedLauncherData( HBufC8* aBuf ); + + private: // Functions from CActive + + virtual void DoCancel(); + virtual void RunL(); + virtual TInt RunError( TInt aError ); + + private: // From MLaunchedServerObserver + + virtual void HandleServerAppExit( TInt aReason ); + virtual void HandleReceivedDataL( TRequestStatus aStatus ); + + private: // Constructors + + CBrowserLauncherExtension( CBrowserLauncher& aLauncher ); + void ConstructL(); + + public: // Data members + + CBrowserLauncher& iLauncher; ///< Reference to the Launcher. + MAknServerAppExitObserver* iBrowserLauncherClientExitObserver; // uses-a + CActiveSchedulerWait iWait; + TInt iExitCode; + MDownloadedContentHandler *iDownloadedContentHandler; // uses-a + // Buffer to hold the data, that the server sends. + // The buffer should be allocated by the client, on receiving + // server HandleReceivedDataL() events. + HBufC8* iReceiveBuffer; + // The size of the buffer, which the client should allocate, to + // create iReceiveBuffer. This value is set on handling + // HandleReceivedDataL() event. + TInt iBufferSize; + // The prev member packed into a ptr + TPckg iBufferSizeP; + RLauncherClientService iLauncherClientService; + TFileName iDownloadedFileName; + HBufC8* iPackedLauncherData; // Owned. + + private: + CLauncherCommandAbsorbingControl* iCommandAbsorber; + }; + +#endif // BROWSERLAUNCHEREXTENSION_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/inc/LauncherClientService.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/inc/LauncherClientService.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for RLauncherClientService +* +* +*/ + + +#ifndef __LAUNCHERCLIENTSERVICE_H +#define __LAUNCHERCLIENTSERVICE_H + +// INCLUDE FILES +#include +#include +#include +#include "LauncherServerCommands.hrh" + +// FORWARD DECLARATIONS +class CLauncherReceiveHandler; + +// CLASS DECLARATION +// Observer class, observes server application events. +class MLaunchedServerObserver: public MAknServerAppExitObserver + { +public: + + /** + * Notifies the client, that implements this class, about + * the server sent data. + * @param aStatus The status of the result of the completion. + */ + virtual void HandleReceivedDataL( TRequestStatus aStatus ) = 0; + + }; + +// CLASS DECLARATION +class RLauncherClientService : public RAknAppServiceBase + { +public: + /** + * Returns the ID of this service. + * @return The UID of the service. + */ + TUid ServiceUid() const; + + /** + * Initializes this object. Call this before using this object. + * @param aServerAppUid The UID of the server application. + * @param aServerObserver Observes the server application. + */ + void InitializeL( TUid aServerAppUid, MLaunchedServerObserver& aServerObserver ); + + /** + * Starts listening to the server application, so the observer + * will be notified about server application events. + */ + void ListenL(); + + /** + * Stops listening to the server application, so the observer + * will not be notified about server application events. + */ + void StopListening(); + + /** + * Destroy the object and release all memory objects + */ + void Close(); + + /** + * Send data to process by the server application syncronously. + * @param aBufferToSend The data to send. + * @return The completion code of the processed data. + */ + TInt SendSync( TDesC8& aBufferToSend ); + + /** + * Send data to process by the server application asyncronously. + * @param aBufferToSend Data to send. + * @param aBufferSize The size of the buffer which the client should + * allocate, to receive the data from server, + * before calling SendSyncBuffer() with the + * allocated descriptor. aBufferSize is defined + * by the server. + */ + void SendAsync( TDesC8& aBufferToSend,TDes8& aBufferSize ); + + /** + * Send data to process by the server application asyncronously. + * @param aBufferToSend Data to send. + * @param aBufferSize The size of the buffer which the client should + * allocate, to receive the data from server, + * before calling SendSyncBuffer() with the + * allocated descriptor. aBufferSize is defined + * by the server. + */ + void SendAsync(); + + void SendAsync(TDes8& aBufferSize ); + /** + * Send data to process by the server application syncronously. + * @param aReceiveBuffer Buffer, which will be filled by the + * server application. + */ + TInt SendSyncBuffer( TDes8 &aReceiveBuffer ); + + TInt SendSyncBools( TBool aClientWantsToContinue, TBool aWasContentHandled ); + + /** + * Send a command to execute by the server application. Server + * commands can be found in ServerCommands.hrh. + * Possibile commands: EOpenDownloadedContent, EServerExit. + * @param aCommand Command to send. + * @return The result of the processed command data. + */ + TInt SendCommand( TInt aCommand ); + +private: + + /** + * Cancel receiving data. + */ + void CancelReceive(); + +public: + + /* + * Observes server application exit. Owned! + */ + CApaServerAppExitMonitor* iServerExitMonitor; + + friend class CLauncherReceiveHandler; + +private: + + /* + * Active object that is notified when receiving data ayncronously from + * server application. Internal use only. Owned! + */ + CLauncherReceiveHandler* iActiveHandler; +}; + +#endif // __LAUNCHER_H + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/inc/LauncherReceiveHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/inc/LauncherReceiveHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CBrowserAppUi +* +* +*/ + + +#ifndef __LAUNCHERRECEIVEHANDLER_H__ +#define __LAUNCHERRECEIVEHANDLER_H__ + +// INCLUDE FILES +#include +#include "Launcherclientservice.h" + +// CLASS DECLARATION +class CLauncherReceiveHandler : public CActive +{ +public: + /** + * Default constructor. + * @param aHandler Notify events of server exit, and server asyncronous data handling. + * @param aSession Session of the RLauncherClientService + */ + CLauncherReceiveHandler( MLaunchedServerObserver* aHandler, RLauncherClientService& aSession ); + + /** + * Destroy the object and release all memory objects. + */ + ~CLauncherReceiveHandler(); + + /** + * Create a CLauncherReceiveHandler object. + * @param aHandler Notify events of server exit, and server asyncronous data handling. + * @param aSession Session of the RLauncherClientService + * @return A pointer to the created instance of CLauncherReceiveHandler + */ + static CLauncherReceiveHandler* NewL( MLaunchedServerObserver* aHandler, RLauncherClientService& aSession ); + + /** + * Create a CLauncherReceiveHandler object + * @param aHandler Notify events of server exit, and server asyncronous data handling. + * @param aSession Session of the RLauncherClientService + * @return A pointer to the created instance of CLauncherReceiveHandler + */ + static CLauncherReceiveHandler* NewLC( MLaunchedServerObserver* aHandler, RLauncherClientService& aSession ); + + /** + * Second phase constructor. + */ + void ConstructL(); + + /** + * Starts listening of the server appliacion, so the client can be notified + * when the server application sends data. + */ + void StartListen(); + +protected: // from CActive + /** + * Cancel any outstanding requests + */ + void DoCancel(); + + /** + * Respond to an event + */ + void RunL(); + +private: + /** + * Observes server application events. + */ + MLaunchedServerObserver* iServerObserver; // "uses-a" + + /** + * Reference to the current session. + */ + RLauncherClientService& iSession; // "uses-a" +}; + +#endif // __LAUNCHERReceiveHANDLER_H__ + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/inc/LauncherServerBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/inc/LauncherServerBase.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CLauncherServerBase +* +* +*/ + + +#ifndef __LAUNCHERSERVERBASE_H__ +#define __LAUNCHERSERVERBASE_H__ + +// INCLUDE FILES +#include +#include + +// FORWARD DECLARATION +class TBrowserOverriddenSettings; +class CBrowserAppDocument; +class CBrowserAppUi; + +// CLASS DECLARATION +class CLauncherServerBase : public CAknAppServiceBase +{ +public: + + /** + * Default constructor + */ + IMPORT_C CLauncherServerBase(); + + /** + * Handle incoming IPC messages. + * @param aMessage Object which encapsulates a client request. + */ + IMPORT_C void ServiceL( const RMessage2& aMessage ); + + /** + * Pointer to the Browser`s Ui. + */ + CBrowserAppUi* iBrowserAppUi; // not owned + +private: + + /** + * Handle syncronous messages. Parse the recieved message, + * and call ProcessMessageSyncL + * @param aMessage Object which encapsulates a client request. + */ + void HandleMessageSyncL( /*const RMessage2& aMessage*/ ); + + /** + * Handle asyncronous messages. Parse the recieved message, + * and call ProcessMessageASyncL. + * @param aMessage Object which encapsulates a client request. + */ + void HandleMessageASyncL( /*const RMessage2& aMessage*/ ); + + /** + * + * @param aMessage Object which encapsulates a client request. + */ + void HandleMessageSyncBufferL( /*const RMessage2& aMessage*/ ); + + /** + * + * @param aMessage Object which encapsulates a client request. + */ + void HandleMessageSyncBoolsL( /*const RMessage2& aMessage*/ ); + + /** + * + * @param aMessage Object which encapsulates a client request. + */ + void HandleBrowserExit( /*const RMessage2& aMessage*/ ); + + + /** + * Process incoming messages syncronously. + * @param aEmbeddingApplicationUid Embedding application`s UID + * @param aSettings Overridden user preferences. + * @param aFolderUid Uid of the folder that the Browser should open. + * @param aSeamlessParam + * @param aIsContentHandlerRegistered True if a content handler is registered + * @return The result of processing. ( same as SendRecieve() ) + */ + virtual TInt ProcessMessageSyncL( TUid aEmbeddingApplicationUid, + TBrowserOverriddenSettings aSettings, + TInt aFolderUid, TPtrC aSeamlessParam, + TBool aIsContentHandlerRegistered ) = 0; + + /** + * Process incoming messages asyncronously. + * @param aEmbeddingApplicationUid Embedding application`s UID + * @param aSettings Overridden user preferences. + * @param aFolderUid Uid of the folder that the Browser should open. + * @param aSeamlessParam + * @param aIsContentHandlerRegistered True if a content handler is registered + * @param isOverridenSettings True if the client sended an overidden setting + */ + virtual void ProcessMessageASyncL( TUid aEmbeddingApplicationUid, + TBrowserOverriddenSettings aSettings, + TInt aFolderUid, + TPtrC aSeamlessParam, + TBool aIsContentHandlerRegistered, + TBool aIsOverridenSettings ) = 0; + + /** + * Process incoming messages asyncronously. + * @param aMessage Object which encapsulates a client request. + * @param aSettings Overridden user preferences. + * @param aFolderUid Uid of the folder that the Browser should open. + * @param aSeamlessParam + * @param aParam The index of the parameter, in SendRecieve() function`s + * parameters, which is the buffer on client side. + */ + virtual TInt ProcessMessageSyncBufferL( ) = 0; + + /** + * Process TBool parameters. + */ + virtual void ProcessBoolsL( TBool aClientWantsToContinue, TBool aWasContentHandled ) = 0; + + /** + * Process BrowserExit. + */ + virtual void DoBrowserExit( ) = 0; + +protected: + + /** + * Buffer which will be copied to the client`s address + * space on completing asyncronous requests. + */ + HBufC8* iClientBuffer; + + /** + * Pointer to the Browser`s document. + */ + CBrowserAppDocument* iBrowserDocument; // not owned + + /** + * Object which encapsulates a copy of a client request. + */ + RMessage2 iMySyncMessage; // One slot for synchronous requests. + RMessage2 iMyAsyncMessage; // One slot for asynchronous requests. + +/* Capability check will come later... +public: + CLauncherServerBase( TCapability aClientReqs ); + +private: + CPolicyServer::TCustomResult SecurityCheckL ( const RMessage2& aMsg, + TInt& aAction, + TSecurityInfo& aMissing ); + TCapability iClientReqs; +*/ +}; + +#endif // __LAUNCHERSERVERBASE_H__ + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/inc/LauncherServerCommands.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/inc/LauncherServerCommands.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* contains common definitions for menu id:s +* +* +*/ + + +#ifndef LAUNCHERSERVERCOMMANDS_HRH +#define LAUNCHERSERVERCOMMANDS_HRH + +// Commands +enum TIpcMessageIds + { + ELauncherSendSync = RApaAppServiceBase::KServiceCmdBase, + ELauncherSendASync, + ELauncherSendASyncListen, + ELauncherCancelReceive, + ELauncherSendSyncBuffer, + ELauncherSendSyncBools + }; + +enum TClientStatus + { + EListenAlreadyListening + }; +#endif + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/src/BrowserLauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/src/BrowserLauncher.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,563 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: BrowserLauncher +* +*/ + +// INCLUDE FILES +#include +#include "BrowserLauncherExtension.h" +#include "logger.h" +#include "BrowserUiPrivateCRKeys.h" +#include +#include "Browser.hrh" + +#include // Context Id:s +#include +#include +#include +#include +#include +#include + +// CONSTANTS +const TInt KBrowserAppUid = 0x10008D39; +const TInt KBrowserSeamlessParamLength = 20; +_LIT( KBookmarkStarterString, "1 " ); +const TInt KMinimumCDriveDiskSpace = 512 * 1024; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::CBrowserLauncher +// ----------------------------------------------------------------------------- +// +CBrowserLauncher::CBrowserLauncher() + { + iBrowserUid = TUid::Uid( KBrowserAppUid ); + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::ConstructL +// ----------------------------------------------------------------------------- +// +void CBrowserLauncher::ConstructL() + { + LOG_CREATE; + LOG_ENTERFN( "CBrowserLauncher::ConstructL" ); + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::NewLC +// ----------------------------------------------------------------------------- +// +EXPORT_C +CBrowserLauncher* CBrowserLauncher::NewLC() + { + LOG_ENTERFN( "CBrowserLauncher::NewLC" ); + CBrowserLauncher* self = new(ELeave) CBrowserLauncher(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C +CBrowserLauncher* CBrowserLauncher::NewL() + { + LOG_ENTERFN( "CBrowserLauncher::NewL" ); + CBrowserLauncher* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::NewLC +// ----------------------------------------------------------------------------- +// +EXPORT_C +CBrowserLauncher* CBrowserLauncher::NewLC( TInt /*aOverrideBrowserUid*/ ) + { + LOG_ENTERFN( "CBrowserLauncher::NewLC(TInt aOverrideBrowserUid) IS DEPRECATED" ); + CBrowserLauncher* self = new(ELeave) CBrowserLauncher(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C +CBrowserLauncher* CBrowserLauncher::NewL( TInt /*aOverrideBrowserUid*/ ) + { + LOG_ENTERFN( "CBrowserLauncher::NewL(TInt aOverrideBrowserUid) IS DEPRECATED" ); + CBrowserLauncher* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +// Destructor +EXPORT_C +CBrowserLauncher::~CBrowserLauncher() + { + LOG_ENTERFN( "CBrowserLauncher::~CBrowserLauncher" ); + Cancel(); + } + +// ---------------------------------------------------------------------------- +// CBrowserLauncher::LaunchBrowserEmbeddedL +// ---------------------------------------------------------------------------- +// +EXPORT_C +void CBrowserLauncher::LaunchBrowserEmbeddedL + ( const TDesC& aParams, + MDownloadedContentHandler* aContentHandler, + MAknServerAppExitObserver* aExitObserver, + TBrowserOverriddenSettings* aSettings ) + { + LaunchBrowserEmbeddedL + ( aParams, + /*aContextId*/KErrNotFound, + aContentHandler, + aExitObserver, + aSettings ); + } + +// ---------------------------------------------------------------------------- +// CBrowserLauncher::LaunchBrowserEmbeddedL +// ---------------------------------------------------------------------------- +// +EXPORT_C +void CBrowserLauncher::LaunchBrowserEmbeddedL + ( TInt aContextId, + MDownloadedContentHandler* aContentHandler, + MAknServerAppExitObserver* aExitObserver, + TBrowserOverriddenSettings* aSettings ) + { + LaunchBrowserEmbeddedL + ( /*aParams*/KNullDesC, + aContextId, + aContentHandler, + aExitObserver, + aSettings ); + } + +// ---------------------------------------------------------------------------- +// CBrowserLauncher::LaunchBrowserSyncEmbeddedL +// ---------------------------------------------------------------------------- +// +EXPORT_C +TInt CBrowserLauncher::LaunchBrowserSyncEmbeddedL + ( const TDesC& aParams, + MDownloadedContentHandler* aContentHandler, + TBrowserOverriddenSettings* aSettings ) + { + LaunchBrowserEmbeddedL + ( aParams, + /*aContextId*/KErrNotFound, + aContentHandler, + /*aExitObserver*/0, + aSettings ); + + return (iExtension->WaitBrowserToFinish()); + } + +// ---------------------------------------------------------------------------- +// CBrowserLauncher::LaunchBrowserSyncEmbeddedL +// ---------------------------------------------------------------------------- +// +EXPORT_C +TInt CBrowserLauncher::LaunchBrowserSyncEmbeddedL + ( TInt aContextId, + MDownloadedContentHandler* aContentHandler, + TBrowserOverriddenSettings* aSettings ) + { + LaunchBrowserEmbeddedL + ( /*aParams*/KNullDesC, + aContextId, + aContentHandler, + /*aExitObserver*/0, + aSettings ); + + return (iExtension->WaitBrowserToFinish()); + } + +// ---------------------------------------------------------------------------- +// CBrowserLauncher::Cancel +// ---------------------------------------------------------------------------- +// +EXPORT_C +void CBrowserLauncher::Cancel() + { + // Terminate the Browser + delete iExtension; + iExtension = 0; + iFavouritesSess.Close(); + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::LaunchBrowserEmbeddedL +// If aParams is not empty, then it is used, otherwise aContextId is used. +// ----------------------------------------------------------------------------- +// +void CBrowserLauncher::LaunchBrowserEmbeddedL + ( const TDesC& aParams, + TInt aContextId, + MDownloadedContentHandler* aContentHandler, + MAknServerAppExitObserver* aExitObserver, + TBrowserOverriddenSettings* aSettings ) + { + LOG_ENTERFN( "CBrowserLauncher::LaunchBrowserEmbeddedL" ); + + LOG_WRITE_FORMAT(" aParams: [%S]", &aParams); + LOG_WRITE_FORMAT(" aContextId: %d", aContextId); + LOG_WRITE_FORMAT(" aContentHandler: 0x%x", aContentHandler); + LOG_WRITE_FORMAT(" aExitObserver: 0x%x", aExitObserver); + LOG_WRITE_FORMAT(" aSettings: 0x%x", aSettings); + + // Check for ciritical disk space if starts as embeded + RFs fs; + User::LeaveIfError(fs.Connect()); + TInt drive( EDriveC ); + TBool isSpace( EFalse ); + TInt err( KErrNone ); + TRAP( err, isSpace = !SysUtil::DiskSpaceBelowCriticalLevelL(&fs, KMinimumCDriveDiskSpace, drive )); + fs.Close(); + if (!isSpace) + User::Leave(KErrDiskFull); + + + TInt folderUid = 0; + TInt folderPreferredUid = 0; + + // keep a local ptr to aSettings + TBrowserOverriddenSettings* aOverrideSettings = aSettings; + + TUid embeddingAppUid = CEikonEnv::Static()->EikAppUi()->Application()->AppDllUid(); + LOG_WRITE_FORMAT(" embeddingAppUid: 0x%x", embeddingAppUid); + + iExtension = CBrowserLauncherExtension::NewL( *this ); + User::LeaveIfError( iFavouritesSess.Connect() ); + + if ( 0 == aParams.Length() ) + { + // SPECIAL folder UID handling + folderUid = KFavouritesNullUid; + TUint specialContextId = EBrowserContextIdNormal; + + switch(aContextId) + { + case KFavouritesFeedsContextId: + // For feeds, leave uid to Root as it is here. + // Upon launch, browser will then switch into the Feeds view + // upon opening. + specialContextId = EBrowserContextIdFeeds; + folderUid = KFavouritesRootUid; + folderPreferredUid = KFavouritesNullUid; + break; + default: + break; + } + + // If we have now just set the folderUid, then + // we need to tell browser of the context id if it's not done already + if(folderUid != KFavouritesNullUid) + { + // if we're already given override settings and the specialContextId + // is not already given, set it now + if(aOverrideSettings) + { + if(aOverrideSettings->GetBrowserSetting(EBrowserOverSettingsContextId) != EBrowserContextIdUndefined) + { + aOverrideSettings->SetBrowserSetting(EBrowserOverSettingsContextId, specialContextId); + } + } + else + { + aOverrideSettings = new (ELeave) TBrowserOverriddenSettings; + CleanupStack::PushL( aOverrideSettings ); + aOverrideSettings->SetBrowserSetting(EBrowserOverSettingsContextId, specialContextId); + } + } + if(folderUid == KFavouritesNullUid) + { + // Resolve folder uid + folderUid = FolderByContextIdL( aContextId ); + if ( folderUid == KFavouritesNullUid ) + { + folderUid = KFavouritesRootUid; + } + folderPreferredUid = BookmarksIdByFolderIdL( folderUid ); + } + } + LOG_WRITE_FORMAT("folderPreferredUid = 0x%x", folderPreferredUid ); + + // Initialize client and connect to Browser application. + iExtension->iLauncherClientService.InitializeL( iBrowserUid, *iExtension ); + + LOG_WRITE("After iLauncherClientService.InitializeL "); + + // Start listening to Browser application. + iExtension->iLauncherClientService.ListenL( ); + LOG_WRITE("After iLauncherClientService.ListenL "); + + // Set handler of finished download. + iExtension->iDownloadedContentHandler = aContentHandler; + // Set handler of server exit. + iExtension->iBrowserLauncherClientExitObserver = aExitObserver; + + HBufC* seamlessParam = 0; + if ( !aParams.Length() && folderPreferredUid && EnhancedSeamlessLinkLocalFeaturesSupportedL() ) + { + seamlessParam = HBufC::NewLC( KBrowserSeamlessParamLength ); + seamlessParam->Des().Copy( KBookmarkStarterString ); + seamlessParam->Des().AppendNum( folderPreferredUid ); + } + + // Pack aSettings,folderUid,aParams into a descriptor, and send the + // data to Browser application. + // Note: if seamlessParam is not empty, it must be used instead of aParams! + HBufC8* bufferToSend = 0; + if ( seamlessParam ) + { + // Create descriptor with seamless seamlessParam + bufferToSend = TLauncherPackageUtils::PackLauncherDataL( embeddingAppUid, aOverrideSettings, folderUid, *seamlessParam, aContentHandler!=0 ); + } + else + { + // Create descriptor with seamless aParams + bufferToSend = TLauncherPackageUtils::PackLauncherDataL( embeddingAppUid, aOverrideSettings, folderUid, aParams, aContentHandler!=0 ); + } + // Remember for this buffer in the Extension, because re-initialization. + iExtension->SetPackedLauncherData( bufferToSend ); + + // dbg + // iExtension->iLauncherClientService.SendCommand( EServerExit ); + // iExtension->iLauncherClientService.SendSync( *bufferToSend ); + // dbg + + // Send parameters to Browser application. + iExtension->iLauncherClientService.SendAsync( *bufferToSend, iExtension->iBufferSizeP ); + + if ( seamlessParam ) + { + CleanupStack::PopAndDestroy( seamlessParam ); // seamlessParam + } + + // Cleanup overridden settings. If it was passed in as NULL, and the local + // version is not, it means we allocated locally for it. Cleanup + if(!aSettings && aOverrideSettings) + { + CleanupStack::PopAndDestroy(1); //aOverrideSettings + } + LOG_WRITE("LaunchBrowserEmbeddedL End "); + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::FolderByContextIdL +// ----------------------------------------------------------------------------- +// +TInt CBrowserLauncher::FolderByContextIdL( TUint32 aContextId ) + { + LOG_ENTERFN( "CBrowserLauncher::FolderByContextIdL" ); + + TInt folder = KFavouritesNullUid; + if ( aContextId != (TUint32)KFavouritesNullContextId ) + { + CArrayFix* uids = new (ELeave) CArrayFixFlat( 1 ); + CleanupStack::PushL( uids ); + + RFavouritesDb db; + User::LeaveIfError( db.Open( iFavouritesSess, KBrowserBookmarks ) ); + CleanupClosePushL( db ); + User::LeaveIfError( db.GetUids( *uids, KFavouritesNullUid, + CFavouritesItem::EFolder, NULL, aContextId ) ); + + if( uids->Count() > 0 ) + { + folder = uids->At( 0 ); + } + CleanupStack::PopAndDestroy( 2 ); // db, uids + } + + return folder; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::BookmarksIdByFolderIdL +// ----------------------------------------------------------------------------- +// +TInt CBrowserLauncher::BookmarksIdByFolderIdL( TUint32 aFolderId ) + { + TInt bookmarkId = KFavouritesNullUid; + if ( aFolderId != (TUint32)NULL ) + { + + RFavouritesDb db; + User::LeaveIfError( db.Open( iFavouritesSess, KBrowserBookmarks ) ); + CleanupClosePushL( db ); + User::LeaveIfError( db.PreferredUid( aFolderId , bookmarkId ) ); + + CleanupStack::PopAndDestroy( ); // db + } + return bookmarkId; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncher::EnhancedSeamlessLinkLocalFeaturesSupportedL +// ----------------------------------------------------------------------------- +// +TBool CBrowserLauncher::EnhancedSeamlessLinkLocalFeaturesSupportedL() + { + TBool supported = EFalse; + TInt featureBitmask; + + CRepository* repository = CRepository::NewL( KCRUidBrowserUiLV ); + //Read local features bitmask + if ( repository->Get( KBrowserUiCommonFlags, featureBitmask ) != KErrNone ) + { + featureBitmask = 0; + } + if ( featureBitmask /*& KBrowserUiPreferredBookmarks*/ ) + { + supported = ETrue; + } + delete repository; + + return supported; + } + +// --------------------------------------------------------- +// TLauncherPackageUtils::PackLauncherDataL() +// --------------------------------------------------------- +// +HBufC8* TLauncherPackageUtils::PackLauncherDataL( const TUid aEmbeddingAppUid, + const TBrowserOverriddenSettings* aSettings, + TInt folderUid, + const TDesC& seamlessParam, + TBool aIsContentHandlerRegistered ) + { + TBool isOverriddenSettings( EFalse ); + + // Check if the overridden settings was set + if ( aSettings ) + { + isOverriddenSettings = ETrue; + } + + // Create the package + TPckgC embeddingAppUidPckg( aEmbeddingAppUid ); + TPckgC isOverriddenSettingsPckg( isOverriddenSettings ); + TPckgC* pSettingsPckg( 0 ); + if ( aSettings ) + { + // Put Overridden settings in package if it is not NULL + pSettingsPckg = new (ELeave) TPckgC( *aSettings ); + CleanupStack::PushL( pSettingsPckg ); + } + TPckgC folderUidPckg( folderUid ); + TPtrC8 seamlessParamPtr( (const TUint8*)seamlessParam.Ptr(), seamlessParam.Size() ); + TPckgC isContentHandlerRegistered( aIsContentHandlerRegistered ); + + // Get the size of all packages + TInt totalSize; + if ( aSettings ) + { + totalSize = embeddingAppUidPckg.Size() + + isOverriddenSettingsPckg.Size() + + (*pSettingsPckg).Size() + + folderUidPckg.Size() + + seamlessParamPtr.Size() + + isContentHandlerRegistered.Size(); + } + else + { + totalSize = embeddingAppUidPckg.Size() + + isOverriddenSettingsPckg.Size() + + folderUidPckg.Size() + + seamlessParamPtr.Size() + + isContentHandlerRegistered.Size(); + } + + // Allocate buffer for packages + HBufC8* buff = HBufC8::NewL( totalSize ); + + // Pack the packages to buffer + buff->Des().Copy( embeddingAppUidPckg ); + buff->Des().Append( isOverriddenSettingsPckg ); + if ( aSettings ) + { + buff->Des().Append( *pSettingsPckg ); + } + buff->Des().Append( folderUidPckg ); + buff->Des().Append( isContentHandlerRegistered ); + buff->Des().Append( seamlessParamPtr ); + + if ( aSettings ) + { + CleanupStack::PopAndDestroy( ); // pSettingsPckg + } + return buff; + } + +// --------------------------------------------------------- +// TLauncherPackageUtils::PackLauncherDataL() +// --------------------------------------------------------- +// +void TLauncherPackageUtils::UnPackLauncherDataL( TUid& aEmbeddingAppUid, TBrowserOverriddenSettings* aSettings, TInt& aFolderUid, TPtrC& aSeamlessParam, const TDesC8& aData, TBool& aIsContentHandlerRegistered, TBool& aIsOverriddenSettings ) + { + TInt pos( 0 ); + + // Get the first parameter aEmbeddingAppUid from IPC data + TPckg embeddingAppUid( aEmbeddingAppUid ); + embeddingAppUid.Copy( aData.Mid( pos, embeddingAppUid.Size() ) ); + pos += embeddingAppUid.Size(); + + // Get the parameter isOverriddenSettings from IPC data + TPckg isOveriddenSettings( aIsOverriddenSettings ); + isOveriddenSettings.Copy( aData.Mid( pos, isOveriddenSettings.Size() ) ); + pos += isOveriddenSettings.Size(); + + if ( aIsOverriddenSettings ) + { + // Unpack the overridden settings + TPckg settingsPckg( *aSettings ); + settingsPckg.Copy( aData.Mid( pos, settingsPckg.Size() ) ); + pos += settingsPckg.Size(); + } + else + { + // No overridden setings were put in IPC data + aSettings = NULL; + } + + // Get second parameters from IPC data + TPckg folderUidPckg( aFolderUid ); + folderUidPckg.Copy( aData.Mid( pos, folderUidPckg.Size() ) ); + pos += folderUidPckg.Size(); + + // Get third parameters from IPC data + TPckg isContentHandlerRegistered( aIsContentHandlerRegistered ); + isContentHandlerRegistered.Copy( aData.Mid( pos, isContentHandlerRegistered.Size() ) ); + pos += isContentHandlerRegistered.Size(); + + TPtrC8 remaining = aData.Mid( pos ); + aSeamlessParam.Set( (const TUint16*)remaining.Ptr(), remaining.Size()/2 ); + } +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/src/BrowserLauncherExtension.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/src/BrowserLauncherExtension.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,368 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: BrowserLauncherExtension +* +*/ + +// INCLUDE FILES +#include +#include "BrowserLauncherExtension.h" +#include "logger.h" +#include +#include // Context Id:s + +#include +#include +#include +#include +#include + +NONSHARABLE_CLASS( CLauncherCommandAbsorbingControl ) : public CCoeControl + { + public: + /** + * Two-phased constructor. + */ + static CLauncherCommandAbsorbingControl* NewL( CActiveSchedulerWait& aWaiter, TInt& aExitCode ); + + /** + * Destructor. + */ + ~CLauncherCommandAbsorbingControl(); + + /** + * Set enabled/disabled status + */ + inline void SetEnabled( TBool aEnabled ) { iEnabled = aEnabled; } + + private: + /** + * From CCoeControl + */ + virtual TKeyResponse OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/ ); + + private: + /** + * C++ default constructor. + */ + CLauncherCommandAbsorbingControl( CActiveSchedulerWait& aWaiter, TInt& aExitCode ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + private: // Data + CEikAppUi* iAppUi; + CActiveSchedulerWait& iWaiter; + TBool iEnabled; + TInt& iExitCode; + }; + + +// ============================ MEMBER FUNCTIONS =============================== + + +// --------------------------------------------------------- +// CLauncherCommandAbsorbingControl::CLauncherCommandAbsorbingControl +// +// --------------------------------------------------------- +// +CLauncherCommandAbsorbingControl::CLauncherCommandAbsorbingControl( CActiveSchedulerWait& aWaiter, TInt& aExitCode ) +: iWaiter( aWaiter ), iExitCode( aExitCode ) + { + } + + +// --------------------------------------------------------- +// CLauncherCommandAbsorbingControl::~CLauncherCommandAbsorbingControl +// +// --------------------------------------------------------- +// +CLauncherCommandAbsorbingControl::~CLauncherCommandAbsorbingControl() + { + if ( iCoeEnv && iAppUi ) + { + iAppUi->RemoveFromStack( this ); + } + } + + +// --------------------------------------------------------- +// CLauncherCommandAbsorbingControl::NewLC +// +// --------------------------------------------------------- +// +CLauncherCommandAbsorbingControl* CLauncherCommandAbsorbingControl::NewL( CActiveSchedulerWait& aWaiter, TInt& aExitCode ) + { + CLauncherCommandAbsorbingControl* self = new( ELeave ) CLauncherCommandAbsorbingControl( aWaiter, aExitCode ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------- +// CLauncherCommandAbsorbingControl::ConstructL +// +// --------------------------------------------------------- +// +void CLauncherCommandAbsorbingControl::ConstructL() + { + iAppUi = iEikonEnv->EikAppUi(); + // + CreateWindowL(); + SetExtent( TPoint( 0,0 ), TSize( 0,0 ) ); + ActivateL(); + SetPointerCapture( ETrue ); + ClaimPointerGrab( ETrue ); + // + iAppUi->AddToStackL( this, ECoeStackPriorityDialog ); + } + + +// --------------------------------------------------------- +// CLauncherCommandAbsorbingControl::OfferKeyEventL +// +// --------------------------------------------------------- +// +TKeyResponse CLauncherCommandAbsorbingControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse response = EKeyWasNotConsumed; + // + if ( iEnabled ) + { + if ( aKeyEvent.iCode == EKeyEscape && aType == EEventKey ) + { + if ( iWaiter.IsStarted() ) + { + iExitCode = KErrCancel; + iWaiter.AsyncStop(); + } + } + + response = EKeyWasConsumed; + } + // + return response; + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::CBrowserLauncherExtension +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBrowserLauncherExtension::CBrowserLauncherExtension + ( CBrowserLauncher& aLauncher ) +: CActive( CActive::EPriorityStandard ), iLauncher( aLauncher ), iBufferSizeP( iBufferSize ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherExtension::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBrowserLauncherExtension* CBrowserLauncherExtension::NewL( CBrowserLauncher& aLauncher ) + { + LOG_ENTERFN( "CBrowserLauncherExtension::NewL" ); + CBrowserLauncherExtension* self = new (ELeave) CBrowserLauncherExtension( aLauncher ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CBrowserLauncherExtension::~CBrowserLauncherExtension() + { + LOG_ENTERFN( "CBrowserLauncherExtension::~CBrowserLauncherExtension" ); + Cancel(); + iLauncherClientService.Close(); + delete iReceiveBuffer; + delete iPackedLauncherData; + delete iCommandAbsorber; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::WaitBrowserToFinish +// ----------------------------------------------------------------------------- +// +TInt CBrowserLauncherExtension::WaitBrowserToFinish() + { + LOG_ENTERFN( "CBrowserLauncherExtension::WaitBrowserToFinish" ); + if( !iCommandAbsorber ) + { + iCommandAbsorber = CLauncherCommandAbsorbingControl::NewL( iWait, iExitCode ); + } + iCommandAbsorber->SetEnabled( ETrue ); + iWait.Start(); + iCommandAbsorber->SetEnabled( EFalse ); + + // This class will complete us as an MAknServerAppExitObserver. + return iExitCode; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::SetPackedLauncherData +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherExtension::SetPackedLauncherData( HBufC8* aBuf ) + { + delete iPackedLauncherData; + iPackedLauncherData = aBuf; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::DoCancel +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherExtension::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::RunL +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherExtension::RunL() + { + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::RunError +// ----------------------------------------------------------------------------- +// +TInt CBrowserLauncherExtension::RunError( TInt aError ) + { + return aError; + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::HandleServerAppExit +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherExtension::HandleServerAppExit( TInt aReason ) + { + LOG_ENTERFN( "CBrowserLauncherExtension::HandleServerAppExit" ); + if ( iWait.IsStarted() ) + { + /* If the Launcher was started synchronously, then + iBrowserLauncherClientExitObserver cannot be set => + no need to call iBrowserLauncherClientExitObserver->HandleServerAppExit() */ + + // Note down the exit reason + iExitCode = aReason; + iWait.AsyncStop(); + iCommandAbsorber->SetEnabled( EFalse ); + } + else if ( iBrowserLauncherClientExitObserver ) + { + // Forward the exit event + iBrowserLauncherClientExitObserver->HandleServerAppExit( aReason ); + } + } + +// ----------------------------------------------------------------------------- +// CBrowserLauncherExtension::HandleReceivedDataL +// ----------------------------------------------------------------------------- +// +void CBrowserLauncherExtension::HandleReceivedDataL( TRequestStatus aStatus ) + { + LOG_ENTERFN( "CBrowserLauncherExtension::HandleReceivedDataL" ); + + LOG_WRITE_FORMAT(" aStatus.Int(): %d", aStatus.Int()); + User::LeaveIfError( aStatus.Int() ); + + //--------------------create buffer for server----- + // Create buffer to hold data, sent by Browser application. + // iBufferSize was defined by the server by now... + delete iReceiveBuffer; + iReceiveBuffer = 0; + iReceiveBuffer = HBufC8::NewL( iBufferSize ); + TPtr8 tempRecBuf ( iReceiveBuffer->Des() ); + // Send the allocated descriptor to server, who fills it. + User::LeaveIfError( iLauncherClientService.SendSyncBuffer( tempRecBuf ) ); + // OK, buffer has been filled. + + //--------------------internalize stream----------- + // Create Stream object. + RDesReadStream readStream( tempRecBuf ); + CleanupClosePushL( readStream ); + // Create param list object + CAiwGenericParamList* paramList = CAiwGenericParamList::NewL( readStream ); + LOG_WRITE(" paramList OK"); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PushL( paramList ); + //--------------------eof internalize stream------- + + TBool clientWantsToContinue( EFalse ); + TBool wasContentHandled = EFalse; + + // If the embedding application handles the downloaded content. + if ( iDownloadedContentHandler ) + { + LOG_WRITE_FORMAT(" iDownloadedContentHandler: 0x%x", iDownloadedContentHandler); + // Extract the file name from the generic paam list + TInt index(0); + const TAiwGenericParam* paramFileName = + paramList->FindFirst( index, EGenericParamFile, EVariantTypeDesC ); + TPtrC fileName; + if ( index == KErrNotFound ) + { + fileName.Set( KNullDesC ); + } + else + { + fileName.Set( paramFileName->Value().AsDes() ); + } + + // Call the embedding app with these parameters, to handle the downloaded + // content + TRAPD( handlerLeave, wasContentHandled = + iDownloadedContentHandler->HandleContentL( + fileName, + *paramList, + clientWantsToContinue ) ); + ++handlerLeave; // To avoid warnings. Used for logging. + LOG_WRITE_FORMAT(" handlerLeave: %d", handlerLeave); + } + + // Tell the server app the output parameters + User::LeaveIfError( iLauncherClientService.SendSyncBools + ( clientWantsToContinue, wasContentHandled ) ); + + // This async request completed, reinitialize it + iLauncherClientService.SendAsync(iBufferSizeP); + + CleanupStack::PopAndDestroy( paramList ); // paramList + } + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/src/LauncherClientService.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/src/LauncherClientService.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CLauncherClientService +* +* +*/ + + +// INCLUDES +#include "LauncherClientService.h" +#include "LauncherReceiveHandler.h" +#include "logger.h" + +// ----------------------------------------------------------------------------- +// RLauncherClientService::ServiceUid() +// ----------------------------------------------------------------------------- +// +TUid RLauncherClientService::ServiceUid() const + { + return TUid::Uid( 0x01010101 ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::InitializeL() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::InitializeL + ( TUid aServerAppUid, MLaunchedServerObserver& aServerObserver ) + { + LOG_ENTERFN( "RLauncherClientService::InitializeL" ); + + iActiveHandler = CLauncherReceiveHandler::NewL( &aServerObserver, *this ); + CActiveScheduler::Add( iActiveHandler ); + + ConnectChainedAppL( aServerAppUid ); + iServerExitMonitor = CApaServerAppExitMonitor::NewL( *this, + aServerObserver, + CActive::EPriorityStandard ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::ListenL() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::ListenL() + { + LOG_ENTERFN( "RLauncherClientService::ListenL" ); + + if ( iActiveHandler ) + { + __ASSERT_DEBUG(!iActiveHandler->IsActive(), User::Panic(_L("Already Listening..."),1)); + iActiveHandler->StartListen(); + } + else + { + User::Leave( KErrNotFound ); + } + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::StopListening() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::StopListening() + { + LOG_ENTERFN( "RLauncherClientService::StopListening" ); + + // tell receive handler to cancel receive and stop listening + iActiveHandler->Cancel(); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendData() +// ----------------------------------------------------------------------------- +// +TInt RLauncherClientService::SendSync( TDesC8& aBufferToSend ) + { + LOG_ENTERFN( "RLauncherClientService::SendSync" ); + return SendReceive( ELauncherSendSync, TIpcArgs( &aBufferToSend ) ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendAsync() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::SendAsync( TDesC8& aBufferToSend, TDes8& aBufferSize ) + { + LOG_ENTERFN( "RLauncherClientService::SendAsync" ); + // If no previous request was done, which has not finished, + // then request is ok, send it... + SendReceive( ELauncherSendASync, TIpcArgs( &aBufferToSend, &aBufferSize ), + iActiveHandler->iStatus ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendAsync() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::SendAsync() + { + LOG_ENTERFN( "RLauncherClientService::SendAsyncListen" ); + // If no previous request was done, which has not finished, + // then request is ok, send it... + SendReceive( ELauncherSendASyncListen, iActiveHandler->iStatus ); + } + + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendAsync() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::SendAsync(TDes8& aBufferSize ) + { + LOG_ENTERFN( "RLauncherClientService::SendAsyncListen" ); + // If no previous request was done, which has not finished, + // then request is ok, send it... + + + TPckg dummyParam(0); + + SendReceive( ELauncherSendASyncListen, TIpcArgs( &dummyParam, &aBufferSize ),iActiveHandler->iStatus ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendSyncBuffer() +// ----------------------------------------------------------------------------- +// +TInt RLauncherClientService::SendSyncBuffer( TDes8& aReceiveBuffer ) + { + LOG_ENTERFN( "RLauncherClientService::SendSyncBuffer" ); + // Else reset the state of the request, and send the buffer with + // the size, set by the SendAsync() function + // So the server can write into it. + return SendReceive( ELauncherSendSyncBuffer, TIpcArgs( &aReceiveBuffer ) ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendSyncBools() +// ----------------------------------------------------------------------------- +// +TInt RLauncherClientService::SendSyncBools + ( TBool aClientWantsToContinue, TBool aWasContentHandled ) + { + LOG_ENTERFN( "RLauncherClientService::SendSyncBools" ); + // Else reset the state of the request, and send the buffer with + // the size, set by the SendAsync() function + // So the server can write into it. + return SendReceive( ELauncherSendSyncBools, + TIpcArgs( aClientWantsToContinue, aWasContentHandled ) ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::SendCommand() +// ----------------------------------------------------------------------------- +// +TInt RLauncherClientService::SendCommand( TInt aCommand ) + { + LOG_ENTERFN( "RLauncherClientService::SendCommand" ); + LOG_WRITE_FORMAT(" aCommand: %d", aCommand); + return SendReceive( aCommand, TIpcArgs() ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::CancelReceive() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::CancelReceive() + { + LOG_ENTERFN( "RLauncherClientService::CancelReceive" ); + SendReceive( ELauncherCancelReceive, TIpcArgs( 0 ) ); + } + +// ----------------------------------------------------------------------------- +// RLauncherClientService::Close() +// ----------------------------------------------------------------------------- +// +void RLauncherClientService::Close() + { + LOG_ENTERFN( "RLauncherClientService::Close" ); + + delete iActiveHandler; + iActiveHandler = 0; + LOG_WRITE(" iActiveHandler OK"); + + delete iServerExitMonitor; + iServerExitMonitor = 0; + LOG_WRITE(" iServerExitMonitor OK"); + + REikAppServiceBase::Close(); + LOG_WRITE(" ServiceBase::Close OK"); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/src/LauncherReceiveHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/src/LauncherReceiveHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CLauncherReceiveHandler +* +* +*/ + + +// INCLUDES +#include "LauncherReceiveHandler.h" +#include "logger.h" + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::CLauncherReceiveHandler() +// ----------------------------------------------------------------------------- +// +CLauncherReceiveHandler::CLauncherReceiveHandler( MLaunchedServerObserver* aServerObserver, RLauncherClientService& aSession ) +: CActive(CActive::EPriorityStandard), iSession ( aSession ) + { + iServerObserver = aServerObserver; + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::~CLauncherReceiveHandler() +// ----------------------------------------------------------------------------- +// +CLauncherReceiveHandler::~CLauncherReceiveHandler() + { + LOG_ENTERFN( "CLauncherReceiveHandler::~CLauncherReceiveHandler" ); + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::NewL() +// ----------------------------------------------------------------------------- +// +CLauncherReceiveHandler* CLauncherReceiveHandler::NewL( MLaunchedServerObserver* aServerObserver, RLauncherClientService& aSession ) + { + LOG_ENTERFN( "CLauncherReceiveHandler::NewL" ); + CLauncherReceiveHandler* self = NewLC( aServerObserver, aSession ); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::NewLC() +// ----------------------------------------------------------------------------- +// +CLauncherReceiveHandler* CLauncherReceiveHandler::NewLC( MLaunchedServerObserver* aServerObserver, RLauncherClientService& aSession ) + { + LOG_ENTERFN( "CLauncherReceiveHandler::NewLC" ); + CLauncherReceiveHandler* self = new (ELeave) CLauncherReceiveHandler( aServerObserver, aSession ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::ConstructL() +// ----------------------------------------------------------------------------- +// +void CLauncherReceiveHandler::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::StartListen() +// ----------------------------------------------------------------------------- +// +void CLauncherReceiveHandler::StartListen() + { + LOG_ENTERFN( "CLauncherReceiveHandler::StartListen" ); + iStatus = KRequestPending; + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::DoCancel() +// ----------------------------------------------------------------------------- +// +void CLauncherReceiveHandler::DoCancel() + { + LOG_ENTERFN( "CLauncherReceiveHandler::DoCancel" ); + iSession.CancelReceive(); + } + +// ----------------------------------------------------------------------------- +// CLauncherReceiveHandler::RunL() +// ----------------------------------------------------------------------------- +// +void CLauncherReceiveHandler::RunL() + { + LOG_ENTERFN( "CLauncherReceiveHandler::RunL" ); + // Handle and re-initialize only if no error occured. + if ( iStatus.Int() == KErrNone ) + { + iServerObserver->HandleReceivedDataL( iStatus ); + iSession.ListenL(); + } + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Launcher2/src/LauncherServerBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Launcher2/src/LauncherServerBase.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CLauncherServerBase +* +* +*/ + +// INCLUDES +#include "LauncherClientService.h" +#include "LauncherServerBase.h" +#include "LauncherServerCommands.hrh" +#include +#include +#include "BrowserAppDocument.h" +#include "BrowserAppUi.h" +#include "eikenv.h" +#include "eikappui.h" +#include "logger.h" +#include + +const TInt KMinimumCDriveDiskSpace = 512 * 1024; + +// ----------------------------------------------------------------------------- +// CLauncherServerBase::CBrowserLauncherService() +// ----------------------------------------------------------------------------- +// +EXPORT_C CLauncherServerBase::CLauncherServerBase() + { + LOG_ENTERFN( "CLauncherServerBase::CLauncherServerBase" ); + + iClientBuffer = NULL; + CEikonEnv* browserAppEnv = CEikonEnv::Static(); + if ( browserAppEnv ) + { + iBrowserAppUi = ( CBrowserAppUi* ) browserAppEnv->EikAppUi(); + if ( iBrowserAppUi ) + { + iBrowserDocument = ( CBrowserAppDocument* ) iBrowserAppUi->Document(); + } + } + } + +// ----------------------------------------------------------------------------- +// CLauncherServerBase::ServiceL() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CLauncherServerBase::ServiceL( const RMessage2& aMessage ) + { + LOG_ENTERFN( "CLauncherServerBase::ServiceL" ); + LOG_WRITE_FORMAT(" Function: %d", aMessage.Function()); + + switch ( aMessage.Function() ) + { + case ELauncherSendSync : + { + __ASSERT_DEBUG(iMySyncMessage.Handle()==0, User::Panic(_L("Launcher"),2)); + iMySyncMessage = aMessage; + HandleMessageSyncL(); + __ASSERT_DEBUG(iMySyncMessage.Handle()==0, User::Panic(_L("Launcher"),21)); + break; + } + case ELauncherSendASync : + { + __ASSERT_DEBUG(iMyAsyncMessage.Handle()==0, User::Panic(_L("Launcher"),3)); + iMyAsyncMessage = aMessage; + HandleMessageASyncL(); + __ASSERT_DEBUG(iMyAsyncMessage.Handle()!=0, User::Panic(_L("Launcher"),31)); + break; + } + case ELauncherSendASyncListen: + { + __ASSERT_DEBUG(iMyAsyncMessage.Handle()==0, User::Panic(_L("Launcher"),4)); + iMyAsyncMessage = aMessage; + // Nothing else to do. It's a reinitialization, we only wanted to know the message. + __ASSERT_DEBUG(iMyAsyncMessage.Handle()!=0, User::Panic(_L("Launcher"),41)); + break; + } + case ELauncherSendSyncBuffer : + { + __ASSERT_DEBUG(iMySyncMessage.Handle()==0, User::Panic(_L("Launcher"),5)); + iMySyncMessage = aMessage; + HandleMessageSyncBufferL(); + __ASSERT_DEBUG(iMySyncMessage.Handle()==0, User::Panic(_L("Launcher"),51)); + break; + } + case ELauncherSendSyncBools : + { + __ASSERT_DEBUG(iMySyncMessage.Handle()==0, User::Panic(_L("Launcher"),6)); + iMySyncMessage = aMessage; + HandleMessageSyncBoolsL(); + __ASSERT_DEBUG(iMySyncMessage.Handle()==0, User::Panic(_L("Launcher"),61)); + break; + } + case ELauncherCancelReceive : + { + iMyAsyncMessage.Complete( KErrCancel ); + HandleBrowserExit(); + aMessage.Complete( KErrNone ); + break; + } + default: + { + CAknAppServiceBase::ServiceL( aMessage ); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CLauncherServerBase::HandleMessageSyncL() +// ----------------------------------------------------------------------------- +// +void CLauncherServerBase::HandleMessageSyncL() + { + LOG_ENTERFN( "CLauncherServerBase::HandleMessageSyncL" ); + + // Client parameters. These will be filled by function + // UnPackLauncherDataL()... + TUid embeddingApplicationUid; + TBrowserOverriddenSettings settings; + TBrowserOverriddenSettings* pSettings; + TInt folderUid; + TPtrC seamlessParam; + TBool isContentHandlerRegistered( EFalse ); + TBool isOverridenSettings( EFalse ); + + TInt result; // The result of the processed data. + + // Read the recieved data buffer + HBufC8* incomingDataBuffer = HBufC8::NewMaxLC( iMySyncMessage.GetDesLengthL( 0 ) ); + TPtr8 incomingDataPointer = incomingDataBuffer->Des( ); + iMySyncMessage.ReadL( 0, incomingDataPointer ); + LOG_WRITE(" ReadL OK"); + + // Unpack the recieved data buffer + pSettings = &settings; + TLauncherPackageUtils::UnPackLauncherDataL( embeddingApplicationUid, + pSettings, + folderUid, + seamlessParam, + incomingDataPointer, + isContentHandlerRegistered, + isOverridenSettings ); + + // Process the unpacked data. + result = ProcessMessageSyncL( embeddingApplicationUid, + settings, + folderUid, + seamlessParam, + isContentHandlerRegistered ); + + // Cleanup, and complete the client`s request. + CleanupStack::PopAndDestroy( ); // incomingDataBuffer + iMySyncMessage.Complete( result ); + } + +// ----------------------------------------------------------------------------- +// CLauncherServerBase::HandleMessageASyncL() +// ----------------------------------------------------------------------------- +// +void CLauncherServerBase::HandleMessageASyncL() + { + LOG_ENTERFN( "CLauncherServerBase::HandleMessageASyncL" ); + + // Check for ciritical disk space if starts in embeded mode + RFs fs; + User::LeaveIfError(fs.Connect()); + TInt drive( EDriveC ); + TBool isSpace( EFalse ); + TInt err( KErrNone ); + TRAP( err, isSpace = !SysUtil::DiskSpaceBelowCriticalLevelL(&fs, KMinimumCDriveDiskSpace, drive )); + fs.Close(); + if (!isSpace) + User::Leave(KErrDiskFull); + + // Client parameters. These will be filled by function + // UnPackLauncherDataL()... + TUid embeddingApplicationUid; + TBrowserOverriddenSettings settings; + TBrowserOverriddenSettings* pSettings; + TInt folderUid; + TPtrC seamlessParam; + TBool isContentHandlerRegistered( EFalse ); + TBool isOverridenSettings( EFalse ); + + // Read the recieved data buffer + HBufC8* incomingDataBuffer = HBufC8::NewMaxLC( iMyAsyncMessage.GetDesLengthL( 0 ) ); + TPtr8 incomingDataPointer = incomingDataBuffer->Des( ); + iMyAsyncMessage.ReadL( 0, incomingDataPointer ); + LOG_WRITE(" ReadL OK"); + + // Unpack the recieved data buffer + pSettings = &settings; + TLauncherPackageUtils::UnPackLauncherDataL( embeddingApplicationUid, + pSettings, + folderUid, + seamlessParam, + incomingDataPointer, + isContentHandlerRegistered, + isOverridenSettings ); + + // Process the unpacked data. + ProcessMessageASyncL( embeddingApplicationUid, + settings, + folderUid, + seamlessParam, + isContentHandlerRegistered, + isOverridenSettings ); + + // Cleanup. + CleanupStack::PopAndDestroy( ); // incomingDataBuffer + } + +void CLauncherServerBase::HandleMessageSyncBufferL() + { + LOG_ENTERFN( "CLauncherServerBase::HandleMessageSyncBufferL" ); + + ProcessMessageSyncBufferL(); + // And complete client`s request. + iMySyncMessage.Complete( KErrNone ); + } + +void CLauncherServerBase::HandleMessageSyncBoolsL() + { + LOG_ENTERFN( "CLauncherServerBase::HandleMessageSyncBoolsL" ); + + TBool clientWantsToContinue = iMySyncMessage.Int0(); + TBool wasContentHandled = iMySyncMessage.Int1(); + ProcessBoolsL( clientWantsToContinue, wasContentHandled ); + // And complete client`s request. + iMySyncMessage.Complete( KErrNone ); + } + +void CLauncherServerBase::HandleBrowserExit() + { + LOG_ENTERFN( "CLauncherServerBase::HandleBrowserExit" ); + DoBrowserExit( ); + } + +/* Capability check will come later... +CLauncherServerBase::CLauncherServerBase(TCapability aClientReqs = ECapability_None):iClientReqs(aClientReqs) + { + } + +CPolicyServer::TCustomResult SecurityCheckL( const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing) + { + switch (aMsg.Function()) + { + case RLauncherClientService::EMessageId: + return aMsg.HasCapability(iClientReqs) ? CPolicyServer::EPass : CPolicyServer::EFail; + break; + default: + return CApaAppServiceBase::SecurityCheckL( aMsg, aAction, aMissing ); + break; + } + } +*/ + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/BrowserLauncher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Rom/BrowserLauncher.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __BROWSERLAUNCHER_IBY__ +#define __BROWSERLAUNCHER_IBY__ + +file=ABI_DIR\BUILD_DIR\browserlauncher.dll SHARED_LIB_DIR\browserlauncher.dll + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/BrowserResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Rom/BrowserResources.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __BROWSERRESOURCES_IBY__ +#define __BROWSERRESOURCES_IBY__ + +S60_APP_CAPTION(Browser) + +data=DATAZ_\RESOURCE_FILES_DIR\BrowserTelService.rsc RESOURCE_FILES_DIR\BrowserTelService.rsc + +S60_APP_RESOURCE(BrowserNG) + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/BrowserUi.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Rom/BrowserUi.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __BROWSERUI_IBY__ +#define __BROWSERUI_IBY__ + +S60_APP_BITMAP(Browser) +S60_APP_BITMAP2(Browser,browserbitmaps) + + +S60_APP_EXE(BrowserNG) +S60_APP_AIF_ICONS(BrowserNG) +data=\epoc32\data\z\private\10003a3f\apps\BrowserNG_reg.rsc \private\10003a3f\import\apps\BrowserNG_reg.rsc +data=ABI_DIR\BUILD_DIR\Browser_Stub.sis system\install\Browser_Stub.sis + +#ifdef __RSS_FEEDS +data=EPOCROOT##epoc32\data\c\feeds_view_template.html feeds_view_template.html +#endif + +data=\epoc32\data\z\private\10008d39\backup_registration.xml private\10008d39\backup_registration.xml + + +#undef BR_EXPORT_ + +#endif __BROWSERUI_IBY__ diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/Browser_stub.SIS Binary file browserui/browser/Rom/Browser_stub.SIS has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/Browser_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Rom/Browser_stub.pkg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,24 @@ +; +; Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of the License "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; + +;Languages +&EN + +;Header +#{"Web Browser"},(0x10008D39),7,2,3, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/Browser_stub_32.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/Rom/Browser_stub_32.pkg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,150 @@ + +;Languages +&EN + +;Header +#{"Web Browser"},(0x10008D39),7,1,0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +""-"z:\RESOURCE\APPS\BrowserAudioVideoPlugin_aif.mif" +""-"z:\RESOURCE\APPS\VideoServices_AIF.MIF" +""-"z:\RESOURCE\APPS\browser.mif" +""-"z:\RESOURCE\APPS\browserng_aif.mif" +""-"z:\RESOURCE\APPS\connman.mif" +""-"z:\RESOURCE\APPS\downloadmgruilib.mif" +""-"z:\RESOURCE\APPS\operatormenu_aif.mif" +""-"z:\RESOURCE\APPS\pushmtm.mif" +""-"z:\RESOURCE_FILES_DIR\WidgetMenu.R*" +""-"z:\Resource\APPS\webkiticons.mif" +""-"z:\Resource\APPS\webkitutilsicons.mif" +""-"z:\Resource\Plugins\CodRecog.rsc" +""-"z:\Resource\Plugins\CookieFilter.rsc" +""-"z:\Resource\Plugins\DdRecog.rsc" +""-"z:\Resource\Plugins\DeflateFilter.rsc" +""-"z:\Resource\Plugins\HttpFilterAcceptHeader.rsc" +""-"z:\Resource\Plugins\HttpFilterAuthentication.rsc" +""-"z:\Resource\Plugins\HttpFilterCache.rsc" +""-"z:\Resource\Plugins\HttpFilterPipeliningConfig.rsc" +""-"z:\Resource\Plugins\PushMtmPushContentHandler.rsc" +""-"z:\Resource\Plugins\PushMtmWhiteListAdapter.rsc" +""-"z:\Resource\Plugins\SchemeDispatcher.rsc" +""-"z:\Resource\Plugins\WidgetInstallerUI.rsc" +""-"z:\Resource\Plugins\WidgetRecognizer.rsc" +""-"z:\Resource\Plugins\httpfilterIop.rsc" +""-"z:\Resource\Plugins\httpfilterconnhandler.rsc" +""-"z:\Resource\Plugins\httpfilterproxy.rsc" +""-"z:\Resource\Plugins\memoryplugin.rsc" +""-"z:\Resource\Plugins\npBrowserAudioVideoPlugin.rsc" +""-"z:\Resource\Plugins\npGpsPlugin.rsc" +""-"z:\Resource\Plugins\npSystemInfoPlugin.rsc" +""-"z:\Resource\Plugins\uaproffilter.rsc" +""-"z:\Resource\Plugins\widgetmemoryplugin.rsc" +""-"z:\Resource\WidgetInstallerUI.R*" +""-"z:\private\10003a3f\import\apps\BrowserNG_reg.rsc" +""-"z:\private\10003a3f\import\apps\CodViewer_reg.rsc" +""-"z:\private\10003a3f\import\apps\DdViewer_reg.rsc" +""-"z:\private\10003a3f\import\apps\Operatormenu_reg.rsc" +""-"z:\private\10003a3f\import\apps\PushViewer_reg.rsc" +""-"z:\private\10003a3f\import\apps\RoapApp_reg.rsc" +""-"z:\private\10003a3f\import\apps\SchemeApp_reg.rsc" +""-"z:\private\10003a3f\import\apps\VideoServices_reg.rsc" +""-"z:\private\10003a3f\import\apps\WidgetUi_reg.rsc" +""-"z:\resource\AiwBrowserProvider.R*" +""-"z:\resource\BrowserAudioVideoPlugin.R*" +""-"z:\resource\BrowserDialogsProvider.R*" +""-"z:\resource\CodUi.R*" +""-"z:\resource\ConnectionManager.R*" +""-"z:\resource\DownloadMgrUiLib.R*" +""-"z:\resource\apps\BrowserNG.R*" +""-"z:\resource\apps\CodViewer.R*" +""-"z:\resource\apps\DdViewer.R*" +""-"z:\resource\apps\Operatormenu.R*" +""-"z:\resource\apps\PushViewer.R*" +""-"z:\resource\apps\RoapApp.R*" +""-"z:\resource\apps\SchemeApp.R*" +""-"z:\resource\apps\VideoServices.R*" +""-"z:\resource\apps\WidgetUi.R*" +""-"z:\resource\apps\schemeapp_aif.mif" +""-"z:\resource\browsertelservice.R*" +""-"z:\resource\messaging\PushMtmUi.R*" +""-"z:\resource\messaging\mtm\PushRegistry.R*" +""-"z:\resource\plugins\AiwBrowserProvider.rsc" +""-"z:\resource\webkit.R*" +""-"z:\resource\webkitutils.R*" +""-"z:\sys\bin\AiwBrowserProvider.dll" +""-"z:\sys\bin\BrowserCache.dll" +""-"z:\sys\bin\BrowserLauncher.dll" +""-"z:\sys\bin\BrowserNG.exe" +""-"z:\sys\bin\BrowserTelService.dll" +""-"z:\sys\bin\CodDownload.dll" +""-"z:\sys\bin\CodEng.dll" +""-"z:\sys\bin\CodRecog.dll" +""-"z:\sys\bin\CodUi.dll" +""-"z:\sys\bin\CodViewer.exe" +""-"z:\sys\bin\ConnectionManager.dll" +""-"z:\sys\bin\CookieServer.exe" +""-"z:\sys\bin\DdRecog.dll" +""-"z:\sys\bin\DdViewer.exe" +""-"z:\sys\bin\DeflateFilter.DLL" +""-"z:\sys\bin\DownloadMgr.dll" +""-"z:\sys\bin\DownloadMgrServer.exe" +""-"z:\sys\bin\DownloadMgrUiLib.dll" +""-"z:\sys\bin\FavouritesEngine.dll" +""-"z:\sys\bin\FavouritesSrv.exe" +""-"z:\sys\bin\FeedsServer.exe" +""-"z:\sys\bin\FeedsServerClient.dll" +""-"z:\sys\bin\HttpCacheManager.dll" +""-"z:\sys\bin\HttpDMServEng.dll" +""-"z:\sys\bin\HttpFilterAcceptHeader.dll" +""-"z:\sys\bin\HttpFilterAuthentication.dll" +""-"z:\sys\bin\HttpFilterCache.dll" +""-"z:\sys\bin\HttpFilterCommon.dll" +""-"z:\sys\bin\HttpFilterPipeliningConfig.dll" +""-"z:\sys\bin\JavaScriptCore.DLL" +""-"z:\sys\bin\MemMan.dll" +""-"z:\sys\bin\MultipartParser.dll" +""-"z:\sys\bin\OperatorMenu.exe" +""-"z:\sys\bin\PushMtmCliSrv.dll" +""-"z:\sys\bin\PushMtmPushContentHandler.dll" +""-"z:\sys\bin\PushMtmUi.dll" +""-"z:\sys\bin\PushMtmUtil.dll" +""-"z:\sys\bin\PushMtmWhiteListAdapter.dll" +""-"z:\sys\bin\PushViewer.exe" +""-"z:\sys\bin\RECENTURLSTORE.DLL" +""-"z:\sys\bin\RoapApp.exe" +""-"z:\sys\bin\SchemeApp.exe" +""-"z:\sys\bin\SchemeDispatcher.dll" +""-"z:\sys\bin\VideoServices.exe" +""-"z:\sys\bin\WidgetBackupRestore.exe" +""-"z:\sys\bin\WidgetInstaller.dll" +""-"z:\sys\bin\WidgetInstallerUI.dll" +""-"z:\sys\bin\WidgetRecognizer.DLL" +""-"z:\sys\bin\WidgetRegistry.exe" +""-"z:\sys\bin\WidgetRegistryClient.dll" +""-"z:\sys\bin\WidgetUi.exe" +""-"z:\sys\bin\browserdialogsprovider.dll" +""-"z:\sys\bin\browserengine.dll" +""-"z:\sys\bin\cXmlParser.dll" +""-"z:\sys\bin\cookiefilter.dll" +""-"z:\sys\bin\cookiemanager.dll" +""-"z:\sys\bin\httpfilterIop.dll" +""-"z:\sys\bin\httpfilterconnhandler.dll" +""-"z:\sys\bin\httpfilterproxy.dll" +""-"z:\sys\bin\memoryplugin.DLL" +""-"z:\sys\bin\npBrowserAudioVideoPlugin.dll" +""-"z:\sys\bin\npGpsPlugin.dll" +""-"z:\sys\bin\npSystemInfoPlugin.dll" +""-"z:\sys\bin\npscript.dll" +""-"z:\sys\bin\pagescaler.dll" +""-"z:\sys\bin\uaproffilter.dll" +""-"z:\sys\bin\webkitutils.dll" +""-"z:\sys\bin\webutils.dll" +""-"z:\sys\bin\widgetengine.dll" +""-"z:\sys\bin\widgetlauncher.exe" +""-"z:\sys\bin\widgetmemoryplugin.DLL" +""-"z:\sys\bin\wmlEngine.dll" diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/Rom/Browser_stub_32.sis Binary file browserui/browser/Rom/Browser_stub_32.sis has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsInc/BrowserSettingsDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsInc/BrowserSettingsDlg.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Dialog for setting the gateway. It's used temporarily. +* +* +*/ + + +#ifndef CBrowserSETTINGSDIALOG_H +#define CBrowserSETTINGSDIALOG_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** +* Dialog for setting the gateway's IP address +*/ +class CBrowserSettingsDlg : public CAknDialog + { + public : // construction + /** + * Two-phased constructor. + */ + static CBrowserSettingsDlg* NewL(); + + protected : // construction + /** + * constructor, that may leave. + */ + void ConstructL(); + + protected : // from CEikDialog + /** + * Set the gateway's IP address, if the user pressed OK. + * @param aButtonId The ID of the pressed button. + * @return May the dialog exit? + */ + TBool OkToExitL( TInt aButtonId ) ; + }; + +#endif + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsInc/BrowserUiPrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsInc/BrowserUiPrivateCRKeys.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef BROWSERUIPRIVATECRKEYS_H +#define BROWSERUIPRIVATECRKEYS_H + +#include + + +// Indicates whether to show connection dialogs or not. +// Valid values: 0 = off, 1 = on +const TUint32 KBrowserConnectionDialogs = 0x00000006; + +// Boolean value which determines whether a confirmation +// query will be shown when exiting Browser. +// Valid values: 0 = off, 1 = on +const TUint32 KBrowserQueryOnExit = 0x0000000A; + +// Flags for variating Browser application for common code +// Valid values: integer 0-255 +const TUint32 KBrowserUiCommonFlags = 0x00000002; + +// Flags for variating Browser application for CDMA branch +// Valid values: integer 0-255 +const TUint32 KBrowserUiCdmaFlags = 0x00000003; + +// Enabling of the Auto Form Fill feature +// Valid values: 0 = off, 1 = on +const TUint32 KBrowserFormDataSaving = 0x00000022; + +// BrowserNG Private Keys + +// Browser Adaptive Bookmarks mode setting. +// Valid values: 0 = on, 1 = hide folder, 2 = off +const TUint32 KBrowserNGAdaptiveBookmarks = 0x00000028; + +// Determines whether the browser is in Full Screen or +// Softkeys Only mode. +// Valid values: 0 = normal, 1 = soft keys, 2 = full screen +const TUint32 KBrowserNGFullScreen = 0x00000029; + +// Search Page URL setting. A string value. Can be up +// to 1000 characters in length. +// Valid Valies: up to 1000 characters in length. +const TUint32 KBrowserNGSearchPageURL = 0x0000002A; + +// Determines whether pop-up blocking in Multiple Windows is enabled or not. +// Valid values: 0 = off, 1 = on (default = 1) +const TUint32 KBrowserNGPopupBlocking = 0x0000002F; + +// Browser's user-defined homepage URL setting. +// Valid values: URL string, up to 1000 characters +const TUint32 KBrowserNGHomepageURL = 0x00000030; + +//DEPRECATED/OBSOLETE: Determine if the platform toolbar should be visible next time Browser starts +const TUint32 KBrowserNGShowPlatformToolbar = 0x00000048; + +//DEPRECATED/OBSOLETE: Int value which determines which of the toolbars was last visible. 0 - basic toolbar, 1 - address toolbar +const TUint32 KBrowserNGLastVisibleToolbar = 0x00000049; + +// Int value which determines if the Access keys feature is enabled or disabled. 0 - disabled, 1 - enabled +const TUint32 KBrowserNGAccessKeys = 0x00000051; + +#endif // BROWSERUIPRIVATECRKEYS_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsInc/SettingsContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsInc/SettingsContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,462 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Container of the information about the active settings +* +*/ + + +#ifndef SETTINGS_CONTAINER_H +#define SETTINGS_CONTAINER_H + +// INCLUDE FILES +#include +#include +#include + +// CONSTANTS +const TInt KWmlSettingsIndexNone = -1; +const TInt KWmlSettingsItemMaxLength = 100; + +// FORWARD DECLARATION +class MApiProvider; +class CAknNavigationDecorator; +class CAknSettingStyleListBox; + + +struct TEncodingStruct + { + TUint32 iSystemId; // System id of the encoding (CHARCONV.h) + TUint32 iResId; // Resource string id + }; + +// CLASS DECLARATION + +/** +* Container of the settings view +* @since 1.2 +*/ +class CSettingsContainer : public CCoeControl, public MEikListBoxObserver + { + public: // construction, destruction + + /** + * Two-phased constructor. + * @since 1.2 + * @param aRect Rectangle. + * @param aPreferences Preferences. + * @param aCommsModel Comms model. + */ + static CSettingsContainer* NewLC( + const TRect& aRect, + MApiProvider& aApiProvider, + MObjectProvider& aMopParent + ); + + /** + * Two-phased constructor. + * @since 1.2 + * @param aRect Rectangle. + * @param aPreferences Preferences. + * @param aCommsModel Comms model. + */ + static CSettingsContainer* NewL( + const TRect& aRect, + MApiProvider& aApiProvider, + MObjectProvider& aMopParent + ); + + /** + * Destructor. + */ + virtual ~CSettingsContainer(); + + private: // constructor + + /** + * Constructor. + * @param aPreferences Preferences. + * @param aCommsModel Comms model. + */ + CSettingsContainer + ( MApiProvider& aApiProvider, MObjectProvider& aMopParent ); + + /** + * By default constructor is private. + */ + void ConstructL( const TRect& aRect ); + + /** + * Inherited functions + */ + public: // from CCoeControl + + /** + * Count component controls. + * @since 1.2 + * @return Number of component controls. + */ + virtual TInt CountComponentControls() const; + + /** + * Handles focus changing + * @param aDrawNow + */ + void FocusChanged( TDrawNow aDrawNow ); + + /** + * Handle resource change. + * @param aType Event type. + */ + void HandleResourceChange( TInt aType ); + + + /** + * Get a component control by index. + * @since 1.2 + * @param aIndex Index of component control to be returned. + * @return Component control or NULL. + */ + virtual CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Handle size change, lay out and draw components. + * @since 1.2 + */ + virtual void SizeChanged(); + + /** + * Handle key event. Forwards all key events to the listbox, if present. + * @since 1.2 + * @param aKeyEvent The key event. + * @param aType Key event type. + * @return Response (was the key event consumed?). + */ + virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * HandleListBoxEventL + * From CCoeControl + * + */ + void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType); + + /** + * HandleGainingForegroundL + * Handles Foreground Event. + */ + void HandleGainingForegroundL(); + + /** + * New functions + */ + public: + + /** + * Handles selection key or menu command to change value of an item. + * @since 1.2 + */ + void ChangeItemL( TBool aSelectKeyWasPressed ); + + MApiProvider& ApiProvider() { return iApiProvider; } + + /** + * Opens the appropriate setting list e.g. Page + * @since 3.1 + */ + void DisplayCorrectSettingCategoryListL(); + + /** + * Closes the current setting list, if the main list, + * then leaves settings + * @return ETrue if settings lists are closed EFalse if still open + * @since 3.1 + */ + TBool CloseSettingsListL(); + + + /** + * Checks for errors in settings values + * @return ETrue if settings values are set incorrectly + * @since 5.0 + */ + TBool SettingsError(); + + + /** + * Indicates if a setting item is modifiable + * + * @return TInt + * @since 3.1 + */ + TBool IsSettingModifiable() const; + + + /** + * Saves changes made by the user to the ini file + * @since 1.2 + */ + void SaveChangesL(); + + + + /** + * Shows the main setting categories in a list box + * @since 3.1 + */ + void DisplaySettingCategoriesL(); + + void DisplayGeneralSettingsL(); + void DisplayPageSettingsL(); + void DisplayPrivacySettingsL(); + void DisplayWebFeedsSettingsL(); + void DisplayToolbarSettingsL(); + void DisplayShortcutsSettingsL(); + + /** + * New functions + */ + private: + TInt SetToolbarButtonValues(CArrayFixFlat *values, TInt value, CArrayFixFlat *displaymap); + TInt SetShortcutKeysValues(CArrayFixFlat *values, TInt value, CArrayFixFlat *displaymap); + + void AddCategoryListBoxItemL( TInt aResourceId, CDesCArray& aList ); + void ClearListBoxContentL(); + void StoreListBoxIndexL(); + void RestoreListBoxIndexL(); + + // Methods for adding settings to the settings lists + + //--------------------------------------------------------------------- + // General Settings + void AppendDefaultAccessPointL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendHomePageL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendPageOverviewL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendBackListL( CDesCArray*& aItemArray, + TBuf& aItemText ); + void AppendURLSuffixListL( CDesCArray*& aItemArray, + TBuf& aItemText ); + void AppendHttpSecurityWarningsL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendEcmaL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendScriptLogL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendDownloadsOpenL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendSearchProviderL( CDesCArray*& aItemArray, + TBuf& aItemText ); + //--------------------------------------------------------------------- + // Page Settings + void AppendAutoLoadContentL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendAutoFullScreenL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendAutoMediaVolumeL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendEncodingL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendPopupBlockingL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendAutoRefreshL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendFontSizeL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + TInt GetFontSizeString(); + + + //--------------------------------------------------------------------- + // Toolbar Settings + void AppendToolbarOnOffL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendToolbarButtonsL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendShortcutKeysL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + //--------------------------------------------------------------------- + // Privacy Settings + void AppendAdaptiveBookmarksL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendFormDataSavingL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendCookiesL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendIMEIL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + //--------------------------------------------------------------------- + // Web feeds Settings + void AppendAutomaticUpdatingAPL( CDesCArray*& aItemArray, + TBuf& aItemText ); + + void AppendAutomaticUpdatingWhileRoamingL( CDesCArray*& aItemArray, + TBuf& aItemText ); + //--------------------------------------------------------------------- + // + /** + * Pops up a custom dialog to allow user to set setting items + */ + TInt ShowRadioButtonSettingPageL( TInt aTitle, + CArrayFixFlat* aValues, + TInt aCurrentItem ); + + + /** + * Pops up a custom dialog to allow user to set setting items + */ + TBool ShowRadioButtonSettingPageBoolL( TInt aTitle, + CArrayFixFlat* aValues, + TInt* aCurrentItem ); + + /** + * Appends two text from resources to display it on lisbox + */ + void CreateItemFromTwoStringsL( + TInt aFirst, + TInt aSecond, + TBuf& aResult); + + TInt MapCurrentItem( TUint aCurrentItem ) const; + + /** + * Gets encoding information as parameters. + * Creates an encoding object and add the new object to iEncodingArray. + */ + void AddEncodingL( TUint32 aSystemId, TUint32 aResId ); + + /** + * Add encodings here. + * To add or remove encodings modify this function! + */ + void CreateEncodingArrayL(); + + /** + * Check if the added encodings are supported by the system. Removes those that are not. + */ + void RemoveUnsupportedEncodingsL(); + + /** + * Notify BrowserControl that a setting has been changed in the UI + */ + void NotifySettingChanged( TInt aSettingItem, TInt aSettingValue ); + + /** + * Query user to delete Form data plus Password data + */ + void ShowFormDataDeleteAllQueryDialogL( ); + /** + * Query user to delete Form Password data + */ + void ShowFormDataDeletePasswordQueryDialogL( ); + + /** + * Query user to select fromm user defined AP + */ + void SelectUserDefinedAPL( TUint32& id ); + + /** + * Launch Search Application Settings View. + */ + void RunSearchSettingsL(); + +#ifdef __SERIES60_HELP + /** + * Get help context for the control. + * @param aContext The context that is filled in. + * @return None. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + +#endif // __SERIES60_HELP + + private: + + // Media Volume indices + enum TMediaVolumeIndices + { + EVolumeMute = 0, + EVolumeLevel1, + EVolumeLevel2, + EVolumeLevel3, + EVolumeLevel4 + }; + + enum TSettingCategory + { + EMain = 0, + EGeneral, + EPrivacy, + EPage, + EWebFeeds, + EToolbar, + EShortCuts, + ENone + }; + + private: // members + + MApiProvider& iApiProvider; // not owned + CAknNavigationDecorator* iNaviDecorator; // not owned + + // Settings List Box related members + CAknSettingStyleListBox* iSettingListBox; // OWNED + CArrayFixFlat* iSettingIndex; // OWNED + TInt iMainSettingCurrentIndex; // hold the most recent index in the main setting list box + TInt iMainSettingTopPosIndex; + TInt iSubSettingCurrentIndex; // hold the most recent index in the sub setting list boxes + TInt iSubSettingTopPosIndex; + TBool iActionCancelled; + TBool iPenEnabled; // stores platform pen enabled flag value + + TSettingCategory iCurrentSettingCategory; + + // The settings are only updated when we leave the settings + // view to avoid unnecessary redraws + TInt iFontSize; + TUint32 iEncoding; + TBool iTextWrap; + + // Holds a 'list' of all encodings + CArrayFixFlat* iEncodingArray; // OWNED + TBool iSelectionKeyDownPressed; + + TBool iFlashPluginPresent; + }; + +#endif // SETTINGS_CONTAINER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsInc/SettingsView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsInc/SettingsView.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* View of the information about the active settings +* +* +*/ + + +#ifndef SETTINGS_VIEW_H +#define SETTINGS_VIEW_H + +// INCLUDES + +// #include +// #include +#include "BrowserAppViewBase.h" +#include "CommsModel.h" + +// FORWARD DECLARATION + +class CSettingsContainer; +class MApiProvider; + +// CLASS DECLARATION + +/** +* View of settings info +*/ +class CBrowserSettingsView: public CBrowserViewBase, + public MCommsModelObserver +{ + public: // construction + + /** + * Two-phased constructor + * @param aApiProvider The API provider. + */ + static CBrowserSettingsView* NewLC( MApiProvider& aApiProvider ); + + /** + * Two-phased constructor + * @param aApiProvider The API provider. + */ + static CBrowserSettingsView* NewL( MApiProvider& aApiProvider ); + + /** + * Destructor. + */ + virtual ~CBrowserSettingsView(); + + public: // From MCbaSetter (CWmlBrowserViewBase) + + /** + * Return command set id, to be displayed. + * @return The command set's resource id. + */ + TInt CommandSetResourceIdL(); + + /** + * Set command set lsk,rsk,msk dynamically via pointers. + * Derived classes should implement, though it can be empty. + * If it does nothing, empty softkeys will be assigned + * @since 5.0 + */ + void CommandSetResourceDynL(TSKPair& /*lsk*/, TSKPair& /*rsk*/, TSKPair& /*msk*/) {}; + + public: // From MCommsModelObserver + + /** + * Handle change in comms model (AP-s). + */ + void HandleCommsModelChangeL(); + + public: // from CAknView (CWmlBrowserViewBase) + + /** + * @see CAknView + */ + void HandleCommandL(TInt aCommand); + + /** + * @see CAknView + */ + TUid Id() const; + + /** + * Updates the options softkey to reflect the command set. + * + * @since 3.2 + * @param aCommandSet The new "command set". + * @return void. + */ + void UpdateCbaL(TInt aCommandSet); + + + protected: // from CAknView + + /** + * @see CAknView + */ + void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); + + + /** + * @see CAknView + */ + void DoDeactivate(); + + /** + * @see CAknView + */ + void HandleClientRectChange(); + + /** + * @see CAknView + */ + void HandleForegroundEventL (TBool aForeground); + + private: // MEikMenuObserver + + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + private: // destruction + + /** + * Constructor. + * @param aApiProvider The API provider. + */ + CBrowserSettingsView( MApiProvider& aApiProvider ); + + /** + * SymbianOS default constructor. + */ + void ConstructL(); + + private: // members + + CSettingsContainer* iContainer; + + TVwsViewId iLastViewId; // The view to switch after closing this +}; +#endif // SETTINGS_VIEW_H + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsSrc/BrowserSettingsDlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsSrc/BrowserSettingsDlg.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Dialog for setting the gateway. It's used temporarily. +* +* +*/ + + +// INCLUDE FILES +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "BrowserSettingsDlg.h" +#include "Browser.hrh" +#include "BrowserUtil.h" + +// ================= MEMBER FUNCTIONS ========================================= + +// --------------------------------------------------------- +// CBrowserSettingsDlg::ConstructL() +// --------------------------------------------------------- +// +void CBrowserSettingsDlg::ConstructL() + { + CAknDialog::ConstructL( R_BROWSER_SETTINGS_MENUBAR ); + } + +// --------------------------------------------------------- +// CBrowserSettingsDlg::NewL() +// --------------------------------------------------------- +// +CBrowserSettingsDlg* CBrowserSettingsDlg::NewL() + { + CBrowserSettingsDlg* self = new (ELeave) CBrowserSettingsDlg; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CBrowserSettingsDlg::OkToExitL +// Good to know : EAknSoftkeyCancel is never called, because +// EEikDialogFlagNotifyEsc flag is not set in the resource. +// --------------------------------------------------------- +// +TBool CBrowserSettingsDlg::OkToExitL( TInt aButtonId ) + { + TBool result( EFalse ); + + if ( aButtonId == EAknSoftkeyOk ) + { + TBuf<256> buf; + + STATIC_CAST( CEikEdwin*, Control( + EWmlControlSettingsEditGateway ) )->GetText( buf ); + buf.ZeroTerminate(); + + result = ETrue; + } + return result; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsSrc/SettingsContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsSrc/SettingsContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,3829 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Container of the information about the active settings +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for TResourceReader +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ApiProvider.h" +#include "SettingsContainer.h" +#include "BrowserPreferences.h" +#include "Display.h" +#include "CommsModel.h" +#include "Browser.hrh" +#include "CommonConstants.h" +#include "BrowserAppUi.h" +#include "BrowserAppViewBase.h" +#include "BrowserUtil.h" +#include "BrowserUiVariant.hrh" +#include "BrowserDialogs.h" +#include "Logger.h" + +#include "BrowserWindowManager.h" +#include "BrowserWindow.h" +// Browser as a plugin +#include +#include + +#include +//Zsolt +#include +#include +#include + + +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include "BrowserApplication.h" +#include +#endif // __SERIES60_HELP + +// CONSTANTS +const TInt KSettingCategoryMaxLength = 50; +_LIT( KSettingsCategoryListBoxItemNoIcon, " " ); +const TInt KDoesntExist = -1; +const TInt KGranularity = 1; +const TInt KMaxTitleLength = 512; + + +_LIT( KWmlSettingsListBoxItemPrefix, " \t" ); +_LIT( KWmlSettingsListBoxItemPostfix, "\t\t" ); + +// ========================= MEMBER FUNCTIONS ================================ + +// ----------------------------------------------------------------------------- +// CSettingsContainer::CSettingsContainer +// ----------------------------------------------------------------------------- +// +CSettingsContainer::CSettingsContainer( MApiProvider& aApiProvider, + MObjectProvider& aMopParent ) + : iApiProvider( aApiProvider ), + iMainSettingCurrentIndex( KWmlSettingsIndexNone ), + iSubSettingCurrentIndex( KWmlSettingsIndexNone ) + { + SetMopParent( &aMopParent ); + } + +// ---------------------------------------------------------------------------- +// CSettingsContainer::NewLC +// ---------------------------------------------------------------------------- +// +CSettingsContainer* CSettingsContainer::NewLC ( const TRect& aRect, + MApiProvider& aApiProvider, + MObjectProvider& aMopParent ) + { + CSettingsContainer* result; + result = new (ELeave) CSettingsContainer( aApiProvider, aMopParent ); + CleanupStack::PushL( result ); + result->ConstructL( aRect ); + return result; + } + + +// ---------------------------------------------------------------------------- +// CSettingsContainer::NewL +// ---------------------------------------------------------------------------- +// +CSettingsContainer* CSettingsContainer::NewL ( const TRect &aRect, + MApiProvider& aApiProvider, + MObjectProvider& aMopParent ) + { + CSettingsContainer* result; + result = CSettingsContainer::NewLC( aRect, aApiProvider, aMopParent ); + CleanupStack::Pop(); // result + return result; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::~CSettingsContainer +// ----------------------------------------------------------------------------- +// +CSettingsContainer::~CSettingsContainer() + { + delete iNaviDecorator; // This pops off the Navi Pane (if pushed). + delete iSettingListBox; + delete iSettingIndex; + delete iEncodingArray; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::ConstructL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::ConstructL( const TRect& aRect ) + { + ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE ); + // Push empty Navi Pane. Do not use PushDefault; that must be popped and + // that is problematic on exit (MDisplay may not be available). + // Create a blank navi pane control, its destructor handles it safely. + CAknNavigationControlContainer* naviPane = + ApiProvider().Display().NaviPaneL(); + iNaviDecorator = naviPane->CreateNavigationLabelL(); + naviPane->PushL( *iNaviDecorator ); + + iSettingIndex = new (ELeave) CArrayFixFlat( 4 ); + + // construct listbox from resources + TResourceReader rr; + + iEikonEnv->CreateResourceReaderLC( rr, R_BROWSER_SETTING_CATEGORIES_LISTBOX ); + + CreateWindowL(); + iSettingListBox = new( ELeave )CAknSettingStyleListBox; + iSettingListBox->SetContainerWindowL( *this ) ; + iSettingListBox->ConstructFromResourceL( rr ); + iPenEnabled = AknLayoutUtils::PenEnabled(); + if (iPenEnabled) + { + iSettingListBox->SetListBoxObserver( this ); + } + CleanupStack::PopAndDestroy(); // resource reader + iSettingListBox->CreateScrollBarFrameL( ETrue ); + iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + + iEncodingArray = new(ELeave) CArrayFixFlat( KGranularity ); + CreateEncodingArrayL(); + RemoveUnsupportedEncodingsL(); + + // Add Unicode + AddEncodingL( KCharacterSetIdentifierUCS2, R_WMLBROWSER_SETTINGS_ENCODING_UCS_2 ); + + // Preferences becomes active, WindowsManager is an observer, + // it provides some local settings + ApiProvider().Preferences().NotifyObserversL( EPreferencesActivate, TBrCtlDefs::ESettingsUnknown ); + + // These settings cause page relayouts and should only be + // updated upon leaving the settings page, this is why they are stored as + // member data rather than getting the values from CBrowserPreferences + iFontSize = ApiProvider().Preferences().FontSize(); + iEncoding = ApiProvider().Preferences().Encoding(); + iTextWrap = ApiProvider().Preferences().TextWrap(); + + // Check if flash plugin is present and set variable + iFlashPluginPresent = ApiProvider().FlashPresent(); + + // Updating listbox content + DisplaySettingCategoriesL(); + + SetRect( aRect ); + ActivateL(); + iSettingListBox->ScrollBarFrame()->MoveVertThumbTo( iSettingListBox->CurrentItemIndex() ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplaySettingCategoriesL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplaySettingCategoriesL() + { + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EMain; + + ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE ); + + ClearListBoxContentL(); + + MDesCArray* itemList = iSettingListBox->Model()->ItemTextArray(); + CDesCArray* itemArray = ( CDesCArray* ) itemList; + TBuf itemText; + + // General Category item + AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_GENERAL, *itemArray ); + iSettingIndex->AppendL( EWmlSettingsGeneral ); + + // Page Category item + AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_PAGE, *itemArray ); + iSettingIndex->AppendL( EWmlSettingsPage ); + + // Privacy Category item + AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_PRIVACY, *itemArray ); + iSettingIndex->AppendL( EWmlSettingsPrivacy ); + +#ifdef __RSS_FEEDS + #if !defined(BRDO_OCC_ENABLED_FF) + // Web feeds Category item + if (!ApiProvider().IsEmbeddedModeOn()) + { + AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_WEBFEEDS, *itemArray ); + iSettingIndex->AppendL( EWmlSettingsWebFeeds ); + } + #endif +#endif // __RSS_FEEDS + + + if (!iPenEnabled) + { + // Toolbar Category item + AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_TOOLBAR, *itemArray ); + iSettingIndex->AppendL( EWmlSettingsToolbar ); + + // Shortcut Keys Category item + if(!ApiProvider().Preferences().ShortcutKeysForQwerty()) + { + AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_SHORTCUTS, *itemArray ); + iSettingIndex->AppendL( EWmlSettingsShortcuts ); + } + } + + + RestoreListBoxIndexL(); + + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplayCorrectSettingCategoryListL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayCorrectSettingCategoryListL() + { + switch ( iSettingIndex->At( iSettingListBox->CurrentItemIndex() ) ) + { + // Open General Browser Settings + case EWmlSettingsGeneral: + { + DisplayGeneralSettingsL(); + break; + } + // Open Privacy Browser Settings + case EWmlSettingsPrivacy: + { + DisplayPrivacySettingsL(); + break; + } + + // Open Page Browser Settings + case EWmlSettingsPage: + { + DisplayPageSettingsL(); + break; + } + + // Open Web Feeds Settings + case EWmlSettingsWebFeeds: + { + DisplayWebFeedsSettingsL(); + break; + } + + // Open Toolbar Settings + case EWmlSettingsToolbar: + { + DisplayToolbarSettingsL(); + break; + } + + // Open Shortcuts Settings + case EWmlSettingsShortcuts: + { + DisplayShortcutsSettingsL(); + break; + } + + default: + { + DisplaySettingCategoriesL(); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AddCategoryListBoxItemL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AddCategoryListBoxItemL( TInt aResourceId, CDesCArray& aItemArray ) + { + TBuf itemText; + itemText.Zero(); + itemText.Append( KSettingsCategoryListBoxItemNoIcon ); + itemText.Append(KWmlSettingsListBoxItemPrefix); + HBufC* listItemText = iCoeEnv->AllocReadResourceLC( aResourceId ); + itemText.Append( *listItemText ); + CleanupStack::PopAndDestroy(); // listItemText + aItemArray.AppendL( itemText ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplayGeneralSettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayGeneralSettingsL() + { + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EGeneral; + + ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE_GENERAL ); + + ClearListBoxContentL(); + + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + + TBuf itemText; + + //========================================================================= + // Add individual settings belonging to the 'General' Settings Category + // + + // Default Access Point + if ( !ApiProvider().Preferences().CustomAccessPointDefined() ) + { + //Access point setting is not required if OCC is enabled + AppendDefaultAccessPointL( itemArray, itemText ); + } + + // Home Page + if( ApiProvider().Preferences(). + UiLocalFeatureSupported( KBrowserUiHomePageSetting ) && + !ApiProvider().IsEmbeddedModeOn() ) + { + AppendHomePageL( itemArray, itemText ); + } + + // Minimap not supported on touch devices + if (!iPenEnabled) + { + //MiniMap feature is determined by the PageScaler dll, not by the preference setting. + //We should query webkit for the feature. + if(ApiProvider().WindowMgr().CurrentWindow()->IsPageOverviewSupportedL()) + { + // Page Overview + AppendPageOverviewL( itemArray, itemText ); + } + } + + + if( iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserGraphicalHistory )) + { + // Back List + AppendBackListL( itemArray, itemText ); + } + + if (!ApiProvider().IsEmbeddedModeOn()) + { + AppendURLSuffixListL(itemArray, itemText); + } + // Http Security Warnings + if ( !ApiProvider().Preferences().HttpSecurityWarningsStatSupressed() ) + { + AppendHttpSecurityWarningsL( itemArray, itemText ); + } + + // Ecma + AppendEcmaL( itemArray, itemText ); + + // Script Logging + AppendScriptLogL( itemArray, itemText ); + + // Downloads open settings + if( PROGRESSIVE_DOWNLOAD ) + { + AppendDownloadsOpenL( itemArray, itemText ); + } + + if( ApiProvider().Preferences().SearchFeature() ) + { + AppendSearchProviderL( itemArray, itemText ); + } + + RestoreListBoxIndexL(); + iSettingListBox->DrawNow(); + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplayPageSettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayPageSettingsL() + { + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EPage; + + ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE_PAGE ); + + ClearListBoxContentL(); + + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + + TBuf itemText; + + //========================================================================= + // Add individual settings belonging to the 'General' Settings Category + // + + // AutoLoad Content + AppendAutoLoadContentL( itemArray, itemText ); + + // Media Volume + if( !HAS_SIDE_VOLUME_KEYS ) //some phones don't have side volume keys + { + AppendAutoMediaVolumeL( itemArray, itemText ); + } + + // Encoding + AppendEncodingL( itemArray, itemText ); + + // Pop-up Blocking + if ( ApiProvider().Preferences().UiLocalFeatureSupported( + KBrowserMultipleWindows ) && + !ApiProvider().IsEmbeddedModeOn() ) + { + AppendPopupBlockingL( itemArray, itemText ); + } + + // Auto Refresh + AppendAutoRefreshL( itemArray, itemText ); + + // Font Size + AppendFontSizeL( itemArray, itemText ); + + RestoreListBoxIndexL(); + iSettingListBox->DrawNow(); + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplayPrivacySettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayPrivacySettingsL() + { + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EPrivacy; + + ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE_PRIVACY ); + + ClearListBoxContentL(); + + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + + TBuf itemText; + + //========================================================================= + // Add individual settings belonging to the 'General' Settings Category + // + + // Adaptive Bookmarks + if ( ADAPTIVEBOOKMARKS ) + { + AppendAdaptiveBookmarksL( itemArray, itemText ); + } + + if (iApiProvider.Preferences().UiLocalFeatureSupported(KBrowserAutoFormFill) ) + { + // Form Data Saving + AppendFormDataSavingL( itemArray, itemText ); + } + + // Cookies + AppendCookiesL( itemArray, itemText ); + + // IMEI + if ( IMEI_NOTIFICATION && !ApiProvider().IsEmbeddedModeOn() ) + { + AppendIMEIL( itemArray, itemText ); + } + + RestoreListBoxIndexL(); + iSettingListBox->DrawNow(); + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplayWebFeedsSettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayWebFeedsSettingsL() + { + MPreferences& preferences = ApiProvider().Preferences(); + + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EWebFeeds; + ApiProvider().Display().SetTitleL( R_SETTINGS_CATEGORY_WEBFEEDS ); + ClearListBoxContentL(); + + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + TBuf itemText; + + // Add setting items + // Show the "Auto Update AP" option + AppendAutomaticUpdatingAPL( itemArray, itemText ); + + // Show the "Automatic update while roaming" option + AppendAutomaticUpdatingWhileRoamingL( itemArray, itemText ); + + RestoreListBoxIndexL(); + iSettingListBox->DrawNow(); + ActivateL(); + } + +// CSettingsContainer::DisplayToolbarSettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayToolbarSettingsL() + { + MPreferences& preferences = ApiProvider().Preferences(); + + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EToolbar; + ApiProvider().Display().SetTitleL( R_SETTINGS_CATEGORY_TOOLBAR ); + ClearListBoxContentL(); + + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + TBuf itemText; + + // Toolbar On/Off Setting + AppendToolbarOnOffL(itemArray, itemText ); + + // Toolbar Buttons + AppendToolbarButtonsL(itemArray, itemText ); + + RestoreListBoxIndexL(); + iSettingListBox->DrawNow(); + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::DisplayShortcutsSettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::DisplayShortcutsSettingsL() + { + MPreferences& preferences = ApiProvider().Preferences(); + + StoreListBoxIndexL(); + // Flag which setting category we are entering + iCurrentSettingCategory = EShortCuts; + ApiProvider().Display().SetTitleL( R_SETTINGS_CATEGORY_SHORTCUTS); + ClearListBoxContentL(); + + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + TBuf itemText; + + // Shortcut Keys + AppendShortcutKeysL (itemArray, itemText ); + + RestoreListBoxIndexL(); + iSettingListBox->DrawNow(); + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::CloseSettingsListL +// ----------------------------------------------------------------------------- +// +TBool CSettingsContainer::CloseSettingsListL() + { + TBool ret( EFalse ); + // Check which list we are in + switch ( iCurrentSettingCategory ) + { + // About to leave + case EMain: + { + SaveChangesL(); + ret = ETrue; + break; + } + // Return to Setting Category List + case EGeneral: + case EPrivacy: + case EWebFeeds: + case EPage: + case EToolbar: + case EShortCuts: + { + DisplaySettingCategoriesL(); + ret = EFalse; + break; + } + default: + break; + } + return ret; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::SettingsError +// ----------------------------------------------------------------------------- +// +TBool CSettingsContainer::SettingsError() + { + TBool ret( EFalse ); + if ( iCurrentSettingCategory == EToolbar ) + { + // Return true is all toolbar buttons set to None for command (which is 0 in value) + MPreferences& preferences = ApiProvider().Preferences(); + if ((preferences.ShowToolbarButton1Cmd() + + preferences.ShowToolbarButton2Cmd() + + preferences.ShowToolbarButton3Cmd() + + preferences.ShowToolbarButton4Cmd() + + preferences.ShowToolbarButton5Cmd() + + preferences.ShowToolbarButton6Cmd() + + preferences.ShowToolbarButton7Cmd() ) == 0 ) + { + ret = ETrue; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendDefaultAccessPointL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendDefaultAccessPointL( CDesCArray*& aItemArray, + TBuf& aItemText ) + { + //get the connection identifier based on the connection type + switch (ApiProvider().Preferences().AccessPointSelectionMode()) + { + case EAlwaysAsk: + { + #if !defined(BRDO_BROWSER_50_FF) + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_DEFAULT_AP, + R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK, + aItemText ); + #else + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_DEFAULT_AP, + R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED, + aItemText ); + #endif //BRDO_BROWSER_50_FF + break; + } + + //get the destination identifyer based on the snap Id + case EDestination: + { + aItemText.Zero(); + aItemText.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* defaultAp = iCoeEnv->AllocReadResourceLC( + R_WMLBROWSER_SETTINGS_DEFAULT_AP ); + aItemText.Append( *defaultAp ); + CleanupStack::PopAndDestroy(); // defaultAp + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + + RCmManager cmManager; + cmManager.OpenL(); + + TInt snapId = ApiProvider().Preferences().DefaultSnapId(); + if (snapId != KWmlNoDefaultSnapId) + { + TRAPD(err, RCmDestination dest = cmManager.DestinationL( snapId )); + if (err == KErrNone) + { + RCmDestination dest = cmManager.DestinationL( snapId ); + CleanupClosePushL( dest ); + HBufC* destName = dest.NameLC(); + aItemText.Append(*destName); + CleanupStack::PopAndDestroy( 2 ); // destName, dest + cmManager.Close(); + break; + } + } + #if !defined(BRDO_BROWSER_50_FF) + HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK ); + #else + HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED ); + #endif // BRDO_BROWSER_50_FF + aItemText.Append( *name ); + CleanupStack::PopAndDestroy(); // name + + ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk ); + cmManager.Close(); + + break; + } + + //if connecting with Iap Id + case EConnectionMethod: + { + aItemText.Zero(); + aItemText.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* defaultAp = iCoeEnv->AllocReadResourceLC( + R_WMLBROWSER_SETTINGS_DEFAULT_AP ); + aItemText.Append( *defaultAp ); + CleanupStack::PopAndDestroy(); // defaultAp + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + + TUint id = ApiProvider().Preferences().DefaultAccessPoint(); + if ( id != KWmlNoDefaultAccessPoint ) + { + TBuf< KCommsDbSvrMaxFieldLength > name; + CApUtils* au = CApUtils::NewLC( ApiProvider().CommsModel().CommsDb() ); + au->NameL( id, name ); + aItemText.Append( name ); + CleanupStack::PopAndDestroy(); // au + } + else + { + #if !defined(BRDO_BROWSER_50_FF) + HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK ); + #else + HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED ); + #endif // BRDO_BROWSER_50_FF + aItemText.Append( *name ); + CleanupStack::PopAndDestroy(); // name + + ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk ); + } + + break; + } + + default: + { + User::Leave( KErrNotSupported); + } + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsAccesspoint ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendHomePageL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendHomePageL( CDesCArray*& aItemArray, + TBuf& aItemText) + { +LOG_ENTERFN( "CSettingsContainer::AppendHomePageL" ); + aItemText.Zero(); + aItemText.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* first = iCoeEnv->AllocReadResourceLC( + R_WMLBROWSER_SETTINGS_HOMEPAGE ); + aItemText.Append( first->Des() ); + CleanupStack::PopAndDestroy(); // first + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + + TWmlSettingsHomePage homepageType = ApiProvider().Preferences().HomePageType(); +BROWSER_LOG( ( _L( " pgtype: %d" ), homepageType ) ); + if( homepageType == EWmlSettingsHomePageBookmarks ) + { + HBufC* second = iCoeEnv->AllocReadResourceLC( + R_WMLBROWSER_SETTINGS_HOMEPAGE_BOOKMARKS ); + aItemText.Append( second->Des() ); + CleanupStack::PopAndDestroy(); // second + } + else + { + HBufC* second = HBufC::NewLC( KMaxHomePgUrlLength ); + TPtr ptr( second->Des() ); + if( ApiProvider().Preferences().HomePageUrlL( ptr ) == KErrNone ) + { + TInt itemLength( KWmlSettingsItemMaxLength - aItemText.Length() ); + if( ptr.Length() > itemLength ) + { + aItemText.Append( ptr.Left( itemLength ) ); + } + else + { + aItemText.Append( ptr ); + } + } + else + { + // If access point homepage is to be used, but no homepage URL is + // defined, then display the bookmarks view instead. + if( homepageType == EWmlSettingsHomePageAccessPoint ) + { + iCoeEnv->ReadResourceL( ptr, + R_WMLBROWSER_SETTINGS_HOMEPAGE_BOOKMARKS ); + aItemText.Append( ptr ); + } + else + { + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + } + } + CleanupStack::PopAndDestroy(); // second + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsHomePage ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendPageOverviewL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendPageOverviewL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + if ( iApiProvider.Preferences().PageOverview() ) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_PAGEOVERVIEW, + R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_ON, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_PAGEOVERVIEW, + R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_OFF, + aItemText ); + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsPageOverview ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendToolbarOnOffL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendToolbarOnOffL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + if ( iApiProvider.Preferences().ShowToolbarOnOff() ) + { + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_ON_OFF, + R_BROWSER_SETTING_TOOLBAR_ON, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_ON_OFF, + R_BROWSER_SETTING_TOOLBAR_OFF, + aItemText ); + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarOnOff ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendBackListL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendBackListL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + //------------------------------------------------------------------------- + // BackList + if ( iApiProvider.Preferences().BackList() ) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_BACK_LIST, + R_WMLBROWSER_SETTINGS_BACK_LIST_ON, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_BACK_LIST, + R_WMLBROWSER_SETTINGS_BACK_LIST_OFF, + aItemText ); + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsBackList ); + } + +void CSettingsContainer::AppendURLSuffixListL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + aItemText.Zero(); + aItemText.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* first = iCoeEnv->AllocReadResourceLC( R_WMLBROWSER_SETTINGS_URL_SUFFIX ); + aItemText.Append( first->Des() ); + CleanupStack::PopAndDestroy(); // first + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + + HBufC* buf = iApiProvider.Preferences().URLSuffixList(); + TPtrC suffix(buf->Des()); + + if ( !suffix.Length() ) + { + // leave line empty + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + } + else + { + TInt itemLength( KWmlSettingsItemMaxLength - aItemText.Length() ); + if( suffix.Length() > itemLength ) + { + aItemText.Append( suffix.Left( itemLength ) ); + } + else + { + aItemText.Append( suffix ); + } + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsUrlSuffix ); + } +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendHttpSecurityWarningsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendHttpSecurityWarningsL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_HTTP_SEC_WRNS, + ApiProvider().Preferences().HttpSecurityWarnings() ? + R_WMLBROWSER_SETTINGS_WRN_VALUE_SHOW : + R_WMLBROWSER_SETTINGS_WRN_VALUE_HIDE, + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsHttpSecurityWarnings ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendEcmaL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendEcmaL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + // Add Ecma + switch ( ApiProvider().Preferences().Ecma() ) + { + case EWmlSettingsECMAEnable: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_ECMA, + R_WMLBROWSER_SETTINGS_ECMA_VALUE_ENABLE, + aItemText ); + break; + } + case EWmlSettingsECMADisable: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_ECMA, + R_WMLBROWSER_SETTINGS_ECMA_VALUE_DISABLE, + aItemText ); + break; + } + default: + break; + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsEcma ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendScriptLogL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendScriptLogL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + TInt scriptLog = ApiProvider().Preferences().ScriptLog(); + CRepository* repo = CRepository::NewLC( KCRUidBrowser ); + TInt newVal; + if ( repo ) + { + if ( ( repo->Get( KBrowserNGScriptLog, newVal ) == KErrNone ) && + newVal != scriptLog ) + { + ApiProvider().Preferences().SetScriptLogL( newVal ); + scriptLog = newVal; + } + } + CleanupStack::PopAndDestroy( repo ); + + switch ( scriptLog ) + { + case EWmlSettingsScriptLogDisable: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SCRIPTLOG, + R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_DISABLE, + aItemText ); + break; + } + case EWmlSettingsScriptLogToFile: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SCRIPTLOG, + R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_FILE, + aItemText ); + break; + } + case EWmlSettingsScriptLogToConsole: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SCRIPTLOG, + R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE, + aItemText ); + break; + } + case EWmlSettingsScriptLogToConsoleFile: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SCRIPTLOG, + R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE_FILE, + aItemText ); + break; + } + default: + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SCRIPTLOG, + R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_DISABLE, + aItemText ); + break; + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsScriptLog ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendDownloadsOpenL +// ----------------------------------------------------------------------------- +void CSettingsContainer::AppendDownloadsOpenL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN, + ApiProvider().Preferences().DownloadsOpen() ? + R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_YES : + R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_NO, + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsDownloadsOpen ); + } + + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendSearchProviderL +// ----------------------------------------------------------------------------- +void CSettingsContainer::AppendSearchProviderL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + aItemText.Zero(); + aItemText.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* settingTitle = iCoeEnv->AllocReadResourceLC( R_BROWSERS_SETT_WEB_SEARCH_PROVIDER ); + aItemText.Append( *settingTitle ); + CleanupStack::PopAndDestroy(); // settingTitle + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + + HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); + TPtr searchProviderPtr = searchProvider->Des(); + + ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, + KMaxTitleLength , searchProviderPtr); + + if(searchProvider->Compare(KNullDesC()) == 0) + { + CleanupStack::PopAndDestroy(searchProvider); + searchProvider = iCoeEnv->AllocReadResourceLC( R_IS_LABEL_NOT_SELECTED ); + } + + aItemText.Append( *searchProvider ); + CleanupStack::PopAndDestroy( searchProvider ); + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsSearchProvider ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAutoLoadContentL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAutoLoadContentL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + + TInt autoLoadContent = ApiProvider().Preferences().AutoLoadContent(); + + switch ( autoLoadContent ) + { + case EWmlSettingsAutoloadText: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT, + R_WMLBROWSER_SETTINGS_AUTOLOAD_TEXT, + aItemText ); + break; + } + case EWmlSettingsAutoloadImagesNoFlash: + { + if (iFlashPluginPresent) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT, + R_WMLBROWSER_SETTINGS_AUTOLOAD_IMAGES_NO_FLASH, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT, + R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL, + aItemText ); + } + break; + } + case EWmlSettingsAutoloadAll: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT, + R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL, + aItemText ); + break; + } + default: + break; + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsAutoLoadContent ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAutoFullScreenL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAutoFullScreenL(CDesCArray*& aItemArray, + TBuf& aItemText) + { + switch ( ApiProvider().Preferences().FullScreen() ) + { + case EWmlSettingsFullScreenSoftkeysOnly: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SOFTKEYS, + R_WMLBROWSER_SETTINGS_SOFTKEYS_ON, + aItemText ); + break; + } + case EWmlSettingsFullScreenFullScreen: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_SOFTKEYS, + R_WMLBROWSER_SETTINGS_SOFTKEYS_OFF, + aItemText ); + break; + } + default: + break; + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsFullScreen ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAutomaticUpdatingAPL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAutomaticUpdatingAPL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + TUint id = ApiProvider().Preferences().AutomaticUpdatingAP(); + aItemText.Zero(); + aItemText.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* defaultAp = iCoeEnv->AllocReadResourceLC( + R_WMLBROWSER_SETTINGS_AUTOUPDATING_AP ); + aItemText.Append( *defaultAp ); + CleanupStack::PopAndDestroy(); // defaultAp + aItemText.Append( KWmlSettingsListBoxItemPostfix ); + + if ( id == KWmlNoDefaultAccessPoint ) + { + // If user hasn't selected an AP, show a blank list entry. Once user + // selects an AP, it will be displayed. Note: The browser's default AP + // is used, until user makes a different AP selection. + aItemText.Append( KNullDesC ); + } + else + { + // User (or configuration) has already selected an AP, display its name + TBuf< KCommsDbSvrMaxFieldLength > name; + CApUtils* au = CApUtils::NewLC( ApiProvider().CommsModel().CommsDb() ); + TRAP_IGNORE(au->NameL( id, name )); + aItemText.Append( name ); + CleanupStack::PopAndDestroy(); // au + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsAutomaticUpdatingAP ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAutomaticUpdatingWhileRoamingL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAutomaticUpdatingWhileRoamingL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + + if ( iApiProvider.Preferences().AutomaticUpdatingWhileRoaming() ) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING, + R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_ON, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING, + R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_OFF, + aItemText ); + } + aItemArray->AppendL( aItemText ); + + iSettingIndex->AppendL( EWmlSettingsAutomaticUpdatingWhileRoaming ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAutoMediaVolumeL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAutoMediaVolumeL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + TInt volumeLevel = ApiProvider().Preferences().MediaVolume(); + + switch ( volumeLevel ) + { + case EWmlSettingsVolumeMuted: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_MUTED, + aItemText ); + break; + } + case EWmlSettingsVolume1: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_1, + aItemText ); + break; + } + case EWmlSettingsVolume2: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_2, + aItemText ); + break; + } + case EWmlSettingsVolume3: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_3, + aItemText ); + break; + } + case EWmlSettingsVolume4: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_4, + aItemText ); + break; + } + default: + break; + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsMediaVolume ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendEncodingL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendEncodingL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + TBool currentEncodingFound = EFalse; + for( int i = 0; i < iEncodingArray->Count(); i++ ) + { + if( iEncodingArray->At(i).iSystemId == iEncoding ) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_ENCODING, + iEncodingArray->At(i).iResId, + aItemText ); + currentEncodingFound = ETrue; + break; + } + } + + if( !currentEncodingFound ) + { + __ASSERT_DEBUG( EFalse, Util::Panic( Util::EOutOfRange )); + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsEncoding ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendPopupBlockingL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendPopupBlockingL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + if ( ApiProvider().Preferences().PopupBlocking() ) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_POPUP_BLOCKING, + R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_ON, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_POPUP_BLOCKING, + R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_OFF, + aItemText ); + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsPopupBlocking ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAutoRefreshL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAutoRefreshL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + if ( iApiProvider.Preferences().AutoRefresh() ) + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTO_REFRESH, + R_WMLBROWSER_SETTINGS_AUTO_REFRESH_ON, + aItemText ); + } + else + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_AUTO_REFRESH, + R_WMLBROWSER_SETTINGS_AUTO_REFRESH_OFF, + aItemText ); + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsAutoRefresh ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendAdaptiveBookmarksL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendAdaptiveBookmarksL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + switch ( ApiProvider().Preferences().AdaptiveBookmarks() ) + { + case EWmlSettingsAdaptiveBookmarksOn: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS, + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_ON, + aItemText ); + break; + } + case EWmlSettingsAdaptiveBookmarksHideFolder: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS, + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_HIDE_FOLDER, + aItemText ); + break; + } + case EWmlSettingsAdaptiveBookmarksOff: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS, + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_OFF, + aItemText ); + break; + } + default: + break; + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsAdaptiveBookmarks ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendFormDataSavingL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendFormDataSavingL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + switch ( ApiProvider().Preferences().FormDataSaving() ) + { + case EWmlSettingsFormDataPlusPassword: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING, + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ON, + aItemText ); + break; + } + case EWmlSettingsFormDataOnly: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING, + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ONLY, + aItemText ); + break; + } + case EWmlSettingsFormDataOff: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING, + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_OFF, + aItemText ); + break; + } + + default: + break; + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsFormDataSaving ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendCookiesL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendCookiesL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + switch ( ApiProvider().Preferences().Cookies() ) + { + case EWmlSettingsCookieAllow: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_COOKIES, + R_WMLBROWSER_SETTINGS_C_VALUE_ALLOW, + aItemText ); + break; + } + case EWmlSettingsCookieReject: + { + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_COOKIES, + R_WMLBROWSER_SETTINGS_C_VALUE_REJECT, + aItemText ); + break; + } + default: + break; + } + + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsCookies ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendIMEIL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendIMEIL( + CDesCArray*& aItemArray, + TBuf& aItemText) + { + switch ( ApiProvider().Preferences().IMEINotification() ) + { + case EWmlSettingsIMEIEnable: + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_IMEI, + R_WMLBROWSER_SETTINGS_IMEI_VALUE_ENABLED, + aItemText ); + break; + case EWmlSettingsIMEIDisable: + CreateItemFromTwoStringsL( + R_WMLBROWSER_SETTINGS_IMEI, + R_WMLBROWSER_SETTINGS_IMEI_VALUE_DISABLED, + aItemText ); + break; + default: + break; + } + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsIMEINotification ); + + } +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendFontSize +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendFontSizeL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + CreateItemFromTwoStringsL(R_WMLBROWSER_SETTINGS_FONT_SIZE, + GetFontSizeString(), + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsFontSize ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::GetFontSizeString +// Convenience utility. Note that many of the settings duplicate the +// code to generate this sort od string. This pattern could be applied +// to many of the settings to reduce the code size. A side effect of this +// code is that the iFontSize variable may be modified in the Chinese +// Build case. This code is in one place now and not duplicated. +// ----------------------------------------------------------------------------- +// +TInt CSettingsContainer::GetFontSizeString() + { + // China build (__AVKON_APAC__) has only three font sizes. + // If for some reason smaller/larger is selected, display it as "normal" + if (!AVKONAPAC) + { + switch (iFontSize) + { + case 0: + return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL; + case 1: + return R_WMLBROWSER_SETTINGS_FS_VALUE_SMALLER; + case 2: + return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL; + case 3: + return R_WMLBROWSER_SETTINGS_FS_VALUE_LARGER; + case 4: + return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE; + default: + return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL; + } + } + else + { + switch (iFontSize) + { + case 0: + return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL; + case 1: + case 2: + case 3: + //These three map to same size. + iFontSize = 2; + return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL; + case 4: + return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE; + default: + return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL; + } + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendToolbarButtonsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendToolbarButtonsL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON1, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton1Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton1Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON2, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton2Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton2Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON3, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton3Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton3Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON4, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton4Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton4Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON5, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton5Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton5Cmd ); + + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON6, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton6Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton6Cmd ); + + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_TOOLBAR_BUTTON7, + ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton7Cmd()][KToolbarCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsToolbarButton7Cmd ); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::AppendShortcutKeysL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::AppendShortcutKeysL( CDesCArray*& aItemArray, + TBuf& aItemText) + { + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY1, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey1Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey1Cmd ); + + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY2, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey2Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey2Cmd ); + + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY3, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey3Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey3Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY4, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey4Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey4Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY5, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey5Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey5Cmd ); + + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY6, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey6Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey6Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY7, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey7Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey7Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY8, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey8Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey8Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY9, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey9Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey9Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEY0, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey0Cmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKey0Cmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEYSTAR, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyStarCmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKeyStarCmd ); + + CreateItemFromTwoStringsL( + R_BROWSER_SETTING_SHORTCUT_KEYHASH, + ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyHashCmd()][KShortcutsCommandDecodeMatrixStringId], + aItemText ); + aItemArray->AppendL( aItemText ); + iSettingIndex->AppendL( EWmlSettingsShortCutKeyHashCmd ); + + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::ClearListBoxContentL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::ClearListBoxContentL() + { + CDesCArray* itemArray = + ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() ); + + // Clear out the listbox content - it is reusable + while ( itemArray->Count() ) + { + itemArray->Delete( 0 ); + } + while ( iSettingIndex->Count() ) + { + iSettingIndex->Delete( 0 ); + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::StoreListBoxIndexL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::StoreListBoxIndexL() + { + // We only use one list box for all of the lists in the Settings, + // we need to keep track of the current & top indices so that focus + // is updated correctly + + if ( iCurrentSettingCategory == EMain ) + { + iMainSettingCurrentIndex = iSettingListBox->CurrentItemIndex(); + iMainSettingTopPosIndex = iSettingListBox->TopItemIndex(); + + // Reinitialise the subsetting indices + iSubSettingCurrentIndex = KWmlSettingsIndexNone; + iSubSettingTopPosIndex = 0; + } + else + { + iSubSettingCurrentIndex = iSettingListBox->CurrentItemIndex(); + iSubSettingTopPosIndex = iSettingListBox->TopItemIndex(); + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::RestoreListBoxIndexL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::RestoreListBoxIndexL() + { + iSettingListBox->Reset(); + + // Listbox might not have index + if ( iCurrentSettingCategory == EMain ) + { + if ( iMainSettingCurrentIndex != KWmlSettingsIndexNone ) + { + iSettingListBox->SetCurrentItemIndex( iMainSettingCurrentIndex ); + iSettingListBox->SetTopItemIndex( iMainSettingTopPosIndex ); + } + } + else + { + if ( iSubSettingCurrentIndex != KWmlSettingsIndexNone ) + { + iSettingListBox->SetCurrentItemIndex( iSubSettingCurrentIndex ); + iSettingListBox->SetTopItemIndex( iSubSettingTopPosIndex ); + } + } + iSettingListBox->HandleItemAdditionL(); + iSettingListBox->DrawNow(); + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::ChangeItemL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::ChangeItemL( TBool aSelectKeyWasPressed ) + { + LOG_ENTERFN("CSettingsContainer::ChangeItemL"); + // item is selected for modification + TInt currentItem( iSettingListBox->CurrentItemIndex() ); + + + + // creating array to hold resource ids of options + CArrayFixFlat *values=new(ELeave)CArrayFixFlat( 4 ); + + // creating an array to hold mapping between displayed choices and resource ids + // in the case of Toolbar/Shortcut key assignments + // where some commands (like ROTATE) are not visible. + CArrayFixFlat *valueDisplayMapping=new(ELeave)CArrayFixFlat(4); + + + CleanupStack::PushL( values ); + CleanupStack::PushL( valueDisplayMapping ); + TInt value; + MPreferences& preferences = ApiProvider().Preferences(); + TInt settingsItem = MapCurrentItem( currentItem ); + switch ( settingsItem ) + { + case EWmlSettingsAccesspoint: + { + TInt err(KErrNone); + TInt retVal( KErrNone ); + //start the connection dialog + CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL(); + CleanupStack::PushL( settings ); + + TCmSettingSelection selection; + + // + // In Avkon tradition, + // set the id of selection from the existing setting in preferences + // so it is shown that way in the selection dialog box. + // + // Note the CCmApplicationSettingsUi API should ensure that if + // "Connection Method" was previously selected, it should show up as + // "Uncategorized" being shown selected + // + switch (preferences.AccessPointSelectionMode()) + { + case EAlwaysAsk: + { + selection.iResult = EAlwaysAsk; + selection.iId = preferences.DefaultSnapId(); + break; + } + case EDestination: + { + selection.iResult = EDestination; + selection.iId = preferences.DefaultSnapId(); + break; + } + case EConnectionMethod: + { + selection.iResult = EConnectionMethod; + selection.iId = Util::IapIdFromWapIdL( ApiProvider(), preferences.DefaultAccessPoint() ); + break; + } + default: + // default case, set it to nothing + selection.iResult = EDefaultConnection; + break; + } + + // empty filter array because no filtering is wanted + TBearerFilterArray filterArray; + TRAP ( err, retVal = settings->RunApplicationSettingsL( selection, + EShowAlwaysAsk | EShowDestinations | EShowConnectionMethods, + // turn off SNAP +// EShowAlwaysAsk | EShowConnectionMethods, + filterArray ) ); + CleanupStack::PopAndDestroy();//settings + + //if something has been selected + if (retVal) + { + //set the selection mode + preferences.SetAccessPointSelectionModeL( + STATIC_CAST( TCmSettingSelectionMode, selection.iResult ) ); + + //based on the chosen connection type, store the connection identifier(iapid, snap id, always ask) + //in the preferences list + switch (preferences.AccessPointSelectionMode()) + { + case EConnectionMethod: + { + BROWSER_LOG( ( _L( "CSettingsContainer::ChangeItemL CApSettingsHandler" ) ) ); + + TUint32 id = preferences.DefaultAccessPoint(); + // CMManager gives us IAPid, need to translate to WAPid + if (selection.iId != 0) + { + id = Util::WapIdFromIapIdL( ApiProvider(), selection.iId ); + } + preferences.SetDefaultAccessPointL( id ); + BROWSER_LOG( ( _L( " SetDefaultAccessPointL OK" ) ) ); + // Requested AP is preset for PushMtm + ApiProvider().SetRequestedAP( preferences.DefaultAccessPoint() ); + break; + } + + case EDestination: + { + TUint32 snapId = preferences.DefaultSnapId(); + if (selection.iId != 0) + { + snapId = selection.iId; + } + preferences.SetDefaultSnapId( snapId ); + + break; + } + + case EAlwaysAsk: + { + break; + } + + default: + { + LOG_ENTERFN(" Wrong value in CSettingsContainer::ChangeItemL"); + } + } + } + + DisplayGeneralSettingsL(); + BROWSER_LOG( ( _L( "DisplayGeneralSettingsL OK" ) ) ); + + break; + } + + case EWmlSettingsAutoLoadContent: + { + if(iFlashPluginPresent) + { + value = 2 - preferences.AutoLoadContent(); + + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL ); // 2 + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_IMAGES_NO_FLASH ); // 1 + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_TEXT ); // 0 + + value = 2 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT, + values, + value )); + } + else + { + // Below is cenrep values for Load Content for cenrep key KBrowserNGImagesEnabled + // Load Content + // Valid values: + // If flash plugin is present: 0 = Text only, 1 = Images,No flash, 2 = All + // If flash plugin is not present 0 = Text only, 1 = All + + // Based on this we have to manually translate the value of 1 from Images,No flash to All + // in case where the flash plugin is not present. + + + value = 1 - preferences.AutoLoadContent(); + + if ( value < 0 ) + { + // for case of EWmlSettingsAutoloadAll value would be negative ; + // reset to 0 to prevent crash later + value = 0; + } + + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL ); // 1 (translated from 2 when flash plugin is present) + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_TEXT ); // 0 + + value = 1 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT, + values, + value )); + + if (value == EWmlSettingsAutoloadImagesNoFlash) + // Flash plugin not present so reset value from 1 to 2 + { + value = EWmlSettingsAutoloadAll; + } + } + + preferences.SetAutoLoadContentL( value ); + DisplayPageSettingsL(); + break; + } + + case EWmlSettingsFontSize: + { + //The relationship between index and fontsize is awkward because + //the radio buttons reverse the order and the routine called tries + //to straighten that out. + TInt fontIndex = 4 - iFontSize; // (0,1,2,3,4 >> 4,3,2,1,0) + if (!AVKONAPAC) + { + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE ); + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_LARGER ); + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL ); + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_SMALLER ); + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL ); + //Convert result to (4,3,2,1,0 >> 0,1,2,3,4) + iFontSize = 4 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_FONT_SIZE, + values, + fontIndex )); + } + else + { + // China build has only three font sizes. Radio button + // indices are 0, 1, 2. Map these to 0, 2, 4 (all small, + // normal, all large) for preferences. + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE ); + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL ); + values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL ); + //Convert result to (4,3,2,1,0 >> 0,1,2,3,4) + iFontSize = 4 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_FONT_SIZE, + values, + fontIndex >> 1 ) << 1); + } + preferences.SetFontSizeL( iFontSize ); + DisplayPageSettingsL(); + break; + } + + case EWmlSettingsPageOverview: + { + if( ApiProvider().WindowMgr().CurrentWindow()->IsPageOverviewSupportedL() ) + { + values->AppendL( R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_ON ); + value = preferences.PageOverview(); + value = aSelectKeyWasPressed ? + 1 - value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_PAGEOVERVIEW, + values, + value ); + preferences.SetPageOverviewL( value ); + DisplayGeneralSettingsL(); + } + break; + } + + case EWmlSettingsBackList: + { + values->AppendL( R_WMLBROWSER_SETTINGS_BACK_LIST_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_BACK_LIST_ON ); + value = preferences.BackList(); + value = aSelectKeyWasPressed ? + 1 - value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_BACK_LIST, + values, + value ); + preferences.SetBackListL( value ); + DisplayGeneralSettingsL(); + break; + } + case EWmlSettingsUrlSuffix: + { + TInt ret; + + HBufC* suffixBuf = iApiProvider.Preferences().URLSuffixList(); + HBufC* suffixToPass = HBufC::NewLC( KMaxSearchPgUrlLength ); + suffixToPass = suffixBuf; + TPtr ptr = suffixToPass->Des(); + + TInt resource = R_URL_SUFFIX_PAGE; + + CAknSettingPage* dlg = new ( ELeave ) CAknTextSettingPage( + resource, ptr, CAknTextSettingPage::EZeroLengthAllowed ); + + ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); + + if ( ret ) + { + iApiProvider.Preferences().SetURLSuffixList(suffixToPass); + } + + CleanupStack::PopAndDestroy(); // suffixToPass + DisplayGeneralSettingsL(); + break; + } + case EWmlSettingsAutoRefresh: + { + values->AppendL( R_WMLBROWSER_SETTINGS_AUTO_REFRESH_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_AUTO_REFRESH_ON ); + value = preferences.AutoRefresh(); + value = aSelectKeyWasPressed ? + 1 - value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_AUTO_REFRESH, + values, + value ); + preferences.SetAutoRefreshL( value ); + DisplayPageSettingsL(); + break; + } + + case EWmlSettingsEncoding: + { + TInt highlightedItemIndex = KDoesntExist; + TInt lathinIndex = KDoesntExist; + for( int i = iEncodingArray->Count() - 1; i >= 0; i-- ) + { + TEncodingStruct encoding = iEncodingArray->At(i); + + if ( encoding.iSystemId == KCharacterSetIdentifierIso88591 ) + { + lathinIndex = i; + } + + values->AppendL( encoding.iResId ); + + if ( encoding.iSystemId == iEncoding ) + { + highlightedItemIndex = i; + } + } + + if( highlightedItemIndex == KDoesntExist ) + { + if( lathinIndex != KDoesntExist ) + { + highlightedItemIndex = lathinIndex; + } + else + { + highlightedItemIndex = 0; + } + } + + TInt selectedIndex = + iEncodingArray->Count() - 1 - + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_ENCODING, + values, + iEncodingArray->Count() - 1 - highlightedItemIndex ); + + TEncodingStruct selectedEncoding = + iEncodingArray->At( selectedIndex ); + + iEncoding = selectedEncoding.iSystemId; + DisplayPageSettingsL(); + break; + } + + case EWmlSettingsAdaptiveBookmarks: + { + values->AppendL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_OFF ); + values->AppendL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_HIDE_FOLDER ); + values->AppendL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_ON ); + + value = 2-preferences.AdaptiveBookmarks(); + value = ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS, + values, + value ); + preferences.SetAdaptiveBookmarksL( + ( TWmlSettingsAdaptiveBookmarks )(2-value) ); + DisplayPrivacySettingsL(); + break; + } + + case EWmlSettingsFormDataSaving: + { + values->AppendL( R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ONLY ); + values->AppendL( R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ON ); + + value = preferences.FormDataSaving(); + TInt origValue(value); + value = ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING, + values, + value ); + preferences.SetFormDataSavingL( (TWmlSettingsFormData) value ); + + if (origValue > value) + { + // query to see if we need to delete stored form data + if (origValue == EWmlSettingsFormDataPlusPassword && value == EWmlSettingsFormDataOnly) + { + // delete password data? + ShowFormDataDeletePasswordQueryDialogL(); + } + else if (origValue == EWmlSettingsFormDataPlusPassword && value == EWmlSettingsFormDataOff) + { + // delete password and form data + ShowFormDataDeleteAllQueryDialogL(); + } + else if (origValue == EWmlSettingsFormDataOnly && value == EWmlSettingsFormDataOff) + { + // delete form data + ShowFormDataDeleteAllQueryDialogL(); + } + } + + DisplayPrivacySettingsL(); + break; + } + + case EWmlSettingsFullScreen: + { + + values->AppendL( R_WMLBROWSER_SETTINGS_SOFTKEYS_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_SOFTKEYS_ON ); + value = preferences.FullScreen(); + value = aSelectKeyWasPressed ? + 1 - value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_SOFTKEYS, + values, + value ); + preferences.SetFullScreenL( ( TWmlSettingsFullScreen )( value ) ); + DisplayPageSettingsL(); + break; + } + + case EWmlSettingsHomePage: + { + values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_BOOKMARKS ); + + // "Use current page" is available only if a page is loaded. + // so there might be a hole in the array! + HBufC *url = CBrowserAppUi::Static()->BrCtlInterface().PageInfoLC( + TBrCtlDefs::EPageInfoUrl ); + + TInt useCurrent( 0 ); + if( url && url->Length() ) + { + values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_USE_CURRENT ); + ++useCurrent; + } + + values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_NEW_ADDRESS ); + values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_ACCESS_POINT ); + TBool dialogCancel( ETrue ); + while( dialogCancel ) + { + value = preferences.HomePageType(); + if( !useCurrent ) + { + // 'Use current' is not shown as current item + if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageUseCurrent ) + { + value = EWmlSettingsHomePageAddress; + } + // items behind UseCurrent must be shifted below + else if( (TWmlSettingsHomePage)value > EWmlSettingsHomePageUseCurrent ) + { + --value; + } + } + // sanity check + if( value >= 7 + useCurrent ) + { + value = 7 + useCurrent; + } + if( ShowRadioButtonSettingPageBoolL( + R_WMLBROWSER_SETTINGS_STARTPAGE, values, &value ) ) + { // OK was pressed on RadioSetting + // shift value if needed + if( !useCurrent && + ( (TWmlSettingsHomePage)value >= EWmlSettingsHomePageUseCurrent) ) + { + ++value; + } + if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageAddress ) + { + HBufC* prompt = StringLoader::LoadLC( R_BROWSER_PROMPT_HOMEPAGE_URL ); + HBufC* retBuf = HBufC::NewL( KMaxHomePgUrlLength ); + TPtr retString = retBuf->Des(); + retString.Copy( KNullDesC ); + + if( preferences.HomePageUrlL( retString, ETrue ) != KErrNone ) + { + retString.Zero(); + retString.Copy( KNullDesC ); + } + TInt result = TBrowserDialogs::DialogPromptReqL( + prompt->Des(), + &retString, + ETrue, + KMaxHomePgUrlLength ); + CleanupStack::PopAndDestroy(); // prompt + if( result ) // URL was accepted + { + preferences.SetHomePageUrlL( retString ); + preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value ); + dialogCancel = EFalse; + } + if( retBuf ) + { + delete retBuf; + } + // else URL was cancelled! one more round + } + else if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageAccessPoint ) + { + preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value ); + dialogCancel = EFalse; + } + else if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageUseCurrent ) + { + // url was already checked. it exists. + TPtr urlPtr = url->Des(); + preferences.SetHomePageUrlL( urlPtr ); + preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value ); + dialogCancel = EFalse; + } + else if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageBookmarks ) + { + preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value ); + dialogCancel = EFalse; + } + } + else // Cancel was pressed on RadioSetting, nothing to do + { + dialogCancel = EFalse; + } + DisplayGeneralSettingsL(); + } + CleanupStack::PopAndDestroy( url ); // url + break; + } + + case EWmlSettingsAutomaticUpdatingAP: + { + TUint32 id = preferences.AutomaticUpdatingAP(); + SelectUserDefinedAPL( id ); + + preferences.SetAutomaticUpdatingApL( id ); + BROWSER_LOG( ( _L( "EWmlSettingsAutomaticUpdatingAP SetAutomaticUpdatingApL()" ) ) ); + + DisplayWebFeedsSettingsL(); + BROWSER_LOG( ( _L( "EWmlSettingsAutomaticUpdatingAP DisplayWebFeedsSettingsL()" ) ) ); + break; + } + + case EWmlSettingsMediaVolume: + { + // Add option list items + values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_4 ); + values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_3 ); + values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_2 ); + values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_1 ); + values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_MUTED ); + + TInt itemcount = values->Count(); + + // Get Media Volume Value + value = preferences.MediaVolume(); + + // Convert volume to list index + switch ( value ) + { + case EWmlSettingsVolumeMuted: + value = EVolumeMute; + break; + case EWmlSettingsVolume1: + value = EVolumeLevel1; + break; + case EWmlSettingsVolume2: + value = EVolumeLevel2; + break; + case EWmlSettingsVolume3: + value = EVolumeLevel3; + break; + case EWmlSettingsVolume4: + value = EVolumeLevel4; + break; + default: + break; + } + + // Open Volume Option List Page + value = ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, values, + ( itemcount - 1 ) - value ); + + // Reconvert list index to volume + value = ( itemcount - 1 ) - value; + switch ( value ) + { + case EVolumeMute: + value = EWmlSettingsVolumeMuted; + break; + case EVolumeLevel1: + value = EWmlSettingsVolume1; + break; + case EVolumeLevel2: + value = EWmlSettingsVolume2; + break; + case EVolumeLevel3: + value = EWmlSettingsVolume3; + break; + case EVolumeLevel4: + value = EWmlSettingsVolume4; + break; + default: + break; + } + + // Save Media Volume Value + preferences.SetMediaVolumeL( value ); + DisplayPageSettingsL(); + break; + } + + case EWmlSettingsCookies: + { + values->AppendL( R_WMLBROWSER_SETTINGS_C_VALUE_REJECT ); + values->AppendL( R_WMLBROWSER_SETTINGS_C_VALUE_ALLOW ); + value = preferences.Cookies(); + value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_COOKIES, + values, + value ); + preferences.SetCookiesL( ( TWmlSettingsCookies )value ); + DisplayPrivacySettingsL(); + break; + } + + case EWmlSettingsEcma: + { + values->AppendL( R_WMLBROWSER_SETTINGS_ECMA_VALUE_DISABLE ); + values->AppendL( R_WMLBROWSER_SETTINGS_ECMA_VALUE_ENABLE ); + value = preferences.Ecma();//items need to be appended in reverse order + value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_ECMA, + values, + value ); + preferences.SetEcmaL( ( TWmlSettingsECMA ) value ); + DisplayGeneralSettingsL(); + break; + } + + case EWmlSettingsScriptLog: + { + value = 3 - preferences.ScriptLog(); + + values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE_FILE ); + values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE ); + values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_FILE ); + values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_DISABLE ); + + value = 3 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_SCRIPTLOG, + values, + value )); + preferences.SetScriptLogL( value ); + DisplayGeneralSettingsL(); + + break; + } + + case EWmlSettingsDownloadsOpen: + { + values->AppendL( R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_YES ); + values->AppendL( R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_NO ); + value = preferences.DownloadsOpen(); + value = aSelectKeyWasPressed ? value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN, + values, + 1 - value ); + preferences.SetDownloadsOpenL( 1 - value ); + DisplayGeneralSettingsL(); + break; + } + + case EWmlSettingsHttpSecurityWarnings: + { + values->AppendL( R_WMLBROWSER_SETTINGS_WRN_VALUE_SHOW ); + values->AppendL( R_WMLBROWSER_SETTINGS_WRN_VALUE_HIDE ); + value = preferences.HttpSecurityWarnings(); + value = aSelectKeyWasPressed ? value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_HTTP_SEC_WRNS, + values, + 1 - value ); + preferences.SetHttpSecurityWarningsL( 1 - value ); // show=1, hide=0 in preferences + DisplayGeneralSettingsL(); + break; + } + + case EWmlSettingsSearchProvider: + { + RunSearchSettingsL(); + break; + } + + + + case EWmlSettingsIMEINotification: + { + if ( IMEI_NOTIFICATION ) + { + values->AppendL( R_WMLBROWSER_SETTINGS_IMEI_VALUE_DISABLED ); + values->AppendL( R_WMLBROWSER_SETTINGS_IMEI_VALUE_ENABLED ); + value = preferences.IMEINotification(); + //items need to be appended in reverse order + value = aSelectKeyWasPressed ? 1 - value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_IMEI, + values, + value ); + preferences.SetIMEINotificationL( ( TWmlSettingsIMEI ) value ); + DisplayPrivacySettingsL(); + } + break; + } + + case EWmlSettingsSendReferrer: + { + values->AppendL( R_WMLBROWSER_SETTINGS_SEND_REFERRER_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_SEND_REFERRER_ON ); + value = preferences.SendReferrer(); + value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_SEND_REFERRER, + values, + value ); + DisplayPrivacySettingsL(); + break; + } + + case EWmlSettingsPopupBlocking: + { + values->AppendL( R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_ON ); + value = preferences.PopupBlocking(); + value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_POPUP_BLOCKING, + values, + value ); + preferences.SetPopupBlockingL( value ); + DisplayPageSettingsL(); + break; + } + + + case EWmlSettingsAutomaticUpdatingWhileRoaming: + { + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_OFF ); + values->AppendL( R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_ON ); + + value = preferences.AutomaticUpdatingWhileRoaming(); + value = aSelectKeyWasPressed ? + 1 - value : + ShowRadioButtonSettingPageL( + R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING, + values, + value ); + preferences.SetAutomaticUpdatingWhileRoamingL( value ); + + DisplayWebFeedsSettingsL(); + break; + } + + + case EWmlSettingsToolbarOnOff: + { + values->AppendL( R_BROWSER_SETTING_TOOLBAR_OFF ); + values->AppendL( R_BROWSER_SETTING_TOOLBAR_ON ); + + value = preferences.ShowToolbarOnOff(); + value = aSelectKeyWasPressed ? + 1 - value : + ShowRadioButtonSettingPageL( + R_BROWSER_SETTING_TOOLBAR_ON_OFF, + values, + value ); + preferences.SetToolbarOnOffL( value ); + + DisplayToolbarSettingsL(); + break; + } + + + case EWmlSettingsToolbarButton1Cmd: + { + value = preferences.ShowToolbarButton1Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON1, + values, + value ); + + preferences.SetToolbarButton1CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsToolbarButton2Cmd: + { + value = preferences.ShowToolbarButton2Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON2, + values, + value ); + + preferences.SetToolbarButton2CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsToolbarButton3Cmd: + { + value = preferences.ShowToolbarButton3Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON3, + values, + value ); + + preferences.SetToolbarButton3CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsToolbarButton4Cmd: + { + value = preferences.ShowToolbarButton4Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON4, + values, + value ); + + preferences.SetToolbarButton4CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsToolbarButton5Cmd: + { + value = preferences.ShowToolbarButton5Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON5, + values, + value ); + + preferences.SetToolbarButton5CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsToolbarButton6Cmd: + { + value = preferences.ShowToolbarButton6Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON6, + values, + value ); + + preferences.SetToolbarButton6CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsToolbarButton7Cmd: + { + value = preferences.ShowToolbarButton7Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetToolbarButtonValues(values, value, valueDisplayMapping); + + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_TOOLBAR_BUTTON7, + values, + value ); + + preferences.SetToolbarButton7CmdL( valueDisplayMapping->At(value) ); + DisplayToolbarSettingsL(); + break; + } + + case EWmlSettingsShortCutKey1Cmd: + { + value = preferences.ShortcutKey1Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY1, + values, + value ); + preferences.SetShortcutKey1CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey2Cmd: + { + value = preferences.ShortcutKey2Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY2, + values, + value ); + preferences.SetShortcutKey2CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey3Cmd: + { + value = preferences.ShortcutKey3Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY3, + values, + value ); + preferences.SetShortcutKey3CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey4Cmd: + { + value = preferences.ShortcutKey4Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY4, + values, + value ); + preferences.SetShortcutKey4CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey5Cmd: + { + value = preferences.ShortcutKey5Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY5, + values, + value ); + preferences.SetShortcutKey5CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey6Cmd: + { + value = preferences.ShortcutKey6Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY6, + values, + value ); + preferences.SetShortcutKey6CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey7Cmd: + { + value = preferences.ShortcutKey7Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY7, + values, + value ); + preferences.SetShortcutKey7CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey8Cmd: + { + value = preferences.ShortcutKey8Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY8, + values, + value ); + preferences.SetShortcutKey8CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey9Cmd: + { + value = preferences.ShortcutKey9Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY9, + values, + value ); + preferences.SetShortcutKey9CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKey0Cmd: + { + value = preferences.ShortcutKey0Cmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEY0, + values, + value ); + preferences.SetShortcutKey0CmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKeyStarCmd: + { + value = preferences.ShortcutKeyStarCmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEYSTAR, + values, + value ); + preferences.SetShortcutKeyStarCmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + case EWmlSettingsShortCutKeyHashCmd: + { + value = preferences.ShortcutKeyHashCmd(); + // set toolbar values will build values into an array to be displayed to the user + // this may mean filtering out some items, so we have to know the mapping between our + // fixed array of commands as well as the current value from settings + value = SetShortcutKeysValues(values, value, valueDisplayMapping); + value = ShowRadioButtonSettingPageL( R_BROWSER_SETTING_SHORTCUT_KEYHASH, + values, + value ); + preferences.SetShortcutKeyHashCmdL( valueDisplayMapping->At(value) ); + DisplayShortcutsSettingsL(); + break; + } + + default: + break; + } + CleanupStack::PopAndDestroy(2); // values, valueDisplayMapping + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::SetToolbarButtonValues +// ----------------------------------------------------------------------------- +// +TInt CSettingsContainer::SetToolbarButtonValues(CArrayFixFlat *values, TInt value, CArrayFixFlat *displaymap) + { + TInt valueNewMapping = 0; + + for ( TInt i=0 ; i < KToolbarCommandDecodeMatrixCount ; i++ ) + { + TInt stringId = ToolbarCommandDecodeMatrix[i][KToolbarCommandDecodeMatrixStringId]; + + if ((stringId == R_BROWSER_SETTING_ROTATE_SCREEN) && (!ApiProvider().Preferences().RotateDisplay()) ) + { // Rotate Display is not available so don't show it as a toolbar button command + continue; + } + +#ifndef __RSS_FEEDS + if (stringId == R_BROWSER_SETTING_SUBSCRIBE_TO_FEEDS) + { // Subscribe to Feeds is not available so don't show it as a toolbar button command + continue; + } +#endif + + // Disable save page until it's officially supported + if (stringId == R_BROWSER_SETTING_SAVE_PAGE ) + { + continue; + } + + // make a note at the index within the new array that the current value is at + // before appending (Count will then correspond to the index, rather than needing to use + // Count() - 1 AFTER we add it + if(i == value) + { + valueNewMapping = displaymap->Count(); + } + displaymap->AppendL( i ); + values->AppendL( stringId ); + } + + return valueNewMapping; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::SetShortcutKeysValues +// ----------------------------------------------------------------------------- +// +TInt CSettingsContainer::SetShortcutKeysValues(CArrayFixFlat *values, TInt value, CArrayFixFlat *displaymap) + { + TInt valueNewMapping = 0; + + for ( TInt i=0 ; i < KShortcutsCommandDecodeMatrixCount ; i++ ) + { + + TInt stringId = ShortcutsCommandDecodeMatrix[i][KShortcutsCommandDecodeMatrixStringId]; + + if ((stringId == R_BROWSER_SETTING_ROTATE_SCREEN) && (!ApiProvider().Preferences().RotateDisplay()) ) + { // Rotate Display is not available so don't show it as a shortcut key command + continue; + } + +#ifndef __RSS_FEEDS + if (stringId == R_BROWSER_SETTING_SUBSCRIBE_TO_FEEDS) + { // Subscribe to Feeds is not available so don't show it as a shortcut key command + continue; + } +#endif + + + // Disable save page until it's officially supported + if (stringId == R_BROWSER_SETTING_SAVE_PAGE ) + { + continue; + } + + // make a note at the index within the new array that the current value is at + // before appending (Count will then correspond to the index, rather than needing to use + // Count() - 1 AFTER we add it + if(i == value) + { + valueNewMapping = displaymap->Count(); + } + + displaymap->AppendL( i ); + values->AppendL(stringId ); + } + + return valueNewMapping; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::IsSettingModifiable +// ----------------------------------------------------------------------------- +// +TBool CSettingsContainer::IsSettingModifiable() const + { + TBool ret( EFalse ); + + switch ( iCurrentSettingCategory ) + { + // Only these setting lists contain items which can be modified + case EGeneral: + case EPage: + case EWebFeeds: + case EPrivacy: + case EToolbar: + case EShortCuts: + { + ret = ETrue; + break; + } + default: + break; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::ShowRadioButtonSettingPageL +// ----------------------------------------------------------------------------- +// +TInt CSettingsContainer::ShowRadioButtonSettingPageL( + TInt aTitle, + CArrayFixFlat* aValues, + TInt aCurrentItem ) + { + // title of the dialog + HBufC* title = iCoeEnv->AllocReadResourceLC( aTitle ); + + __ASSERT_DEBUG( (aValues != NULL), Util::Panic( Util::EUninitializedData )); + + + // options array + CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat(1); + CleanupStack::PushL( values ); + + for ( TInt i = aValues->Count() - 1; i >= 0; i-- ) + { + HBufC* value = iCoeEnv->AllocReadResourceLC( aValues->At( i ) ); + values->AppendL( *value ); + CleanupStack::PopAndDestroy(); // value + } + + // index must be turned upside down, because options list is upside down + TInt newItem = aCurrentItem = aValues->Count() - 1 - aCurrentItem; + + // We have everything to create dialog + CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( + R_RADIO_BUTTON_SETTING_PAGE, newItem, values ); + + CleanupStack::PushL( dlg ); + dlg->SetSettingTextL( *title ); + //dlg->ConstructL(); + //dlg->ListBoxControl()->SetCurrentItemIndex( newItem ); + CleanupStack::Pop(); // dlg + iActionCancelled = EFalse; + if ( !dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) + { + // Changes confirmed + newItem = aCurrentItem; + iActionCancelled = ETrue; + } + + CleanupStack::PopAndDestroy( 2 ); // title, values + + // index must be re-turned upside down, because options list is upside down + return aValues->Count() - 1 - newItem; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::ShowRadioButtonSettingPageL +// ----------------------------------------------------------------------------- +// +TBool CSettingsContainer::ShowRadioButtonSettingPageBoolL( + TInt aTitle, + CArrayFixFlat* aValues, + TInt* aCurrentItem ) + { + // title of the dialog + HBufC* title = iCoeEnv->AllocReadResourceLC( aTitle ); + + __ASSERT_DEBUG( (aValues != NULL), Util::Panic( Util::EUninitializedData )); + __ASSERT_DEBUG( (aCurrentItem != NULL), Util::Panic( Util::EUninitializedData )); + + + // options array + CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat(1); + CleanupStack::PushL( values ); + + for ( TInt i = aValues->Count() - 1; i >= 0; i-- ) + { + HBufC* value = iCoeEnv->AllocReadResourceLC( aValues->At( i ) ); + values->AppendL( *value ); + CleanupStack::PopAndDestroy(); // value + } + + TInt newItem = *aCurrentItem; + CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( + R_RADIO_BUTTON_SETTING_PAGE, newItem, values ); + + CleanupStack::PushL( dlg ); + dlg->SetSettingTextL( *title ); + CleanupStack::Pop(); // dlg + + TBool retval = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); + + if ( retval ) // OK was selected, store new value + { + *aCurrentItem = newItem; + } + CleanupStack::PopAndDestroy( 2 ); // title, values + return retval; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::SaveChangesL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::SaveChangesL() + { + // These settings result in page layout changes, and changes to these + // settings should only be relayed once the settings page is closed + MPreferences& preferences = ApiProvider().Preferences(); + + if ( iFontSize != preferences.FontSize() ) + { + preferences.SetFontSizeL( iFontSize ); + } + + if ( iEncoding != preferences.Encoding() ) + { + preferences.SetEncodingL( iEncoding ); + } + + if ( iTextWrap != preferences.TextWrap() ) + { + preferences.SetTextWrapL( iTextWrap ); + } + preferences.FlushSD(); + + preferences.NotifyObserversL( EPreferencesDeactivate, TBrCtlDefs::ESettingsUnknown ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::OfferKeyEventL +// ----------------------------------------------------------------------------- +// +TKeyResponse CSettingsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse ret = EKeyWasNotConsumed; + TKeyEvent keyEvent(aKeyEvent); + + // Special case for MSK enabled mode - turn MSK KeyUp to MSK KeyEvent to process Settings toggle function + // This is what is done in BookmarksContainer::OfferKeyEventL + if (( keyEvent.iScanCode == EStdKeyDevice3 ) || (keyEvent.iScanCode == EStdKeyEnter)) + { + if( aType == EEventKeyDown ) + { + iSelectionKeyDownPressed = ETrue; + ret = EKeyWasConsumed; + } + else if( aType == EEventKeyUp ) + { + if( iSelectionKeyDownPressed ) + { + keyEvent.iCode = EKeyOK; + ret = EKeyWasNotConsumed; + iSelectionKeyDownPressed = EFalse; + } + else + { + // long press of Selection key was already processed + ret = EKeyWasConsumed; + } + } + } + + + switch ( keyEvent.iCode ) + { + // Open List Box item + case EKeyEnter: + { + switch ( iSettingIndex->At( iSettingListBox->CurrentItemIndex() ) ) + { + case EWmlSettingsGeneral: + case EWmlSettingsPrivacy: + case EWmlSettingsPage: + case EWmlSettingsWebFeeds: + case EWmlSettingsToolbar: + case EWmlSettingsShortcuts: + { + DisplayCorrectSettingCategoryListL(); + break; + } + + // Individual Settings + case EWmlSettingsAccesspoint: + case EWmlSettingsHomePage: + case EWmlSettingsBackList: + case EWmlSettingsHttpSecurityWarnings: + case EWmlSettingsEcma: + case EWmlSettingsScriptLog: + case EWmlSettingsDownloadsOpen: + case EWmlSettingsAutoLoadContent: + case EWmlSettingsFullScreen: + case EWmlSettingsPageOverview: + case EWmlSettingsMediaVolume: + case EWmlSettingsEncoding: + case EWmlSettingsPopupBlocking: + case EWmlSettingsAutoRefresh: + case EWmlSettingsAdaptiveBookmarks: + case EWmlSettingsFormDataSaving: +#ifdef __WIM + case EWmlSettingsSaveReceipt: +#endif + case EWmlSettingsCookies: + case EWmlSettingsIMEINotification: + case EWmlSettingsAutomaticUpdatingAP: + case EWmlSettingsAutomaticUpdatingWhileRoaming: + case EWmlSettingsUrlSuffix: + case EWmlSettingsFontSize: + case EWmlSettingsToolbarButton1Cmd: + case EWmlSettingsToolbarButton2Cmd: + case EWmlSettingsToolbarButton3Cmd: + case EWmlSettingsToolbarButton4Cmd: + case EWmlSettingsToolbarButton5Cmd: + case EWmlSettingsToolbarButton6Cmd: + case EWmlSettingsToolbarButton7Cmd: + case EWmlSettingsShortCutKey1Cmd: + case EWmlSettingsShortCutKey2Cmd: + case EWmlSettingsShortCutKey3Cmd: + case EWmlSettingsShortCutKey4Cmd: + case EWmlSettingsShortCutKey5Cmd: + case EWmlSettingsShortCutKey6Cmd: + case EWmlSettingsShortCutKey7Cmd: + case EWmlSettingsShortCutKey8Cmd: + case EWmlSettingsShortCutKey9Cmd: + case EWmlSettingsShortCutKey0Cmd: + case EWmlSettingsShortCutKeyStarCmd: + case EWmlSettingsShortCutKeyHashCmd: + case EWmlSettingsSearchProvider: + { + ChangeItemL( ETrue ); + ret = EKeyWasConsumed; + break; + } + default: + break; + } + break; + } + + case EKeyOK: + { + // MSK command handles the commands - no need for key handling + ret = EKeyWasConsumed; + break; + } + + default: + break; + } + + if ( iSettingListBox && ( ret == EKeyWasNotConsumed || iSettingListBox ) ) + { + ret = iSettingListBox->OfferKeyEventL( keyEvent, aType ); + } + return ret; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::HandleListBoxEventL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType) + { + if (iPenEnabled) + { + if (iSettingListBox && aListBox == iSettingListBox) + { + switch (aEventType) + { + //case MEikListBoxObserver::EEventEnterKeyPressed: + case MEikListBoxObserver::EEventItemClicked: + break; + case MEikListBoxObserver::EEventItemDoubleClicked: + { + TKeyEvent keyEvent; + keyEvent.iModifiers = 0; + keyEvent.iRepeats = 0; + keyEvent.iCode = EKeyEnter; + keyEvent.iScanCode = EStdKeyEnter; + CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKey ); + } + break; +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + case MEikListBoxObserver::EEventItemSingleClicked: + + switch ( iSettingIndex->At( iSettingListBox->CurrentItemIndex() ) ) + { + case EWmlSettingsGeneral: + case EWmlSettingsPrivacy: + case EWmlSettingsPage: + case EWmlSettingsWebFeeds: + case EWmlSettingsToolbar: + case EWmlSettingsShortcuts: + { + DisplayCorrectSettingCategoryListL(); + break; + } + + // Individual Settings + case EWmlSettingsAccesspoint: + case EWmlSettingsHomePage: + case EWmlSettingsBackList: + case EWmlSettingsHttpSecurityWarnings: + case EWmlSettingsEcma: + case EWmlSettingsScriptLog: + case EWmlSettingsDownloadsOpen: + case EWmlSettingsAutoLoadContent: + case EWmlSettingsFullScreen: + case EWmlSettingsPageOverview: + case EWmlSettingsMediaVolume: + case EWmlSettingsEncoding: + case EWmlSettingsPopupBlocking: + case EWmlSettingsAutoRefresh: + case EWmlSettingsAdaptiveBookmarks: + case EWmlSettingsFormDataSaving: + #ifdef __WIM + case EWmlSettingsSaveReceipt: + #endif + case EWmlSettingsCookies: + case EWmlSettingsIMEINotification: + case EWmlSettingsAutomaticUpdatingAP: + case EWmlSettingsAutomaticUpdatingWhileRoaming: + case EWmlSettingsUrlSuffix: + case EWmlSettingsFontSize: + case EWmlSettingsToolbarButton1Cmd: + case EWmlSettingsToolbarButton2Cmd: + case EWmlSettingsToolbarButton3Cmd: + case EWmlSettingsToolbarButton4Cmd: + case EWmlSettingsToolbarButton5Cmd: + case EWmlSettingsToolbarButton6Cmd: + case EWmlSettingsToolbarButton7Cmd: + case EWmlSettingsShortCutKey1Cmd: + case EWmlSettingsShortCutKey2Cmd: + case EWmlSettingsShortCutKey3Cmd: + case EWmlSettingsShortCutKey4Cmd: + case EWmlSettingsShortCutKey5Cmd: + case EWmlSettingsShortCutKey6Cmd: + case EWmlSettingsShortCutKey7Cmd: + case EWmlSettingsShortCutKey8Cmd: + case EWmlSettingsShortCutKey9Cmd: + case EWmlSettingsShortCutKey0Cmd: + case EWmlSettingsShortCutKeyStarCmd: + case EWmlSettingsShortCutKeyHashCmd: + case EWmlSettingsSearchProvider: + { + ChangeItemL( ETrue ); + break; + } + default: + break; + } +#endif + default: + break; + } + } + } + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::HandleGainingForegroundL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::HandleGainingForegroundL() + { + switch(iCurrentSettingCategory) + { + case EGeneral: + DisplayGeneralSettingsL(); + break; + default: // do nothing + break; + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::CreateItemFromTwoStringsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::CreateItemFromTwoStringsL( + TInt aFirst, + TInt aSecond, + TBuf& aResult ) + { + // Appends two text from resources next to each other + aResult.Zero(); + aResult.Append( KWmlSettingsListBoxItemPrefix ); + HBufC* first = iCoeEnv->AllocReadResourceLC( aFirst ); + aResult.Append( first->Des() ); + CleanupStack::PopAndDestroy(); // first + aResult.Append( KWmlSettingsListBoxItemPostfix ); + HBufC* second = iCoeEnv->AllocReadResourceLC( aSecond ); + aResult.Append( second->Des() ); + CleanupStack::PopAndDestroy(); //second + } + + +// ---------------------------------------------------------------------------- +// CSettingsContainer::AddEncodingL() +// ---------------------------------------------------------------------------- +// +void CSettingsContainer::AddEncodingL( TUint32 aSystemId, TUint32 aResId ) + { + TEncodingStruct encoding; + + encoding.iSystemId = aSystemId; + encoding.iResId = aResId; + + iEncodingArray->AppendL( encoding ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::RemoveUnsupportedEncodingsL() +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::RemoveUnsupportedEncodingsL() + { + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); + CleanupClosePushL( fsSession ); + + CCnvCharacterSetConverter* charConv; + charConv = CCnvCharacterSetConverter::NewLC(); + + CArrayFix* charSets; + charSets = charConv->CreateArrayOfCharacterSetsAvailableLC(fsSession); + + TInt lastIndex = iEncodingArray->Count()-1; + + for ( int i = lastIndex; i >= 0; i-- ) + { + TBool remove = ETrue; + TEncodingStruct encoding = iEncodingArray->At(i); + for ( int j = 0; j < charSets->Count(); j++ ) + { + TUint32 identifier = charSets->At(j).Identifier(); + + if ( identifier == encoding.iSystemId ) + { + remove = EFalse; + break; + } + } + + if ( remove && + ( encoding.iSystemId != KCharacterSetIdentifierAutomatic ) ) + { + iEncodingArray->Delete(i); + } + } + + fsSession.Close(); + CleanupStack::PopAndDestroy(3); // charConv, charSets, fsSession + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::CreateEncodingArrayL() +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::CreateEncodingArrayL() + { + AddEncodingL( KCharacterSetIdentifierGb2312, R_WMLBROWSER_SETTINGS_ENCODING_GB2312 ); + AddEncodingL( KCharacterSetIdentifierIso88591, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_1 ); + AddEncodingL( KCharacterSetIdentifierBig5, R_WMLBROWSER_SETTINGS_ENCODING_BIG5 ); + AddEncodingL( KCharacterSetIdentifierUtf8, R_WMLBROWSER_SETTINGS_ENCODING_UTF8 ); + AddEncodingL( KCharacterSetIdentifierIso88592, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_2 ); + AddEncodingL( KCharacterSetIdentifierIso88594, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_4 ); + AddEncodingL( KCharacterSetIdentifierIso88595, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_5 ); + AddEncodingL( KCharacterSetIdentifierIso88597, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_7 ); + AddEncodingL( KCharacterSetIdentifierIso88599, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_9 ); + AddEncodingL( KCharacterSetIdentifierIso88598, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_8 ); + AddEncodingL( KCharacterSetIdentifierIso88596, R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_6 ); + AddEncodingL( KCharacterSetIdentifierWindows1256, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1256 ); + AddEncodingL( KCharacterSetIdentifierWindows1255, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1255 ); + AddEncodingL( KCharacterSetIdentifierWindows1250, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1250 ); + AddEncodingL( KCharacterSetIdentifierWindows1251, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1251 ); + AddEncodingL( KCharacterSetIdentifierWindows1253, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1253 ); + AddEncodingL( KCharacterSetIdentifierWindows1254, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1254 ); + AddEncodingL( KCharacterSetIdentifierWindows1257, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1257 ); + AddEncodingL( KCharacterSetIdentifierWindows1258, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1258 ); + AddEncodingL( KCharacterSetIdentifierTis620, R_WMLBROWSER_SETTINGS_ENCODING_TIS_620 ); // Thai + AddEncodingL( KCharacterSetIdentifierWindows874, R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_874 ); // Thai + AddEncodingL( KCharacterSetIdentifierEucJpPacked, R_WMLBROWSER_SETTINGS_ENCODING_EUC_JP ); + AddEncodingL( KCharacterSetIdentifierJis, R_WMLBROWSER_SETTINGS_ENCODING_ISO_2022_JP ); + AddEncodingL( KCharacterSetIdentifierShiftJis, R_WMLBROWSER_SETTINGS_ENCODING_SHIFT_JIS ); + AddEncodingL( KCharacterSetIdentifierKoi8_r, R_WMLBROWSER_SETTINGS_ENCODING_KOI8_R ); + AddEncodingL( KCharacterSetIdentifierKoi8_u, R_WMLBROWSER_SETTINGS_ENCODING_KOI8_U ); + AddEncodingL( KCharacterSetIdentifierIscii_temp, R_WMLBROWSER_SETTINGS_ENCODING_ISCII); + AddEncodingL( KCharacterSetIdentifierEucKr, R_WMLBROWSER_SETTINGS_ENCODING_EUC_KR ); + AddEncodingL( KCharacterSetIdentifierKsc5601_temp, R_WMLBROWSER_SETTINGS_ENCODING_KSC_5601 ); + AddEncodingL( KCharacterSetIdentifierAutomatic, R_WMLBROWSER_SETTINGS_ENCODING_AUTOMATIC ); + } + +#ifdef __SERIES60_HELP +// ----------------------------------------------------------------------------- +// CSettingsContainer::GetHelpContext() +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KUidBrowserApplication; + /* + context is dependent on what Category we are in + enum TSettingCategory + { + EMain = 0, + EGeneral, + EPrivacy, + EPage, + EWebFeeds, + EToolbar, + EShortCuts, + ENone + }; + */ + switch ( iCurrentSettingCategory ) + { + case EMain: + aContext.iContext = KOSS_HLP_SETTINGS_FOLDERS; + break; + case EGeneral: + aContext.iContext = KOSS_HLP_SETTINGS_GENERAL; + break; + case EPrivacy: + aContext.iContext = KOSS_HLP_SETTINGS_PRIVACY; + break; + case EPage: + aContext.iContext = KOSS_HLP_SETTINGS_PAGE; + break; + case EWebFeeds: + aContext.iContext = KOSS_HLP_SETTINGS_RSS; + break; + case ENone: + aContext.iContext = KOSS_HLP_SETTINGS_FOLDERS; + break; + default: + aContext.iContext = KOSS_HLP_SETTINGS_FOLDERS; + break; + + + } + + } +#endif // __SERIES60_HELP + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::MapCurrentItem +// ----------------------------------------------------------------------------- +// +TInt CSettingsContainer::MapCurrentItem( TUint aCurrentItem ) const + { + return iSettingIndex->At( aCurrentItem ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::CountComponentControls +// ----------------------------------------------------------------------------- +// +TInt CSettingsContainer::CountComponentControls() const + { + return iSettingListBox ? 1 : 0; + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::ComponentControl +// ----------------------------------------------------------------------------- +// +CCoeControl* CSettingsContainer::ComponentControl( TInt aIndex ) const + { + return ( aIndex ? NULL : iSettingListBox ); + } + + +// ----------------------------------------------------------------------------- +// CSettingsContainer::SizeChanged +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::SizeChanged() + { + if ( iSettingListBox ) + { + iSettingListBox->SetRect( Rect() ); + } + } + + +// ---------------------------------------------------------------------------- +// CSettingsContainer::FocusChanged +// ---------------------------------------------------------------------------- +// +void CSettingsContainer::FocusChanged( TDrawNow aDrawNow ) + { + if ( iSettingListBox && iSettingListBox->IsVisible() ) + { + iSettingListBox->SetFocus( IsFocused(), aDrawNow ); + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::HandleResourceChange +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::HandleResourceChange( TInt aType ) + { + if ( iSettingListBox ) + { + iSettingListBox->HandleResourceChange( aType ); + } + + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect)) + { + SetRect(rect); + } + DrawDeferred(); + } + + } + +// --------------------------------------------------------- +// CSettingsContainer::ShowFormDataDeleteAllQueryDialogL +// --------------------------------------------------------- +// +void CSettingsContainer::ShowFormDataDeleteAllQueryDialogL( ) + { + CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog(CAknQueryDialog::EConfirmationTone); + HBufC* deleteQuery = StringLoader::LoadLC(R_WMLBROWSER_SETTINGS_FORM_DATA_DELETE_ALL); + dlg->SetPromptL(*deleteQuery); + dlg->PrepareLC( R_SETTINGS_QUERY_LINES); + TInt ret = dlg->RunLD(); + if( ret == EAknSoftkeyYes ) + { + // call brctl to clear data + CBrowserAppUi::Static()->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandClearAutoFormFillData); + CBrowserAppUi::Static()->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData); + } + CleanupStack::PopAndDestroy(1); // deleteQuery + } + +// --------------------------------------------------------- +// CSettingsContainer::ShowFormDataDeletePasswordQueryDialogL +// --------------------------------------------------------- +// +void CSettingsContainer::ShowFormDataDeletePasswordQueryDialogL( ) + { + CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog(CAknQueryDialog::EConfirmationTone); + HBufC* deleteQuery = StringLoader::LoadLC(R_WMLBROWSER_SETTINGS_FORM_DATA_DELETE_PASSWORD); + dlg->SetPromptL(*deleteQuery); + dlg->PrepareLC( R_SETTINGS_QUERY_LINES); + TInt ret = dlg->RunLD(); + if( ret == EAknSoftkeyYes ) + { + // call brctl to clear data + CBrowserAppUi::Static()->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData); + } + CleanupStack::PopAndDestroy(1); // deleteQuery + } + +// --------------------------------------------------------- +// CSettingsContainer::SelectUserDefinedAPL +// --------------------------------------------------------- +// +void CSettingsContainer::SelectUserDefinedAPL( TUint32& id ) + { + LOG_ENTERFN( "CSettingsContainer::SelectUserDefinedAPL" ); + + BROWSER_LOG( ( _L( "CApSettingsHandler()" ) ) ); + CApSettingsHandler *ApUi = CApSettingsHandler::NewLC( + ETrue, + EApSettingsSelListIsPopUp, + EApSettingsSelMenuSelectNormal, + KEApIspTypeAll, + EApBearerTypeAll, + KEApSortNameAscending, + EIPv4 | EIPv6 + ); + BROWSER_LOG( ( _L( "EWmlSettingsAutomaticUpdatingAP RunSettingsL()" ) ) ); + TInt ret = ApUi->RunSettingsL( id, id ); + CleanupStack::PopAndDestroy( ApUi ); //ApUi + if ( ret & KApUiEventExitRequested ) // & because it is a bit-mask... + { + CBrowserAppUi::Static()->ExitBrowser( EFalse ); + } + + CApSelect* ApSel = CApSelect::NewLC( + iApiProvider.CommsModel().CommsDb(), + KEApIspTypeAll, //KEApIspTypeWAPMandatory, + EApBearerTypeAll, + KEApSortNameAscending, + EIPv4 | EIPv6 ); + TInt apSelCount = ApSel->Count(); + BROWSER_LOG( ( _L( " ApSel->Count(): %d" ), apSelCount ) ); + CleanupStack::PopAndDestroy( ApSel ); //ApSel + + CApUtils* au = CApUtils::NewLC( iApiProvider.CommsModel().CommsDb() ); + TBool apExist = au->WapApExistsL( id ); + CleanupStack::PopAndDestroy( au ); // au + + if( ( 0 == apSelCount ) || ( EFalse == apExist ) ) + { + id = KWmlNoDefaultAccessPoint; + } + } + +// ----------------------------------------------------------------------------- +// CSettingsContainer::RunSearchSettingsL +// ----------------------------------------------------------------------------- +// +void CSettingsContainer::RunSearchSettingsL() + { + // Get Search application UID from CenRep + TInt id = ApiProvider().Preferences().GetIntValue( KBrowserSearchAppUid ); + TUid searchAppId( TUid::Uid( id ) ); + id = ApiProvider().Preferences().GetIntValue( KBrowserSearchProviderSettingViewId ); + TUid settingViewId( TUid::Uid( id ) ); + TVwsViewId viewToOpen(searchAppId, settingViewId); + CBrowserAppUi::Static()->ActivateViewL(viewToOpen); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SettingsSrc/SettingsView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SettingsSrc/SettingsView.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* View of the information about the active settings +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +#include "BrowserAppUi.h" +#include "BrowserPreferences.h" +#include "BrowserDialogs.h" +#include "SettingsView.h" +#include "SettingsContainer.h" +#include "CommonConstants.h" + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include // KNullViewId +#endif + +// CONSTS + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------- +// CBrowserSettingsView::ConstructL +// --------------------------------------------------------- +// +void CBrowserSettingsView::ConstructL() + { + BaseConstructL( R_BROWSER_SETTINGS_SETTINGS_VIEW ); + } + +// --------------------------------------------------------- +// CBrowserSettingsView::NewLC +// --------------------------------------------------------- +// +CBrowserSettingsView* CBrowserSettingsView::NewLC( MApiProvider& aApiProvider ) + { + CBrowserSettingsView* result; + result = new( ELeave ) CBrowserSettingsView( aApiProvider ); + CleanupStack::PushL( result ); + result->ConstructL(); + return result; + } + +// --------------------------------------------------------- +// CBrowserSettingsView::NewL +// --------------------------------------------------------- +// +CBrowserSettingsView* CBrowserSettingsView::NewL( MApiProvider& aApiProvider ) + { + CBrowserSettingsView* result; + result = CBrowserSettingsView::NewLC( aApiProvider ); + CleanupStack::Pop(); + return result; + } + +// --------------------------------------------------------- +// CBrowserSettingsView::CBrowserSettingsView +// --------------------------------------------------------- +// +CBrowserSettingsView::CBrowserSettingsView( MApiProvider& aApiProvider ) +: CBrowserViewBase( aApiProvider ) + { + } + +// --------------------------------------------------------- +// CBrowserSettingsView::~CBrowserSettingsView +// --------------------------------------------------------- +// +CBrowserSettingsView::~CBrowserSettingsView() + { + delete iContainer; + } + +// --------------------------------------------------------------------------- +// CBrowserSettingsView::CommandSetResourceIdL +// --------------------------------------------------------------------------- +TInt CBrowserSettingsView::CommandSetResourceIdL() + { + // It is never called, but this function have to be implemented + return KWmlEmptyResourceId; + } + +// --------------------------------------------------------- +// CBrowserSettingsView::HandleCommsModelChangeL +// --------------------------------------------------------- +// +void CBrowserSettingsView::HandleCommsModelChangeL() + { + MPreferences& preferences = ApiProvider().Preferences(); + TUint defaultAp = preferences.DefaultAccessPoint(); + + // re-check default access point in case it was deleted. + preferences.SetDefaultAccessPointL(defaultAp); + + if ( iContainer ) + { + iContainer->DisplayCorrectSettingCategoryListL(); + } + } + +// --------------------------------------------------------- +// CBrowserSettingsView::HandleCommandL +// --------------------------------------------------------- +// +void CBrowserSettingsView::HandleCommandL( TInt aCommandId ) + { + switch ( aCommandId ) + { + case EWmlCmdSettingsOpen: + { + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); + iContainer->DisplayCorrectSettingCategoryListL(); + break; + } + case EWmlCmdSettingsChange: + { + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); + iContainer->ChangeItemL( ETrue ); + break; + } + case EAknSoftkeyBack: + { + if ( iContainer->SettingsError() ) + { + TBrowserDialogs::ErrorNoteL( R_BROWSER_SETTING_TOOLBAR_SAVE_DIALOG ); + break; + } + + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_OPEN); + + // Close the settings + if ( iContainer->CloseSettingsListL() ) + { + if ( iLastViewId != KNullViewId ) + { + ActivateViewL( iLastViewId ); + } + } + break; + } + case EWmlNoCmd: + { + // Fake MSK command for settings -- update cba to label MSK as Change + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); + break; + } + + case EWmlCmdUserExit: + { + if ( iContainer->SettingsError() ) + { + TBrowserDialogs::ErrorNoteL( R_BROWSER_SETTING_TOOLBAR_SAVE_DIALOG ); + break; + } + + // Save the settings + iContainer->SaveChangesL(); + } + // intentional fall through to default case below. + + default: + { + AppUi()->HandleCommandL( aCommandId ); + break; + } + } + } + +// --------------------------------------------------------- +// CBrowserSettingsView::Id +// --------------------------------------------------------- +// +TUid CBrowserSettingsView::Id() const + { + return KUidBrowserSettingsViewId; + } + +// --------------------------------------------------------- +// CBrowserSettingsView::DoActivateL +// --------------------------------------------------------- +// +void CBrowserSettingsView::DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& /*aCustomMessage*/ ) + { + StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); + StatusPane()->MakeVisible( ETrue ); + + if (aPrevViewId.iAppUid == AppUi()->Application()->AppDllUid()) + { // store this only if our own... + iLastViewId = aPrevViewId; + } + else + { + iLastViewId = TVwsViewId(AppUi()->Application()->AppDllUid(), ApiProvider().LastActiveViewId()); + } + + ApiProvider().SetLastActiveViewId( Id() ); + + // restoring container + iContainer = CSettingsContainer::NewL + ( ClientRect(), ApiProvider(), *this ); + + + AppUi()->AddToViewStackL( *this, iContainer ); + ApiProvider().CommsModel().AddObserverL( *this ); + + if (iContainer && ( aCustomMessageId == KUidSettingsGotoToolbarGroup ) ) + { + iContainer->DisplayToolbarSettingsL(); + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); + } + else if (iContainer && ( aCustomMessageId == KUidSettingsGotoShortcutsGroup ) ) + { + iContainer->DisplayShortcutsSettingsL(); + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); + } + else if (iContainer) + { + UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_OPEN); + } + } + +// --------------------------------------------------------- +// CBrowserSettingsView::DoDeactivate +// --------------------------------------------------------- +// +void CBrowserSettingsView::DoDeactivate() + { + if ( !ApiProvider().ExitInProgress() ) + { + ApiProvider().CommsModel().RemoveObserver( *this ); + } + // removing container + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + +// --------------------------------------------------------- +// CBrowserSettingsView::HandleClientRectChange +// --------------------------------------------------------- +// +void CBrowserSettingsView::HandleClientRectChange() + { + if( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CBrowserSettingsView::HandleForegroundEventL +// --------------------------------------------------------- +// +void CBrowserSettingsView::HandleForegroundEventL (TBool aForeground) + { + if(aForeground) + { + iContainer->HandleGainingForegroundL(); + } + } + +// --------------------------------------------------------------------------- +// CBrowserSettingsView::DynInitMenuPaneL +// --------------------------------------------------------------------------- +void CBrowserSettingsView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + if ( aResourceId == R_BROWSER_SETTINGS_SETTINGS_MENU ) + { + // Show the appropriate menu items, depending on whether + // we are in the main setting list, or sub category e.g. Page + if ( iContainer->IsSettingModifiable() ) + { + aMenuPane->SetItemDimmed( EWmlCmdSettingsOpen, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EWmlCmdSettingsChange, ETrue ); + } + + } +#endif + } + +// --------------------------------------------------------------------------- +// CBrowserSettingsView::UpdateCba() +// --------------------------------------------------------------------------- +void CBrowserSettingsView::UpdateCbaL(TInt aCommandSet) + { + if (Cba()) + { + Cba()->SetCommandSetL(aCommandSet); + Cba()->DrawDeferred(); + } + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/Browser.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/Browser.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,537 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* contains common definitions for menu id:s +* +* +*/ + + +#ifndef BROWSER_HRH +#define BROWSER_HRH + +#include "WmlBrowserBuild.h" +#include + +// Commands + +enum TBrowserCommands + { + // No command (used, for example, for marking the end of commands in + // variable length command lists). + + EWmlNoCmd = -1, + + // for Feeds View Application commands + EWmlCmdFeedsViewCommandIdBase = 12000, + // leave this range empty !!! + EWmlCmdFeedsViewLastCommand = 12099, + + // for FindItem submenu and menuitems + EWmlCmdFindInPage = 12100, + // and a couple of finditem specific command used in that module + // Phone number, Mail, Url, VoIP + // leave this range empty !!! + EWmlCmdFindInPageLast = 12109, + + // put dynamic ranges here + + // Common + EWmlCmdDisconnect = 12500, + EWmlCmdInfo, + EWmlCmdInfoSession, + EWmlCmdInfoSecurity, + EWmlCmdPageInfo, + + // IAD: version + EWmlCmdAboutProduct, + // IAD: browser user-initiated IAD update + EWmlCmdProductUpdate, + // + // IAD: help cascade sub-menu + EWmlCmdHelpMenu, + + EWmlCmdPreferences, + EWmlCmdPreferencesToolbar, + EWmlCmdCancelFetch, + EWmlCmdUserExit, + EWmlCmdCloseBrowser, + EWmlCmdChangeConnection, + + // Goto Pane buttons + + EWmlCmdGotoPaneGoTo, + EWmlCmdGotoPaneCancel, + EWmlCmdGotoPaneSelect, + + // Save Image Dialog buttons + + EWmlCmdGetUrlGo, + EWmlCmdGetUrlCancel, + + // Browser View + +// EWmlCmdDone, + EWmlCmdHistory, + EWmlCmdServiceOptions, + EWmlCmdFavourites, + EWmlCmdGoToAddress, + EWmlCmdGoToAddressAndSearch, + EIsCmdSearchWeb, // launch search pane + EWmlCmdSaveAsBookmark, + EWmlCmdReload, + EWmlCmdBack, + EWmlCmdForward, + EWmlCmdLoadImages, + EWmlCmdShowToolBar, + EWmlCmdShowShortcutKeymap, + EWmlCmdOpenBookmarks, + EWmlCmdZoomMode, + EWmlCmdZoomSmallest, + EWmlCmdZoomSmall, + EWmlCmdZoomNormal, + EWmlCmdZoomLarge, + EWmlCmdZoomLargest, + EWmlCmdZoomIn, + EWmlCmdZoomOut, + EWmlCmdZoomSliderShow, + EWmlCmdZoomSliderHide, + + EWmlCmdFind, // not used + EWmlCmdFindKeyword, // 'Find keyword' menuitem + EWmlCmdFindNext, // find pane's options list + EWmlCmdFindPrevious, // find pane's options list + // Goto Pane buttons + EWmlCmdFindKeywordPaneFind, // not used + EWmlCmdFindKeywordPaneClose, + EWmlCmdSubscribeTo, // subscribe to a feed menuitem + + EWmlCmdSavePage, + EWmlCmdOpenLink, + EWmlCmdOpenLinkInNewWindow, + EWmlCmdOpenItem, + EWmlCmdDownload, // for bookmarks view with no DownloadSubmenu + EWmlCmdDownloadSubmenu, // for bookmarks view + EWmlCmdDownloadPage, + EWmlCmdDownloadPageNewWindow, + EWmlCmdSendAddressViaUnifiedMessage, + EWmlCmdDefaultHome, + EWmlCmdDefaultBack, + EWmlCmdInputElementDone, + EWmlCmdInputElementBack, + EWmlCmdTableDataElementBack, + EWmlCmdCancelScriptRunning, + EWmlCmdElementBack, + EWmlCmdSearchWeb, + + // Favourites Views + + EWmlCmdOpenFolder, + EWmlCmdOpenMarkedFolder, // for OK-Options menu. + EWmlCmdBackToPage, + EWmlCmdMarkUnmark, + EWmlCmdUnmarkOnly, // for OK-Options menu. + EWmlCmdMark, + EWmlCmdUnmark, + EWmlCmdMarkAll, + EWmlCmdUnmarkAll, + EWmlCmdDelete, + EWmlCmdDeleteItems, + EWmlCmdNewFolder, + EWmlCmdMove, + EWmlCmdMoveOk, + EWmlCmdMoveCancel, + EWmlCmdMoveToFolder, + EWmlCmdRename, + EWmlCmdRetry, + EWmlCmdCancel, + EWmlCmdBackFromFolder, + EWmlCmdRootFolder, + EWmlCmdBackToFeedsView, + + // Bookmarks View + + EWmlCmdAddBookmark, + EWmlCmdSwitchToGotoActive, + EWmlCmdEditBookmark, + EWmlCmdSendBookmarkViaUnifiedMessage, + EWmlCmdManageBookmarks, // when Small Screen is available + EWmlCmdWindowSelectionCancel, + EWmlCmdCloseAllWindowButThis, + + // GENERIC commands used when dynamic softkey is active in Bookmarks View + EBrowserBookmarksCmdCancel, + EBrowserBookmarksCmdOpen, + EBrowserBookmarksCmdBack, + EBrowserBookmarksCmdSoftkeyEmpty, + + //Adaptive Bookmarks + EWmlCmdCopyToBookmarks, + EWmlCmdClearAdaptiveBookmarks, + EWmlCmdClearAdaptiveBookmarksNoPrompt, + EWmlCmdSetPreferredBookmark, + EWmlCmdSetUnPreferredBookmark, + + // Small screen layout specific menu item commands + + EWmlCmdNavigation, + + // Settings View + + EWmlCmdSettingsOpen, + EWmlCmdSettingsChange, + EWmlCmdShowImages, + EWmlCmdDownloads, + EWmlCmdTools, + EWmlCmdShowMiniature, + + // WIM buttons + + EWmlCmdAccept, + EWmlCmdReject, + + // Home Page + EWmlCmdSetAsHomePage, + EWmlCmdLaunchHomePage, + + // Multiple Windows Support + EWmlCmdWindows, + EWmlCmdSwitchWindow, + EWmlCmdCloseWindow, + EWmlCmdAllowPopups, + EWmlCmdBlockPopups, + + // Privacy Related Items + EWmlCmdPrivacy, + EWmlCmdClearAllPrivacy, + EWmlCmdClearTheCache, + EWmlCmdDeleteCookies, + EWmlCmdClearHistory, + EWmlCmdClearFormAndPasswd, + + // Rotate Display Option Menu + EWmlCmdRotateDisplay, + + // Open Main Feeds Folder in Bookmarks View + EWmlCmdOpenFeedsFolder, + EWmlCmdShowAnchorHref, + EWmlCmdSaveToGallery, + EWmlCmdOpenToViewer, + EWmlCmdSmartLinkMakeCall, + EWmlCmdSmartLinkSendEmail, + EWmlCmdSmartLinkSendSms, + EWmlCmdSmartLinkAddToContacts, + EWmlCmdSaveUrlAsBookmark, + EWmlCmdLoadFocusedImage, + EWmlCmdLoadImagesOnly, + EWmlCmdLoadImagesAndFlash, + EWmlCmdOneStepBack, + EWmlCmdShowSubscribeList, + EWmlCmdHome, + EWmlCmdEdwin, + EWmlCmdGo, + EWmlCmdOptionsView, + // Toolbar + EWmlCmdToolbarExtensionContentView, + // Keymap + EWmlCmdConfigureShortcutKeymap, + EWmlCmdHideShortcutKeymap, + // Bookmark Actions Submenu command + EWmlCmdBmActions, + //History View + EWmlCmdHistoryBack, + EWmlCmdHistoryForward, + // Content View Full Screen + EWmlCmdEnterFullScreenBrowsing, + EWmlCmdExitFullScreenBrowsing + }; + +// Tabs (Favourites Views) + +enum TWmlBrowserFavouritesTabs + { + EWmlTabFavouritesUnused, // NOT USED Avoid controls with 0 id! + EWmlTabFavouritesBookmarks + }; + +// Control ids. + +enum TWmlBrowserControls + { + + // Edit Bookmark Form + + EWmlControlEditBmEditTitle = 1, // Avoid controls with 0 id! + EWmlControlEditBmEditAddress, + EWmlControlEditBmEditUsername, + EWmlControlEditBmEditPassword, + EWmlControlEditBmWapApSelector, + + // Settings Dialog + EWmlControlSettingsEditGateway, + + // Script User Password Dialog + EWmlControlScriptUserPasswdDlgEditUsername, + EWmlControlScriptUserPasswdDlgEditPassword, + + // Input element messages + EWmlControlInputFewNote, + + // Favourites incremental operations wait note + EWmlControlIncrementalNote, + EWmlControlIdRefreshingPage, + EWmlControlIdProcessingPage + }; + +// Limit constants (which are included into resources as well). + +/// Max length of URL. +#define KBrowserMaxUrl 1024 +/// Max length of User name. +#define KBrowserMaxUsername 40 +/// Max length of password. +#define KBrowserMaxPassword 40 +/// Max length of WAP AP. +#define KBrowserMaxWapApName 32 /*Display limit - real name is not limited*/ +/// Max length of text Dialogs.dlgPrompt +#define KBrowserMaxPrompt 255 + +/// Max length of URL. +#define KFavouritesMaxUrlDefine 1024 + +/// Max length of Goto Pane URL. +#define KFavouritesMaxUrlGotoPaneDefine 1000 + + +/// Max length of User name. +#define KFavouritesMaxUsernameDefine 40 +/// Max length of password. +#define KFavouritesMaxPasswordDefine 40 +/// Max length of bookmark name. +#define KFavouritesMaxBookmarkNameDefine 50 + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ + +//---------------------------------------------------- +// +// TWmlBrowserMenuRequests +// menu elements +// +//---------------------------------------------------- +/* +enum TWmlBrowserMenuRequests + { + EMaskNoneMenuItem = 0, + EMaskOpenMenuItem = 1, + EMaskViewImageMenuItem = 2, + EMaskSaveImageMenuItem = 4 + }; +*/ +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ + +//---------------------------------------------------- +// +// TAuthenticationDialogControlIds +// +//---------------------------------------------------- +/* +enum TAuthenticationDialogControlIds + { + EAuthUrlId = 100, + EAuthRealmId, + EAuthUserId, + EAuthPasswordId + }; +*/ +// AdaptiveBookmarks +enum TWmlSettingsAdaptiveBookmarks + { + EWmlSettingsAdaptiveBookmarksOn, + EWmlSettingsAdaptiveBookmarksHideFolder, + EWmlSettingsAdaptiveBookmarksOff + }; + + +// FullScreen +enum TWmlSettingsFullScreen + { + EWmlSettingsFullScreenSoftkeysOnly, + EWmlSettingsFullScreenFullScreen + }; + +// MediaVolume +enum TWmlSettingsMediaVolume + { + EWmlSettingsVolumeMuted = 0, + EWmlSettingsVolume1 = 2, + EWmlSettingsVolume2 = 5, + EWmlSettingsVolume3 = 8, + EWmlSettingsVolume4 = 10 + }; + +// Cookies +enum TWmlSettingsCookies + { + EWmlSettingsCookieReject, + EWmlSettingsCookieAllow + }; + +// ECMA +enum TWmlSettingsECMA + { + EWmlSettingsECMADisable, + EWmlSettingsECMAEnable + }; + +// SCRIPT LOG +enum TWmlSettingsScriptLog + { + EWmlSettingsScriptLogDisable, + EWmlSettingsScriptLogToFile, + EWmlSettingsScriptLogToConsole, + EWmlSettingsScriptLogToConsoleFile + }; + +// IMEI +enum TWmlSettingsIMEI + { + EWmlSettingsIMEIDisable, + EWmlSettingsIMEIEnable + }; + +// HomePage +enum TWmlSettingsHomePage + { + EWmlSettingsHomePageAccessPoint, // 0 + EWmlSettingsHomePageAddress, // 1 + EWmlSettingsHomePageUseCurrent, // 2 + EWmlSettingsHomePageBookmarks // 3 + }; + +// FormData +enum TWmlSettingsFormData + { + EWmlSettingsFormDataOff, // 0 + EWmlSettingsFormDataOnly, // 1 + EWmlSettingsFormDataPlusPassword // 2 + }; + +// settings listbox items +enum TWmlBrowserSettingsItems + { + // Main Settings Categories + EWmlSettingsGeneral = 0, + EWmlSettingsPage, + EWmlSettingsPrivacy, + EWmlSettingsWebFeeds, + EWmlSettingsToolbar, + EWmlSettingsShortcuts, + + // Individual Settings + EWmlSettingsAccesspoint, + EWmlSettingsAutoLoadContent, + EWmlSettingsPageOverview, + EWmlSettingsBackList, + EWmlSettingsAutoRefresh, + EWmlSettingsEncoding, + EWmlSettingsAdaptiveBookmarks, + EWmlSettingsFullScreen, + EWmlSettingsCookies, + EWmlSettingsEcma, + EWmlSettingsScriptLog, + EWmlSettingsHttpSecurityWarnings, + EWmlSettingsIMEINotification, + +#ifdef __WIM + EWmlSettingsSaveReceipt, +#endif + EWmlSettingsMediaVolume, + EWmlSettingsAutomaticUpdatingAP, + EWmlSettingsAutomaticUpdatingWhileRoaming, + EWmlSettingsHomePage, + EWmlSettingsUrlSuffix, + EWmlSettingsFormDataSaving, + EWmlSettingsFontSize, + + // Multiple Windows Support + EWmlSettingsPopupBlocking, + // Download Open Support + EWmlSettingsDownloadsOpen, + // Search provider support + EWmlSettingsSearchProvider, + + // toolbar buttons + EWmlSettingsToolbarOnOff, + EWmlSettingsToolbarButton1Cmd, + EWmlSettingsToolbarButton2Cmd, + EWmlSettingsToolbarButton3Cmd, + EWmlSettingsToolbarButton4Cmd, + EWmlSettingsToolbarButton5Cmd, + EWmlSettingsToolbarButton6Cmd, + EWmlSettingsToolbarButton7Cmd, + + // For CDMA settings, use any values within this range + EWmlSettingsCDMAMin = 50, + EWmlSettingsSendReferrer, + EWmlSettingsCDMAMax = 70, + + // Shortcut Keys + EWmlSettingsShortCutKey1Cmd, + EWmlSettingsShortCutKey2Cmd, + EWmlSettingsShortCutKey3Cmd, + EWmlSettingsShortCutKey4Cmd, + EWmlSettingsShortCutKey5Cmd, + EWmlSettingsShortCutKey6Cmd, + EWmlSettingsShortCutKey7Cmd, + EWmlSettingsShortCutKey8Cmd, + EWmlSettingsShortCutKey9Cmd, + EWmlSettingsShortCutKey0Cmd, + EWmlSettingsShortCutKeyStarCmd, + EWmlSettingsShortCutKeyHashCmd + }; + + // ShortCuts +enum TWmlSettingsShortCuts + { + EWmlSettingsShortCutsActivateHomepage, // 0 + EWmlSettingsShortCutsActivateBkmkview, + EWmlSettingsShortCutsGotoPane, + EWmlSettingsShortCutsShowFindKeyword, + EWmlSettingsShortCutsShowSwitchWindowList, + EWmlSettingsShortCutsZoomOut, + EWmlSettingsShortCutsZoomIn, + EWmlSettingsShortCutsGotoPreviousPage, + EWmlSettingsShortCutsShowMiniature, + EWmlSettingsShortCutsShowFullScreen, + EWmlSettingsShortCutsZoomMode + }; + +enum TWmlSettingsAutoloadContent + { + EWmlSettingsAutoloadText, + EWmlSettingsAutoloadImagesNoFlash, + EWmlSettingsAutoloadAll + }; + +#ifdef __RSS_FEEDS +#include "Feeds.hrh" +#endif // __RSS_FEEDS + +#endif // BROWSER_HRH + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/Browser.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/Browser.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,943 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main browser resource file +* +* +*/ + + +// RESOURCE IDENTIFIER + +NAME SERV // for Services + +// INCLUDES +#include +#include "WmlBrowserBuild.h" +#include +#include +#include +#include "Browser.hrh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +#include +#endif + +RESOURCE RSS_SIGNATURE { } + + RESOURCE TBUF { buf="BrowsNG"; } + +RESOURCE EIK_APP_INFO + { + cba = R_AVKON_SOFTKEYS_EMPTY; // CBA commands are set dynamically + menubar= R_AVKON_MENUPANE_EMPTY; + } + +#include "BrowserBookmarks.rssi" +#include "BrowserGenericDialogs.rssi" +#include "BrowserScriptDialogs.rssi" +#include "BrowserSettings.rssi" +#include "BrowserAnimation.rssi" +#include "BrowserHp.rssi" +#include "browser_menu.rssi" +#ifdef RD_SCALABLE_UI_V2 + #include "browser_toolbar.rssi" +#endif // RD_SCALABLE_UI_V2 +#include + +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// IF RESOURCES NEEDS TO BE CHANGED : +// IF NEW RESOURCE IS ADDED ONE r_browser_dummy_dialog_0..n +// NEED TO BE REMOVED +// IF NEW RESOURCE IS REMOVED ONE r_browser_dummy_dialog_0..n +// NEED TO BE ADDED +// THE RESOURCE ID OF THE ANIMATIONS CAN NOT BE CHANGED +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +//---------------------------------------------------- +// +// r_browser_localisable_app_info +// ?description +// +//---------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_browser_localisable_app_info + { + short_caption = qtn_apps_browserng_grid; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_apps_browserng_list; + +#ifdef __SCALABLE_ICONS + number_of_icons = 1; + + icon_file = + APP_RESOURCE_DIR"\\browserng_aif.mif"; + +#else + number_of_icons = 2; + icon_file = + APP_RESOURCE_DIR"\\browserng_aif.mbn"; +#endif // __SCALABLE_ICONS + }; + } + + +//---------------------------------------------------- +// +// r_wmlbrowser_hotkeys +// ?description +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_browser_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + + +RESOURCE AVKON_VIEW r_browser_content_view + { + hotkeys = r_browser_hotkeys; + menubar = r_menu_bar; + cba = r_browser_options_menu_during_download; +#ifdef RD_SCALABLE_UI_V2 + toolbar = r_content_view_toolbar; +#endif + } + + +RESOURCE CBA r_cancel_data_buttons + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyEmpty; txt = " "; }, + CBA_BUTTON { id = EWmlCmdCancelFetch; txt = text_softkey_stop; } + }; + } + + +//---------------------------------------------------- +// +// r_input_element_buttons +// CBA buttons for input element +// +//---------------------------------------------------- +RESOURCE CBA r_input_element_buttons + { + flags = EAknCBAFlagRespondWhenInvisible; // SEE NOTE BELOW: + // allows cba to work in full screen mode, but also can let cbas from + // other views work also so care must taken in using this flag. It should + // only used in BrowserContentView related CBAs due to full screen mode. + + buttons = + { + // left softkey id has to be EAknSoftkeyOptions so that T9 will + // be able to replace it with "Spell" when needed + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyCancel; txt=text_softkey_cancel;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + + }; + } + +//---------------------------------------------------- +// +// r_browser_default_buttons +// Default CBA buttons for multipurpose browser display +// +//---------------------------------------------------- +// +RESOURCE CBA r_browser_default_buttons + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EWmlCmdBack; txt=text_softkey_back;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; + } + +RESOURCE CBA r_browser_default_buttons_at_beginning_of_history + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyClose; txt=text_softkey_close;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; + } + +RESOURCE CBA r_browser_default_buttons_at_beginning_of_history_embedded + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyClose; txt=text_softkey_back;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; + } + +RESOURCE CBA r_browser_options_menu_during_download + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, + CBA_BUTTON {id=EWmlCmdCancelFetch; txt=text_softkey_stop;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; + } + +RESOURCE CBA r_browser_softkeys_cancel + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyEmpty; txt = ""; }, + CBA_BUTTON {id=EAknSoftkeyCancel; txt = text_softkey_cancel; }, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; + } + +RESOURCE CBA r_browser_cba_find_keyword_pane_option_close // TEMP + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdFindKeywordPaneClose; txt = text_softkey_close; }, + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; } + }; + } + +RESOURCE CBA r_browser_default_buttons_at_thumbnail_view_on + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOk; txt=text_softkey_ok;}, + CBA_BUTTON {id=EAknSoftkeyCancel; txt=text_softkey_cancel;}, + CBA_BUTTON {id=EAknSoftkeyOk; txt=text_softkey_ok;} + }; + } + +RESOURCE CBA r_browser_default_buttons_at_zoom_mode_on + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EAknSoftkeySelect; txt=text_softkey_select;}, + CBA_BUTTON {id=EAknSoftkeyCancel; txt=text_softkey_cancel;} + }; + } + +RESOURCE CBA r_browser_cba_options_back_options + { + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, + CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;} + }; + } + +RESOURCE CBA r_browser_cba_options_back_change + { + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back;}, + CBA_BUTTON {id=EAknSoftkeyChange; txt=text_softkey_empty;} + }; + } + +RESOURCE CBA r_browser_softkeys_select_cancel_select + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + // This prevents EAknSoftkeySelect operating on a long keypress + AVKON_CBA_BUTTON{id=EAknSoftkeySelect; longpressid=0; txt= text_softkey_select; }, + CBA_BUTTON{id=EAknSoftkeyCancel; txt= text_softkey_cancel; }, + AVKON_CBA_BUTTON{id=EAknSoftkeySelect; longpressid=0; txt= text_softkey_select; } + }; + } + +RESOURCE CBA r_browser_softkeys_configure_hide + { + buttons = + { + CBA_BUTTON{id=EWmlCmdConfigureShortcutKeymap; txt= text_softkey_configure; }, + CBA_BUTTON{id=EWmlCmdHideShortcutKeymap; txt= qtn_softkey_hide; }, + CBA_BUTTON{id=EAknSoftkeyForwardKeyEvent; txt= text_softkey_empty; } + }; + } + +RESOURCE CBA r_browser_softkeys_exit_full_screen + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON {id=EWmlCmdExitFullScreenBrowsing; txt=text_softkey_empty;}, + CBA_BUTTON {id=EWmlCmdExitFullScreenBrowsing; txt=text_softkey_empty;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; + } + +// +// A NULL empty resource for tracking dynamic SK assignment +// +RESOURCE TBUF r_browser_dyn_sk_null {} + +// +// Empty TBUF for getting an empty string for dynamic SK assignment +// +RESOURCE TBUF r_browser_dyn_sk_empty { buf = text_softkey_empty; } + +// NULL, empty CBA for initialization. DO not use. Only base view uses to +// track dynamic cba assignments +RESOURCE CBA r_browser_buttons_cba_null {} + +//Generic, empty CBA to be used for dynamic cba assignment +RESOURCE CBA r_browser_buttons_cba_dynamic + { + buttons = + { + CBA_BUTTON {}, + CBA_BUTTON {}, + CBA_BUTTON {} + }; + } + +//---------------------------------------------------- +// +// r_browser_default_caption +// Default caption for multipurpose browser +// display view +// +//---------------------------------------------------- +// +RESOURCE TBUF r_browser_default_caption { buf = qtn_apps_browserng_list; } + + +RESOURCE TBUF r_text_wml_exit_confirm { buf = text_wml_exit_confirm; } + +//---------------------------------------------------- +// +// r_wmlbrowser_settings_menubar +// TEMP by GTO : it's only a temporal thingie +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_browser_settings_menubar + { + } + +//---------------------------------------------------- +// +// r_menu_bar +// main menu for multipurpose browser display +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_menu_bar + { + titles = + { + MENU_TITLE { menu_pane = r_menu_pane; } + }; + } + +//---------------------------------------------------- +// +// r_menu_pane +// new menu pane for the main menu of the +// multipurpose browser display +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_menu_pane + { + items = + { + MENU_ITEM + { + command = EWmlCmdShowShortcutKeymap; + txt = qtn_browser_list_main_show_shortcuts; + }, + MENU_ITEM + { + cascade = r_DO_elements; + command = EWmlCmdServiceOptions; + txt = qtn_wml_list_srv_opts; + }, + MENU_ITEM + { + command = EWmlCmdShowSubscribeList; + txt=qtn_browser_list_subscribe_to; + }, + MENU_ITEM + { + command = EWmlCmdDownloads; + txt = qtn_browser_list_downloads; + }, + MENU_ITEM + { + cascade = r_goto_submenu; + txt = qtn_browser_options_goto; + }, + MENU_ITEM + { + cascade = r_pageactions_submenu; + txt = qtn_browser_options_pageactions; + }, + MENU_ITEM + { + cascade = r_view_submenu; + command = EWmlCmdOptionsView; + txt = qtn_browser_options_view; + }, + MENU_ITEM + { + command = EWmlCmdFindKeyword; + txt = qtn_browser_find_keyword_mm; + }, + MENU_ITEM + { + cascade = r_clear_submenu; + command = EWmlCmdPrivacy; + txt = qtn_browser_options_clear; + }, + MENU_ITEM + { + command = EWmlCmdPreferences; + txt = qtn_wmls_browser_opt_sett; + }, + MENU_ITEM + { + cascade = r_help_submenu; + command = EAknCmdHelp; + txt = qtn_browser_options_help; + }, + MENU_ITEM + { + command = EWmlCmdUserExit; + txt = qtn_options_exit; + }, + MENU_ITEM + { + command = EWmlCmdFindNext; + txt = qtn_browser_find_keyword_search_for_next; + }, + MENU_ITEM + { + command = EWmlCmdFindPrevious; + txt = qtn_browser_find_keyword_search_for_previous; + } + }; + } + +//---------------------------------------------------- +// +// r_option_zoom_level +// Submenu pane for the main menu of zoom page +// Actual items are loaded dynamically +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_option_zoom_level + { + } + +//---------------------------------------------------- +// +// r_goto_submenu +// Cascading menu for go to menu items +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_goto_submenu + { + items = + { + MENU_ITEM { command = EWmlCmdGoToAddress; txt = qtn_browser_list_new_web_page; }, + MENU_ITEM { command = EIsCmdSearchWeb; txt = qtn_is_list_search; }, + MENU_ITEM { command = EWmlCmdBackToPage; txt = qtn_wml_list_ret_page; }, + MENU_ITEM { command = EWmlCmdFavourites; txt = qtn_wml_faves; }, + MENU_ITEM { command = EWmlCmdOpenFeedsFolder; txt = qtn_browser_list_web_feeds;}, + MENU_ITEM { command = EWmlCmdHistory; txt = qtn_wml_list_history; }, + MENU_ITEM { command = EWmlCmdLaunchHomePage; txt = qtn_browser_list_home; } + }; + } + +//---------------------------------------------------- +// +// r_pageactions_submenu +// Cascading menu for page actions menu items +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_pageactions_submenu + { + items = + { + MENU_ITEM { command = EWmlCmdSaveAsBookmark; txt = qtn_wmlbm_fav_saveas_bm_sm; }, + MENU_ITEM { command = EWmlCmdReload; txt = qtn_wml_list_reload; }, + MENU_ITEM { command = EWmlCmdSendAddressViaUnifiedMessage; txt=qtn_options_send_via; }, + MENU_ITEM { command = EWmlCmdSendBookmarkViaUnifiedMessage; txt =qtn_options_send_via; }, + MENU_ITEM { command = EWmlCmdSetAsHomePage; txt=qtn_browserbm_list_set_as_home_page_sm; }, + MENU_ITEM { command = EWmlCmdAllowPopups; txt = qtn_browser_list_windows_allow; }, + MENU_ITEM { command = EWmlCmdBlockPopups; txt = qtn_browser_list_windows_block; }, + MENU_ITEM { command = EWmlCmdCloseWindow; txt = qtn_browser_list_close_window; } + }; + } + +//---------------------------------------------------- +// +// r_view_submenu +// Cascading menu for view menu items +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_view_submenu + { + items = + { + MENU_ITEM { command = EWmlCmdEnterFullScreenBrowsing; txt = qtn_browser_list_full_screen_enter; }, + MENU_ITEM { command = EWmlCmdRotateDisplay; txt = qtn_browser_rotate_display; }, + MENU_ITEM { command = EWmlCmdShowToolBar; txt = qtn_browser_list_toolbar; }, + MENU_ITEM { command = EWmlCmdShowMiniature; txt = qtn_browser_list_miniature_show_mini; }, + MENU_ITEM { command = EWmlCmdShowImages; txt = qtn_browser_list_view_images; }, + MENU_ITEM { command = EWmlCmdLoadImages; txt = qtn_browser_list_fetch_img;}, + MENU_ITEM { command = EWmlCmdSwitchWindow; txt = qtn_browser_list_switch_window; }, + MENU_ITEM { command = EWmlCmdPageInfo; txt = qtn_browser_list_page_info; } + }; + } + +//---------------------------------------------------- +// +// r_clear_submenu +// Cascading menu for privacy related menu items +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_clear_submenu + { + items = + { + MENU_ITEM { command = EWmlCmdClearAllPrivacy; txt = qtn_browser_list_privacy_clear_all; }, + MENU_ITEM { command = EWmlCmdClearTheCache ; txt = text_wml_option_empty_cache; }, + MENU_ITEM { command = EWmlCmdDeleteCookies ; txt = qtn_browser_list_delete_cookies; }, + MENU_ITEM { command = EWmlCmdClearHistory; txt = qtn_browser_list_clear_history; }, + MENU_ITEM { command = EWmlCmdClearFormAndPasswd; txt = qtn_browser_list_privacy_clear_form_data; } + }; + } + +//---------------------------------------------------- +// +// r_DO_elements +// empty submenu for the DO elements +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_DO_elements + { + } + + +RESOURCE MENU_PANE r_help_submenu + { + items = + { + MENU_ITEM { command = EAknCmdHelp; txt = qtn_browser_list_browser_help; }, + MENU_ITEM { command = EWmlCmdAboutProduct; txt=qtn_browser_list_browser_version;} + }; + } + +//---------------------------------------------------- +// +// CBA text +// +//---------------------------------------------------- +// + +RESOURCE TBUF r_wml_unable_to_retrieve { buf=qtn_wml_informationnote_unable_to_retrieve; } +RESOURCE TBUF r_wml_unable_to_fetch_bookmark { buf=qtn_wml_bookmark_not_found; } +RESOURCE TBUF r_wml_memlo_not_enough_memory { buf=qtn_memlo_not_enough_memory; } + + +//---------------------------------------------------- +// +// r_wml_open_new_page_query +// open new page query +// +//---------------------------------------------------- +// +RESOURCE TBUF r_wml_query_dwnl { buf=qtn_wml_query_dwnl; } +RESOURCE TBUF r_wml_auth_fail_retry_query { buf=text_wml_auth_fail_retry_query; } +RESOURCE TBUF r_wml_invalid_ap { buf=qtn_wml_info_invalid_ap; } +RESOURCE TBUF r_wml_invalid_ap_sd { buf=qtn_wml_confquery_invalid_ap; } + +//---------------------------------------------------- +// +// text_wml_cache_emptied_note +// message to ui +// +//---------------------------------------------------- +// +RESOURCE TBUF r_text_wml_cache_emptied_note { buf=text_wml_cache_emptied_note; } +RESOURCE TBUF r_wml_disconnect { buf = qtn_ics_cnote_disconn_from_service; } + + +//---------------------------------------------------- +// +// Wim dialog buttons texts +// +//---------------------------------------------------- +RESOURCE TBUF r_wml_enter_bookmark_name { buf = qtn_wml_query_bookmark_title; } +RESOURCE TBUF r_wml_name_already_in_use { buf = qtn_wmlbm_name_already_used; } + + +//---------------------------------------------------- +// +// Progress bar texts +// +//---------------------------------------------------- +RESOURCE TBUF r_wml_unit_kb { buf = qtn_wml_unit_kb; } +RESOURCE TBUF r_wml_unit_mb { buf = qtn_wml_unit_mb; } +RESOURCE TBUF r_wml_unit_percent { buf = qtn_wml_unit_percent; } + + +//---------------------------------------------------- +// +// Connection Secured info notes +// +//---------------------------------------------------- + +RESOURCE TBUF r_wml_conn_secured { buf=qtn_wmlsec_conn_secured; } +RESOURCE TBUF r_wml_conn_secured_unk_serv { buf=qtn_wmlsec_conn_sec_unk_serv; } + + +RESOURCE AVKON_LAYOUT_EDWIN r_goto_pane_layout + { + font = ELatinBold13; + C = 100; + l = 2; + r = 2; + B = 60; + W = 172; + J = ELayoutAlignRight; + lines = 1; + nextB = 76; + } + + +//---------------------------------------------------- +// +// qtn_browser_note_cookies_deleted +// message to ui +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_browser_note_cookies_deleted { buf=qtn_browser_note_cookies_deleted; } + +//---------------------------------------------------- +// +// qtn_browser_note_history_cleared +// message to ui +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_browser_note_history_cleared { buf=qtn_browser_note_history_cleared; } + + +//---------------------------------------------------- +// +// qtn_browser_note_form_data_cleared +// message to ui +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_browser_note_form_and_passwd_data_cleared { buf=qtn_browser_note_form_and_passwd_data_cleared; } + +//---------------------------------------------------- +// +// qtn_browser_note_clear_all_privacy_done +// message to ui +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_browser_note_clear_all_privacy_done { buf=qtn_browser_note_clear_all_privacy_done; } + +//---------------------------------------------------- +// +// qtn_wmlbm_errornote_url_too_long +// Confirmation query prompt when user confirmation +// during login over unsecure connection. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_wmlbm_errornote_url_too_long { buf=qtn_wmlbm_errornote_url_too_long; } + +RESOURCE TBUF r_qtn_browsers_browser_name { buf = qtn_browsers_browser_name; } + +RESOURCE TBUF r_qtn_browsers_plugins_label { buf = qtn_browsers_plugins_label; } + +//---------------------------------------------------- +// qtn_browserbm_query_set_as_home_page +// Confirmation query prompt before using "set as home page" +// option. +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_browserbm_query_set_as_home_page { buf = qtn_browserbm_query_set_as_home_page; } + +//----------------------------------------------------------------------------- +// Confirmation query for setting currently undefined search web setting +// option. +//----------------------------------------------------------------------------- +// +RESOURCE TBUF r_browser_query_def_searchpage { buf = qtn_browser_query_search_url; } +RESOURCE TBUF r_browser_prompt_search_url { buf = qtn_wml_prompt_search_url; } + +//----------------------------------------------------------------------------- +// Data query for entering homepage url +//----------------------------------------------------------------------------- +// +RESOURCE TBUF r_browser_prompt_homepage_url { buf = qtn_wml_prompt_homepage_url; } + +//---------------------------------------------------- +// r_upload_progressnote +// Upload progress note dialog. +//---------------------------------------------------- +// +RESOURCE DIALOG r_upload_progressnote + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + animation = 0; + }; + } + }; + } + +//---------------------------------------------------- +// +// Upload progress note strings +// +//---------------------------------------------------- +// + +RESOURCE TBUF r_qtn_browser_upload_progressnote_uploaded { buf = qtn_browser_upload_progressnote_uploaded; } +RESOURCE TBUF r_qtn_browser_upload_progressnote_unit_kbyte { buf = qtn_browser_upload_progressnote_unit_kbyte; } +RESOURCE TBUF r_qtn_browser_upload_progressnote_unit_mb { buf = qtn_browser_upload_progressnote_unit_mb; } + +//---------------------------------------------------- +// +// Download Manager related +// +//---------------------------------------------------- +// +RESOURCE TBUF r_browser_note_downloading { buf = qtn_browser_note_object_downloading; } + + +//============================================================================= +// +// Multiple Windows Support +// +//============================================================================= +RESOURCE TBUF r_browser_switch_window_header { buf = qtn_browser_query_switch_window_header; } +RESOURCE TBUF r_browser_confirm_close_window { buf = qtn_browser_query_close_window; } +RESOURCE TBUF r_browser_note_max_windows { buf = qtn_browser_note_pop_up_max_reached; } +RESOURCE TBUF r_browser_note_popup_blocked { buf = qtn_browser_multiple_windows_tooltip; } +RESOURCE TBUF r_browser_new_window_opened { buf = qtn_browser_note_pop_up_window_opened; } +RESOURCE TBUF r_browser_multiple_windows_wml { buf = qtn_browser_multiple_windows_wml; } + +// --------------------------------------------------------- +// +// +// Settings / Browser version +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_browser_query_browser_version { buf = qtn_browser_list_browser_version; } + +//---------------------------------------------------- +// +// r_gotopane_cancel_buttons +// CBA buttons for gotopane cancel +// +//---------------------------------------------------- +RESOURCE CBA r_gotopane_cancel_buttons + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EAknSoftkeyEmpty; txt = " "; }, + CBA_BUTTON { id = EWmlCmdGotoPaneCancel; txt=text_softkey_cancel;}, + CBA_BUTTON { id = EAknSoftkeyEmpty; txt = " "; } + }; + } + +//============================================================================= +// +// Page overview +// +//============================================================================= +RESOURCE TBUF r_browser_tooltip_page_overview_on { buf = qtn_browser_tooltip_page_overview_on; } +RESOURCE TBUF r_browser_tooltip_page_overview_off { buf = qtn_browser_tooltip_page_overview_off; } + +//============================================================================= +// +// images / text +// +//============================================================================= +RESOURCE TBUF r_browser_zoom_level { buf = qtn_browser_zoom_level_tooltip; } +RESOURCE TBUF r_browser_zoom_level_max { buf = qtn_browser_zoom_level_tooltip_maximum; } +RESOURCE TBUF r_browser_zoom_level_min { buf = qtn_browser_zoom_level_tooltip_minimum; } +RESOURCE TBUF r_browser_image_zoom_level { buf = qtn_browser_image_zoom_level; } +RESOURCE TBUF r_browser_text_size { buf = qtn_browser_text_size_tooltip; } + +//============================================================================= +// +// Web Feeds +// +//============================================================================= +RESOURCE TBUF r_browser_menu_item_back_to_page { buf = qtn_wml_list_ret_page; } +RESOURCE TBUF r_browser_menu_item_favourites { buf = qtn_wml_faves; } +RESOURCE TBUF r_browser_menu_item_list_navigation { buf = qtn_wml_list_navigation; } + +RESOURCE TBUF r_browser_menu_item_list_option_goto { buf = text_wml_option_goto; } +RESOURCE TBUF r_browser_menu_item_list_home { buf = qtn_browser_list_home; } + +RESOURCE TBUF r_browser_menu_item_list_folder_tools { buf = qtn_browser_list_folder_tools; } + +RESOURCE TBUF r_browser_menu_item_list_download { buf = qtn_browser_list_downloads; } + +RESOURCE TBUF r_browser_menu_item_list_change_connection { buf = qtn_wml_list_change_connection; } +RESOURCE TBUF r_browser_menu_item_list_dconn { buf = qtn_wml_list_dconn; } +RESOURCE TBUF r_browser_menu_item_list_delete_cookies { buf = qtn_browser_list_delete_cookies; } +RESOURCE TBUF r_browser_menu_item_list_empty_cache { buf = text_wml_option_empty_cache; } + +RESOURCE TBUF r_browser_menu_item_list_infoview { buf = qtn_wml_option_infoview; } +RESOURCE TBUF r_browser_menu_item_list_session { buf = qtn_wml_opt_smenu_session; } +RESOURCE TBUF r_browser_menu_item_list_about_product { buf = qtn_wml_opt_about_product_oss; } +//Send selected feeds +RESOURCE TBUF r_browser_menu_item_help { buf = qtn_browser_options_help; } +RESOURCE TBUF r_browser_menu_item_exit { buf = qtn_options_exit; } +RESOURCE TBUF r_browser_menu_item_find_keyword { buf = qtn_browser_find_keyword_mm; } +RESOURCE TBUF r_browser_menu_item_list_privacy { buf = qtn_browser_list_privacy; } +RESOURCE TBUF r_browser_menu_item_rotate_display { buf = qtn_browser_rotate_display; } + +RESOURCE TBUF r_browser_tooltip_toolbar { buf = qtn_browser_tooltip_toolbar; } +RESOURCE TBUF r_browser_subscribe_list { buf = qtn_browser_subscribe_list; } +RESOURCE TBUF r_browser_query_set_as_home_page { buf = qtn_browser_query_set_as_home_page; } + +//============================================================================= +// +// Browser Keymap Key Assignments +// +//============================================================================= +RESOURCE TBUF r_browser_keymap_key0 { buf = "1"; } +RESOURCE TBUF r_browser_keymap_key1 { buf = "2"; } +RESOURCE TBUF r_browser_keymap_key2 { buf = "3"; } +RESOURCE TBUF r_browser_keymap_key3 { buf = "4"; } +RESOURCE TBUF r_browser_keymap_key4 { buf = "5"; } +RESOURCE TBUF r_browser_keymap_key5 { buf = "6"; } +RESOURCE TBUF r_browser_keymap_key6 { buf = "7"; } +RESOURCE TBUF r_browser_keymap_key7 { buf = "8"; } +RESOURCE TBUF r_browser_keymap_key8 { buf = "9"; } +RESOURCE TBUF r_browser_keymap_key9 { buf = "*"; } +RESOURCE TBUF r_browser_keymap_key10 { buf = "0"; } +RESOURCE TBUF r_browser_keymap_key11 { buf = "#"; } +RESOURCE TBUF r_browser_keymap_keyDefault { buf = "X"; } + +//============================================================================= +// +// Browser Shortcut Keymap Text Assignments +// +//============================================================================= +RESOURCE TBUF r_browser_keymap_text_none { buf = qtn_browser_keymap_text_none; } +RESOURCE TBUF r_browser_keymap_text_show_help { buf = qtn_browser_keymap_text_show_help; } +RESOURCE TBUF r_browser_keymap_text_switch_window { buf = qtn_browser_keymap_text_switch_window; } +RESOURCE TBUF r_browser_keymap_text_save_page { buf = qtn_browser_keymap_text_save_page; } +RESOURCE TBUF r_browser_keymap_text_view_images { buf = qtn_browser_keymap_text_view_images; } +RESOURCE TBUF r_browser_keymap_text_visual_history { buf = qtn_browser_keymap_text_visual_history; } +RESOURCE TBUF r_browser_keymap_text_manage_bookmarks { buf = qtn_browser_keymap_text_manage_bookmarks; } +RESOURCE TBUF r_browser_keymap_text_subscribe_to_feeds { buf = qtn_browser_keymap_text_subscribe_to_feeds; } +RESOURCE TBUF r_browser_keymap_text_rotate_screen { buf = qtn_browser_keymap_text_rotate_screen; } +RESOURCE TBUF r_browser_keymap_text_settings { buf = qtn_browser_keymap_text_settings; } +RESOURCE TBUF r_browser_keymap_text_zoom_out { buf = qtn_browser_keymap_text_zoom_out; } +RESOURCE TBUF r_browser_keymap_text_zoom_in { buf = qtn_browser_keymap_text_zoom_in; } +RESOURCE TBUF r_browser_keymap_text_zoom_mode { buf = qtn_browser_keymap_text_zoom_mode; } +RESOURCE TBUF r_browser_keymap_text_go_to_homepage { buf = qtn_browser_keymap_text_go_to_homepage; } +RESOURCE TBUF r_browser_keymap_text_previous_page { buf = qtn_browser_keymap_text_previous_page; } +RESOURCE TBUF r_browser_keymap_text_miniature_show { buf = qtn_browser_keymap_text_miniature_show; } +RESOURCE TBUF r_browser_keymap_text_reload { buf = qtn_browser_keymap_text_reload; } +RESOURCE TBUF r_browser_keymap_text_find_keyword { buf = qtn_browser_keymap_text_find_keyword; } +RESOURCE TBUF r_browser_keymap_text_save_as_bookmark { buf = qtn_browser_keymap_text_save_as_bookmark; } +RESOURCE TBUF r_browser_keymap_text_go_to_web_address { buf = qtn_browser_keymap_text_go_to_web_address; } +RESOURCE TBUF r_browser_keymap_text_show_toolbar { buf = qtn_browser_keymap_text_show_toolbar; } +RESOURCE TBUF r_browser_keymap_text_show_keymap { buf = qtn_browser_keymap_text_show_keymap; } +RESOURCE TBUF r_browser_keymap_text_full_screen { buf = qtn_browser_keymap_text_full_screen; } + +//RESOURCE TBUF r_update_tim { buf = "update infonote!"; } +//RESOURCE TBUF r_about_tim { buf = "version infonote!"; } + +//============================================================================= +// +// Service +// +//============================================================================= +RESOURCE TBUF r_is_recommendations { buf = qtn_is_recommendations; } +RESOURCE TBUF r_is_recommendations_title { buf = qtn_is_recommendations_title; } + +//============================================================================= +// +// Search +// +//============================================================================= +RESOURCE TBUF r_browsers_sett_web_search_provider { buf = qtn_browsers_sett_web_search_provider; } +RESOURCE TBUF r_is_web_search { buf = qtn_is_web_search; } +RESOURCE TBUF r_is_label_not_selected { buf = qtn_is_label_not_selected; } +#ifdef BRDO_IAD_UPDATE_ENABLED_FF +RESOURCE TBUF r_install_addon_browser { buf = qtn_install_addon_browser; } +RESOURCE TBUF r_install_browser_now { buf = qtn_swupdate_now; } +RESOURCE TBUF r_install_browser_later { buf = qtn_swupdate_later ; } +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserAnimation.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserAnimation.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser animation resources + +* +*/ + + +// INCLUDES +#include "Browser.hrh" +#include + + +// RESOURCE DEFINITIONS +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// IF RESOURCES NEEDS TO BE CHANGED : +// IF NEW RESOURCE IS ADDED ONE r_browser_dummy_dialog_0..n +// NEED TO BE REMOVED +// IF NEW RESOURCE IS REMOVED ONE r_browser_dummy_dialog_0..n +// NEED TO BE ADDED +// THE RESOURCE ID OF THE ANIMATIONS CAN NOT BE CHANGED +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +// RESOURCE DEFINITIONS + +// Dummy resources to fix compatibility break +RESOURCE DIALOG r_browser_dummy_dialog_0 + { + } + +RESOURCE DIALOG r_browser_dummy_dialog_1 + { + } + +// --------------------------------------------------------- +// +// r_browser_waiting_csd +// +// --------------------------------------------------------- +// +RESOURCE BMPANIM_DATA r_browser_waiting_csd // animation + { + frameinterval = 300; // in milliseconds + playmode = EAknBitmapAnimationPlayModeCycle; // play, cycle or bounce + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + frames = r_browser_waiting_csd_image_array; // link to an array + } + +// --------------------------------------------------------- +// +// r_browser_waiting_csd_image_array +// +// --------------------------------------------------------- +// +RESOURCE ARRAY r_browser_waiting_csd_image_array // array of frames + { + items={ + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_1; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_1_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_2; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_2_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_3; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_3_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_4; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_4_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_5; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_5_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_6; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_6_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_csd_7; + maskid=EMbmBrowserQgn_indi_wait_wml_csd_7_mask;} + }; + } + +// --------------------------------------------------------- +// +// r_browser_waiting_gprs +// +// --------------------------------------------------------- +// +RESOURCE BMPANIM_DATA r_browser_waiting_gprs // animation + { + frameinterval = 300; // in milliseconds + playmode = EAknBitmapAnimationPlayModeCycle; // play, cycle or bounce + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + frames = r_browser_waiting_gprs_image_array; // link to an array + } + +// --------------------------------------------------------- +// +// r_browser_waiting +// +// --------------------------------------------------------- +// +RESOURCE BMPANIM_DATA r_browser_waiting // animation + { + frameinterval = 300; // in milliseconds + playmode = EAknBitmapAnimationPlayModeCycle; // play, cycle or bounce + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + frames = r_browser_waiting_image_array; // link to an array + } +// --------------------------------------------------------- +// +// r_browser_waiting_image_array +// +// --------------------------------------------------------- +// +RESOURCE ARRAY r_browser_waiting_image_array // array of frames + { + items={ + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_02; + maskid=EMbmBrowserQgn_menu_wml_02_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_03; + maskid=EMbmBrowserQgn_menu_wml_03_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_04; + maskid=EMbmBrowserQgn_menu_wml_04_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_05; + maskid=EMbmBrowserQgn_menu_wml_05_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_06; + maskid=EMbmBrowserQgn_menu_wml_06_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_07; + maskid=EMbmBrowserQgn_menu_wml_07_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_08; + maskid=EMbmBrowserQgn_menu_wml_08_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_09; + maskid=EMbmBrowserQgn_menu_wml_09_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_10; + maskid=EMbmBrowserQgn_menu_wml_10_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_11; + maskid=EMbmBrowserQgn_menu_wml_11_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_12; + maskid=EMbmBrowserQgn_menu_wml_12_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_13; + maskid=EMbmBrowserQgn_menu_wml_13_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_14; + maskid=EMbmBrowserQgn_menu_wml_14_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_15; + maskid=EMbmBrowserQgn_menu_wml_15_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_menu_wml_16; + maskid=EMbmBrowserQgn_menu_wml_16_mask;} + }; + } + + + + + +// --------------------------------------------------------- +// +// r_browser_waiting_gprs_image_array +// +// --------------------------------------------------------- +// +RESOURCE ARRAY r_browser_waiting_gprs_image_array // array of frames + { + items={ + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_gprs_2; + maskid=EMbmBrowserQgn_indi_wait_wml_gprs_2_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_gprs_3; + maskid=EMbmBrowserQgn_indi_wait_wml_gprs_3_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_gprs_4; + maskid=EMbmBrowserQgn_indi_wait_wml_gprs_4_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_gprs_5; + maskid=EMbmBrowserQgn_indi_wait_wml_gprs_5_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_gprs_6; + maskid=EMbmBrowserQgn_indi_wait_wml_gprs_6_mask;} + }; + } + +// --------------------------------------------------------- +// +// r_browser_waiting_hscsd +// +// --------------------------------------------------------- +// +RESOURCE BMPANIM_DATA r_browser_waiting_hscsd // animation + { + frameinterval = 300; // in milliseconds + playmode = EAknBitmapAnimationPlayModeCycle; // play, cycle or bounce + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + frames = r_browser_waiting_hscsd_image_array; // link to an array + } + +// --------------------------------------------------------- +// +// r_browser_waiting_hscsd_image_array +// +// --------------------------------------------------------- +// +RESOURCE ARRAY r_browser_waiting_hscsd_image_array // array of frames + { + items={ + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_hscsd_2; + maskid=EMbmBrowserQgn_indi_wait_wml_hscsd_2_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_hscsd_3; + maskid=EMbmBrowserQgn_indi_wait_wml_hscsd_3_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_hscsd_4; + maskid=EMbmBrowserQgn_indi_wait_wml_hscsd_4_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_hscsd_5; + maskid=EMbmBrowserQgn_indi_wait_wml_hscsd_5_mask;}, + BMPANIM_FRAME { bmpid=EMbmBrowserQgn_indi_wait_wml_hscsd_6; + maskid=EMbmBrowserQgn_indi_wait_wml_hscsd_6_mask;} + }; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserBookmarks.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserBookmarks.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,626 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Resources for browser bookmarks view +* +* +*/ + + +#ifndef BROWSER_BOOKMARKS_RSSI +#define BROWSER_BOOKMARKS_RSSI + +#include "BrowserFavourites.rssi" // Components common to all favourites views +#include "Browser.hrh" // Data definitions +#include // Localization constants +#include +#include +#include "bookmark_toolbar.rssi" + +// VIEWS + +// Bookmarks view +RESOURCE AVKON_VIEW r_browser_bookmarks_view + { + menubar = r_browser_bookmarks_menu_bar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; // CBA commands are set dynamically + toolbar = r_bookmark_view_toolbar; + } + +// MENUBARS + +// Normal Options menubar for the bookmarks view +RESOURCE MENU_BAR r_browser_bookmarks_menu_bar + { + titles = + { + MENU_TITLE { menu_pane = r_browser_bookmarks_menu_pane; } + }; + } + +// OK-Options menubar for the bookmarks view +RESOURCE MENU_BAR r_browser_bookmarks_menu_bar_ok + { + titles = + { + MENU_TITLE { menu_pane = r_browser_bookmarks_menu_pane_ok; } + }; + } + +// MENU PANES + + +// Normal Options menu pane for bookmarks +RESOURCE MENU_PANE r_browser_bookmarks_menu_pane + { + items = + { + MENU_ITEM + { + command = EWmlCmdDownloads; + txt = qtn_browser_list_downloads; + }, + MENU_ITEM + { + cascade = r_goto_submenu; + txt = qtn_browser_options_goto; + }, +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + MENU_ITEM + { + command = EWmlCmdAddBookmark; + txt = text_wmlbm_option_enter_new; + }, + + MENU_ITEM + { + command = EWmlCmdNewFolder; + txt = qtn_options_org_new_folder; + }, + MENU_ITEM + { + command = EWmlCmdSendAddressViaUnifiedMessage; + txt = qtn_options_send_via; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EWmlCmdSendBookmarkViaUnifiedMessage; + txt = qtn_options_send_via; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EWmlCmdSetAsHomePage; + txt = qtn_browserbm_list_set_as_home_page_sm; + flags = EEikMenuItemSpecific; + }, +#endif + MENU_ITEM + { + cascade = r_bmactions_submenu; + command = EWmlCmdBmActions; + txt = qtn_browser_options_bmactions; +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + flags = EEikMenuItemSpecific; +#endif + }, + MENU_ITEM + { + cascade = r_bookmarks_edit_submenu; + command = EWmlCmdManageBookmarks; + txt = qtn_wmlbm_manage_bm; +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + flags = EEikMenuItemSpecific; +#endif + }, +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + MENU_ITEM + { + cascade = r_browser_favourites_menu_pane_mark_unmark; + command = EWmlCmdMarkUnmark; + txt = qtn_browser_options_markunmark; + }, +#else + MENU_ITEM + { + command = EWmlCmdDelete; + txt = qtn_fldr_delete; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EWmlCmdMove; + txt = qtn_options_org_move; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EWmlCmdMoveToFolder; + txt = qtn_options_org_move_to_folder; + flags = EEikMenuItemSpecific; + }, + +#endif + MENU_ITEM + { + cascade = r_clear_submenu; + command = EWmlCmdPrivacy; + txt = qtn_browser_options_clear; + }, + MENU_ITEM + { + command = EWmlCmdPreferences; + txt = qtn_wmls_browser_opt_sett; + }, + MENU_ITEM + { + cascade = r_help_submenu; + command = EWmlCmdHelpMenu; + txt = qtn_browser_options_help; + }, + MENU_ITEM + { + command = EWmlCmdUserExit; + txt = qtn_options_exit; + } + }; + } + +// OK-Options menu pane for bookmarks +RESOURCE MENU_PANE r_browser_bookmarks_menu_pane_ok + { + items = + { + MENU_ITEM { command = EWmlCmdAddBookmark; txt = text_wmlbm_option_enter_new; }, + MENU_ITEM { command = EWmlCmdDelete; txt = qtn_fldr_delete; }, + MENU_ITEM { command = EWmlCmdMove; txt = qtn_options_org_move; }, + MENU_ITEM { command = EWmlCmdMoveToFolder; txt = qtn_options_org_move_to_folder; }, + MENU_ITEM { command = EWmlCmdNewFolder; txt = qtn_options_org_new_folder; }, + MENU_ITEM { command = EWmlCmdCopyToBookmarks; txt = qtn_browserbm_options_copy_to_bookmarks; }, + MENU_ITEM { command = EWmlCmdSwitchToGotoActive; txt = text_wml_option_goto; }, + MENU_ITEM { cascade = r_browser_favourites_menu_pane_mark_unmark; command = EWmlCmdMarkUnmark; txt = qtn_browser_options_markunmark; } + }; + } + +// Edit submenu +RESOURCE MENU_PANE r_bookmarks_edit_submenu + { + items = + { + MENU_ITEM + { + command = EWmlCmdEditBookmark; + txt = qtn_wmlbm_edit_bm; + }, + MENU_ITEM + { + command = EWmlCmdRename; + txt = qtn_fldr_rename; + } +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + , + MENU_ITEM + { + command = EWmlCmdDelete; + txt = qtn_fldr_delete; + }, + MENU_ITEM + { + command = EWmlCmdMove; + txt = qtn_options_org_move; + }, + MENU_ITEM + { + command = EWmlCmdMoveToFolder; + txt = qtn_options_org_move_to_folder; + }, + MENU_ITEM + { + command = EWmlCmdNewFolder; + txt = qtn_options_org_new_folder; + } +#endif + }; + } + +//---------------------------------------------------- +// +// r_bmactions_submenu +// Cascading menu for bookmark actions menu items +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_bmactions_submenu + { + items = + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + MENU_ITEM { command = EWmlCmdSendAddressViaUnifiedMessage; txt=qtn_options_send_via; }, + MENU_ITEM { command = EWmlCmdSendBookmarkViaUnifiedMessage; txt =qtn_options_send_via; }, + MENU_ITEM { command = EWmlCmdSetAsHomePage; txt=qtn_browserbm_list_set_as_home_page_sm; }, + MENU_ITEM { command = EWmlCmdAddBookmark; txt = text_wmlbm_option_enter_new; }, +#endif + MENU_ITEM { command = EWmlCmdCopyToBookmarks; txt = qtn_browserbm_options_copy_to_bookmarks_sm; }, + MENU_ITEM { command = EWmlCmdSetPreferredBookmark; txt = qtn_browserbm_list_set_as_preferred; }, + MENU_ITEM { command = EWmlCmdSetUnPreferredBookmark; txt = qtn_browserbm_list_unset_from_preferred; } + }; + } + +// sub-menu pane for bookmarks help form +RESOURCE MENU_PANE r_browser_bookmarks_menu_pane_edit_bookmark + { + items = + { +#ifdef __SERIES60_HELP + MENU_ITEM { command = EAknCmdHelp; txt=qtn_browser_options_help;}, +#endif + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_PANE r_browser_bookmarks_menu_pane_download_page + { + items = + { + MENU_ITEM { command = EWmlCmdDownloadPage; txt = qtn_browserbm_options_download_page; }, + MENU_ITEM { command = EWmlCmdDownloadPageNewWindow; txt = qtn_browserbm_options_download_in_new_window; } + }; + } + +// CBA-s + +RESOURCE CBA r_browser_bookmarks_cba_goto_pane_goto_cancel // TEMP + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EWmlCmdGotoPaneGoTo; txt = qtn_wml_softk_go; }, + CBA_BUTTON { id = EWmlCmdGotoPaneCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EWmlCmdGotoPaneGoTo; txt = qtn_wml_softk_go; } + }; + } +// No need for separate search command, active search editor is checked. +RESOURCE CBA r_browser_bookmarks_cba_search_pane_search_cancel + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EWmlCmdGotoPaneGoTo; txt = qtn_is_softkey_search; }, + CBA_BUTTON { id = EWmlCmdGotoPaneCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EWmlCmdGotoPaneGoTo; txt = qtn_is_softkey_search; } + }; + } + +//adaptive popuplist needs it +RESOURCE CBA r_browser_bookmarks_cba_goto_pane_opendir_cancel // TEMP + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EWmlCmdOpenFolder; txt = text_softkey_open; }, + CBA_BUTTON { id = EWmlCmdGotoPaneCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EWmlCmdOpenFolder; txt = text_softkey_open; } + }; + } + +// Adaptive popuplist needs it +RESOURCE CBA r_browser_bookmarks_cba_goto_pane_select_cancel // TEMP + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EWmlCmdGotoPaneSelect; txt = text_softkey_select; }, + CBA_BUTTON { id = EWmlCmdGotoPaneCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EWmlCmdGotoPaneSelect; txt = text_softkey_select; } + }; + } + +/* +RESOURCE DIALOG r_processing_wait_note + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWmlControlIdProcessingPage; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_gen_note_processing; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } +*/ + +// LISTBOXES + +RESOURCE DIALOG r_browser_bookmarks_dialog_edit + { + flags = EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagNoTitleBar | + EEikDialogFlagCbaButtons | EEikDialogFlagWait + /*| EEikDialogFlagModeless */; + buttons = r_browser_cba_options_back_change ; + form = r_browser_bookmarks_form_edit; + } + +RESOURCE DIALOG r_browser_bookmarks_dialog_edit_apac // Dummy resource to fix compatibility break + { + } + +RESOURCE FORM r_browser_bookmarks_form_edit + { + flags = EEikFormEditModeOnly | EEikFormUseDoubleSpacedFormat; + items = + { + DLG_LINE + { + type = EEikCtEdwin; + prompt = qtn_wmlbm_flabel_bmtitle; + id = EWmlControlEditBmEditTitle; + control = EDWIN + { + maxlength = KFavouritesMaxBookmarkNameDefine; + width = 10; + lines = 1; + max_view_height_in_lines = 5; + base_line_delta = 21; + default_input_mode = EAknEditorTextInputMode; + flags = EEikEdwinAllowUndo | EEikEdwinNoHorizScrolling | EEikEdwinResizable | EEikEdwinAutoSelection | EAknEditorNumericInputMode; + }; + }, + + DLG_LINE + { + type = EEikCtEdwin; + prompt = qtn_wmlbm_flabel_bmadrs; + id = EWmlControlEditBmEditAddress; + control = EDWIN + { + maxlength = KFavouritesMaxUrlDefine; + width = 10; + lines = 1; + max_view_height_in_lines = 5; + base_line_delta = 21; + default_case = EAknEditorLowerCase; + allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase; + default_input_mode = EAknEditorTextInputMode; + allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; + flags = EEikEdwinAllowUndo | EEikEdwinNoHorizScrolling | EEikEdwinResizable | EEikEdwinNoLineOrParaBreaks | EAknEditorNumericInputMode ; + special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG; + avkon_flags = EAknEditorFlagLatinInputModesOnly; + }; + }, + + DLG_LINE + { + type = EAknCtPopupField; + prompt = qtn_wmlbm_flabel_wapap; + id = EWmlControlEditBmWapApSelector; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD + { + flags = 0; + width = KBrowserMaxWapApName; + other = "x"; // unused, but dialog panics if empty. + emptynote = r_browser_bookmarks_info_no_valid_ap; + empty = qtn_wmlbm_text_ap_none; + invalid = qtn_wmlbm_text_ap_invalid; + }; + }, + + DLG_LINE + { + type = EEikCtEdwin; + prompt = qtn_wmlbm_flabel_username; + id = EWmlControlEditBmEditUsername; + control = EDWIN + { + maxlength = KFavouritesMaxUsernameDefine; + width = 10; + lines = 1; + max_view_height_in_lines = 5; + base_line_delta = 21; +// default_case = EAknEditorLowerCase; + default_input_mode = EAknEditorTextInputMode; + flags = EEikEdwinAllowUndo | EEikEdwinNoHorizScrolling | EEikEdwinResizable | EEikEdwinAutoSelection | EAknEditorNumericInputMode; + avkon_flags = EAknEditorFlagLatinInputModesOnly; + }; + }, + + DLG_LINE + { + type = EEikCtSecretEd; + prompt = qtn_wmlbm_flabel_passwd; + id = EWmlControlEditBmEditPassword; + control = SECRETED + { + num_letters = KFavouritesMaxPasswordDefine; + }; + } + }; + } + +RESOURCE DIALOG r_browser_bookmarks_info_no_valid_ap + { + flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | + EEikDialogFlagCbaButtons | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EAknPopupFieldEmptyListNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_wmlbm_info_no_valid_ap; + plural_label = ""; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + + +RESOURCE FORM r_browser_bookmarks_form_edit_apac // Dummy resource to fix compatibility break + { + } + + +// ICONARRAYS +/* +RESOURCE AKN_ICON_ARRAY_ARRAY r_browser_bookmarks_listbox_icons + { + iconarrays = + { + AKN_ICON_ARRAY + { + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + icons = + { + AKN_ICON { iconId = EMbmAvkonQgn_indi_marked_add; maskId = EMbmAvkonQgn_indi_marked_add_mask; }, + AKN_ICON { iconId = EMbmAvkonQgn_prop_folder_small; maskId = EMbmAvkonQgn_prop_folder_small_mask; } + }; + }, + AKN_ICON_ARRAY + { + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + icons = + { + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_home; maskId = EMbmBrowserQgn_prop_wml_home_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_bm_last; maskId = EMbmBrowserQgn_prop_wml_bm_last_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_bm; maskId = EMbmBrowserQgn_prop_wml_bm_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_indi_wml_csd_add; maskId = EMbmBrowserQgn_indi_wml_csd_add_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_indi_wml_hscsd_add; maskId = EMbmBrowserQgn_indi_wml_hscsd_add_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_indi_wml_gprs_add; maskId = EMbmBrowserQgn_indi_wml_gprs_add_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_folder_link_seamless; maskId = EMbmBrowserQgn_prop_wml_folder_link_seamless_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_folder_adap; maskId = EMbmBrowserQgn_prop_wml_folder_adap_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_bm_adap; maskId = EMbmBrowserQgn_prop_wml_bm_adap_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_psln_active; maskId = EMbmBrowserQgn_prop_psln_active_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_folder_rss; maskId = EMbmBrowserQgn_prop_folder_rss_mask; } + }; + } + }; + } +*/ +RESOURCE TBUF r_browser_option_bookmarks + { buf = text_wml_option_bookmarks; } + +RESOURCE TBUF r_browser_bookmarks_text_no_bookmarks + { buf = text_wml_no_bookmarks; } + +RESOURCE TBUF r_browser_bookmarks_text_default_bm_title + { buf = qtn_wmlbm_default_bm_title; } + +RESOURCE TBUF r_browser_bookmarks_text_bm_not_saved + { buf = qtn_wmlbm_bm_not_saved; } + +RESOURCE TBUF r_browser_bookmarks_text_bm_saved + { buf = text_wml_bm_saved; } + +RESOURCE TBUF r_browser_bookmarks_text_query_address + { buf = qtn_wmlbm_query_address; } + +RESOURCE TBUF r_browser_bookmarks_name_already_used + { buf = qtn_wmlbm_name_already_used; } + +// RESOURCE TBUF r_browser_bokmarks_text_ap_none +// { buf = qtn_wmlbm_text_ap_none; } + +RESOURCE TBUF r_browser_bokmarks_text_default_wapap + { buf = qtn_wmlbm_default_wapap; } + +// RESOURCE TBUF r_browser_bokmarks_text_invalid_wapap +// { buf = qtn_wmlbm_text_ap_invalid; } + +// RESOURCE TBUF r_browser_bokmarks_text_info_no_valid_ap +// { buf = qtn_wmlbm_info_no_valid_ap; } + +RESOURCE TBUF r_browser_adaptive_bookmarks_folder + {buf= qtn_browserbm_folder_adaptive_bookmarks;} + +RESOURCE TBUF r_browser_adaptive_bookmarks_no_adaptive_bookmarks + { buf = qtn_browserbm_no_adaptive_bookmarks; } + +RESOURCE TBUF r_browser_adaptive_bookmarks_delete_all_adaptive_bookmarks + { buf = qtn_browserbm_query_delete_adap_bookmarks;} + +RESOURCE TBUF r_browser_adaptive_bookmarks_adaptive_bookmark_copied + { buf= qtn_browserbm_note_adaptive_bookmark_copied;} + +RESOURCE TBUF r_browser_adaptive_bookmarks_adaptive_bookmarks_copied + { buf= qtn_browserbm_note_adaptive_bookmarks_copied;} + +RESOURCE TBUF r_browser_apps_feeds_list + {buf= qtn_apps_feeds_list;} + +RESOURCE TBUF r_browser_adaptive_bookmarks_title + { buf = qtn_browserbm_title_adaptive_bookmarks; } + + +// These are SK string resources for dynamic softkey assignment in Bookmarks View + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_qtn_browser_msk_goto + { buf = qtn_browser_msk_goto; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_qtn_msk_add + { buf = qtn_msk_add; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_qtn_msk_open + { buf = qtn_msk_open; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_qtn_wml_softk_go + { buf = qtn_wml_softk_go; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_qtn_is_softk_search + { buf = qtn_is_softkey_search; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_back + { buf = text_softkey_back; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_cancel + { buf = text_softkey_cancel; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_empty + { buf = text_softkey_empty; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_exit + { buf = text_softkey_exit; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_ok + { buf = text_softkey_ok; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_open + { buf = text_softkey_open; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_option + { buf = text_softkey_option; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_stop + { buf = text_softkey_stop; } + +RESOURCE TBUF r_browser_bookmarks_dyn_sk_text_softkey_select + { buf = text_softkey_select; } + + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserFavourites.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserFavourites.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,450 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Common resources for browser views +* +* +*/ + + +#ifndef BROWSER_FAVOURITES_RSSI +#define BROWSER_FAVOURITES_RSSI + +#include "Browser.hrh" // Data definitions +#include + +// TABS + +// tabgroup common to all views. +RESOURCE TAB_GROUP r_browser_views_tab_group + { + tabs = + { + TAB + { + id = EWmlTabFavouritesBookmarks; + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + bmpid = EMbmBrowserQgn_prop_wml_pages_tab2; + bmpmask = EMbmBrowserQgn_prop_wml_pages_tab2_mask; + } + }; + } + +RESOURCE IMAGE r_browser_icon_prop_folder + { + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + bmpid = EMbmBrowserQgn_prop_folder_tab1; + bmpmask = EMbmBrowserQgn_prop_folder_tab1_mask; + } + +// MENU PANES + +// OK-Options menu for the favourites views +RESOURCE MENU_PANE r_browser_favourites_menu_pane_ok + { + items = + { + // Dummy menu pane; its resource id is used to refer to the common + // menu items in bookmarks view. + }; + } + +// Normal Options menu for the favourites views +RESOURCE MENU_PANE r_browser_favourites_menu_pane + { + items = + { + // Dummy menu pane; its resource id is used to refer to the common + // menu items in bookmarks view. + }; + } + +// sub-menu pane for favourites views +RESOURCE MENU_PANE r_browser_favourites_menu_pane_mark_unmark + { + items = + { + MENU_ITEM { command = EWmlCmdMark; txt = qtn_options_list_mark_one; }, + MENU_ITEM { command = EWmlCmdUnmark; txt = qtn_options_list_unmark_one; }, + MENU_ITEM { command = EWmlCmdMarkAll; txt = qtn_options_list_mark_all; }, + MENU_ITEM { command = EWmlCmdUnmarkAll; txt = qtn_options_list_unmark_all; } + }; + } + +// sub-menu pane for favourites views +RESOURCE MENU_PANE r_browser_favourites_menu_pane_info + { + items = + { + MENU_ITEM { command = EWmlCmdPageInfo; txt = qtn_browser_list_page_info;}, + MENU_ITEM { command = EWmlCmdInfoSession; txt = qtn_wml_opt_smenu_session; }, + MENU_ITEM { command = EWmlCmdInfoSecurity; txt = qtn_wml_opt_smenu_security; } + }; + } + +// 'Advanced functions' submenu when Small Screen support is available +RESOURCE MENU_PANE r_browser_favourites_advanced_submenu + { + items = + { + MENU_ITEM { command = EWmlCmdChangeConnection; txt = qtn_wml_list_change_connection; }, + MENU_ITEM { command = EWmlCmdDisconnect; txt = qtn_wml_list_dconn; } + }; + } +// CBA-s + +RESOURCE CBA r_browser_favourites_cba_options_exit + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_exit_open_item + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; }, + CBA_BUTTON { id = EWmlCmdOpenItem; txt = qtn_msk_open; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_exit_context_menu + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; }, + CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_back_options + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdFavourites; txt = text_softkey_back; }, + CBA_BUTTON { id = EWmlNoCmd; txt = text_softkey_empty; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_back_context_menu + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdFavourites; txt = text_softkey_back; }, + CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } + + +RESOURCE CBA r_browser_favourites_cba_options_backtopage + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackToPage; txt = text_softkey_back; } + }; + } + + +RESOURCE CBA r_browser_favourites_cba_options_backtopage_open_item + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackToPage; txt = text_softkey_back; }, + CBA_BUTTON { id = EWmlCmdOpenItem; txt = qtn_msk_open; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_backtopage_context_menu + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackToPage; txt = text_softkey_back; }, + CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_move_okcancel_ok + { + buttons = + { + CBA_BUTTON { id = EWmlCmdMoveOk; txt = text_softkey_ok; }, + CBA_BUTTON { id = EWmlCmdMoveCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EWmlCmdMoveOk; txt = text_softkey_ok; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_backfromfolder + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackFromFolder; txt = text_softkey_back; }, + CBA_BUTTON { id = EAknSoftkeyForwardKeyEvent; txt = text_softkey_empty; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_backfromfolder_goto + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackFromFolder; txt = text_softkey_back; }, + CBA_BUTTON { id = EWmlCmdGoToAddress; txt = qtn_browser_msk_goto; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_backfromfolder_addbm + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackFromFolder; txt = text_softkey_back; }, + CBA_BUTTON { id = EWmlCmdAddBookmark; txt = qtn_msk_add; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_backfromfolder_options + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackFromFolder; txt = text_softkey_back; }, + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; } + }; + } + + +RESOURCE CBA r_browser_favourites_cba_options_backfromfolder_open_item + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackFromFolder; txt = text_softkey_back; }, + CBA_BUTTON { id = EWmlCmdOpenItem; txt = qtn_msk_open; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_options_backfromfolder_context_menu + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdBackFromFolder; txt = text_softkey_back; }, + CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } + +RESOURCE CBA r_browser_favourites_cba_movetofolder_movecancel_move + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOk; txt = text_softkey_move; }, + CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EAknSoftkeyOk; txt = text_softkey_move; } + }; + } + +// DIALOGS + +RESOURCE DIALOG r_wmlbrowser_favourites_note_moving + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWmlControlIncrementalNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_fldr_moving_wait_note; + imagefile = AVKON_BITMAP_FILE; // bitmap file + imageid = EMbmAvkonQgn_note_move; + imagemask = EMbmAvkonQgn_note_move_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +RESOURCE DIALOG r_wmlbrowser_favourites_note_deleting + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EWmlControlIncrementalNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_fldr_deleting_wait_note; + imagefile = AVKON_BITMAP_FILE; // bitmap file + imageid = EMbmAvkonQgn_note_erased; + imagemask = EMbmAvkonQgn_note_erased_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +// ICONARRAYS +RESOURCE AKN_ICON_ARRAY_ARRAY r_browser_favourites_folder_listbox_icons + { + iconarrays = + { + AKN_ICON_ARRAY + { + bmpfile = AVKON_BITMAP_FILE; + icons = + { + AKN_ICON { iconId = EMbmAvkonQgn_indi_marked_add; maskId = EMbmAvkonQgn_indi_marked_add_mask; }, + AKN_ICON { iconId = EMbmAvkonQgn_prop_folder_small; maskId = EMbmAvkonQgn_prop_folder_small_mask; }, + AKN_ICON { iconId = EMbmAvkonQgn_indi_level_back; maskId = EMbmAvkonQgn_indi_level_back_mask; } + }; + }, + AKN_ICON_ARRAY + { + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + icons = + { + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_home; maskId = EMbmBrowserQgn_prop_wml_home_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_bm_last; maskId = EMbmBrowserQgn_prop_wml_bm_last_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_bm; maskId = EMbmBrowserQgn_prop_wml_bm_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_indi_wml_csd_add; maskId = EMbmBrowserQgn_indi_wml_csd_add_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_indi_wml_hscsd_add; maskId = EMbmBrowserQgn_indi_wml_hscsd_add_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_indi_wml_gprs_add; maskId = EMbmBrowserQgn_indi_wml_gprs_add_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_wml_folder_link_seamless; maskId = EMbmBrowserQgn_prop_wml_folder_link_seamless_mask; } + }; + } + }; + } + + +RESOURCE DIALOG r_browser_favourites_name_query_ok_cancel + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = ""; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinAutoSelection | EEikEdwinNoWrap; + maxlength = KFavouritesMaxBookmarkNameDefine; + width = 6; + lines = 1; + }; + }; + } + }; + } + +// STRINGS + +RESOURCE TBUF r_browser_favourites_text_cant_delete_item + { buf = qtn_fldr_cant_delete_item; } + +RESOURCE TBUF r_browser_favourites_text_cant_delete_items + { buf = qtn_fldr_cant_delete_items; } + +RESOURCE TBUF r_browser_favourites_text_fldr_name_default + { buf = qtn_fldr_name_default; } + +RESOURCE TBUF r_browser_favourites_text_fldr_name_prmpt + { buf = qtn_fldr_name_prmpt; } + +RESOURCE TBUF r_browser_favourites_text_fldr_item_name_prmpt + { buf = qtn_fldr_item_name_prmpt; } +RESOURCE TBUF r_browser_favourites_text_fldr_name_already_used + { buf = qtn_fldr_name_already_used; } + +RESOURCE TBUF r_browser_favourites_text_fldr_names_in_use_rename + { buf = qtn_fldr_names_in_use_rename; } + +RESOURCE TBUF r_browser_favourites_text_query_common_conf_delete + { buf = qtn_query_common_conf_delete; } + +RESOURCE TBUF r_browser_favourites_text_del_items_query + { buf = qtn_fldr_del_items_query; } + +RESOURCE TBUF r_browser_favourites_text_del_full_fldrs_query + { buf = qtn_fldr_del_full_fldrs_query; } + +RESOURCE TBUF r_browser_favourites_text_item_cannot_be_moved + { buf = qtn_fldr_item_cannot_be_moved; } + +RESOURCE TBUF r_browser_favourites_text_some_items_cant_move + { buf = qtn_fldr_some_items_cant_move; } + +// RESOURCE TBUF r_browser_favourites_text_no_folders_exist +// { buf = qtn_fldr_no_folders_exist; } + +RESOURCE TBUF r_browser_favourites_text_cannot_access_db + { buf = qtn_wmlbm_err_db_inaccessible; } + +RESOURCE TBUF r_browser_favourites_text_fldr_root_level + { buf = qtn_fldr_root_level; } + +RESOURCE TBUF r_browser_favourites_text_move_to_prmpt + { buf = qtn_fldr_move_to_prmpt; } + +RESOURCE TBUF r_browser_favourites_text_prmpt_edit_name + { buf = qtn_wml_prmpt_edit_name; } + +RESOURCE TBUF r_browser_favourites_text_prmpt_illegal_char + { buf = qtn_fldr_illegal_characters; } + +RESOURCE TBUF r_browser_favourites_text_prmpt_cant_rename + { buf = qtn_fldr_cant_rename_item; } + + +RESOURCE TBUF r_browserbm_folder_download_applications { buf = qtn_browserbm_folder_download_applications; } +RESOURCE TBUF r_browserbm_folder_download_images { buf = qtn_browserbm_folder_download_images; } +RESOURCE TBUF r_browserbm_folder_download_tones { buf = qtn_browserbm_folder_download_tones; } +RESOURCE TBUF r_browserbm_folder_download_videos { buf = qtn_browserbm_folder_download_videos; } +RESOURCE TBUF r_browserbm_folder_download_skins { buf = qtn_browserbm_folder_download_skins; } +RESOURCE TBUF r_browserbm_folder_download_music { buf = qtn_browserbm_folder_download_music; } + +RESOURCE TBUF r_browserbm_folder_title_download_applications { buf = qtn_browserbm_folder_title_download_applications; } +RESOURCE TBUF r_browserbm_folder_title_download_images { buf = qtn_browserbm_folder_title_download_images; } +RESOURCE TBUF r_browserbm_folder_title_download_tones { buf = qtn_browserbm_folder_title_download_tones; } +RESOURCE TBUF r_browserbm_folder_title_download_videos { buf = qtn_browserbm_folder_title_download_videos; } +RESOURCE TBUF r_browserbm_folder_title_download_skins { buf = qtn_browserbm_folder_title_download_skins; } +RESOURCE TBUF r_browserbm_folder_title_download_music { buf = qtn_browserbm_folder_title_download_music; } + +#endif +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserGenericDialogs.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserGenericDialogs.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,325 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* browser generic dialog resources +* +* +*/ + + +#ifndef WML_BROWSER_GENERIC_DIALOGS_RSSI +#define WML_BROWSER_GENERIC_DIALOGS_RSSI + +#include "browser.hrh" // Data definitions +#include + +RESOURCE DIALOG r_browser_confirm_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = ""; + }; + } + }; + } + +RESOURCE DIALOG r_browser_clearformpasswddata_query + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_browser_form_data_delete_all; + }; + } + }; + } + + +RESOURCE DIALOG r_browser_clearpasswddata_query + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_browser_form_data_delete_password; + }; + } + }; + } + + +RESOURCE DIALOG r_browser_clearprivacydata_query + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_browser_privacy_delete_all; + }; + } + }; + } + +RESOURCE DIALOG r_browser_clearhistorydata_query + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_browser_privacy_query_clear_history; + }; + } + }; + } + +// Use this with TbrowserDialogs::InfoNoteL(...); set prompt there. +RESOURCE DIALOG r_browser_info_note + { + flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | + EEikDialogFlagCbaButtons | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = ""; + plural_label = ""; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +// Use this with TbrowserDialogs::InfoNoteL(...); set prompt there. +RESOURCE DIALOG r_browser_ok_note + { + flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | + EEikDialogFlagCbaButtons | EEikDialogFlagWait; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = ""; + plural_label = ""; + animation = R_QGN_NOTE_OK_ANIM; + }; + } + }; + } + +/* +//---------------------------------------------------- +// +// r_wml_wim_dialog_list +// WIM ListSelect dialog +// +//---------------------------------------------------- + +RESOURCE AVKON_LIST_QUERY r_wml_wim_dialog_list + { + softkeys = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + //type = EAknCtListQueryControl; + //id = EListControl; + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id=0; + }; + heading = "title"; + + }; + } + }; + } +*/ +//---------------------------------------------------- +// +// r_wim_query_with_heading +// WIM InputPrompt dialog (edwin) +// +//---------------------------------------------------- + +RESOURCE DIALOG r_wim_query_with_heading + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + bmpfile = AVKON_BITMAP_FILE; // bitmap file + bmpid = EMbmAvkonQgn_indi_checkbox_on; + bmpmask = EMbmAvkonQgn_indi_checkbox_on_mask; + }; + }, + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + //allowed_input_modes=EAknEditorTextInputMode | EAknEditorNumericInputMode; + default_input_mode=EAknEditorTextInputMode; + //avkon_flags = EAknEditorFlagNoT9; + //num_letters=4; + }; + + }; + } + + }; + } +//---------------------------------------------------- +// +// r_wim_query_with_hidetext +// WIM InputPrompt dialog (secreteditor) +// +//---------------------------------------------------- + +RESOURCE DIALOG r_wim_query_with_hidetext + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + bmpfile = AVKON_BITMAP_FILE; // bitmap file + bmpid = EMbmAvkonQgn_indi_checkbox_on; + bmpmask = EMbmAvkonQgn_indi_checkbox_on_mask; + }; + }, + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = EPinLayout; + control = SECRETED + { + num_letters=4; + }; + + }; + } + + }; + } + +//---------------------------------------------------- +// +// r_wim_prompt_dialog +// WIM Prompt dialog +// +//---------------------------------------------------- + +RESOURCE DIALOG r_wim_prompt_dialog + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + //label=qtn_wmlsec_query_hdr_secwarn; + //headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = ""; + }; + } + }; + } + + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserHp.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserHp.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser hp resource file +* +* +*/ + + +// INCLUDES +#include + +// RESOURCE IDENTIFIER +RESOURCE TBUF r_lhp_title { buf = qtn_lhp_title; } +RESOURCE TBUF r_lhp_search_web { buf = qtn_lhp_search_web; } +RESOURCE TBUF r_lhp_search_images { buf = qtn_lhp_search_images; } +RESOURCE TBUF r_lhp_my_top { buf = qtn_lhp_my_top; } +RESOURCE TBUF r_lhp_shortcut_keys { buf = qtn_lhp_shortcut_keys; } +RESOURCE TBUF r_lhp_selection_key { buf = qtn_lhp_selection_key; } +RESOURCE TBUF r_lhp_selection_key_label { buf = qtn_lhp_selection_key_label; } +RESOURCE TBUF r_lhp_c_key_label { buf = qtn_lhp_c_key_label; } +RESOURCE TBUF r_lhp_1_key_label { buf = qtn_lhp_1_key_label; } +RESOURCE TBUF r_lhp_2_key_label { buf = qtn_lhp_2_key_label; } +RESOURCE TBUF r_lhp_3_key_label { buf = qtn_lhp_3_key_label; } +RESOURCE TBUF r_lhp_4_key_label { buf = qtn_lhp_unused_key_label; } +RESOURCE TBUF r_lhp_5_key_label { buf = qtn_lhp_5_key_label; } +RESOURCE TBUF r_lhp_6_key_label { buf = qtn_lhp_unused_key_label; } +RESOURCE TBUF r_lhp_7_key_label { buf = qtn_lhp_unused_key_label; } +RESOURCE TBUF r_lhp_8_key_label { buf = qtn_lhp_8_key_label; } +RESOURCE TBUF r_lhp_9_key_label { buf = qtn_lhp_9_key_label; } +RESOURCE TBUF r_lhp_0_key_label { buf = qtn_lhp_0_key_label; } +RESOURCE TBUF r_lhp_star_key_label { buf = qtn_lhp_star_key_label; } +RESOURCE TBUF r_lhp_hash_key_label { buf = qtn_lhp_hash_key_label; } +RESOURCE TBUF r_lhp_note { buf = qtn_lhp_note; } +RESOURCE TBUF r_lhp_shortcut_unavailable { buf = qtn_lhp_shortcut_unavailable; } +RESOURCE TBUF r_lhp_browser_forum { buf = qtn_lhp_browser_forum; } +RESOURCE TBUF r_lhp_join_discussion_1 { buf = qtn_lhp_join_discussion_1; } +RESOURCE TBUF r_lhp_join_discussion_2 { buf = qtn_lhp_join_discussion_2; } +// end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserInitial.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserInitial.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser Initial view resources + +* +*/ + + +#ifndef BROWSER_INITIAL_RSSI +#define BROWSER_INITIAL_RSSI + +// INCLUDES + +#include "Browser.hrh" +#include +#include +#include + +// RESOURCE DEFINITIONS + +//---------------------------------------------------- +// +// r_browserinitial_view +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_browserinitial_view + { + menubar = r_browserinitial_menubar_view; + cba = R_AVKON_SOFTKEYS_EMPTY; // CBA commands are set dynamically + } + +//---------------------------------------------------- +// +// r_browserinitial_cba_options_exit +// +//---------------------------------------------------- +// +RESOURCE CBA r_browserinitial_cba_options_exit + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdCloseBrowser; txt = text_softkey_exit; } + }; + } + +//---------------------------------------------------- +// +// r_browserinitial_menubar_view +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_browserinitial_menubar_view + { + titles = + { + MENU_TITLE { menu_pane = r_browserinitial_view_menu; txt = " "; } + }; + } + +//---------------------------------------------------- +// +// r_browserinitial_view_menu +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_browserinitial_view_menu + { + items = + { + MENU_ITEM { command = EWmlCmdUserExit; txt = qtn_options_exit; } + }; + } + +//---------------------------------------------------- +// +// r_browserinitial_app_menu +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_browserinitial_app_menu + { + items = + { + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE TBUF r_browser_initial_view_title { buf = qtn_apps_browserng_grid; } + +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserNG.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserNG.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main browser resource file +* +* +*/ + +#include "Browser.rss" +#include "BrowserWindowSelection.rssi" +#include "BrowserInitial.rssi" +#include +#ifdef __RSS_FEEDS +#include "Feeds.rssi" +#endif // __RSS_FEEDS + +//---------------------------------------------------- +// +// Find keyword strings +// +//---------------------------------------------------- +// + +RESOURCE TBUF r_qtn_browser_keyword_find_no_matches { buf = qtn_browser_keyword_find_no_matches; } +RESOURCE TBUF r_qtn_browser_keyword_find_wraparound { buf = qtn_browser_keyword_find_wraparound; } +RESOURCE TBUF r_qtn_browser_keyword_find_all_content_searched { buf = qtn_browser_keyword_find_all_content_searched; } + +// Misc dialogs +RESOURCE TBUF r_qtn_browser_dialog_oom { buf=qtn_memlo_ram_out_of_mem; } +RESOURCE TBUF r_qtn_OK_button { buf= text_softkey_ok; } diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserNG_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserNG_reg.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RSS for registration file for Browser. +* +*/ + + +#include +#include + +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10008D39 + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "BrowserNG"; + localisable_resource_file = APP_RESOURCE_DIR"\\BrowserNG"; + localisable_resource_id = R_BROWSER_LOCALISABLE_APP_INFO; + embeddability = KAppEmbeddable; + newfile = KAppDoesNotSupportNewFile; + + // MIME types + datatype_list= + { + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/html"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/xhtml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.xhtml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlc"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/wml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/vnd.wap.wml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlscriptc"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlscript"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wbxml"; + }, + DATATYPE + { + // ++PK + // TSW EAPG-757BHY priority for text/x-opml should be low instead of high. Changed from High to Low + priority=EDataTypePriorityLow; + // ++PK + type="text/x-opml"; + } + }; + + } + + + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserScriptDialogs.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserScriptDialogs.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Script dialogs resources +* +* +*/ + + +// RESOURCE DEFINITIONS +// --------------------------------------------------------- +// +// r_wb_script_prompt_lines +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_wb_script_prompt_url_address + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + width = 20; + maxlength = 128; + default_case = EAknEditorLowerCase; + allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase; + default_input_mode = EAknEditorTextInputMode; + allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; + avkon_flags = EAknEditorFlagLatinInputModesOnly; + }; + }; + } + }; + + } + + +RESOURCE DIALOG r_wb_script_prompt_lines + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout=EDataLayout; + control = EDWIN + { + width = 20; + maxlength = 128; + default_case = EAknEditorLowerCase; + allowed_case_modes = EAknEditorAllCaseModes; + default_input_mode = EAknEditorTextInputMode; + allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; + }; + }; + } + }; + + } + +// RESOURCE DEFINITIONS +// --------------------------------------------------------- +// +// r_wb_script_query_lines +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_wb_script_query_lines + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = "dummy"; + }; + } + }; + } + + +// RESOURCE DEFINITIONS +// --------------------------------------------------------- +// +// r_wb_script_info_lines +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_wb_script_info_lines + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = "dummy"; + }; + } + }; + } + + +// End of File \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserSettings.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserSettings.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,813 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser settings resources +* +*/ + + +// resources for browser settings + +#ifndef BROWSER_SETTINGS_RSSI +#define BROWSER_SETTINGS_RSSI + +#include "Browser.hrh" // Data definitions +#include // Localization constants +#include +#include //Browser feature flags + +//----------------------------------------------------------------------------- +// CBAs + +RESOURCE CBA r_browser_settings_cba_options_back_open + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, + CBA_BUTTON {id = EWmlCmdSettingsOpen; txt = qtn_msk_open;} + }; + } + + +RESOURCE CBA r_browser_settings_cba_options_back_change + { + buttons = + { + CBA_BUTTON {id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, + CBA_BUTTON {id = EWmlCmdSettingsChange; txt = qtn_msk_change;} + }; + } + +//----------------------------------------------------------------------------- +// Views + +// --------------------------------------------------------- +// +// r_wmlbrowser_settings_settings_view +// Settings view +// +// --------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_browser_settings_settings_view + { + menubar=r_browser_settings_settings_menubar; + cba=r_browser_settings_cba_options_back_open; + } + +//----------------------------------------------------------------------------- +// Menu bars + +// --------------------------------------------------------- +// +// r_wmlbrowser_settings_settings_menubar +// menubar for the settings view +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_browser_settings_settings_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_browser_settings_settings_menu; txt="App"; } + }; + } + + +// --------------------------------------------------------- +// +// r_wmlbrowser_settings_settings_menu +// menu pane for browser settings +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_browser_settings_settings_menu + { + items= + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + MENU_ITEM { command=EWmlCmdSettingsOpen; txt=qtn_options_open; }, + MENU_ITEM { command=EWmlCmdSettingsChange; txt=qtn_wmls_local_set_opt_change; }, +#endif + MENU_ITEM {cascade = r_help_submenu; txt=qtn_options_help;}, + MENU_ITEM { command=EWmlCmdUserExit; txt=qtn_options_exit; } + }; + } + + +//----------------------------------------------------------------------------- +// Listboxes + +// --------------------------------------------------------- +// +// r_browser_setting_categories_listbox +// List of individual settings +// + +// --------------------------------------------------------- +// +RESOURCE LISTBOX r_browser_setting_categories_listbox + { + flags = EAknListBoxSelectionList; + } +// --------------------------------------------------------- +// +// r_browser_settings_listbox +// List of individual settings +// +// --------------------------------------------------------- +// +RESOURCE LISTBOX r_browser_settings_settings_listbox + { + flags = EAknListBoxSelectionList; + } + +//----------------------------------------------------------------------------- +// Arrays for listboxes + +//----------------------------------------------------------------------------- +// Dialogs + + +// --------------------------------------------------------- +// +// r_radio_button_setting_page +// Dialog for setting values for items +// +// --------------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_radio_button_setting_page + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; +#else + softkey_resource = R_AVKON_SOFTKEYS_CANCEL; +#endif + type = EAknSetListBox; + editor_resource_id= r_setting_app_listbox; + } + +// --------------------------------------------------------- +// +// r_setting_app_listbox +// Belongs to r_radio_button_setting_page +// +// --------------------------------------------------------- +// +RESOURCE LISTBOX r_setting_app_listbox + { + flags = EEikListBoxMultipleSelection; + } + + +// RESOURCE DEFINITIONS +// --------------------------------------------------------- +// +// r_setting_query_lines +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_settings_query_lines + { + flags=EGeneralQueryFlags; + buttons=R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = "dummy"; + }; + } + }; + } + + +//---------------------------------------------------- +// session info +//---------------------------------------------------- +// +RESOURCE DIALOG r_browser_session_info + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_BACK; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +//---------------------------------------------------- +// security info +//---------------------------------------------------- +// +RESOURCE DIALOG r_browser_security_info + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_CLOSE; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +//---------------------------------------------------- +// page info +//---------------------------------------------------- +// +RESOURCE DIALOG r_browser_page_info + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +//---------------------------------------------------- +// page version +//---------------------------------------------------- +// +RESOURCE DIALOG r_browser_page_version + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +//---------------------------------------------------- +// Search Web Setting page +//---------------------------------------------------- +// +RESOURCE EDWIN r_setting_app_edwin + { + lines=2; + avkon_flags = EAknEditorFlagLatinInputModesOnly; + default_case = EAknEditorLowerCase; + allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase; + } +RESOURCE EDWIN r_setting_app_edwin_read_only + { + lines=2; + default_case = EAknEditorLowerCase; + allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase; + flags = EEikEdwinReadOnly; + } + +RESOURCE AVKON_SETTING_PAGE r_url_setting_page + { + label= qtn_browsers_sett_search; + type = EEikCtEdwin; + editor_resource_id = r_setting_app_edwin; + } +RESOURCE AVKON_SETTING_PAGE r_url_setting_page_read_only + { + label= qtn_browsers_sett_search; + type = EEikCtEdwin; + editor_resource_id = r_setting_app_edwin_read_only; + } +RESOURCE AVKON_SETTING_PAGE r_url_suffix_page + { + label= qtn_browsers_sett_url_suffix; + type = EEikCtEdwin; + editor_resource_id = r_setting_app_edwin; + } +//----------------------------------------------------------------------------- +// Other strings + +//---------------------------------------------------------------------------- +// +// Settings / Settings listbox content TITLES +// +//---------------------------------------------------------------------------- +// +RESOURCE TBUF r_settings_category_general { buf = qtn_browsers_fldr_general; } +RESOURCE TBUF r_settings_category_page { buf = qtn_browsers_fldr_page; } +RESOURCE TBUF r_settings_category_privacy { buf = qtn_browsers_fldr_privacy; } +RESOURCE TBUF r_settings_category_webfeeds { buf = qtn_browsers_fldr_feeds; } +RESOURCE TBUF r_settings_category_toolbar { buf = qtn_browser_setting_group_toolbar; } +RESOURCE TBUF r_settings_category_shortcuts { buf = qtn_browser_setting_group_shortcuts; } + + +// Default Access Point +RESOURCE TBUF r_wmlbrowser_settings_default_ap { buf = qtn_wmls_local_set_default_ap; } + +// Autoload Images and Objects +RESOURCE TBUF r_wmlbrowser_settings_image_autoload { buf = qtn_browsers_sett_autoload_objects; } + +// Autoload Content +RESOURCE TBUF r_wmlbrowser_settings_autoload_content { buf = qtn_browser_sett_autoload_objects; } + +// Page overview +RESOURCE TBUF r_wmlbrowser_settings_pageoverview { buf = qtn_wmls_local_set_pageoverview; } + +RESOURCE TBUF r_wmlbrowser_settings_pageoverview_on { buf = qtn_browsers_sett_pageoverview_on; } +RESOURCE TBUF r_wmlbrowser_settings_pageoverview_off { buf = qtn_browsers_sett_pageoverview_off; } + +// Back list +RESOURCE TBUF r_wmlbrowser_settings_back_list { buf = qtn_browsers_sett_back_list; } + +RESOURCE TBUF r_wmlbrowser_settings_back_list_on { buf = qtn_browsers_sett_val_back_list_on; } +RESOURCE TBUF r_wmlbrowser_settings_back_list_off { buf = qtn_browsers_sett_val_back_list_off; } + +// Autorefresh +RESOURCE TBUF r_wmlbrowser_settings_auto_refresh { buf = qtn_browsers_sett_auto_refresh; } + +RESOURCE TBUF r_wmlbrowser_settings_auto_refresh_on { buf = qtn_browsers_sett_val_auto_refresh_on; } +RESOURCE TBUF r_wmlbrowser_settings_auto_refresh_off { buf = qtn_browsers_sett_val_auto_refresh_off; } + +// Font Size +RESOURCE TBUF r_wmlbrowser_settings_font_size { buf = qtn_wmls_pref_fontsize; } + +// Adaptive Bookmarks +RESOURCE TBUF r_wmlbrowser_settings_adaptive_bookmarks { buf = qtn_browsers_sett_adaptive_bookmarks;} + +// Full Screen +RESOURCE TBUF r_wmlbrowser_settings_fullscreen { buf = qtn_browsers_sett_full_screen; } + +// Search Web +RESOURCE TBUF r_wmlbrowser_settings_search_web { buf = qtn_browsers_sett_search; } + +// Url Suffix +RESOURCE TBUF r_wmlbrowser_settings_url_suffix { buf = qtn_browsers_sett_url_suffix; } + +// Cookies +RESOURCE TBUF r_wmlbrowser_settings_cookies { buf = qtn_wmls_sett_cookies; } + +// ECMA Script +RESOURCE TBUF r_wmlbrowser_settings_ecma { buf = qtn_browsers_sett_scripting; } + +// HTTP Security Warnings +RESOURCE TBUF r_wmlbrowser_settings_http_sec_wrns { buf = qtn_browser_sett_security; } + +// Open downloads +RESOURCE TBUF r_wmlbrowser_settings_download_open { buf = qtn_browsers_sett_open_loading; } + +// IMEI +RESOURCE TBUF r_wmlbrowser_settings_imei { buf = qtn_wmls_local_set_imei_notif; } + +// Wallet +RESOURCE TBUF r_wmlbrowser_settings_ewallet_auto { buf = qtn_wmls_set_wallet_auto; } + +// Save Receipt +RESOURCE TBUF r_wmlbrowser_settings_save_receipt { buf = qtn_wmls_save_receipt; } + +// Default Encoding +RESOURCE TBUF r_wmlbrowser_settings_encoding { buf = qtn_brow_sett_defenc; } + +// Query Exit +RESOURCE TBUF r_wmlbrowser_settings_query_exit { buf = qtn_wml_setting_exit_confirm; } + +// Send Referrer header +RESOURCE TBUF r_wmlbrowser_settings_send_referrer { buf = qtn_wml_setting_referrer; } + +// Media Volume +RESOURCE TBUF r_wmlbrowser_settings_media_volume { buf = qtn_browsers_sett_media_volume; } + +// Homepage +RESOURCE TBUF r_wmlbrowser_settings_homepage { buf = qtn_browsers_sett_homepage; } + +// Startpage +RESOURCE TBUF r_wmlbrowser_settings_startpage { buf = qtn_browsers_sett_startpage; } + +// Enable Popup Blocking (Multiple Windows) +RESOURCE TBUF r_wmlbrowser_settings_popup_blocking { buf = qtn_brow_sett_pop_up_blocking; } + +// Enable Form Data Saving +RESOURCE TBUF r_wmlbrowser_settings_form_data_saving { buf = qtn_browsers_sett_form_data_saving; } + +// Automatic updating +RESOURCE TBUF r_wmlbrowser_settings_autoupdating { buf = qtn_browsers_sett_autoupdating; } + +// Automatic updating +RESOURCE TBUF r_wmlbrowser_settings_autoupdating_ap { buf = qtn_browsers_sett_autoupdating_ap; } + +// Automatic updating +RESOURCE TBUF r_wmlbrowser_settings_autoupdating_roaming { buf = qtn_browsers_sett_autoupdating_roaming; } + +RESOURCE TBUF r_wmlbrowser_settings_autoupdating_roaming_on { buf = qtn_browsers_sett_val_autoupdating_roaming_on; } +RESOURCE TBUF r_wmlbrowser_settings_autoupdating_roaming_off { buf = qtn_browsers_sett_val_autoupdating_roaming_off; } + + +// Automatic updating info note ( if AP = Always Ask and automatic updating is off.) +RESOURCE TBUF r_wmlbrowser_settings_dataquery_autoupdate_ap { buf = qtn_browsers_sett_dataquery_autoupdate_ap; } + +// Automatic updating info note ( phone bill will be increased ) +RESOURCE TBUF r_wmlbrowser_settings_dataquery_autoupdatewarn { buf = qtn_browsers_sett_dataquery_autoupdatewarn; } + +//---------------------------------------------------------------------------- +// +// Settings / Settings listbox content VALUES +// +//---------------------------------------------------------------------------- +// + +// Autoload Images and Objects +RESOURCE TBUF r_wmlbrowser_settings_ai_value_on { buf = qtn_wmls_local_var_image_on; } +RESOURCE TBUF r_wmlbrowser_settings_ai_value_off { buf = qtn_wmls_local_var_image_off; } + +// Autoload Content + +RESOURCE TBUF r_wmlbrowser_settings_autoload_text { buf = qtn_browser_sett_autoload_text; } +RESOURCE TBUF r_wmlbrowser_settings_autoload_images_no_flash { buf = qtn_browser_sett_autoload_images_no_flash; } +RESOURCE TBUF r_wmlbrowser_settings_autoload_all { buf = qtn_browser_sett_autoload_all; } + + + +// Expanded View (Text Wrapping) +RESOURCE TBUF r_wmlbrowser_settings_ev_value_on { buf = qtn_wmls_local_var_expand_on; } +RESOURCE TBUF r_wmlbrowser_settings_ev_value_off { buf = qtn_wmls_local_var_expand_off; } + +// Default Encoding +RESOURCE TBUF r_wmlbrowser_settings_encoding_gb2312 { buf = qtn_brow_sett_defenc_gb2312; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_1 { buf = qtn_brow_sett_defenc_latin1; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_big5 { buf = qtn_brow_sett_defenc_big5; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_utf8 { buf = qtn_brow_sett_defenc_utf8; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_2 { buf = qtn_brow_sett_charenc_iso_8859_2; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_4 { buf = qtn_brow_sett_charenc_iso_8859_4; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_5 { buf = qtn_brow_sett_charenc_iso_8859_5; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_7 { buf = qtn_brow_sett_charenc_iso_8859_7; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_9 { buf = qtn_brow_sett_charenc_iso_8859_9; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_6 { buf = qtn_wmls_sett_defenc_iso_88596; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_8 { buf = qtn_wmls_sett_defenc_iso_88598; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso8859_8i { buf = qtn_wmls_sett_defenc_iso_88598_i; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1256 { buf = qtn_wmls_sett_defenc_windows_1256; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1255 { buf = qtn_wmls_sett_defenc_windows_1255; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1250 { buf = qtn_wmls_sett_defenc_windows_1250; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1251 { buf = qtn_wmls_sett_defenc_windows_1251; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1253 { buf = qtn_wmls_sett_defenc_windows_1253; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1254 { buf = qtn_wmls_sett_defenc_windows_1254; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1257 { buf = qtn_wmls_sett_defenc_windows_1257; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_1258 { buf = qtn_wmls_sett_defenc_windows_1258; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_tis_620 { buf = qtn_wmls_sett_defenc_tis_620; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_windows_874 { buf = qtn_wmls_sett_defenc_windows_874;} +RESOURCE TBUF r_wmlbrowser_settings_encoding_shift_jis { buf = qtn_wmls_sett_defenc_shift_jis; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_euc_jp { buf = qtn_wmls_sett_defenc_euc_jp; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iso_2022_jp { buf = qtn_wmls_sett_defenc_iso_2022_jp; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_ucs_2 { buf = qtn_wmls_sett_defenc_ucs_2; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_koi8_r { buf = qtn_wmls_sett_defenc_shift_koi8_r; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_koi8_u { buf = qtn_wmls_sett_defenc_shift_koi8_u; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_iscii { buf = qtn_wmls_sett_defenc_iscii; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_euc_kr { buf = qtn_wmls_sett_defenc_euc_kr; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_ksc_5601 { buf = "Korean (Euc-Kr)"; } +RESOURCE TBUF r_wmlbrowser_settings_encoding_automatic { buf = qtn_wmls_sett_defenc_automatic; } + +// Media Volume +RESOURCE TBUF r_wmlbrowser_settings_media_volume_muted { buf = qtn_browsers_sett_volume_muted; } +RESOURCE TBUF r_wmlbrowser_settings_media_volume_1 { buf = qtn_browsers_sett_volume_1; } +RESOURCE TBUF r_wmlbrowser_settings_media_volume_2 { buf = qtn_browsers_sett_volume_2; } +RESOURCE TBUF r_wmlbrowser_settings_media_volume_3 { buf = qtn_browsers_sett_volume_3; } +RESOURCE TBUF r_wmlbrowser_settings_media_volume_4 { buf = qtn_browsers_sett_volume_4; } + +// Font Size +RESOURCE TBUF r_wmlbrowser_settings_fs_value_all_small { buf = qtn_xhtml_settings_all_small; } +RESOURCE TBUF r_wmlbrowser_settings_fs_value_smaller { buf = qtn_xhtml_settings_smaller; } +RESOURCE TBUF r_wmlbrowser_settings_fs_value_normal { buf = qtn_xhtml_settings_normal; } +RESOURCE TBUF r_wmlbrowser_settings_fs_value_larger { buf = qtn_xhtml_settings_larger; } +RESOURCE TBUF r_wmlbrowser_settings_fs_value_all_large { buf = qtn_xhtml_settings_all_large; } + +// Adaptive Bookmarks +RESOURCE TBUF r_wmlbrowser_settings_adaptive_bookmarks_value_on {buf =qtn_browsers_sett_adaptive_bookmarks_on;} +RESOURCE TBUF r_wmlbrowser_settings_adaptive_bookmarks_value_hide_folder {buf =qtn_browsers_sett_adaptive_bookmarks_hide_folder;} +RESOURCE TBUF r_wmlbrowser_settings_adaptive_bookmarks_value_off {buf =qtn_browsers_sett_adaptive_bookmarks_off;} + +// Full Screen +RESOURCE TBUF r_wmlbrowser_settings_fullscreen_value_normal { buf = qtn_browsers_sett_full_screen_normal; } +RESOURCE TBUF r_wmlbrowser_settings_fullscreen_value_softkeysonly { buf = qtn_browsers_sett_full_screen_normal; } +RESOURCE TBUF r_wmlbrowser_settings_fullscreen_value_fullscreen { buf = qtn_browsers_sett_full_screen_full_screen;} + +// Display Softkeys +RESOURCE TBUF r_wmlbrowser_settings_softkeys { buf = qtn_browsers_sett_softkeys; } +RESOURCE TBUF r_wmlbrowser_settings_softkeys_on { buf = qtn_browsers_sett_softkeys_on; } +RESOURCE TBUF r_wmlbrowser_settings_softkeys_off { buf = qtn_browsers_sett_softkeys_off; } + +// Cookies +RESOURCE TBUF r_wmlbrowser_settings_c_value_allow { buf = qtn_wmls_sett_cookie_allow; } +RESOURCE TBUF r_wmlbrowser_settings_c_value_reject { buf = qtn_wmls_sett_cookie_reject; } + +// ECMA +RESOURCE TBUF r_wmlbrowser_settings_ecma_value_enable { buf = qtn_browsers_sett_scripting_enable; } +RESOURCE TBUF r_wmlbrowser_settings_ecma_value_disable { buf = qtn_browsers_sett_scripting_disable; } + +// HTTP Security Warnings +RESOURCE TBUF r_wmlbrowser_settings_wrn_value_show { buf = qtn_browser_sett_item_show_all; } +RESOURCE TBUF r_wmlbrowser_settings_wrn_value_hide { buf = qtn_browser_sett_item_hide_all; } + +// Download Open Selection +RESOURCE TBUF r_wmlbrowser_settings_download_open_yes { buf = qtn_brow_sett_open_downloads_yes; } +RESOURCE TBUF r_wmlbrowser_settings_download_open_no { buf = qtn_brow_sett_open_downloads_no; } + +// IMEI +RESOURCE TBUF r_wmlbrowser_settings_imei_value_enabled { buf = qtn_wmls_local_set_imei_notif_enabled; } +RESOURCE TBUF r_wmlbrowser_settings_imei_value_disabled { buf = qtn_wmls_local_set_imei_notif_disabled; } + +// DTMF +RESOURCE TBUF r_wmlbrowser_settings_sdtmf_value_always_confirm { buf = qtn_wmls_wtai_dtmf_alcon; } +RESOURCE TBUF r_wmlbrowser_settings_sdtmf_value_confirm_once { buf = qtn_wmls_wtai_dtmf_one; } + +// Save Receipt +RESOURCE TBUF r_wmlbrowser_settings_sr_value_to_notepad { buf = qtn_wmls_save_to_notepad; } +RESOURCE TBUF r_wmlbrowser_settings_sr_value_never { buf = qtn_wmls_save_not; } + +// Wallet +RESOURCE TBUF r_wmlbrowser_settings_wallet_auto_on { buf = qtn_wmls_wall_auto_on; } +RESOURCE TBUF r_wmlbrowser_settings_wallet_auto_off { buf = qtn_wmls_wall_auto_off; } + +// Query Exit +RESOURCE TBUF r_wmlbrowser_settings_query_exit_on { buf = qtn_wml_setting_exit_on; } +RESOURCE TBUF r_wmlbrowser_settings_query_exit_off { buf = qtn_wml_setting_exit_off; } + +// Send Referrer header +RESOURCE TBUF r_wmlbrowser_settings_send_referrer_on { buf = qtn_wml_setting_refer_on; } +RESOURCE TBUF r_wmlbrowser_settings_send_referrer_off { buf = qtn_wml_setting_refer_off; } + +// Home Page +RESOURCE TBUF r_wmlbrowser_settings_homepage_access_point { buf = qtn_browsers_sett_ap_home_page; } +RESOURCE TBUF r_wmlbrowser_settings_homepage_new_address { buf = qtn_browsers_sett_own_home_page; } +RESOURCE TBUF r_wmlbrowser_settings_homepage_use_current { buf = qtn_browsers_sett_use_current_home_page; } +RESOURCE TBUF r_wmlbrowser_settings_homepage_bookmarks { buf = qtn_browsers_homepage_bookmarks; } + +// Search Page +RESOURCE TBUF r_wmlbrowser_settings_searchpage_new_address { buf = qtn_browsers_sett_search; } + +// Enable Popup Blocking (Multiple Windows) +RESOURCE TBUF r_wmlbrowser_settings_popup_blocking_on { buf = qtn_brow_sett_pop_up_blocking_on; } +RESOURCE TBUF r_wmlbrowser_settings_popup_blocking_off { buf = qtn_brow_sett_pop_up_blocking_off; } + +// Form Data Saving +RESOURCE TBUF r_wmlbrowser_settings_form_data_saving_on { buf = qtn_brow_sett_form_data_saving_on; } +RESOURCE TBUF r_wmlbrowser_settings_form_data_saving_off { buf = qtn_brow_sett_form_data_saving_off; } +RESOURCE TBUF r_wmlbrowser_settings_form_data_saving_only { buf = qtn_brow_sett_form_data_saving_only; } + +// Form Data Query text +RESOURCE TBUF r_wmlbrowser_settings_form_data_delete_all { buf = qtn_browser_form_data_delete_all; } +RESOURCE TBUF r_wmlbrowser_settings_form_data_delete_password { buf = qtn_browser_form_data_delete_password; } + +// SCRIPT LOG +RESOURCE TBUF r_wmlbrowser_settings_scriptlog { buf = qtn_browsers_sett_scriptlog; } +RESOURCE TBUF r_wmlbrowser_settings_scriptlog_value_disable { buf = qtn_browsers_sett_scriptlog_disable; } +RESOURCE TBUF r_wmlbrowser_settings_scriptlog_value_to_file { buf = qtn_browsers_sett_scriptlog_to_file; } +RESOURCE TBUF r_wmlbrowser_settings_scriptlog_value_to_console { buf = qtn_browsers_sett_scriptlog_to_console; } +RESOURCE TBUF r_wmlbrowser_settings_scriptlog_value_to_console_file { buf = qtn_browsers_sett_scriptlog_to_console_file; } + +// Toolbar buttons / Shortcut Keys Commands +// Settings Values +// please present these in this order! +RESOURCE TBUF r_browser_setting_none { buf = qtn_browser_setting_none; } +RESOURCE TBUF r_browser_setting_show_keymap { buf = qtn_browser_setting_show_keymap; } +RESOURCE TBUF r_browser_setting_go_to_web_address { buf = qtn_browser_setting_go_to_web_address; } +RESOURCE TBUF r_browser_setting_list_bookmarks { buf = qtn_browser_setting_list_bookmarks; } // toolbar only +RESOURCE TBUF r_browser_setting_save_as_bookmark { buf = qtn_browser_setting_save_as_bookmark; } +RESOURCE TBUF r_browser_setting_recent_urls { buf = qtn_browser_setting_recent_urls; } +RESOURCE TBUF r_browser_setting_find_keyword { buf = qtn_browser_setting_find_keyword; } +RESOURCE TBUF r_browser_setting_reload { buf = qtn_browser_setting_reload; } +RESOURCE TBUF r_browser_setting_miniature_show { buf = qtn_browser_setting_miniature_show; } +RESOURCE TBUF r_browser_setting_previous_page { buf = qtn_browser_setting_previous_page; } +RESOURCE TBUF r_browser_setting_go_to_hompage { buf = qtn_browser_setting_go_to_hompage; } +RESOURCE TBUF r_browser_setting_zoom_in { buf = qtn_browser_setting_zoom_in; } +RESOURCE TBUF r_browser_setting_zoom_out { buf = qtn_browser_setting_zoom_out; } +RESOURCE TBUF r_browser_setting_settings { buf = qtn_browser_setting_settings; } +RESOURCE TBUF r_browser_setting_rotate_screen { buf = qtn_browser_setting_rotate_screen; } +RESOURCE TBUF r_browser_setting_subscribe_to_feeds { buf = qtn_browser_setting_subscribe_to_feeds; } +RESOURCE TBUF r_browser_setting_manage_bookmarks { buf = qtn_browser_setting_manage_bookmarks; } +RESOURCE TBUF r_browser_setting_visual_history { buf = qtn_browser_setting_visual_history; } +RESOURCE TBUF r_browser_setting_view_images { buf = qtn_browser_setting_view_images; } +RESOURCE TBUF r_browser_setting_save_page { buf = qtn_browser_setting_save_page; } +RESOURCE TBUF r_browser_setting_send { buf = qtn_browser_setting_send; } +RESOURCE TBUF r_browser_setting_switch_window { buf = qtn_browser_setting_switch_window; } +RESOURCE TBUF r_browser_setting_show_toolbar { buf = qtn_browser_setting_show_toolbar; } // (keymap only) +RESOURCE TBUF r_browser_setting_show_help { buf = qtn_browser_setting_show_help; } +RESOURCE TBUF r_browser_setting_full_screen { buf = qtn_browser_setting_full_screen; } +RESOURCE TBUF r_browser_setting_zoom_mode { buf = qtn_browser_setting_zoom_mode; } + +// Settings Items for Toolbar Buttons +RESOURCE TBUF r_browser_setting_toolbar_button1 { buf = qtn_browser_setting_toolbar_button1; } +RESOURCE TBUF r_browser_setting_toolbar_button2 { buf = qtn_browser_setting_toolbar_button2; } +RESOURCE TBUF r_browser_setting_toolbar_button3 { buf = qtn_browser_setting_toolbar_button3; } +RESOURCE TBUF r_browser_setting_toolbar_button4 { buf = qtn_browser_setting_toolbar_button4; } +RESOURCE TBUF r_browser_setting_toolbar_button5 { buf = qtn_browser_setting_toolbar_button5; } +RESOURCE TBUF r_browser_setting_toolbar_button6 { buf = qtn_browser_setting_toolbar_button6; } +RESOURCE TBUF r_browser_setting_toolbar_button7 { buf = qtn_browser_setting_toolbar_button7; } + +// Error text when all toolbar buttons' command set to None +RESOURCE TBUF r_browser_setting_toolbar_save_dialog { buf = qtn_browser_setting_toolbar_save_dialog; } + +// Settings for enabling/disable toolbar in content view +RESOURCE TBUF r_browser_setting_toolbar_on_off { buf = qtn_browser_setting_toolbar_on_off; } +RESOURCE TBUF r_browser_setting_toolbar_on { buf = qtn_browser_setting_toolbar_on; } +RESOURCE TBUF r_browser_setting_toolbar_off { buf = qtn_browser_setting_toolbar_off; } + +// Settings Items for Shortcut Keys +RESOURCE TBUF r_browser_setting_shortcut_key1 { buf = qtn_browser_setting_shortcuts_key1; } +RESOURCE TBUF r_browser_setting_shortcut_key2 { buf = qtn_browser_setting_shortcuts_key2; } +RESOURCE TBUF r_browser_setting_shortcut_key3 { buf = qtn_browser_setting_shortcuts_key3; } +RESOURCE TBUF r_browser_setting_shortcut_key4 { buf = qtn_browser_setting_shortcuts_key4; } +RESOURCE TBUF r_browser_setting_shortcut_key5 { buf = qtn_browser_setting_shortcuts_key5; } +RESOURCE TBUF r_browser_setting_shortcut_key6 { buf = qtn_browser_setting_shortcuts_key6; } +RESOURCE TBUF r_browser_setting_shortcut_key7 { buf = qtn_browser_setting_shortcuts_key7; } +RESOURCE TBUF r_browser_setting_shortcut_key8 { buf = qtn_browser_setting_shortcuts_key8; } +RESOURCE TBUF r_browser_setting_shortcut_key9 { buf = qtn_browser_setting_shortcuts_key9; } +RESOURCE TBUF r_browser_setting_shortcut_key0 { buf = qtn_browser_setting_shortcuts_key0; } +RESOURCE TBUF r_browser_setting_shortcut_keystar { buf = qtn_browser_setting_shortcuts_starkey; } +RESOURCE TBUF r_browser_setting_shortcut_keyhash { buf = qtn_browser_setting_shortcuts_hashkey; } + + +// --------------------------------------------------------- +// +// +// Settings / Settings listbox content titles +// +// --------------------------------------------------------- +// + +// --------------------------------------------------------- +// +// +// Settings / Session titles +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_wml_session_view_title { buf=qtn_wmls_session_info; } +RESOURCE TBUF r_wml_session_view_ap { buf = qtn_wmls_ses_view_ap; } +RESOURCE TBUF r_wml_session_view_bt { buf = qtn_wmls_ses_view_bearer_type; } +RESOURCE TBUF r_wml_session_view_cs { buf = qtn_wmls_ses_view_max_speed; } + +// --------------------------------------------------------- +// +// +// Settings / Security titles +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_wml_security_view_title { buf=qtn_wmlsec_security_info; } +RESOURCE TBUF r_wml_certificate_details { buf = qtn_wmlsec_cert_details; } +RESOURCE TBUF r_wml_security_conn_type { buf = qtn_wmlsec_ses_info_contype; } +RESOURCE TBUF r_wml_security_server_aut { buf = qtn_wmlsec_ses_info_server; } +RESOURCE TBUF r_wml_security_info_issuer { buf = qtn_wmlsec_ses_info_issuer; } +RESOURCE TBUF r_wml_security_cert_owner { buf = qtn_wmlsec_ses_info_cert_owner; } +RESOURCE TBUF r_wml_security_valid_from { buf = qtn_wmlsec_ses_info_valid_from; } +RESOURCE TBUF r_wml_security_valid_to { buf = qtn_wmlsec_ses_info_valid_to; } +RESOURCE TBUF r_wml_security_fingerprint { buf = qtn_wmlsec_ses_info_fingerprint; } +RESOURCE TBUF r_wml_security_serialno { buf = qtn_wmlsec_ses_info_serialno; } + +// --------------------------------------------------------- +// +// +// Settings / Security info data texts +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_wml_security_conn_secure { buf=qtn_wmlsec_ses_info_con_secur; } +RESOURCE TBUF r_wml_security_conn_unsecure { buf=qtn_wmlsec_ses_info_con_unsec; } + +// --------------------------------------------------------- +// +// +// Settings / Session info data texts +// +// --------------------------------------------------------- +// + +RESOURCE TBUF r_wml_bearer_data_call { buf=qtn_set_bearer_data_call; } +RESOURCE TBUF r_wml_bearer_packet_data { buf=qtn_set_bearer_packet_data; } +RESOURCE TBUF r_wml_bearer_hscsd { buf=qtn_browser_set_bearer_hscsd; } + +RESOURCE TBUF r_wml_conn_speed_ad { buf=qtn_set_auto_detect; } + +// --------------------------------------------------------- +// +// +// Main title for Settings +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_wmlbrowser_settings_title { buf = qtn_wmls_browser_opt_sett; } + +RESOURCE TBUF r_wmlbrowser_settings_title_general { buf = qtn_browsers_title_general; } +RESOURCE TBUF r_wmlbrowser_settings_title_page { buf = qtn_browsers_title_page; } +RESOURCE TBUF r_wmlbrowser_settings_title_privacy { buf = qtn_browsers_title_privacy; } +RESOURCE TBUF r_wmlbrowser_settings_title_webfeeds { buf = qtn_browsers_fldr_feeds; } + +// --------------------------------------------------------- +// +// +// Value "None" for Default access point +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_wml_settings_default_access_point_none { buf = qtn_selec_sett_val_field_none; } + + +// --------------------------------------------------------- +// +// +// Settings / Page info texts +// +// --------------------------------------------------------- +// + +RESOURCE TBUF r_browser_query_current_page { buf = qtn_browser_query_current_page; } +RESOURCE TBUF r_browser_query_current_page_url { buf = qtn_browser_query_current_page_url; } + +// --------------------------------------------------------- +// +// +// Settings / Always ask/User defined for access point texts +// +// --------------------------------------------------------- +// + +RESOURCE TBUF r_wml_settings_access_point_user_defined { buf = qtn_wml_settings_access_point_user_defined; } +#if !defined(BRDO_BROWSER_50_FF) + RESOURCE TBUF r_wml_settings_access_point_always_ask { buf = qtn_wml_settings_access_point_always_ask; } +#else + RESOURCE TBUF r_wml_settings_access_point_ask_when_needed { buf = qtn_wml_settings_access_point_ask_when_needed; } +#endif // BRDO_BROWSER_50_FF + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserToolbar.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserToolbar.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* header file for browser toolbars' AVKON_BUTTON_STATE_EXTENSION +* +* +*/ + + +#ifndef BROWSERTOOLBAR_HRH +#define BROWSERTOOLBAR_HRH + +#include +#include + + +//---------------------------------------------------- +// +// Button state extensions for toolbar and toolbar extension buttons. +// These is required to support skinned graphics for the buttons. +// +//---------------------------------------------------- +// + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_blank + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbBlank; + //skin KAknsIIDQgnIndiBrowserTbBlank + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_bm + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbBm; + //skin KAknsIIDQgnIndiBrowserTbBm + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_feeds + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbFeeds; + //skin KAknsIIDQgnIndiBrowserTbFeeds + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_findkw + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbFindKw; + //skin KAknsIIDQgnIndiBrowserTbFindKw + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_goto + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbGoto; + //skin KAknsIIDQgnIndiBrowserTbGoto + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_help + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbHelp; + //skin KAknsIIDQgnIndiBrowserTbHelp + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_images + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbImages; + //skin KAknsIIDQgnIndiBrowserTbImages + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_keymap + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbKeyMap; + //skin KAknsIIDQgnIndiBrowserTbKeyMap + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_pages + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbPages; + //skin KAknsIIDQgnIndiBrowserTbPages + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_rotate + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbRotate; + //skin KAknsIIDQgnIndiBrowserTbRotate + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_rss + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbRss; + //skin KAknsIIDQgnIndiBrowserTbRss + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_savebm + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSaveBm; + //skin KAknsIIDQgnIndiBrowserTbSaveBm + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_savepage + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSavePage; + //skin KAknsIIDQgnIndiBrowserTbSavePage + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_sendurl + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSendUrl; + //skin KAknsIIDQgnIndiBrowserTbSendUrl + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_settings + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSettings; + //skin KAknsIIDQgnIndiBrowserTbSettings + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_switchwin + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSwitchWin; + //skin KAknsIIDQgnIndiBrowserTbSwitchWin + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_tb + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbTb; + //skin KAknsIIDQgnIndiBrowserTbTb + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_urls + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbUrls; + //skin KAknsIIDQgnIndiBrowserTbUrls + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_zoomin + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbZoomIn; + //skin KAknsIIDQgnIndiBrowserTbZoomIn + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_zoomout + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbZoomOut; + //skin KAknsIIDQgnIndiBrowserTbZoomOut + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_back + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbBack; + //skin KAknsIIDQgnIndiBrowserTbBack + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_forward + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbForward; + //skin KAknsIIDQgnIndiBrowserTbForward + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_forwardinact + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbForwardInact; + //skin KAknsIIDQgnIndiBrowserTbForwardInact + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_go + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbGo; + //skin KAknsIIDQgnIndiBrowserTbGo + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_home + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbHome; + //skin KAknsIIDQgnIndiBrowserTbHome + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_reload + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbReload; + //skin KAknsIIDQgnIndiBrowserTbReload + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_stop + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbStop; + //skin KAknsIIDQgnIndiBrowserTbStop + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_viewimages + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbViewImages; + //skin KAknsIIDQgnIndiBrowserTbViewImages + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_viewpages + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbViewPages; + //skin KAknsIIDQgnIndiBrowserTbViewPages + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_websearch + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbWebsearch; + //skin KAknsIIDQgnIndiBrowserTbWebsearch + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_findkw_next + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbFindKwNext; + //skin KAknsIIDQgnIndiBrowserTbFindKwNext + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_findkw_prev + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbFindKwPrev; + //skin KAknsIIDQgnIndiBrowserTbFindKwPrev + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_send_url + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSendUrl; + //skin KAknsIIDQgnIndiBrowserTbSendUrl + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_history_back + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbHistoryBack; + //skin KAknsIIDQgnIndiBrowserTbHistoryBack + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_history_fw + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbHistoryFw; + //skin KAknsIIDQgnIndiBrowserTbHistoryFw + } + +// BOOKMARKS + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_bm_tb_new + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserBmTbNew; + //skin KAknsIIDQgnIndiBrowserBmTbNew + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_delete + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbDelete; + //skin KAknsIIDQgnIndiBrowserTbDelete + } + +// FEEDS + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_toweb + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbBackToWeb; + //skin KAknsIIDQgnIndiBrowserFeedsTbBackToWeb + } +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_next + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbNext; + //skin KAknsIIDQgnIndiBrowserFeedsTbNext + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_opendetail + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbOpenDetail; + //skin KAknsIIDQgnIndiBrowserFeedsTbOpenDetail + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_openfull + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbOpenFull; + //skin KAknsIIDQgnIndiBrowserFeedsTbOpenFull + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_opentopic + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbOpenTopic; + //skin KAknsIIDQgnIndiBrowserFeedsTbOpenTopic + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_openprev + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbPrevious; + //skin KAknsIIDQgnIndiBrowserFeedsTbPrevious + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_update + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbUpdate; + //skin KAknsIIDQgnIndiBrowserFeedsTbUpdate + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_feeds_tb_updateall + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserFeedsTbUpdateAll; + //skin KAknsIIDQgnIndiBrowserFeedsTbUpdateAll + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_switch_win + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbSwitchWin; + //skin KAknsIIDQgnIndiBrowserTbSwitchWin + } + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_goto_and_search + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbGotoAndSearch; + //skin KAknsIIDQgnIndiBrowserTbGotoAndSearch + } +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_exit + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbExit; + //skin KAknsIIDQgnIndiBrowserTbGotoAndSearch + } +#endif +#ifdef BRDO_MULTITOUCH_ENABLED_FF + +RESOURCE AVKON_BUTTON_STATE_EXTENSION r_browser_ext_qgn_indi_browser_tb_downloads + { + bmbSkinIdMajor = EAknsMajorGeneric; + bmbSkinIdMinor = EAknsMinorGenericQgnIndiBrowserTbDownloads; + //skin KAknsIIDQgnIndiBrowserTbDownloads + } + +#endif +#endif // BROWSERTOOLBAR_HRH diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/BrowserWindowSelection.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/BrowserWindowSelection.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Browser Window Selection resources +* +* +*/ + + +#ifndef BROWSER_WINDOWSELECTION_RSSI +#define BROWSER_WINDOWSELECTION_RSSI + +// INCLUDES + +#include "Browser.hrh" +#include +#include +#include + +// RESOURCE DEFINITIONS + +//---------------------------------------------------- +// +// r_browserwindowselection_view +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_browserwindowselection_view + { + menubar = r_browserwindowselection_menubar_view; + cba = r_browserwindowselection_cba_options_close_select; + } + +//---------------------------------------------------- +// +// r_browserwindowselection_cba_options_exit +// +//---------------------------------------------------- +// +RESOURCE CBA r_browserwindowselection_cba_options_close_select + { + flags = EAknCBAFlagRespondWhenInvisible; + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EWmlCmdWindowSelectionCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id = EAknCmdOpen; txt = qtn_msk_select; } + }; + } + +//---------------------------------------------------- +// +// r_browserwindowselection_menubar_view +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_browserwindowselection_menubar_view + { + titles = + { + MENU_TITLE { menu_pane = r_browserwindowselection_view_menu; } + }; + } + +//---------------------------------------------------- +// +// r_browserwindowselection_view_menu +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_browserwindowselection_view_menu + { + items = + { + MENU_ITEM { command = EAknCmdOpen; txt = qtn_browser_list_select_window; }, + MENU_ITEM { command = EWmlCmdCloseWindow; txt = qtn_browser_list_close_window; }, + MENU_ITEM { command = EWmlCmdCloseAllWindowButThis; txt = qtn_browser_list_close_all_but_this; } + }; + } + +RESOURCE TBUF r_browser_windowselection_view_title { buf = qtn_browser_view_title_windowselection; } + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/Browser_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/Browser_caption.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This file contains all the resources for the module. + +* +*/ + + +// INCLUDES + +#include +#include + +//---------------------------------------------------- +// +// CAPTION_DATA +// ?description +// +//---------------------------------------------------- +// +RESOURCE CAPTION_DATA + { + caption = qtn_apps_browserng_list; + shortcaption = qtn_apps_browserng_grid; + } +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/Browser_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/Browser_reg.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RSS for registration file for DRMRightsManager. +* +*/ + + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile + +UID3 0x10008D39 + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "Browser"; + localisable_resource_file = APP_RESOURCE_DIR"\\Browser"; + localisable_resource_id = R_BROWSER_LOCALISABLE_APP_INFO; + embeddability = KAppEmbeddable; + newfile = KAppDoesNotSupportNewFile; + + // MIME types + datatype_list= + { + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/html"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlc"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/wml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/xhtml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.xhtml+xml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="text/vnd.wap.wml"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlscriptc"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wmlscript"; + }, + DATATYPE + { + priority=EDataTypePriorityHigh; + type="application/vnd.wap.wbxml"; + } + }; + + } + + + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/Feeds.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/Feeds.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defines the Feeds commands. +* +*/ + + + +#ifndef FEEDS_HRH +#define FEEDS_HRH + +// Feeds enumerate command codes +enum TFeedsCommandIds + { + // Softkeys + EFeedsSoftkeyOk = EWmlCmdFeedsViewCommandIdBase, + EFeedsSoftkeyCancel, + EFeedsSoftkeyBack, + + // Option menu commands + EFeedsOpen, + EFeedsActivate, + EFeedsSeeFullStory, + EFeedsUpdate, + EFeedsUpdateAll, + EFeedsBackToPage, + EFeedsWebMenu, + EFeedsManage, + EFeedsMarkUnMark, + EFeedsNavigation, + EFeedsTools, + EFeedsAdvanced, + EFeedsSend, + EFeedsInfo, + EFeedsSettings, + EFeedsBack, + + // NEW Option menu commands + EFeedsOptionsGoto, + EFeedsOptionsFeedsActions, + EFeedsOptionsEdit, + EFeedsOptionsMarkUnmark, + EFeedsOptionsClear, + EFeedsOptionsPreferences, + EFeedsOptionsExit, + + // Manage sub-menu commands + EFeedsMove, + EFeedsMoveToFolder, + EFeedsNewFolder, + EFeedsNewFeed, + EFeedsRename, + EFeedsEdit, + EFeedsDelete, + EFeedsImport, + EFeedsExport, + + // Navigation sub-menu commands + EFeedsGotoAddress, + EFeedsHome, + EFeedsSearch, + + // Tools sub-menu commands + EFeedsFindFeed, + EFeedsDownloads, + + // Advanced sub-menu commands + EFeedsChangeConnection, + EFeedsDisconnect, + + // Send sub-menu commands + + // Info sub-menu commands + EFeedsSession, + EFeedsAbout, + + // Debug sub-menu commands + EFeedsDebug, + EFeedsStartTestHarnessCanned, + EFeedsStartTestHarnessCannedShort, + EFeedsStartTestHarnessLive, + + // Feeds Item navigation commands + EFeedsShowNextItem, + EFeedsShowPrevItem + }; + + +enum TFeedsResourceIds + { + EFeedsWaitNoteDlgId = 1, + EFeedsProgressDlgId, + EFeedsEditFeedDialogId, + EFeedsEditDialogNameId, + EFeedsEditDialogUrlId, + EFeedsEditAutomaticUpdatingId + }; + +// Automatic updating +enum TFeedsAutomaticUpdating + { + EFeedsEditAutomaticUpdatingOff, + EFeedsEditAutomaticUpdating15min, + EFeedsEditAutomaticUpdatingHourly, + EFeedsEditAutomaticUpdating4hours, + EFeedsEditAutomaticUpdatingDaily, + EFeedsEditAutomaticUpdatingWeekly + }; + +// CRichTextEditor +#define KNumberOfLinesInRichTextEditor 7 + + +// CEditFeedDialog +#define KMaxFeedNameLength 50 +#define KMaxFeedUrlLength 1000 + +#endif // FEEDS_VIEW_MGR_HRH diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/Feeds.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/Feeds.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,777 @@ +/* +* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions +* +*/ + + +#ifndef FEEDS_RSSI +#define FEEDS_RSSI + +// INCLUDES + +#include + +#include "Browser.hrh" +#include "Feeds.hrh" +#include +#include "feeds_toolbar.rssi" + + +// ***************************************************************************** +// CFeedsFolderView + +// ----------------------------------------------------------------------------- +// +// r_feeds_folder_view +// Define view 1 +// +// ----------------------------------------------------------------------------- +// +RESOURCE CBA r_feeds_folder_view_cba_movetofolder_movecancel + { + buttons = + { + CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_fldr_move_item;}, + CBA_BUTTON {id = EAknSoftkeyCancel; txt = text_softkey_cancel;} + }; + } + + +RESOURCE CBA r_feeds_folder_view_cba_options_back_open + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, + CBA_BUTTON {id = EFeedsOpen; txt = qtn_msk_open;} + }; + } + +RESOURCE CBA r_feeds_folder_view_cba_options_back_addfeed + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, + CBA_BUTTON {id = EFeedsNewFeed; txt = qtn_msk_add;} + }; + } + +RESOURCE CBA r_feeds_folder_view_cba_options_back_context_menu + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, + CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } + +RESOURCE CBA r_feeds_folder_view_cba_options_exit_open + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EWmlCmdUserExit; txt = text_softkey_exit;}, + CBA_BUTTON {id = EFeedsOpen; txt = qtn_msk_open;} + }; + } + +RESOURCE CBA r_feeds_folder_view_cba_options_exit_addfeed + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyExit; txt = text_softkey_exit;}, + CBA_BUTTON {id = EFeedsNewFeed; txt = qtn_msk_add;} + }; + } + +RESOURCE CBA r_feeds_folder_view_cba_options_exit_context_menu + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON {id = EAknSoftkeyExit; txt = text_softkey_exit;}, + CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_feeds_folder_view +// Define view 1 +// +// ----------------------------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_feeds_folder_view + { + menubar = r_feeds_folder_view_menubar; + cba = r_feeds_folder_view_cba_options_back_addfeed; + toolbar = r_feeds_folder_view_toolbar; + } + + +// ----------------------------------------------------------------------------- +// +// r_feeds_folder_view_menubar +// Menu title definition +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_feeds_folder_view_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_feeds_folder_view_menu; + } + }; + } + + +RESOURCE MENU_BAR r_feeds_folder_menu_bar_context_menu + { + titles = + { + MENU_TITLE { menu_pane = r_feeds_folder_menu_pane_context_menu; } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_feeds_folder_view_menu +// Menu for "Options" +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_folder_view_menu + { + } + + + +// NEW OPTIONS MENU ITEMS + +// ----------------------------------------------------------------------------- +// +// r_feeds_options_goto_submenu +// Menu for Feeds' go to submenu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_options_goto_submenu {} + +// ----------------------------------------------------------------------------- +// +// r_feeds_options_feedsactions_submenu +// Menu for Feeds' feeds actions submenu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_options_feedsactions_submenu {} + +// ----------------------------------------------------------------------------- +// +// r_feeds_options_edit_submenu +// Menu for Feeds' edit submenu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_options_edit_submenu {} + +// ----------------------------------------------------------------------------- +// +// r_feeds_options_markunmark_submenu +// Menu for Feeds' markunmark submenu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_options_markunmark_submenu {} + +// ----------------------------------------------------------------------------- +// +// r_feeds_options_clear_submenu +// Menu for Feeds' clear submenu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_options_clear_submenu {} + +// ----------------------------------------------------------------------------- +// +// r_feeds_folder_view_manage_menu +// Manage sub-menu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_folder_view_manage_menu + { + } + + +// ----------------------------------------------------------------------------- +// +// r_feeds_folder_view_mark_unmark_menu +// Mark/Unmark sub-menu +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_folder_view_mark_unmark_menu + { + } + + +RESOURCE MENU_PANE r_feeds_folder_menu_pane_context_menu + { + items = + { + MENU_ITEM { command = EFeedsUpdate; txt = qtn_feeds_update; }, + MENU_ITEM { command = EFeedsUpdateAll; txt = qtn_feeds_update_all; }, + MENU_ITEM { command = EFeedsDelete; txt = qtn_fldr_delete; }, + MENU_ITEM { command = EFeedsMove; txt = qtn_options_org_move; }, + MENU_ITEM { command = EFeedsMoveToFolder; txt = qtn_options_org_move_to_folder; }, + MENU_ITEM { command = EFeedsExport; txt = qtn_options_export_feeds; }, + MENU_ITEM { cascade = r_feeds_folder_view_mark_unmark_menu; command = EWmlCmdMarkUnmark; txt = qtn_options_list; }, + MENU_ITEM { cascade = r_feeds_help_submenu; command = EWmlCmdHelpMenu; txt = qtn_browser_options_help; } + }; + } + +//---------------------------------------------------- +// +// r_feeds_help_submenu +// Cascading menu for help menu items +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_help_submenu + { + items = + { + MENU_ITEM { command = EAknCmdHelp; txt = qtn_browser_list_browser_help; }, + MENU_ITEM { command = EWmlCmdAboutProduct; txt=qtn_browser_list_browser_version;} + }; + } + +// ***************************************************************************** +// CFeedsTopicView +// ----------------------------------------------------------------------------- +// +// r_feeds_topic_view +// Define view 1 +// +// ----------------------------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_feeds_topic_view + { + menubar = r_feeds_topic_view_menubar; + cba = r_feeds_folder_view_cba_options_back_open; + toolbar = r_feeds_topic_view_toolbar; + } + + +// ----------------------------------------------------------------------------- +// +// r_feeds_topic_view_menubar +// Menu title definition +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_feeds_topic_view_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_feeds_topic_view_menu; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_feeds_topic_view_menu +// Menu for "Options" +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_topic_view_menu + { + } + + +// ***************************************************************************** +// CFeedsFeedView +// ----------------------------------------------------------------------------- +// +// r_feeds_feed_view +// Define view 1 +// +// ----------------------------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_feeds_feed_view + { + menubar = r_feeds_feed_view_menubar; + cba = r_feeds_softkeys_options_next_open; + toolbar = r_feeds_feed_view_toolbar; + } + + +// ----------------------------------------------------------------------------- +// +// r_feeds_feed_view_menubar +// Menu title definition +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_feeds_feed_view_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_feeds_feed_view_menu; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_feeds_feed_view_menu +// Menu for "Options" +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_feed_view_menu + { + } + + +RESOURCE CBA r_feeds_softkeys_options_next_open + { + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, + CBA_BUTTON {id=EFeedsSeeFullStory; txt = qtn_msk_open; } + }; + } + + +// ***************************************************************************** +// CFeedsWaitDialog +// ----------------------------------------------------------------------------- +// +// r_feeds_wait_note_dialog +// General wait-note dialog. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_feeds_wait_note_dialog + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = EFeedsWaitNoteDlgId; + control= AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_feeds_progress_note_dialog +// General progress-note dialog. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_feeds_progress_note_dialog + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EFeedsProgressDlgId; + control = AVKON_NOTE + { + layout = EProgressLayout; + }; + } + }; + } + + +// ***************************************************************************** +// CFeedsEditFeedDialog +// --------------------------------------------------------- +// r_feeds_edit_feed_dialog +// The edit feed dialog +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_feeds_edit_feed_dialog + { + flags = EEikDialogFlagNoDrag | + EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoTitleBar | + EEikDialogFlagWait | + EEikDialogFlagCbaButtons; + buttons = r_browser_cba_options_back_change; + form = r_feeds_edit_feed_form; + } + +//---------------------------------------------------- +// r_feeds_edit_autoupdate_information_note_dialog +// Note used alert the user while setting auto +// updating. +//---------------------------------------------------- +// +RESOURCE DIALOG r_feeds_edit_autoupdate_information_note_dialog + { + flags = EEikDialogFlagNoDrag | + EEikDialogFlagNoTitleBar | + EEikDialogFlagCbaButtons | + EEikDialogFlagWait; + buttons=R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVERELL_NOTE + { + layout = EGeneralLayout; + singular_label = ""; + plural_label = ""; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_feeds_edit_feed_form +// The form for the edit feed dialog. +// +// ----------------------------------------------------------------------------- +// +RESOURCE FORM r_feeds_edit_feed_form + { + flags = EEikFormEditModeOnly | EEikFormUseDoubleSpacedFormat; + items = + { + DLG_LINE + { + type = EEikCtEdwin; + prompt = qtn_feeds_name_dialog_text; + id = EFeedsEditDialogNameId; + control=EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = KMaxFeedNameLength; + maxlength = KMaxFeedNameLength; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = qtn_feeds_url_dialog_text; + id = EFeedsEditDialogUrlId; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + maxlength = KMaxFeedUrlLength; + max_view_height_in_lines = 6; + // if you have the line above, you must have this. + // It's calculable from LAF + base_line_delta = 21; + default_case = EAknEditorLowerCase; + allowed_case_modes = EAknEditorUpperCase | EAknEditorLowerCase; + numeric_keymap = EAknEditorPlainNumberModeKeymap; + allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; + default_input_mode = EAknEditorTextInputMode; + special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG; + }; + }, + DLG_LINE + { + type = EAknCtPopupField; + prompt = qtn_feeds_autoupdating_text; + id = EFeedsEditAutomaticUpdatingId; + itemflags = EEikDlgItemTakesEnterKey + | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD + { + }; + } + }; + } + + +// ***************************************************************************** +// CFeedsEditFolderDialog +// --------------------------------------------------------- +// r_feeds_edit_folder_dialog +// The edit folder dialog +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_feeds_edit_folder_dialog + { + flags = EEikDialogFlagNoDrag | + EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoTitleBar | + EEikDialogFlagWait | + EEikDialogFlagCbaButtons; + buttons = r_browser_cba_options_back_options; + form = r_feeds_edit_folder_form; + } + + +// ----------------------------------------------------------------------------- +// +// r_feeds_edit_folder_form +// The form for the edit folder dialog. +// +// ----------------------------------------------------------------------------- +// +RESOURCE FORM r_feeds_edit_folder_form + { + flags = EEikFormEditModeOnly | EEikFormUseDoubleSpacedFormat; + items = + { + DLG_LINE + { + type = EEikCtEdwin; + prompt = qtn_feeds_name_dialog_text; + id = EFeedsEditDialogNameId; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control=EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + width = KMaxFeedNameLength; + maxlength = KMaxFeedNameLength; + }; + } + }; + } + + +// ***************************************************************************** +// MiscDialogs::DeleteDialogL +// ----------------------------------------------------------------------------- +// +// r_feeds_delete_dialog +// General delete-note dialog. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_feeds_delete_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + + +// ***************************************************************************** +// Other menus + +// ----------------------------------------------------------------------------- +// +// r_feeds_help_exit_feed_menu +// Options menu for the edit/add feed/folder dialogs. +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_feeds_help_exit_feed_menu + { + items = + { + MENU_ITEM + { + cascade = r_feeds_help_submenu; + command = EWmlCmdHelpMenu; + txt = qtn_browser_options_help; + }, + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + +// ***************************************************************************** +// Icons +RESOURCE AKN_ICON_ARRAY_ARRAY r_feeds_icons + { + iconarrays = + { + AKN_ICON_ARRAY + { + bmpfile = "Z:"APP_RESOURCE_DIR"\\browser.mbm"; // bitmap file + icons = + { + AKN_ICON { iconId = EMbmBrowserQgn_prop_file_rss; maskId = EMbmBrowserQgn_prop_file_rss_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_folder_rss; maskId = EMbmBrowserQgn_prop_folder_rss_mask; }, + + AKN_ICON { iconId = EMbmBrowserQgn_prop_file_rss_unread; maskId = EMbmBrowserQgn_prop_file_rss_unread_mask; }, + AKN_ICON { iconId = EMbmBrowserQgn_prop_file_rss_read; maskId = EMbmBrowserQgn_prop_file_rss_read_mask; } + }; + } + }; + } + + +// ***************************************************************************** +// Resource based strings + +// new options menu +RESOURCE TBUF r_feeds_options_goto { buf = qtn_browser_options_goto; } +RESOURCE TBUF r_feeds_options_feedsactions { buf = qtn_browser_options_feedsactions; } +RESOURCE TBUF r_feeds_options_edit { buf = qtn_browser_options_edit; } +RESOURCE TBUF r_feeds_options_markunmark { buf = qtn_browser_options_markunmark; } +RESOURCE TBUF r_feeds_options_clear { buf = qtn_browser_options_clear; } +RESOURCE TBUF r_feeds_options_preferences { buf = qtn_wmls_browser_opt_sett; } +RESOURCE TBUF r_feeds_options_exit { buf = qtn_options_exit; } + +RESOURCE TBUF r_feeds_options_go_downloads { buf = qtn_browser_list_downloads; } + +// Menu strings +RESOURCE TBUF r_fldr_open { buf = qtn_fldr_open; } +RESOURCE TBUF r_feeds_update { buf = qtn_feeds_update; } +RESOURCE TBUF r_feeds_update_all { buf = qtn_feeds_update_all; } +RESOURCE TBUF r_feeds_manage { buf = qtn_feeds_manage; } + +RESOURCE TBUF r_options_list_mark_unmark { buf = qtn_options_list; } +RESOURCE TBUF r_options_list_mark_one { buf = qtn_options_list_mark_one; } +RESOURCE TBUF r_options_list_unmark_one { buf = qtn_options_list_unmark_one; } +RESOURCE TBUF r_options_list_mark_all { buf = qtn_options_list_mark_all; } +RESOURCE TBUF r_options_list_unmark_all { buf = qtn_options_list_unmark_all; } + +RESOURCE TBUF r_options_org_move { buf = qtn_options_org_move; } +RESOURCE TBUF r_options_org_move_to_folder { buf = qtn_options_org_move_to_folder; } +RESOURCE TBUF r_options_org_new_folder { buf = qtn_options_org_new_folder; } +RESOURCE TBUF r_feeds_edit { buf = qtn_feeds_edit; } +RESOURCE TBUF r_fldr_rename { buf = qtn_fldr_rename; } +RESOURCE TBUF r_feeds_new_feed { buf = qtn_feeds_new_feed; } +RESOURCE TBUF r_feeds_delete { buf = qtn_fldr_delete; } +RESOURCE TBUF r_options_import_feeds { buf = qtn_options_import_feeds; } +RESOURCE TBUF r_options_export_feeds { buf = qtn_options_export_feeds; } + + +RESOURCE TBUF r_feeds_open_full_story { buf = qtn_feeds_open_full_story; } + +// CFolderView +RESOURCE TBUF r_feeds_folder_view_title { buf = qtn_feeds_folder_view_title; } +RESOURCE TBUF r_feeds_no_feeds { buf = qtn_feeds_no_feeds; } +RESOURCE TBUF r_feeds_folder_view_move_to_prmpt { buf = qtn_fldr_move_to_prmpt; } +RESOURCE TBUF r_feeds_text_fldr_root_level { buf = qtn_fldr_root_level; } + + +// CFeedView +RESOURCE TBUF r_feeds_Enclosure { buf = qtn_feeds_feeds_view_enclosure; } + +// CWaitDialog +RESOURCE TBUF r_feeds_opening_folders { buf = qtn_feeds_updating_wait_dialog_text; } +RESOURCE TBUF r_feeds_opening_feed { buf = qtn_feeds_opening_wait_dialog_text; } +RESOURCE TBUF r_feeds_updating_all_wait_dialog { buf = qtn_feeds_updating_all_wait_dialog; } +RESOURCE TBUF r_feeds_updating_feed { buf = qtn_feeds_updating_wait_dialog_text; } + +// MiscDialogs +RESOURCE TBUF r_feeds_delete_feed { buf = qtn_feeds_delete_dialog_text; } +RESOURCE TBUF r_feeds_delete_multiple_feed { buf = qtn_feeds_delete_multiple_dialog_text; } +RESOURCE TBUF r_feeds_title_needed { buf = qtn_feeds_title_needed; } +RESOURCE TBUF r_feeds_address_needed { buf = qtn_feeds_address_needed; } +RESOURCE TBUF r_feeds_title_single_quote_not_allowed { buf = qtn_feeds_title_single_quote_not_allowed; } + +// Edit/Add Dialogs +RESOURCE TBUF r_feeds_new_feed_item { buf = qtn_feeds_new_feed_item; } +RESOURCE TBUF r_feeds_new_feed_url_item { buf = "http://"; } +RESOURCE TBUF r_feeds_new_folder_item { buf = qtn_fldr_name_default; } +RESOURCE TBUF r_feeds_autoupdating_feed { buf = qtn_feeds_autoupdating_text; } + +// Import/Export Dialogs +RESOURCE TBUF r_feeds_wait_searching_for_feeds { buf = qtn_wait_searching_for_feeds; } +RESOURCE TBUF r_feeds_popup_title_feeds_files_found { buf = qtn_popup_title_feeds_files_found; } +RESOURCE TBUF r_feeds_no_feeds_found_on_device { buf = qtn_feeds_no_feeds_found_on_device; } +RESOURCE TBUF r_feeds_wait_importing_feeds { buf = qtn_wait_importing_feeds; } +RESOURCE TBUF r_feeds_name_exported_file { buf = qtn_feeds_name_exported_file; } +RESOURCE TBUF r_feeds_export_opml_title_needed { buf = qtn_feeds_export_opml_tilte_needed; } +RESOURCE TBUF r_feeds_wait_processing { buf = qtn_wait_processing; } +RESOURCE TBUF r_feeds_query_import_now { buf = qtn_feeds_query_import_now; } +RESOURCE TBUF r_feeds_import_now_yes { buf = text_softkey_yes; } +RESOURCE TBUF r_feeds_import_now_no { buf = text_softkey_no; } + + +// Misc. Strings +RESOURCE TBUF r_feeds_unnamed_item { buf = qtn_feeds_unnamed_item; } +RESOURCE TBUF r_feeds_default_folder_path { buf = ""; } +RESOURCE TBUF r_feeds_default_folder_temp { buf = "\\private\\102072ef\\default_feeds_temp.xml"; } +RESOURCE TBUF r_feeds_default_folder_url { buf = "file://c:/private/102072ef/default_feeds.xml"; } +RESOURCE TBUF r_feeds_http_unsupported_winscw { buf = "Http based feeds aren't supported on the emulator"; } + +// Errors +RESOURCE TBUF r_feeds_out_of_memory { buf = qtn_err_eikon_mem; } +RESOURCE TBUF r_feeds_malformed_feed { buf = qtn_feeds_malformed_main_pane_text; } +RESOURCE TBUF r_feeds_malformed_feed_error { buf = qtn_feeds_malformed_dialog_text; } +RESOURCE TBUF r_feeds_unsupported_feed { buf = qtn_feeds_unsupported_main_pane_text; } +RESOURCE TBUF r_feeds_network_error { buf = qtn_feeds_network_error_main_pane_text; } +RESOURCE TBUF r_feeds_general_error { buf = qtn_feeds_general_error_dialog_text; } +RESOURCE TBUF r_feeds_general_error_main_pane { buf = qtn_feeds_general_error_main_pane_text; } +RESOURCE TBUF r_feeds_name_already_in_use { buf = qtn_feeds_duplicate_title_error_dialog_text; } +RESOURCE TBUF r_feeds_invalid_url { buf = qtn_feeds_invalid_url_main_pane_text; } +RESOURCE TBUF r_feeds_opening_wait { buf = qtn_feeds_opening_wait_dialog_text; } +RESOURCE TBUF r_feeds_file_not_found_error { buf = qtn_feeds_file_not_found_dialog_text; } + +// Automatic updating +RESOURCE TBUF r_feeds_autoupdating_feeds_off { buf = qtn_feeds_autoupdating_off; } +RESOURCE TBUF r_feeds_updating_interval_15min { buf = qtn_feeds_val_updating_interval_15min; } +RESOURCE TBUF r_feeds_updating_interval_hourly { buf = qtn_feeds_val_updating_interval_hourly; } +RESOURCE TBUF r_feeds_updating_interval_4hours { buf = qtn_feeds_val_updating_interval_4hours; } +RESOURCE TBUF r_feeds_updating_interval_daily { buf = qtn_feeds_val_updating_interval_daily; } +RESOURCE TBUF r_feeds_updating_interval_weekly { buf = qtn_feeds_val_updating_interval_weekly; } + +// Automatic updating info note ( phone bill will be increased ) +RESOURCE TBUF r_feeds_dataquery_autoupdatewarn { buf = qtn_feeds_new_feed_dataquery_autoupdatewarn; } +#endif +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/backup_registration.xml Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/bookmark_toolbar.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/bookmark_toolbar.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Resource file for the bookmark view's toolbar +* +* +*/ + + +#include + +#ifdef BRDO_AVKON_EXT_TB_FF + +// RESOURCE IDENTIFIER + +#include +#include "BrowserToolbar.hrh" + +// +// Bookmark View toolbar +// +// Common toolbar resource + +RESOURCE AVKON_TOOLBAR r_bookmark_view_toolbar + { + flags = KAknToolbarFixed | KAknToolbarWithoutCba; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdAddBookmark; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_add_bookmark_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_bm_tb_new; + bmpmask = EMbmBrowserQgn_indi_browser_bm_tb_new_mask; + extension = r_browser_ext_qgn_indi_browser_bm_tb_new; + } + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdGoToAddress; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_gotoaddress_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_goto; + bmpmask = EMbmBrowserQgn_indi_browser_tb_goto_mask; + extension = r_browser_ext_qgn_indi_browser_tb_goto; + } + }; + }; + }, + + TBAR_CTRL //Search Goto + { + type = EAknCtButton; + id = EWmlCmdGoToAddressAndSearch; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_is_tooltip_goto_search; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_goto_and_search; + bmpmask = EMbmBrowserQgn_indi_browser_tb_goto_and_search_mask; + extension = r_browser_ext_qgn_indi_browser_tb_goto_and_search; + } + }; + }; + }, +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdPreferences; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_setting_settings; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_settings; + bmpmask = EMbmBrowserQgn_indi_browser_tb_settings_mask; + extension = r_browser_ext_qgn_indi_browser_tb_settings; + } + }; + }; + } +#else + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdDelete; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_del_bookmark_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_delete; + bmpmask = EMbmBrowserQgn_indi_browser_tb_delete_mask; + extension = r_browser_ext_qgn_indi_browser_tb_delete; + } + }; + }; + } + #endif + }; + } + +#else +// +// Bookmark View toolbar +// +// Common toolbar resource + +RESOURCE AVKON_TOOLBAR r_bookmark_view_toolbar + { + } + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/browser_menu.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/browser_menu.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: resource for aiw ecom +* +*/ + +// RESOURCE IDENTIFIER + +//---------------------------------------------------- +// +// Empty space stylus popup menu. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_empty_space_stylus_popup_menu + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_wmlbm_fav_saveas_bm; command = EWmlCmdSaveAsBookmark; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_wml_list_save_pgs; command = EWmlCmdSavePage; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_list_miniature_show_mini; command = EWmlCmdShowMiniature; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_wml_list_reload; command = EWmlCmdReload; } + }; + } + +//---------------------------------------------------- +// +// Anchor stylus popup menu. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_anchor_stylus_popup_menu + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_wmlbm_fav_saveas_bm; command = EWmlCmdSaveUrlAsBookmark; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_list_show_address; command = EWmlCmdShowAnchorHref; } + }; + } + +//---------------------------------------------------- +// +// Image stylus popup menu. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_image_stylus_popup_menu + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_save_image_to_gallery; command = EWmlCmdSaveToGallery; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_list_open_to_viewer; command = EWmlCmdOpenToViewer; } + }; + } + +//---------------------------------------------------- +// +// Imagemap stylus popup menu. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_imagemap_stylus_popup_menu + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_wmlbm_fav_saveas_bm; command = EWmlCmdSaveUrlAsBookmark; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_list_show_address; command = EWmlCmdShowAnchorHref; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_save_image_to_gallery; command = EWmlCmdSaveToGallery; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_list_open_to_viewer; command = EWmlCmdOpenToViewer; } + }; + } + +//---------------------------------------------------- +// +// Image placeholder stylus popup menu, no Flash. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_image_placeholder_stylus_popup_menu_no_flash + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_load_image; command = EWmlCmdLoadFocusedImage; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_load_all_images; command = EWmlCmdLoadImages; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_enable_autoload_images; command = EWmlCmdLoadImagesOnly; } + }; + } + +//---------------------------------------------------- +// +// Image placeholder stylus popup menu, with Flash +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_image_placeholder_stylus_popup_menu_with_flash + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_load_image; command = EWmlCmdLoadFocusedImage; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_load_all_images; command = EWmlCmdLoadImages; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_enable_autoload_images; command = EWmlCmdLoadImagesOnly; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_enable_autoload_all; command = EWmlCmdLoadImagesAndFlash; } + }; + } + +//---------------------------------------------------- +// +// Phone number stylus popup menu. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_phone_number_stylus_popup_menu + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_options_call; command = EWmlCmdSmartLinkMakeCall; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_create_sms; command = EWmlCmdSmartLinkSendSms; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_options_contacts; command = EWmlCmdSmartLinkAddToContacts; } + }; + } + +//---------------------------------------------------- +// +// E-mail address stylus popup menu. +//---------------------------------------------------- +// +RESOURCE STYLUS_POPUP_MENU r_browser_email_address_stylus_popup_menu + { + items = + { + STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_create_email; command = EWmlCmdSmartLinkSendEmail; }, + STYLUS_POPUP_MENU_ITEM { txt = qtn_options_contacts; command = EWmlCmdSmartLinkAddToContacts; } + }; + } + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/browser_toolbar.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/browser_toolbar.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,580 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Resource file for the content view's toolbar +* +* +*/ + + +#include + +#ifdef BRDO_AVKON_EXT_TB_FF + +// RESOURCE IDENTIFIER + +#include +#include "BrowserToolbar.hrh" + +// Common toolbar resource +RESOURCE AVKON_TOOLBAR r_content_view_toolbar + { + flags = KAknToolbarFixed | KAknToolbarWithoutCba; + items = + { + TBAR_CTRL + { + type=EAknCtToolbarExtension; + id= EWmlCmdToolbarExtensionContentView; + + control = AVKON_TOOLBAR_EXTENSION + { + helptxt = qtn_browser_ext_tb_tt; + items = + { +#ifndef BRDO_SINGLE_CLICK_ENABLED_FF + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdFavourites; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_bm; + helptxt = qtn_browser_ext_tb_bm_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_bm; + bmpmask = EMbmBrowserQgn_indi_browser_tb_bm_mask; + extension = r_browser_ext_qgn_indi_browser_tb_bm; + } + }; + }; + }, +#endif + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdLaunchHomePage; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_home; + helptxt = qtn_browser_ext_tb_home_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_home; + bmpmask = EMbmBrowserQgn_indi_browser_tb_home_mask; + extension = r_browser_ext_qgn_indi_browser_tb_home; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdSaveAsBookmark; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_save_bookmark; + helptxt = qtn_browser_ext_tb_save_bookmark_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_save_bm; + bmpmask = EMbmBrowserQgn_indi_browser_tb_save_bm_mask; + extension = r_browser_ext_qgn_indi_browser_tb_savebm; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdFindKeyword; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_find_keyword; + helptxt = qtn_browser_ext_tb_find_keyword_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_find_kw; + bmpmask = EMbmBrowserQgn_indi_browser_tb_find_kw_mask; + extension = r_browser_ext_qgn_indi_browser_tb_findkw; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdReload; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_reload; + helptxt = qtn_browser_ext_tb_reload_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_reload; + bmpmask = EMbmBrowserQgn_indi_browser_tb_reload_mask; + extension = r_browser_ext_qgn_indi_browser_tb_reload; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EAknCmdHelp; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_help; + helptxt = qtn_browser_ext_tb_help_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_help; + bmpmask = EMbmBrowserQgn_indi_browser_tb_help_mask; + extension = r_browser_ext_qgn_indi_browser_tb_help; + } + }; + }; + }, +#ifndef BRDO_MULTITOUCH_ENABLED_FF + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdShowMiniature; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_miniature_show; + helptxt = qtn_browser_ext_tb_miniature_show_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_page; + bmpmask = EMbmBrowserQgn_indi_browser_tb_page_mask; + extension = r_browser_ext_qgn_indi_browser_tb_pages; + } + }; + }; + }, +#else + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdDownloads; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_list_downloads; + helptxt = qtn_browser_list_downloads; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_downloads; + bmpmask = EMbmBrowserQgn_indi_browser_tb_downloads_mask; + extension = r_browser_ext_qgn_indi_browser_tb_downloads; + } + }; + }; + }, +#endif + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdPreferences; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_settings; + helptxt = qtn_browser_ext_tb_settings_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_settings; + bmpmask = EMbmBrowserQgn_indi_browser_tb_settings_mask; + extension = r_browser_ext_qgn_indi_browser_tb_settings; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdOpenFeedsFolder; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_view_feeds; + helptxt = qtn_browser_ext_tb_view_feeds_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_feeds; + bmpmask = EMbmBrowserQgn_indi_browser_tb_feeds_mask; + extension = r_browser_ext_qgn_indi_browser_tb_feeds; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdShowSubscribeList; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_subscribe_list; + helptxt = qtn_browser_ext_tb_subscribe_list_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_rss; + bmpmask = EMbmBrowserQgn_indi_browser_tb_rss_mask; + extension = r_browser_ext_qgn_indi_browser_tb_rss; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdSwitchWindow; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_switch_win; + helptxt = qtn_browser_ext_tb_switch_win_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_switch_win; + bmpmask = EMbmBrowserQgn_indi_browser_tb_switch_win_mask; + extension = r_browser_ext_qgn_indi_browser_tb_switch_win; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdSendAddressViaUnifiedMessage; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_browser_ext_tb_send_url; + helptxt = qtn_browser_ext_tb_send_url_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_send_url; + bmpmask = EMbmBrowserQgn_indi_browser_tb_send_url_mask; + extension = r_browser_ext_qgn_indi_browser_tb_send_url; + } + }; + }; + #ifndef BRDO_SINGLE_CLICK_ENABLED_FF + } + #else + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdUserExit; + + control = AVKON_BUTTON + { + flags = KAknButtonRequestExitOnButtonUpEvent; + states = + { + AVKON_BUTTON_STATE + { + txt = qtn_options_exit; //qtn_browser_list_close_window; + helptxt = qtn_options_exit; //qtn_browser_list_close_window; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_exit; + bmpmask = EMbmBrowserQgn_indi_browser_tb_exit_mask; + extension = r_browser_ext_qgn_indi_browser_tb_exit; + } + }; + }; + } + #endif + + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdGoToAddress; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_gotoaddress_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_goto; + bmpmask = EMbmBrowserQgn_indi_browser_tb_goto_mask; + extension = r_browser_ext_qgn_indi_browser_tb_goto; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdGoToAddressAndSearch; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_is_tooltip_goto_search; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_goto_and_search; + bmpmask = EMbmBrowserQgn_indi_browser_tb_goto_and_search_mask; + extension = r_browser_ext_qgn_indi_browser_tb_goto_and_search; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdHistoryBack; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_history_back_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_history_back; + bmpmask = EMbmBrowserQgn_indi_browser_tb_history_back_mask; + extension = r_browser_ext_qgn_indi_browser_tb_history_back; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdFindPrevious; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_findprevious_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_find_kw_prev; + bmpmask = EMbmBrowserQgn_indi_browser_tb_find_kw_prev_mask; + extension = r_browser_ext_qgn_indi_browser_tb_findkw_prev; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlNoCmd; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = ""; + // bmpfile = ; + // bmpid = ; + // bmpmask = ; + extension = r_browser_ext_qgn_indi_browser_tb_blank; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdFindNext; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_findnext_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_find_kw_next; + bmpmask = EMbmBrowserQgn_indi_browser_tb_find_kw_next_mask; + extension = r_browser_ext_qgn_indi_browser_tb_findkw_next; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdHistoryForward; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_history_forward_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_history_fw; + bmpmask = EMbmBrowserQgn_indi_browser_tb_history_fw_mask; + extension = r_browser_ext_qgn_indi_browser_tb_history_fw; + } + }; + }; + }, + +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdFavourites; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; + helptxt = qtn_browser_ext_tb_bm_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_bm; + bmpmask = EMbmBrowserQgn_indi_browser_tb_bm_mask; + extension = r_browser_ext_qgn_indi_browser_tb_bm; + } + }; + }; + } +#else + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdZoomSliderShow; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_tb_zoomshow_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_zoom_in; + bmpmask = EMbmBrowserQgn_indi_browser_tb_zoom_in_mask; + extension = r_browser_ext_qgn_indi_browser_tb_zoomin; + } + }; + }; + } +#endif + }; + } + +#else + +// Common toolbar resource +RESOURCE AVKON_TOOLBAR r_content_view_toolbar + { + } + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/feeds_toolbar.rssi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/feeds_toolbar.rssi Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,350 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Resource file for the content view's toolbar +* +* +*/ + + +#include + +#ifdef BRDO_AVKON_EXT_TB_FF + +// RESOURCE IDENTIFIER + +#include +#include "BrowserToolbar.hrh" + +// +// Feeds Views toolbars +// +// Common toolbar resource + +RESOURCE AVKON_TOOLBAR r_feeds_folder_view_toolbar + { + flags = KAknToolbarFixed | KAknToolbarWithoutCba; + items = + { +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsNewFeed; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_new_feed; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_prop_file_rss_new; + bmpmask = EMbmBrowserQgn_prop_file_rss_new_mask; + extension = r_browser_ext_qgn_indi_browser_tb_feeds; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsUpdateAll; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_folder_update_all_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_update_all; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_update_all_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_updateall; + } + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EWmlCmdPreferences; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_browser_setting_settings; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_tb_settings; + bmpmask = EMbmBrowserQgn_indi_browser_tb_settings_mask; + extension = r_browser_ext_qgn_indi_browser_tb_settings; + } + }; + }; + } +#else + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsUpdate; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_folder_update_selected_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_update; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_update_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_update; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsUpdateAll; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_folder_update_all_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_update_all; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_update_all_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_updateall; + } + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsOpen; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_folder_open_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_open_topic; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_open_topic_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_opentopic; + } + }; + }; + } +#endif + }; + } + +RESOURCE AVKON_TOOLBAR r_feeds_topic_view_toolbar + { + flags = KAknToolbarFixed | KAknToolbarWithoutCba; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsUpdate; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_topic_update_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_update; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_update_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_update; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsBackToPage; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_topic_back_to_page_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_back_to_web; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_back_to_web_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_toweb; + } + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsOpen; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_topic_open_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_open_detail; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_open_detail_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_opendetail; + } + }; + }; + } + }; + } + + +RESOURCE AVKON_TOOLBAR r_feeds_feed_view_toolbar + { + flags = KAknToolbarFixed | KAknToolbarWithoutCba; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsShowPrevItem; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_feed_previous_article_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_previous; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_previous_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_openprev; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsSeeFullStory; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_feed_show_full_story_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_open_full; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_open_full_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_openfull; + } + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EFeedsShowNextItem; + + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + txt = ""; //Icon should always be visible instead of this + helptxt = qtn_feeds_feed_next_article_tt; + bmpfile = "\\Resource\\apps\\browser.mif"; + bmpid = EMbmBrowserQgn_indi_browser_feeds_tb_next; + bmpmask = EMbmBrowserQgn_indi_browser_feeds_tb_next_mask; + extension = r_browser_ext_qgn_indi_browser_feeds_tb_next; + } + }; + }; + } + }; + } +#else + +// +// Feeds Views toolbars +// +// Common toolbar resource + +RESOURCE AVKON_TOOLBAR r_feeds_folder_view_toolbar + { + } + +RESOURCE AVKON_TOOLBAR r_feeds_topic_view_toolbar + { + } + +RESOURCE AVKON_TOOLBAR r_feeds_feed_view_toolbar + { + } + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/SrcData/feeds_view_template.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/SrcData/feeds_view_template.html Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,45 @@ + + + + + + + +#Title# + + + + + + + +
#Date#
#Description#
#Enclosure#
+ + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/cenrep/keys_browserui.xls Binary file browserui/browser/cenrep/keys_browserui.xls has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/Feeds.confml Binary file browserui/browser/conf/Feeds.confml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/Feeds_OPML.gcfml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/conf/Feeds_OPML.gcfml Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,26 @@ + + + + + + + + + <xsl:value-of select="Header/Title"/> + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/bookmarkitems.gcfml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/conf/bookmarkitems.gcfml Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,11 @@ + + + + + + + ,,,,,,,,,,, + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/browserbookmarks.confml Binary file browserui/browser/conf/browserbookmarks.confml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/browserui.confml Binary file browserui/browser/conf/browserui.confml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/browserui_10008D39.crml Binary file browserui/browser/conf/browserui_10008D39.crml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/conf/browserui_101F861B.crml Binary file browserui/browser/conf/browserui_101F861B.crml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_bm_tb_new.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_bm_tb_new.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_back_to_web.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_back_to_web.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_next.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_next.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_open_detail.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_open_detail.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_open_full.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_open_full.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_open_topic.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_open_topic.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_previous.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_previous.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_update.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_update.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_feeds_tb_update_all.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_feeds_tb_update_all.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_delete.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_delete.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_exit.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_exit.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_find_kw_next.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_find_kw_next.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_find_kw_prev.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_find_kw_prev.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_history_back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_history_back.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_history_fw.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_history_fw.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_view_images.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_view_images.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_browser_tb_view_pages.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_browser_tb_view_pages.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_indi_button_exit_fs.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_indi_button_exit_fs.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,6 @@ + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_prop_file_rss_error.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_prop_file_rss_error.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/data/qgn_prop_folder_rss_error.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/data/qgn_prop_folder_rss_error.svg Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/help/data/xhtml.zip Binary file browserui/browser/help/data/xhtml.zip has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/help/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* Export help related files. +* +*/ + +#include +#include "../../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +#if !defined(__PLATFORM_VERSION_32__) && !defined(__PLATFORM_VERSION_5250__) && !defined(__PLATFORM_VERSION_S60_50__) + +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/browser.hlp.hrh APP_LAYER_PLATFORM_EXPORT_PATH(csxhelp/browser.hlp.hrh) +../rom/browseruihelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(browseruihelps_variant.iby) + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/help/inc/browser.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/help/inc/browser.hlp.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// +// browser.hlp.hrh generated by CSXHelp Utilities. +// + +#ifndef __BROWSER_HLP_HRH__ +#define __BROWSER_HLP_HRH__ + +_LIT(KOSS_HLP_BM_ADDBM, "OSS_HLP_BM_ADDBM"); // +_LIT(KOSS_HLP_RSS_ADD, "OSS_HLP_RSS_ADD"); // +_LIT(KOSS_HLP_PAGEVIEW, "OSS_HLP_PAGEVIEW"); // +_LIT(KOSS_HLP_BM_MAIN, "OSS_HLP_BM_MAIN"); // +_LIT(KOSS_HLP_BM_EDIT, "OSS_HLP_BM_EDIT"); // +_LIT(KOSS_HLP_RSS_EDIT, "OSS_HLP_RSS_EDIT"); // +_LIT(KOSS_HLP_SETTINGS_GENERAL, "OSS_HLP_SETTINGS_GENERAL"); // +_LIT(KOSS_HLP_SETTINGS_PAGE, "OSS_HLP_SETTINGS_PAGE"); // +_LIT(KOSS_HLP_SETTINGS_PRIVACY, "OSS_HLP_SETTINGS_PRIVACY"); // +_LIT(KOSS_HLP_RSS_ARTICLE, "OSS_HLP_RSS_ARTICLE"); // +_LIT(KOSS_HLP_SETTINGS_RSS, "OSS_HLP_SETTINGS_RSS"); // +_LIT(KOSS_HLP_RSS_ARTICLELST, "OSS_HLP_RSS_ARTICLELST"); // +_LIT(KOSS_HLP_PAGEVIEW_EMBED, "OSS_HLP_PAGEVIEW_EMBED"); // +_LIT(KOSS_HLP_SETTINGS_FOLDERS, "OSS_HLP_SETTINGS_FOLDERS"); // +_LIT(KOSS_HLP_RSS_MAIN, "OSS_HLP_RSS_MAIN"); // +_LIT(KOSS_HLP_SHORTCUTS, "OSS_HLP_SHORTCUTS"); // +_LIT(KOSS_HLP_KEYPAD, "OSS_HLP_KEYPAD"); // + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/help/rom/browseruihelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/help/rom/browseruihelps_variant.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for Browser Help +* +*/ + +#ifndef __BROWSERUIHELPS_VARIANT_IBY__ +#define __BROWSERUIHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) /* && defined(__BROWSERUI_USED) */ + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008d39\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10008d39\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008d39\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008d39\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008d39\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008d39\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008d39\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008d39\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/loc/BrowserHp.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/loc/BrowserHp.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +//d: Local home page title +//l: none +//w: +//r: 3.1 +#define qtn_lhp_title "Web Browser for S60" + + + +//d: Local home search web +//l: none +//w: +//r: 3.1 +#define qtn_lhp_search_web "Web" + +//d: Local home search images +//l: none +//w: +//r: 3.1 +#define qtn_lhp_search_images "Images" + + + + +//d: Local home my top links +//l: none +//w: +//r: 3.1 +#define qtn_lhp_my_top "My Top Links" + + +//d: Local home Shortcut Keys +//l: none +//w: +//r: 3.1 +#define qtn_lhp_shortcut_keys "Shortcut Keys" + + +//d: Local home alt text selection key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_selection_key "Selection key" + + +//d: Local home selection key label +//l: none +//w: +//r: 3.1 +#define qtn_lhp_selection_key_label "Open link, or start entering text in a form input field" + + +//d: Local home label c key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_c_key_label "If more than one window is open, closes the current window" + + + +//d: Local home label 1 key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_1_key_label "Show bookmarks" + + +//d: Local home label 2 key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_2_key_label "Text search in current page" + + + +//d: Local home label 3 key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_3_key_label "Back one page" + + +//d: Local home label 5 key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_5_key_label "List windows" + + +//d: Local home label 8 key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_8_key_label "Show Page Overview" + + + +//d: Local home label 9 key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_9_key_label "Go to address" + + + +//d: Local home label star key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_star_key_label "Zoom images out" + +//d: Local home label hash key +//l: none +//w: +//r: 3.1 +#define qtn_lhp_hash_key_label "Zoom images in" + +//d: Local home shortcut keys note +//l: none +//w: +//r: 3.1 +#define qtn_lhp_note "Note" + +//d: Local home shortcut keys unavailable +//l: none +//w: +//r: 3.1 +#define qtn_lhp_shortcut_unavailable "Shortcut keys not available while entering text" + +//d: Local home browser forum title +//l: none +//w: +//r: 3.1 +#define qtn_lhp_browser_forum "Browser Forum" + +//d: Local home join discussion label 1 +//l: none +//w: +//r: 3.1 +#define qtn_lhp_join_discussion_1 "Join the discussion at" + +//d: Local home join discussion label 2 +//l: none +//w: +//r: 3.1 +#define qtn_lhp_join_discussion_2 "the S60 user community forum!" + +//d: Local home unused key label +//l: none +//w: +//r: 3.1 +#define qtn_lhp_unused_key_label "Not used" + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/loc/Feeds.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/loc/Feeds.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,552 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Localized strings. +* +*/ + + +// APPLICATION INFORMATION + +/* Application related */ +/* -------------------------------------------------------------------- */ +//d:application name +//l:list_single_large_graphic_pane_t1 +//w: +//r:3.0 +#define qtn_apps_feeds_list "Web Feeds" +//d:application name +//l:cell_app_pane_t1 +//w: +//r:3.0 +#define qtn_apps_feeds_grid "Web Feeds" + + +/* Options Menu */ +/* -------------------------------------------------------------------- */ +//d: Menu text to update the selected feed. +//l:list_single_pane_t1_cp2 +//w: +//r:3.0 +#define qtn_feeds_update "Update" + +//d: Menu text to update all feed. +//l:list_single_pane_t1_cp2 +//w: +//r:3.0 +#define qtn_feeds_update_all "Update All" + +//d: Menu text for the manage sub-menu +//l:list_single_pane_t1_cp2/opt3 +//w: +//r:3.0 +#define qtn_feeds_manage "Manage" + +//d: Menu text to open the associated web page in the browser. +//l:list_single_pane_t1_cp2 +//w: +//r:3.0 +#define qtn_feeds_open_full_story "Open Full Story" + + +/* Manage Sub-Menu */ +/* -------------------------------------------------------------------- */ +//d: Menu text to create a new feed. +//l:list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_new_feed "Add feed" + +//d: Menu text to edit the current feed. +//l:list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_edit "Edit feed" + +/* Info Sub-Menu */ +/* -------------------------------------------------------------------- */ +//d: Menu text to view the about info. +//l:list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_about "About" + + +/* Folder View */ +/* -------------------------------------------------------------------- */ +//d: The title of the folder-view when the top-level folder is showing. +//l:title_pane_t2/opt9 +//w: +//r:3.0 +#define qtn_feeds_folder_view_title "Web Feeds" + +/* -------------------------------------------------------------------- */ +//d: The text displayed in the folder view when there are no feeds or folders. +//l:main_list_empty_pane +//w: +//r:3.1 +#define qtn_feeds_no_feeds "No Web Feeds" + +/* Feeds View */ +/* -------------------------------------------------------------------- */ +//d: The text string at the end of a feed that's associated with the +//d: item's full story -- the browser is launched when this text is selected. +//l:None +//w: +//r:3.0 +#define qtn_feeds_feeds_view_see_full_story "See full story" + +/* -------------------------------------------------------------------- */ +//d: The default title of enclosures. The title is used to display the +//d: the enclosure in content area of the Feeds View. +//l:None +//w: +//r:3.1 +#define qtn_feeds_feeds_view_enclosure "Podcast" + + +// ----------------------------------------------------------------- +// Touch Toolbar Button strings +// ----------------------------------------------------------------- + +//--------------------------------- +// Feeds Folder View Toolbar Strings +//--------------------------------- +// Update Selected Feed +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_folder_update_selected_tt "Update Selected Feed" + +// Update All Feed +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_folder_update_all_tt "Update All Feeds" + +// Open into article listing view +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_folder_open_tt "Open into article listing view" + + +//--------------------------------- +// Feeds Topic View Toolbar Strings +//--------------------------------- +// Update Feed +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_topic_update_tt "Update Feed" + +// Back to Page +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_topic_back_to_page_tt "Back to Page" + +// Open into detail view +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_topic_open_tt "Open into detail view" + +//--------------------------------- +// Feeds Feed View Toolbar Strings +//--------------------------------- +// Previous Article +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_feed_previous_article_tt "Previous Article" + +// Show Full Story +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_feed_show_full_story_tt "Show Full Story" + +// Next Article +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_feeds_feed_next_article_tt "Next Article" + + +/* Wait Dialog */ +/* -------------------------------------------------------------------- */ +//d: Information text when a feed is updating. +//l:popup_note_wait_window +//w: +//r:3.0 +#define qtn_feeds_updating_wait_dialog_text "Updating" + +//d: Information text when a feed is opening. +//l:popup_note_wait_window +//w: +//r:5.0 +#define qtn_feeds_opening_wait_dialog_text "Opening" +/* -------------------------------------------------------------------- */ +//d: Information text when all feeds are updating. +//l:popup_note_wait_window +//w: +//r:3.1 +#define qtn_feeds_updating_all_wait_dialog "Updating all feeds" + + +/* Delete Dialog */ +/* -------------------------------------------------------------------- */ +//d: Information text when the user chooses to delete a feed. +//d: The text follows this form, "Delete %U?", where %U is +//d: the name of the feed. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_delete_dialog_text "Delete %U?" + +//d: Information text when the user chooses to delete multiple feeds. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_delete_multiple_dialog_text "Delete selected feeds?" + + +/* Edit/Add Feed/Folder Dialog */ +/* -------------------------------------------------------------------- */ +//d: Header test for the feed's name. +//l:list_double_heading_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_name_dialog_text "Title" + +//d: Header test for the feed's url. +//l:list_double_heading_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_url_dialog_text "Address" + +//d: Text displayed in the New feed dialog. +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_new_feed_item "New feed" + +//d:Header text for Automatic updating of web feeds +//l:list_setting_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_autoupdating_text "Automatic updating" + +//d: Selectable text for the Automatic updating setting +//d: If Off is selected, automatic updating does not occur +//l: list_set_graphic_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_autoupdating_off "Off" + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done every 15 minutes +//l: list_set_graphic_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_val_updating_interval_15min "Every 15 minutes" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done every hour +//l: list_set_graphic_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_val_updating_interval_hourly "Every hour" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done every 4 hours +//l: list_set_graphic_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_val_updating_interval_4hours "Every 4 hours" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done daily +//l: list_set_graphic_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_val_updating_interval_daily "Every day" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done weekly +//l: list_set_graphic_pane_t1 +//w: +//r:7.1 +// +#define qtn_feeds_val_updating_interval_weekly "Every week" + + +//d: When the user enables automatic updating of feeds, a confirmation query is displayed to the user +//d: noting that turning the feature on may cost them money +//l: popup_note_window +//w: +//r:7.1 +// +#define qtn_feeds_new_feed_dataquery_autoupdatewarn "Enabling automatic updating may increase your monthly phone bill" + + +/* Import/Export Feed Strings */ +/* -------------------------------------------------------------------- */ + + + +//d: Menu text to import selected or marked feeds from a file +//l: list_single_popup_submenu_pane_t1 +//w: +//r: 3.2 +#define qtn_options_import_feeds "Import Feeds" + +//d: Popup waiting note when searching for feed files +//d: stored on the phone +//l: popup_note_wait_window +//w: +//r: 3.2 +#define qtn_wait_searching_for_feeds "Searching for feeds..." + +//d: When the search for feeds has completed, a header +//d: over the list of results +//l: heading_pane_t1 +//w: +//r: 3.2 +#define qtn_popup_title_feeds_files_found "Feeds Files Found:" + +//d: When the search for feeds has completed, if no +//d: feeds are found on the device, this error is shown +//l: popup_note_window/opt1 +//w: +//r: 3.2 +#define qtn_feeds_no_feeds_found_on_device "No feeds found on device" + +//d: A wait screen for when the phone is importing a feed file +//l: popup_note_wait_window +//w: +//r: 3.2 +#define qtn_wait_importing_feeds "Importing Feeds..." + +//d: Menu text to export selected or marked feeds to a file +//l: list_single_popup_submenu_pane_t1 +//w: +//r: 3.2 +#define qtn_options_export_feeds "Send" + +//d: When exporting some feeds to a file, header on a popup +//d: asking the user to name the file +//l: popup_query_data_window/opt1 +//w: +//r: 3.2 +#define qtn_feeds_name_exported_file "Name the file to be sent:" + +//d: When exporting some feeds to a file, if the +//l: popup_note_window +//w: +//r: 3.2 +#define qtn_feeds_export_opml_title_needed "You must enter a name for the file." + +//d: Wait window as feeds are exported into a file +//l: popup_note_wait_window +//w: +//r: 3.2 +#define qtn_wait_processing "Processing..." + +//d: Confirmation to import feeds from an OPML file +//d: that has been downloaded or received from another application +//d: The %U referes to the filename of the OPML file +//l: popup_note_window +//w: +//r: 3.2 +#define qtn_feeds_query_import_now "Import feeds from %U now?" + + +/* Error Strings */ +/* -------------------------------------------------------------------- */ +//d: Information text for the error dialog. Displayed when the user +//d: doesn't include a title when editing or adding a feed. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_title_needed "Title needed" + +//d: Information text for the error dialog. Displayed when the user +//d: doesn't include a url when editing or adding a feed. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_address_needed "Address needed" + +//d: Information text for the error dialog. Displayed when the user +//d: enters a single quote character anywhere in the feed title. +//l:popup_note_window +//w: +//r:7.0 +#define qtn_feeds_title_single_quote_not_allowed "Single quote character (’) is not allowed in the title" + +//d: Information text for the error dialog. Displayed when the user +//d: tries to add the same feed a second time. +//d: %U is the name of the feed. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_duplicate_feed_error_dialog_text "%U already subscribed" + +//d: Information text for the error dialog. Displayed when the user +//d: tries to add/edit a feed that has a non-unique title. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_duplicate_title_error_dialog_text "Title must be unique" + +//d: Information text for the error dialog. Displayed when a requested +//d: feed is malformed(corrupted/empty). +//l:popup_note_window +//w: +//r:5.0 +#define qtn_feeds_malformed_dialog_text "Feed cannot be processed" + +//d: Information text for the main pane. Displayed when a requested +//d: feed couldn't be fetched from the network. +//l:list_double_graphic_pane_t2 +//w: +//r:5.0 +#define qtn_feeds_network_error_main_pane_text "Couldn't update feed" + +//d: Information text for the main pane. Displayed when a requested +//d: feed is malformed. +//l:list_double_graphic_pane_t2 +//w: +//r:5.0 +#define qtn_feeds_malformed_main_pane_text "Can't process feed" + +//d: Information text for the main pane. Displayed when a requested +//d: feed is in an unsupported format. +//l:list_double_graphic_pane_t2 +//w: +//r:5.0 +#define qtn_feeds_unsupported_main_pane_text "Feed format is not supported" + +//d: Information text for the main pane. Displayed when a requested +//d: feed has invalid URL. +//l:list_double_graphic_pane_t2 +//w: +//r:5.0 +#define qtn_feeds_invalid_url_main_pane_text "Invalid web address" + +//d: Information text for the main pane. Displayed when a requested +//d: feed fails for some other reason. +//l:list_double_graphic_pane_t2 +//w: +//r:5.0 +#define qtn_feeds_general_error_main_pane_text "An unkown error occurred" + +//d: Information text for the error dialog. Displayed when a requested +//d: feed fails for some other reason. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_general_error_dialog_text "An unkown error occurred" + +//d: Information text for the error dialog. Displayed when an OPML file +//d: somehow gets deleted after it is found and displayed in the list, and the +#define qtn_feeds_malformed_dialog_text "Can't process feed" + +//d: Information text for the error dialog. Displayed when a requested +//d: feed is in an unsupported format. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_unsupported_dialog_text "Feed format is not supported" +//d: user then tries to select and import it. +//l:popup_note_window +//w: +//r:7.1 +#define qtn_feeds_file_not_found_dialog_text "File Not Found" + +/* Misc Strings */ +/* -------------------------------------------------------------------- */ +//d: Text displayed in the Topic-View when an item's name isn't available. +//l:list_single_heading_pane_t1 +//w: +//r:3.0 +#define qtn_feeds_unnamed_item "Unnamed item" + + +/* Strings copied from wmlbrowser.loc */ +/* -------------------------------------------------------------------- */ +//d:DO element menu item +//l:list_single_popup_submenu_pane_t1 +// +#define text_wml_option_back "Back" + +//d:Menu item in Bookmarks View: activate highlighted bookmark +//l:list_single_pane_t1_cp2 +// +#define qtn_wmlbm_load_bm "Activate" + +// WmlBrowser Settings/Session listbox items + +//d:Browser settings session list item texts +//l:heading_pane_t1 +// +#define qtn_wmls_session_info "Session info" + +//d:Format title text in session view. +//l:popup_info_list_pane_t1 +// +#define qtn_wmls_ses_view_ap "Access point name:" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmls_ses_view_bearer_type "Bearer type:" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmls_ses_view_max_speed "Max. connection speed:" + +//d:Text in About Product information note's heading +//l:heading_pane_t1 +#define qtn_browsers_title_about "Name and Version" + +//d:Text in About Product information note, the first %U is the browser version number, the second is the Browser build number +//l:popup_info_list_pane_t1 +#define qtn_browsers_about_version_label "Version: %0U (%1U)" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_browser_set_bearer_hscsd "HSCSD" + +//d: Information text for the error dialog. Displayed when a requested +//d: feed couldn't be fetched from the network. +//l:popup_note_window +//w: +//r:3.0 +#define qtn_feeds_network_error_dialog_text "Couldn't update feed" + + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/browser/loc/WmlBrowser.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/browser/loc/WmlBrowser.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,3229 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is a localisation file. +* A .loc file is the one and only place where the logical strings +* to be localised are defined. +* +* +*/ + + + +// LOCALISATION STRINGS + +//d:Information note text +//l:popup_note_window +// +#define qtn_wml_informationnote_unable_to_retrieve "Unable to retrieve" + +//d:Move - cancel softkey, Softkey used when moving the bookmark to folder +//l:control_pane_t1/opt7 +// +#define text_softkey_move "Move" + +//d:application name +//l:list_single_large_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_apps_browserng_list "BrowserNG" + +//d: application name +//l: cell_app_pane_t1 +//w: +//r:3.0 +// +#define qtn_apps_browserng_grid "BrowserNG" + + +//d:Confirmation query text on exiting Browser +//l:popup_note_window +// +#define text_wml_exit_confirm "Quit browsing?" + +// strings for main menu for multipurpose browser display + +//d:Open selected deck +//d:Open focused anchor node. +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_open "Open" + + +//d:Menu item for DO elements' parent menu text +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_wml_list_history "History" + + +//d:Menu item for DO elements' parent menu text +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_srv_opts "Service options" + +//d:Menu item to get access to the bookmarks +//l:list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +// +#define qtn_wml_faves "Bookmarks" + +//d:Menu item to +//l:list_single_pane_t1_cp2 +// +#define qtn_browser_list_close "Close browser" + +//d: main menu item to rotate the display orientation +//l: list_single_pane_t1_cp2 +//w: +//r:3.1 +// +#define qtn_browser_rotate_display "Rotate display" + + +//d:Menu access to navigation submenu +//l:list_single_pane_t1_cp2/opt3 +// +#define qtn_wml_list_navigation "Navigation functions" + + +//d:Menu item to change connection +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_change_connection "Change connection" + +//d:Menu item brings up input field for custom URL address +//d:Menu item in bookmark favorites view +//l:list_single_pane_t1_cp2 +// +#define text_wml_option_goto "Go to address" + +//d:Text in middle soft key (goto address function) +//l:control_pane_t3/opt7 +//w: +//r:3.2 +#define qtn_browser_msk_goto "Go to" + +//d:Menu item to create a bookmark +//l:list_single_pane_t1_cp2 +//w: +//r:3.0 +// +#define qtn_wmlbm_fav_saveas_bm "Add bookmark" + +//d:SubMenu item to create a bookmark +//l:list_single_popup_submenu_pane_t1 +//w: +//r:5.0 & 3.2.3 +// +#define qtn_wmlbm_fav_saveas_bm_sm "Add bookmark" + +//d:Menu item to show the zoom slider +//l:list_single_pane_t1_cp2 +//r:5.0 +// +#define qtn_wml_list_zoom_slider_show "Show Zoom Slider" + +//d:Menu item to hide the zoom slider +//l:list_single_pane_t1_cp2 +//r:5.0 +// +#define qtn_wml_list_zoom_slider_hide "Hide Zoom Slider" + +//d:Menu item to reload currently showed card +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_reload "Reload" + +//d:Menu item the user can get different kind of information +//d:about service in use +//l:list_single_pane_t1_cp2/opt3 +// +#define qtn_wml_option_infoview "Info" + +//d:Menu item to terminate network connection +//d:about service in use +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_dconn "Disconnect" + +//d:Menu item to load and show unloaded image +//l: list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_fetch_img "Show Images" + +//d:Menu item to entirely clear the cache +//l:list_single_popup_submenu_pane_t1 +// +#define text_wml_option_empty_cache "Clear cache" + +//d:Menu item to save current card +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_save_pgs "Save" + +//d:Menu item to view/change browsing settings +//l:list_single_pane_t1_cp2 +// +#define qtn_wmls_browser_opt_sett "Preferences" + +//d:Browser main menu +//l:list_single_pane_t1_cp2 +// +#define text_wml_option_help "Help" + +//d:Browser main menu +//l: list_single_pane_t1_cp2/opt3 +// +#define qtn_browser_options_help "Help" + +//d:Options menu item to open Downloads List. +//l:list_single_pane_t1_cp2 +//w: +// +#define qtn_browser_list_downloads "Downloads" + +//d:Browser main menu +//l: list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_view_images "View Images" + +//d:Menu access to tools submenu +//l:list_single_pane_t1_cp2/opt3 +// +#define qtn_browser_list_folder_tools "Tools" + +//d:Strings for page info submenu +//l:list_single_popup_submenu_pane_t1 +#define qtn_browser_list_page_info "Page info" + +//d:Strings for Info submenu +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_wml_opt_smenu_session "Session" + +//d:Strings for Info submenu +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_wml_opt_smenu_security "Security" + +//d:open new page query +//l:popup_note_window +// +#define qtn_wml_query_dwnl "Downloading ongoing. Cancel previous downloading?" + +//d:External app started browser with an invalid bookmark id +//l:popup_note_window +// +#define qtn_wml_bookmark_not_found "Bookmark does not exist!" + +//d:Information note text +//l:popup_note_window +// +#define text_wml_cache_emptied_note "Cache cleared" + +//d:Text to display if the current access point is invalid while editing bookmark +//l:list_single_heading_pane_t1 +#define qtn_wmlbm_text_ap_invalid "Invalid" + + +//d:Error note message: Invalid accesspoint is defined in a bookmark +//l:popup_note_window +#define qtn_wml_info_invalid_ap "Invalid access point. Edit bookmark." + +//d:Error note message: Invalid accesspoint is defined in a saved deck +//l:popup_note_window +#define qtn_wml_confquery_invalid_ap "Invalid access point. Use default?" + +//d:Command text associated to a softkey in the control pane. +//d:Go to root level (folder). +//l:control_pane_t1/opt7 +// +#define text_softkey_root_level "Root level" + +// Authentication Dialog + +//d:label for bookmark name query +//l:popup_query_data_window +#define qtn_wml_query_bookmark_title "Enter bookmark name" +//d:label for saved deck name query +//l:popup_query_data_window +#define qtn_wml_query_savedpage_title "Enter name for saved page" + +//d:title of bookmark favorites view +//l:title_pane_t2/opt9 +// +#define text_wml_option_bookmarks "Bookmarks" + + +//d:Empty list text in Bookmarks View (displayed if no bookmarks exist) +//l:main_list_empty_pane +// +#define text_wml_no_bookmarks "No bookmarks" + +//d:Prompt for renaming a saved deck in Saved Decks View. +//l:popup_query_data_window +// +#define qtn_wml_prmpt_edit_name "Edit name:" + +//d:Information note text in Bookmarks View: could not move items due to name collision +//d:Information note text in Saved Decks View: could not move items due to name collision +//l:popup_note_window +// +#define qtn_fldr_names_in_use_rename "Some of the names are already in use. Please rename those items" + +//d:Menu item in Bookmarks View: create new bookmark +//l:list_single_pane_t1_cp2 +// +#define text_wmlbm_option_enter_new "Add bookmark" + +//d:Menu item in Bookmarks View: activate highlighted bookmark +//l:list_single_pane_t1_cp2 +// +#define qtn_wmlbm_load_bm "Activate" + +//d:Menu item in Bookmarks View: edit highlighted bookmark +//l:list_single_pane_t1_cp2 +// +#define qtn_wmlbm_edit_bm "Edit bookmark" + + +//d:Menu item in Bookmarks View: set prefered bookmark +//l:list_single_pane_t1_cp2 +// +#define qtn_browserbm_list_set_as_preferred "Set as preferred" + +//d:Menu item in Bookmarks View: set un prefered bookmark +//l:list_single_pane_t1_cp2 +// +#define qtn_browserbm_list_unset_from_preferred "Unset from preferred" + +//d:Menu access to bookmark management submenu (Bookmarks view) +//l:list_single_pane_t1_cp2/opt3 +// +#define qtn_wmlbm_manage_bm "Edit" + +//d:Bookmark Edit Form title editor label. +//l:list_double_heading_pane_t1 +// +#define qtn_wmlbm_flabel_bmtitle "Title" + +//d:Bookmark Edit Form URL editor label. +//l:list_double_heading_pane_t1 +// +#define qtn_wmlbm_flabel_bmadrs "Address" + +//d:Bookmark Edit Form Access Point selector label. +//l:list_double_heading_pane_t1 +// +#define qtn_wmlbm_flabel_wapap "Access point" + +//d:Name for "Default" Access Point +//l:list_set_graphic_pane_t1 +// +#define qtn_wmlbm_default_wapap "Default" + +//d:Text to display if there are no Access Points +//l:list_single_heading_pane_t1 +// +#define qtn_wmlbm_text_ap_none "None" + +//d:Bookmark Edit Form user name editor label. +//l:list_double_heading_pane_t1 +// +#define qtn_wmlbm_flabel_username "User name" + +//d:Bookmark Edit Form password editor label. +//l:list_double_heading_pane_t1 +// +#define qtn_wmlbm_flabel_passwd "Password" + +//d:Error note message: attempt to select AP when no such exist. +//l:popup_note_window +// +#define qtn_wmlbm_info_no_valid_ap "No valid access point available. Please add one to preferences." + +//d:Error note message: database is inaccessible. +//l:popup_note_window +// +#define qtn_wmlbm_err_db_inaccessible "Cannot access\ndatabase.\nTry again later." + +//d:Info note message: bookmark was saved. +//l:popup_note_window +// +#define text_wml_bm_saved "Bookmark saved" + +//d:Error note message: bookmark was not saved. +//l:popup_note_window +// +#define qtn_wmlbm_bm_not_saved "Bookmark not saved" + +//d:Default name for new bookmark. +//l:list_single_heading_pane_t1 +// +#define qtn_wmlbm_default_bm_title "New bookmark" + +//d:Left softkey: (accept typing and activate typed URL address) +//l:control_pane_t1/opt7 +// +#define qtn_wml_softk_go "Go to" + +//d:Confirmation query prompt if no URL specified for a bookmark. +//l:popup_note_window +// +#define qtn_wmlbm_query_address "Address needed.\nAdd an address?" + +//d:Information note text in Bookmarks View: name is conflicting with existing name. +//d:Information note text in Saved Decks View: name is conflicting with existing name. +//l:popup_note_window +// +#define qtn_wmlbm_name_already_used "Name already in use" + +//Saved Pages. + +//d:Confirmation query text in Bookmarks View +//d:Confirmation query text in Saved Decks View +//l:popup_note_window +// +#define qtn_wml_quest_overwrite "Page already exists\Overwrite?" + +//d:Menu item in Saved Decks View +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_list_refresh "Refresh" + +//d:Menu access to saved page management submenu (Saved Pages view) +//l:list_single_pane_t1_cp2/opt3 +// +#define qtn_wml_list_manage_sp "Manage saved pages" + +//d:Title for Saved Decks View +//l:title_pane_t2/opt9 +// +#define qtn_wml_title_svd_pgs "Saved pages" + +//d:Empty list text for Saved Decks View: displayed if there are no saved pages. +//l:main_list_empty_pane +// +#define qtn_wml_no_svd_pgs "No saved pages" + +//d:Information note text in Saved Decks View: page saved +//l:popup_note_window +// +#define qtn_wml_conf_pages_saved "Page saved" + +//d:Information note text in Saved Decks View +//l:popup_note_window +// +#define qtn_wml_conf_pages_refreshed "Page refreshed" + +//d: Wait note while refreshing a saved deck +//l: popup_note_wait_window +// +#define qtn_wml_page_refreshing "Refreshing page" + +//d:Menu item in Bookmarks View: go back to Browser View +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_wml_list_ret_page "Back to page" + +// +// Settings texts +// + + +//d:Browser page info title text +//l:heading_pane_t1 +#define qtn_browser_query_current_page "Current page" + + +//d: Browser page info item text +//l:popup_info_list_pane_t1 +#define qtn_browser_query_current_page_url "URL" + + +// WmlBrowser Settings/Session listbox items + +//d:Browser settings session list item texts +//l:heading_pane_t1 +// +#define qtn_wmls_session_info "Session info" + +//d:Format title text in session view. +//l:popup_info_list_pane_t1 +// +#define qtn_wmls_ses_view_ap "Access point name:" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmls_ses_view_bearer_type "Bearer type:" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmls_ses_view_max_speed "Max. connection speed:" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_set_bearer_data_call "Data call" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_set_bearer_packet_data "Packet data" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_browser_set_bearer_hscsd "HSCSD" + +//d:Browser settings session list item texts +//l:popup_info_list_pane_t1 +// +#define qtn_set_auto_detect "Auto detect" + +//d:Browser security item texts +//l:heading_pane_t1 +// +#define qtn_wmlsec_security_info "Security info" + +//d:Browser security item texts +//l:heading_pane_t1 +// +#define qtn_wmlsec_cert_details "Certificate details" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_serialno "Serial number:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_contype "Connection:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_issuer "Issuer:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_cert_owner "Owner:\n%U" + + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_valid_from "Valid from:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_valid_to "Valid to:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_fingerprint "Fingerprint:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_server "Server authentication:\n%U" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_con_secur "Secure" + +//d:Browser security item texts +//l:popup_info_list_pane_t1 +// +#define qtn_wmlsec_ses_info_con_unsec "Unsecure" + +//d: A list box item referring to settings categorised as Page +//d: When selected a settings list is displayed containing those settings +//l: list_single_large_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_fldr_general "General" + +//d: A list box item referring to settings categorised as General +//d: When selected a settings list is displayed containing those settings +//l: list_single_large_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_fldr_page "Page" + +//d: A list box item referring to settings categorised as Privacy +//d: When selected a settings list is displayed containing those settings +//l: list_single_large_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_fldr_privacy "Privacy" + +//d: When the General Settings are opened, this should be displayed in the title pane +//l: title_pane_t2/opt9 +//w: +//r:3.1 +// +#define qtn_browsers_title_general "General Settings" + +//d: When the PageSettings are opened, this should be displayed in the title pane +//l: title_pane_t2/opt9 +//w: +//r:3.1 +// +#define qtn_browsers_title_page "Page settings" + +//d: When the Privacy Settings are opened, this should be displayed in the title pane +//l: title_pane_t2/opt9 +//w: +//r:3.1 +// +#define qtn_browsers_title_privacy "Privacy settings" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_wmls_local_set_default_ap "Default access point" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +//w: +//r:2.8 +// +#define qtn_browsers_sett_autoload_objects "Autoload images and objects" + + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +//w: +//r:3.0 +// +#define qtn_wmls_local_set_pageoverview "Mini map" + +//d: Selectable text for the Page Overview setting +//d: Page Overview is enabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_pageoverview_on "On" + +//d: Selectable text for the Page Overview setting +//d: Page Overview is disabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_pageoverview_off "Off" + +//d:Browser settings main list item texts +//d:Back list is the History list +//l:list_setting_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_back_list "Back list" + +//d: Selectable text for the Back list setting +//d: If On is selected, back list is shown when SK2 Back +//d: is pressed in page view. +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_val_back_list_on "On" + +//d: Selectable text for the Back list setting +//d: If Off is selected, back list is not shown when SK2 Back +//d: is pressed in page view. +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_val_back_list_off "Off" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_auto_refresh "Automatic page refresh" + +//d: Selectable text for the Automatic page refresh setting +//d: Automatic page refresh is enabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_val_auto_refresh_on "On" + +//d: Selectable text for the Automatic page refresh setting +//d: Automatic page refresh is disabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_browsers_sett_val_auto_refresh_off "Off" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_xhtml_settings_all_small "Smallest" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_xhtml_settings_smaller "Small" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_xhtml_settings_normal "Normal" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// + +#define qtn_xhtml_settings_larger "Large" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_xhtml_settings_all_large "Largest" + +//d: Browser character encoding in browser settings: ISO 8859-2 +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_charenc_iso_8859_2 "ISO 8859-2" + +//d: Browser character encoding in browser settings: ISO 8859-4 +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_charenc_iso_8859_4 "ISO 8859-4" + +//d: Browser character encoding in browser settings: ISO 8859-5 +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_charenc_iso_8859_5 "ISO 8859-5" + +//d: Browser character encoding in browser settings: ISO 8859-7 +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_charenc_iso_8859_7 "ISO 8859-7" + +//d: Browser character encoding in browser settings: ISO 8859-9 +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_charenc_iso_8859_9 "ISO 8859-9" + + +//d: Browser default character encoding in browser settings: ISO 8859-6 (Arabic) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_iso_88596 "Arabic (ISO)" + + +//d: Browser default character encoding in browser settings: Windows-1256 (Arabic) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1256 "Arabic (Windows)" + + +//d: Browser default character encoding in browser settings: ISO 8859-8 (Hebrew) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_iso_88598 "Hebrew (ISO-Visual)" + + +//d: Browser default character encoding in browser settings: ISO 8859-8-i (Hebrew) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_iso_88598_i "Hebrew (ISO-Logical)" + +//d: Browser default character encoding in browser settings: Windows-1255 (Hebrew) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1255 "Hebrew (Windows)" + +//d: Browser default character encoding in browser settings: Windows-1250 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1250 "Windows-1250" + +//d: Browser default character encoding in browser settings: Windows-1251 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1251 "Windows-1251" + +//d: Browser default character encoding in browser settings: Windows-1253 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1253 "Windows-1253" + +//d: Browser default character encoding in browser settings: Windows-1254 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1254 "Windows-1254" + +//d: Browser default character encoding in browser settings: Windows-1257 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1257 "Windows-1257" + +//d: Browser default character encoding in browser settings: Windows-1258 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_1258 "Windows-1258" + +//d: Browser default character encoding in browser settings: Automatic +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_automatic "Automatic" + +//d: Browser default character encoding in browser settings: Tis-620 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_tis_620 "Thai" + + +//d: Browser default character encoding in browser settings: Windows-874 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_windows_874 "Thai (Windows-874)" + + +//d: Browser default character encoding in browser settings: Shift_JIS +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_shift_jis "shift_jis" + +//d: Browser default character encoding in browser settings: euc-jp +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_euc_jp "euc-jp" + +//d: Browser default character encoding in browser settings: iso-2022-jp +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_iso_2022_jp "iso-2022-jp" + +//d: Browser default character encoding in browser settings: Ucs-2 +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_ucs_2 "Unicode (ucs-2)" + +//d: Browser default character encoding in browser settings: KOI8-R +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_shift_koi8_r "KOI8-R" + +//d: Browser default character encoding in browser settings: KOI8-U +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_shift_koi8_u "KOI8-U" + +//d: Browser default character encoding in browser settings: ISCII +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_iscii "ISCII" + +//d: Browser default character encoding in browser settings: Korean (Euc-Kr) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_euc_kr "Korean (Euc-Kr)" + +//d: Browser default character encoding in browser settings: Korean (KSC5601) +//l: list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_defenc_ksc_5601 "Korean (KSC5601)" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_wmls_save_receipt "Save receipt" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_wmls_set_wallet_auto "Automatic eWallet use" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_cookie_allow "Allow" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_sett_cookie_reject "Reject" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_wtai_dtmf_alcon "Always confirm" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_wtai_dtmf_one "Confirm once" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_save_to_notepad "To notepad" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_save_not "Never" + + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_wall_auto_on "On" + + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_wall_auto_off "Off" + + +// Settings Menu texts + +//d:Browser settings main menu +//l:list_single_pane_t1_cp2 +// +#define qtn_wmls_local_set_opt_change "Change" + +//d:Invalid certificate indicator dialog's message body +//l:popup_query_wml_sign_window_2 +// +// #define qtn_wmlsec_invalid_cert "Server could not be authenticated\nReason:\n%U" + +//d:Certificate error: Server certificate not valid yet +//l:popup_query_wml_sign_window_2 +// +// #define text_wml_certificate_sc_not_val "Server certificate not valid yet" + +//d:Authentication of the WML card failed. +//l:popup_note_window +#define text_wml_auth_fail_retry_query "Authorisation failed. Try again?" + +//d:if the secured connection established. +//l:popup_note_window +#define qtn_wmlsec_conn_secured "Connection secured to %U" + +//d:when anonymous connection established to server +//l:popup_note_window +#define qtn_wmlsec_conn_sec_unk_serv "Connection secured to unknown server" + +//d:Confirmation note text about the closure of the active connection +//l:popup_note_window +// +#define qtn_ics_cnote_disconn_from_service "Connection to service is closed" + +//d:Browser settings font size +//l:list_setting_pane_t1 +// +#define qtn_wmls_pref_fontsize "Font size" + +//d:Browser settings cookies +//l:list_setting_pane_t1 +// +#define qtn_wmls_sett_cookies "Cookies" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_local_var_image_on "On" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_local_var_image_off "Off" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_local_var_expand_on "On" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +// +#define qtn_wmls_local_var_expand_off "Off" + +//d:Confirmation query shown if the Search Menu item is selected, and the Search Web Setting value is empty +//d: Accepting this query opens the search page setting for editing +//l: popup_note_window +#define qtn_browser_query_search_url "Search page address is missing. Define now?" + +//d: Prompt dialog shown to enter a url for the Search Page setting +//l: popup_query_data_window +#define qtn_wml_prompt_search_url "Search page address" + +//d: Browser default character encoding in browser settings +//l: list_setting_pane_t1 +// +#define qtn_brow_sett_defenc "Default encoding" + +// Text used by Progress bar + +//d: Percent mark ("%") to be used in the progress bar to indicate the percentage of the data loaded at the moment. +//d: %N is replaced by the actual percentage number. +//l: none +#define qtn_wml_unit_percent "%N %" + + +//d: Size of data in kilo bytes +//d: text used by progress bar +//l: none +#define qtn_wml_unit_kb "%N kB" + +//d: Size of data in mega bytes +//d: text used by progress bar +//l: none +#define qtn_wml_unit_mb "%U MB" + +//d: Browser default character encoding in browser settings: ISO 8859-1 (Latin 1) +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_defenc_latin1 "Latin" + +//d: Browser default character encoding in browser settings: GB 2312 (Simplified Chinese) +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_defenc_gb2312 "Simplified Chinese" + +//d: Browser default character encoding in browser settings: Big5 (Traditional Chinese) +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_defenc_big5 "Traditional Chinese" + +//d: Browser default character encoding in browser settings: UTF-8 (Unicode) +//l: list_set_graphic_pane_t1 +// +#define qtn_brow_sett_defenc_utf8 "Unicode (UTF-8)" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_browsers_sett_full_screen "Full screen" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_full_screen_normal "Normal" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_full_screen_full_screen "Full screen" + +//d:Browser settings to display softkeys +//l:list_setting_pane_t1 +//w: +//r:3.2 +// +#define qtn_browsers_sett_softkeys "Display softkeys" + +//d: Selectable text for the softkey setting +//d: Will display the softkeys if on +//l: set_value_pane_t1 +//w: +//r:3.2 +// +#define qtn_browsers_sett_softkeys_on "On" + +//d: Selectable text for the softkey setting +//d: Will not display the softkeys if off +//l: set_value_pane_t1 +//w: +//r:3.2 +// +#define qtn_browsers_sett_softkeys_off "Off" + +//d:Browser settings main list item texts +//l: list_setting_pane_t1 +#define qtn_browsers_sett_search "Search page address" + +//d:Browser settings main list item texts +//l: list_setting_pane_t1 +#define qtn_browsers_sett_url_suffix "URL Suffix" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_browsers_sett_media_volume "Media volume" + +//d:Browser settings selectable item texts volume muted +//l:list_set_graphic_pane_t1 +// +#define qtn_browsers_sett_volume_muted "Muted" + +//d:Browser settings selectable item texts volume level 1 +//l:list_set_graphic_pane_t1 +// +#define qtn_browsers_sett_volume_1 "Level 1" + +//d:Browser settings selectable item texts volume level 2 +//l:list_set_graphic_pane_t1 +// +#define qtn_browsers_sett_volume_2 "Level 2" + +//d:Browser settings selectable item texts volume level 3 +//l:list_set_graphic_pane_t1 +// +#define qtn_browsers_sett_volume_3 "Level 3" + +//d:Browser settings selectable item texts volume level 4 +//l:list_set_graphic_pane_t1 +// +#define qtn_browsers_sett_volume_4 "Level 4" + +//d: Setting for showing or hiding security related warnings +//l: list_setting_pane_t1 +#define qtn_browser_sett_security "Security notifications" + +//d: Show security related warnings +//l: list_set_graphic_pane_t1 +#define qtn_browser_sett_item_show_all "Show" + +//d: Hide security related warnings +//l: list_set_graphic_pane_t1 +#define qtn_browser_sett_item_hide_all "Hide" + +//d: Setting for open downloading files progressively +//l: list_setting_pane_t1 +#define qtn_browsers_sett_open_loading "Open while loading" + +//d: Automatically open downloaded files progressively +//l: list_set_graphic_pane_t1 +#define qtn_brow_sett_open_downloads_yes "Yes" +// +#define qtn_browser_list_check_for_updates "Update Browser" + +//d:Browser main menu +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_browser_version "Browser Version" + +//d:Browser main menu +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_browser_help "Browser Help" +// +#define qtn_brow_sett_product_update_manual "Manual" +#define qtn_brow_sett_product_update_auto "Automatic" + +//d: Not automatically open downloaded files progressively +//l: list_set_graphic_pane_t1 +#define qtn_brow_sett_open_downloads_no "No" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 + // +#define qtn_wmls_local_set_imei_notif "IMEI notification" + +//d:Enables IMEI sending +//d:Browser settings selectable item text +//l:list_set_graphic_pane_t1 +#define qtn_wmls_local_set_imei_notif_enabled "Enabled" + + +//d:Disables IMEI sending +//d:Browser settings selectable item text +//l:list_set_graphic_pane_t1 +#define qtn_wmls_local_set_imei_notif_disabled "Disabled" + + +//d: Boomark folder "Download applications" +//l: list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_download_applications "Download applications" + +//d: Boomark folder "Download images" +//l: list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_download_images "Download images" + +//d: Boomark folder "Download tones" +//l: list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_download_tones "Download tones" + +//d: Boomark folder "Download videos" +//l: list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_download_videos "Download videos" + +//d: Boomark folder "Download skins" +//l: list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_download_skins "Download skins" + +//d: Boomark folder "Download Music" +//l: list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_download_music "Download music" + +//d: Boomark folder title "Download applications" +//l: title_pane_t2/opt9 +// +#define qtn_browserbm_folder_title_download_applications "Download applications" + +//d: Boomark folder title "Download images" +//l: title_pane_t2/opt9 +// +#define qtn_browserbm_folder_title_download_images "Download images" + +//d: Boomark folder title "Download tones" +//l: title_pane_t2/opt9 +// +#define qtn_browserbm_folder_title_download_tones "Download tones" + +//d: Boomark folder title "Download videos" +//l: title_pane_t2/opt9 +// +#define qtn_browserbm_folder_title_download_videos "Download videos" + +//d: Boomark folder title "Download skins" +//l: title_pane_t2/opt9 +// +#define qtn_browserbm_folder_title_download_skins "Download skins" + +//d: Boomark folder title "Download music" +//l: title_pane_t2/opt9 +//w: +//r:3.0 +// +#define qtn_browserbm_folder_title_download_music "Download music" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_browsers_sett_adaptive_bookmarks "Recent URLs" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_adaptive_bookmarks_on "On" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_adaptive_bookmarks_hide_folder "Hide folder" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_adaptive_bookmarks_off "Off" + + +//d:Empty list text for Recent URLs Folder: displayed if there are no Recent URLs. +//l:main_list_empty_pane +// +#define qtn_browserbm_no_adaptive_bookmarks "No recent URLs" + +//d:Text for Recent URLs Folder in Bookmarks view. +//l:list_single_graphic_pane_t1 +// +#define qtn_browserbm_folder_adaptive_bookmarks "Recent URLs" + +//d: Title of Recent URLs view +//l: title_pane_t2/opt9 +//w: +//r:3.2 +// +#define qtn_browserbm_title_adaptive_bookmarks "Recent URLs" + +//d: Confirmation query shown before deleting all Recent URLs. +//l:popup_note_window +// +#define qtn_browserbm_query_delete_adap_bookmarks "Delete all recent URLs?" + +//d: Options menu item for copying Recent URLs to Bookmarks Folder. +//l:list_single_pane_t1_cp2 +// +#define qtn_browserbm_options_copy_to_bookmarks "Copy to bookmarks" + +//d: Options submenu item for copying Recent URLs to Bookmarks Folder. +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_browserbm_options_copy_to_bookmarks_sm "Copy to bookmarks" +//d: Options menu item for deleting all Recent URLs. +//l:list_single_pane_t1_cp2 +// +#define qtn_browserbm_options_clear_adaptive_bookmarks "Clear Recent URLs" + +//d: Confirmation note shown when 1 Adaptive Bookmark has been copied to root level of Bookmarks View. +//l:popup_note_window +// +#define qtn_browserbm_note_adaptive_bookmark_copied "Copied to bookmarks" + +//d: Confirmation note shown when more than one Recent URLs (%N is the number of Recent URLs) has been copied to root level of Bookmarks View. +//l:popup_note_window +// +#define qtn_browserbm_note_adaptive_bookmarks_copied "%N items copied to bookmarks" + +//d: Options menu item for restarting the browser +//l:list_single_pane_t1_cp2 +// +#define qtn_wml_opt_restart "Restart" + +//d:Exit confirmation in browser settings +//l:list_setting_pane_t1 +// +#define qtn_wml_setting_exit_confirm "Exit confirmation" + +//d:Selectable item texts for Exit confirmation setting +//d:Activate the exit confirmation prompt. +//l:list_set_graphic_pane_t1 +#define qtn_wml_setting_exit_on "On" + +//d:Selectable item texts for Exit confirmation setting +//d:Deactivate the exit confirmation prompt. +//l:list_set_graphic_pane_t1 +#define qtn_wml_setting_exit_off "Off" + +//d:Send referrer heading in browser settings +//l:list_setting_pane_t1 +#define qtn_wml_setting_referrer "Send referrer heading" + +//d:Selectable item texts for Send referrer setting. +//d:Activate the sending of the referrer header. +//l:list_set_graphic_pane_t1 +#define qtn_wml_setting_refer_on "On" + +//d:Selectable item texts for Send referrer setting. +//d:Deactivate the sending of the referrer header. +//l:list_set_graphic_pane_t1 +#define qtn_wml_setting_refer_off "Off" + +//d: This is a setting item which controls +//d: whether external style sheets are fetched +//l: list_setting_pane_t1 +#define qtn_browsers_sett_external_css "Rendering quality" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +// +#define qtn_browsers_sett_scripting "Java/Ecma Script" + +//d: Enables Java and ECMA scripts to be executed in browser +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_scripting_enable "Enable" + +//d: Disables Java and ECMA scripts to be executed in browser +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_scripting_disable "Disable" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +//r: 3.2 +// +#define qtn_browsers_sett_scriptlog "Javascript notifications" + +//d: Disables Java and ECMA script logging output in browser +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +//r: 3.2 +#define qtn_browsers_sett_scriptlog_disable "No notification" + +//d: Enables Java and ECMA script log to be output to a log file +//l:list_set_graphic_pane_t1 +//r: 3.2 +#define qtn_browsers_sett_scriptlog_to_file "Log to file" + +//d: Enables Java and ECMA script log to be output to GUI console +//l:list_set_graphic_pane_t1 +//r: 3.2 +#define qtn_browsers_sett_scriptlog_to_console "Pop-up notes" + +//d: Enables Java and ECMA script log to be output to both GUI console and file +//l:list_set_graphic_pane_t1 +//r: 3.2 +#define qtn_browsers_sett_scriptlog_to_console_file "Log to file and as pop-up notes" + + +//d:Menu item to clear all window(s) page script logging +//l: list_single_popup_submenu_pane_t1 +//r: 3.2 +// +#define qtn_browser_list_clear_scriptlog "Clear Javascript Log" + +//d: Browser Privacy main menu +//l: list_single_pane_t1_cp2/opt3 +// will contain 5 submenu options +#define qtn_browser_list_privacy "Privacy" + + +//d:Menu item to clear all privacy related data (cache, cookies, history, form & password data) +//l: list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_privacy_clear_all "Clear all privacy data" + + +//d:Menu item to clear all the stored cookies +//l:list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_delete_cookies "Clear cookies" + +//d:Menu item to clear all window(s) page load history data +//l: list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_clear_history "Clear history" + + +//d:Menu item to clear all form and password data +//l: list_single_popup_submenu_pane_t1 +// +#define qtn_browser_list_privacy_clear_form_data "Clear form data" + + +//d:Information note text after clearing history +//l: popup_note_window +// +#define qtn_browser_note_history_cleared "History and recent URLs cleared" + + +//d:Information note text after clearing form data +//l: popup_note_window +// +#define qtn_browser_note_form_and_passwd_data_cleared "Form and password data cleared" + + +//d:Information note text after deleting cookies +//l:popup_note_window +// +#define qtn_browser_note_cookies_deleted "Cookies deleted" + +//d:Information note text after clearing all privacy data +//l: popup_note_window +// +#define qtn_browser_note_clear_all_privacy_done "All privacy data cleared" + + +//d:Menu item in Preferences->Options->Info menu +//l:list_single_pane_t1_cp2 +#define qtn_wml_opt_about_product "Name and version" +//d:Text in About Product information note's heading +//l:heading_pane_t1 +#define qtn_browsers_title_about "Name and Version" + +//d:Menu item in Preferences->Options->Info menu +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +// +#define qtn_wml_opt_about_product_oss "About product" + +//d:Text in About Product information note's heading +//l:heading_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_title_about_oss "About product" + +//d:Text in About Product information note, shown in the first line +//l:popup_info_list_pane_t1 +#define qtn_browsers_browser_name "Series 60 Mobile Browser" + +//d:Text in About Product information note, the first %U is the browser version number, the second is the Browser build number +//l: heading_pane_t1 +#define qtn_browsers_about_version_label "Version: %0U (%1U)" + +//d:Browser main menu +//l:heading_pane_t1 +#define qtn_browser_query_browser_version "Browser Version" + +//d:Text in About Product information note, the list of installed plugins comes after this +//l:popup_info_list_pane_t1 +#define qtn_browsers_plugins_label "Plug-Ins:" + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +#define qtn_browsers_sett_homepage "Home page" + +//d:Browser settings main list item texts for OSS browser +//l:list_setting_pane_t1 +//w: +//r: 3.0 +// +#define qtn_browsers_sett_startpage "Startpage" + +//d:Browser settings selectable item texts access point home page +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_ap_home_page "Access point home page" + +//d:Browser settings selectable item texts user-defined home page +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_own_home_page "New address" + +//d:Browser settings selectable item texts for selecting bookmark view +//l:list_set_graphic_pane_t1 +#define qtn_browsers_homepage_bookmarks "Bookmarks" + +//d:Browser submenu item for Set as Home page +//l:list_single_pane_t1_cp2 +#define qtn_browserbm_list_set_as_home_page "Set as Home Page" + +//d:Browser submenu item for Set as Home page +//l:list_single_popup_submenu_pane_t1 +#define qtn_browserbm_list_set_as_home_page_sm "Set as Home Page" + +//d:Browser menu item for Home page launch +//l:list_single_popup_submenu_pane_t1 +#define qtn_browser_list_home "Home" + +//d: Prompt dialog shown to enter a url for the Home Page setting +//l: popup_query_data_window +#define qtn_wml_prompt_homepage_url "New address" + +//d: Confirmation query shown before setting new home page +//l:popup_note_window +#define qtn_browserbm_query_set_as_home_page "Do you want to use this bookmark as home page?" + +//d:Browser settings selectable item texts user-defined home page +//l:list_set_graphic_pane_t1 +#define qtn_browsers_sett_use_current_home_page "Use current page" + + +//d:Text in upload progress note. +//l:popup_note_window +#define qtn_browser_upload_progressnote_uploaded "Uploaded:\n%0U / %1U " + +//d:Unit in upload progress note. +//l:popup_note_window +#define qtn_browser_upload_progressnote_unit_kbyte "kB" + +//d:Unit in upload progress note. +//l:popup_note_window +#define qtn_browser_upload_progressnote_unit_mb "MB" + + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_wml_settings_access_point_user_defined "User defined" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_wml_settings_access_point_always_ask "Always ask" + +//d:Browser settings selectable item texts +//l:list_set_graphic_pane_t1 +#define qtn_wml_settings_access_point_ask_when_needed "Ask when needed" + +//d:Browser gotopane default text +//l:query_popup_data_pane_t1/opt4 +#define qtn_browser_goto_text_enter_address "Enter address" + +//d:Download already in progress info note. +//l:popup_note_window +//w: +//r:2.8 +// +#define qtn_browser_note_object_downloading "Downloading" + +//============================================================================= +// OSS Browser Support +//============================================================================= + +// ========================================================== +// Finding +// ========================================================== +//d: Browser Find main menu +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +// #define qtn_options_find "Find item" + +//d: Menu item for searching for a keyword +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +// +#define qtn_browser_find_keyword "Keyword" + +//d: Menu item for searching for a keyword +//l: list_single_pane_t1_cp2 +//w: +//r: 5.0 +// +#define qtn_browser_find_keyword_mm "Find Keyword" + +//d: Menu item for searching the next matching string in the page +//l: list_single_pane_t1_cp2 +//w: +//r:3.0 +// +#define qtn_browser_find_keyword_search_for_next "Search for next" + +//d: Menu item for searching the previous matching string in the page +//l: list_single_pane_t1_cp2 +//w: +//r:3.0 +// +#define qtn_browser_find_keyword_search_for_previous "Search for previous" + +//d: Tooltip shown when there were no matches of the search +//l: popup_preview_text_window/opt3 +//w: +//r:3.0 +// +#define qtn_browser_keyword_find_no_matches "No matches" + +//d: Tooltip shownwhen the search has reached the end of the page +//l: popup_preview_text_window/opt3 +//w: +//r:3.0 +// +#define qtn_browser_keyword_find_wraparound "Wraparound" + +//d: Tooltip shownwhen the search has reached the starting point +//l: popup_preview_text_window/opt3 +//w: +//r:3.0 +// +#define qtn_browser_keyword_find_all_content_searched "All the content searched" + +// ========================================================== +// Zooming +// ========================================================== + +//d: Browser zooming main menu +//l: list_single_pane_t1_cp2/opt3 +//w: +//r:3.0 +// +#define qtn_wml_option_zoom "Zoom" + +//d: Options menu list item for the new Zoom Mode. Options>View>Zoom +//l: list_single_popup_submenu_pane_t1 +//r: Browser 7.x +// +#define qtn_browser_list_zoom_mode "Zoom" + +//d: When zoom level of images change, new level is shown in title pane +//l: navi_navi_text_pane_t1 +//w: +//r:3.0 +// +#define qtn_browser_zoom_level "Zoom level: %U%" + +//d: Zoom levels displayed as zoom menu subitems +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_image_zoom_level "%U%" + + +//d: When zoom level of text change, new level is shown in title pane +//l: navi_navi_text_pane_t1 +//w: +//r:3.0 +// +#define qtn_browser_text_size "Text size: %U%" + +//d: When zoom level of text changes, new level is shown in tooltip +//l: popup_preview_text_window/opt3 +//w: +//r:3.1 +// +#define qtn_browser_text_size_tooltip "Text size: %U%" + +//d: When zoom level of images change, new level is shown in tooltip +//l: popup_preview_text_window/opt3 +//w: +//r:3.1 +// +#define qtn_browser_zoom_level_tooltip "Zoom level: %U%" + +//d: Tooltip that displays when the maximum zoom level has been reached +//l: popup_preview_text_window/opt3 +//r: 3.2.3, 5.0+, browser 7.x +// +#define qtn_browser_zoom_level_tooltip_maximum "Maximum zoom level" + +//d: Tooltip that displays when the minimum zoom level has been reached +//l: popup_preview_text_window/opt3 +//r: 3.2.3, 5.0+, browser 7.x +// +#define qtn_browser_zoom_level_tooltip_minimum "Minimum zoom level" + +//============================================================================= +// Multiple Windows Support +//============================================================================= + + +//d: menu item. Selecting this will open the current url link +//l: list_single_pane_t1_cp2 +//w: +//r:3.1 +// +#define qtn_browser_list_open_link_main "Open link" + + +//d: Submenu item. Selecting this will open the current url link in +//d: a new window +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +// +#define qtn_browser_list_open_in_new_window "Open link in new window" + +//d: Download main menu, contains download page menuitems. +//l: list_single_pane_t1_cp2/opt3 +//w: +//r:3.1 +// +#define qtn_browserbm_options_submenu_download "Download" + +//d: Selecting this will open the current url link. +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.1 +// +#define qtn_browserbm_options_download_page "Download page" + +//d: Selecting this will open the current url link in a new window. +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.1 +// +#define qtn_browserbm_options_download_in_new_window "Download page in new window" + +//d: Menu access to pop-ups submenu +//l: list_single_pane_t1_cp2/opt3 +//w: +//r:3.0 +// +#define qtn_browser_list_windows "Windows" + +//d: Opens a selection dialog which will allow the +//d: the user to switch between all open windows. +//d: Only shown if more than one window is opened. +//l: list_single_popup_submenu_pane_t1 +//r:3.0 +// +#define qtn_browser_list_switch_window "Windows" + +//d: Closes the current window. +//l: list_single_pane_t1_cp2 +//r:3.0 +// +#define qtn_browser_list_close_window "Close" + +//d: Submenu item. Selecting this item allows pop-up windows to be opened from +//d: the current webpage's domain. This applies to non-user initiated pop-ups. +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +// +#define qtn_browser_list_windows_allow "Allow pop-ups" + +//d: Submenu item. Selecting this item blocks pop-up windows being opened from +//d: the current webpage's domain. This applies to non-user initiated pop-ups. +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.0 +// +#define qtn_browser_list_windows_block "Block pop-ups" + +//d: The header for an option list dialog. The list contains +//d: all open windows, selection will make that window active. +//l: heading_pane_t1 +//r:3.0 +// +#define qtn_browser_query_switch_window_header "Switch to:" + +//d: A confirmation dialog responding to a user +//d: request to close the current window +//l: popup_note_window +//r:3.0 +// +#define qtn_browser_query_close_window "Close current window?" + +//d: A pop-up note to indicate to the user that the maximum number +//d: of popup windows allowed has been reached, no more may be opened +//l: popup_note_window +//w: +//r:3.0 +// +#define qtn_browser_note_pop_up_max_reached "Cannot open pop-up, maximum number reached." + +//d: An information note, indicating that a new window is being opened +//d: will be added to the whitelist +//l: popup_preview_text_window/opt3 +//r:3.0 +// +#define qtn_browser_note_pop_up_window_opened "Opening new window" + +//----------------------------------------------------------------------------- +// Settings for Multiple Windows +// +//d: Browser setting for enabling popup blocking +//l: list_setting_pane_t1 +//w: +//r:3.0 +// +#define qtn_brow_sett_pop_up_blocking "Pop-up blocking" + +//d: Selectable text for the Popup blocking setting +//d: Popup blocking is enabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_brow_sett_pop_up_blocking_on "Enabled" + +//d: Selectable text for the Popup blocking setting +//d: Popup blocking is disabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_brow_sett_pop_up_blocking_off "Disabled" + +// ========================================================== +// Subscribe to +// ========================================================== + +//d: Browser Subscribe to main menu +//l: list_single_pane_t1_cp2/opt3 +//w: +//r:3.0 +// +#define qtn_browser_list_subscribe_to "Subscribe to feeds" + +//----------------------------------------------------------------------------- +// Popup dialog - stored preference data +// + +//d: Tooltip note notifying the user that pop-ups have been disabled +//d: and indicating to the user that they must use the options menu +//d: to allow pop-ups for the current page +//l: popup_preview_text_window/opt3 +//w: +//r:3.0 +// +#define qtn_browser_multiple_windows_tooltip "Pop-up window was blocked. Pop-ups can be enabled from Options" + +//d:Text for RSS Folder in Bookmarks view. +//l:list_single_graphic_pane_t1 +//w: +//r:3.0 +// +#define qtn_apps_feeds_list "Web feeds" + +//---------------------------------------------------------------------------- +// Show Miniature +// + +//d:Menu item to show Thumbnail view of the currently visited page. +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_list_miniature_show_mini "Page overview" + +//-------------------------------------------------------------------------------- +// Smart Text recognition +// + +//d:Browser setting for smart link detection +//l:list_setting_pane_t1 +// +#define qtn_browsers_sett_smartlink "Smart text recognition" + +//d: Enables automatic detection of phone numbers and email addresses when scrolling +//l:list_set_graphic_pane_t1 +//w: +//r:3.2 +// +#define qtn_brow_sett_smartlink_on "On" + +//d: Disables Jutomatic detection of phone numbers and email addresses when scrolling +//l:list_set_graphic_pane_t1 +//w: +//r:3.2 +// +#define qtn_brow_sett_smartlink_off "Off" + + +//---------------------------------------------------------------------------- +// Page overview +// + +//d:Tooltip when the Page Overview is switched on by Shortcut key 7. +//l: popup_preview_text_window/opt3 +//w: +//r: 3.0 +// +#define qtn_browser_tooltip_page_overview_on "Mini map on" + +//d:Tooltip when the Page Overview is switched off by Shortcut key 7. +//l: popup_preview_text_window/opt3 +//w: +//r: 3.0 +// +#define qtn_browser_tooltip_page_overview_off "Mini map off" + +//----------------------------------------------------------------------------- +// Form Data Saving +// + +//d: Browser setting for Form data saving +//l: list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_form_data_saving "Form data saving" + +//d: Selectable text for the Form data saving setting +//d: Saving passwords is enabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_brow_sett_form_data_saving_on "Form and password data" + +//d: Selectable text for the Form data saving setting +//d: Saving passwords is disabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_brow_sett_form_data_saving_off "Off" + +//d: Selectable text for the Form data saving setting +//d: Saving passwords is disabled if this is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_brow_sett_form_data_saving_only "Form data only" + +//d:Clear history and Recent URLs query string +//l: popup_note_window +//w: +//r:3.1 +// +#define qtn_browser_privacy_query_clear_history "Clear history and recent URLs?" + + +//d:Delete Form Data and Password query string +//l:popup_note_window +//w: +//r:3.1 +// +#define qtn_browser_form_data_delete_all "Clear form and password data?" + +//d:Delete all privacy data query string +//l: popup_note_window +//w: +//r:3.1 +// +#define qtn_browser_privacy_delete_all "Clear all privacy data?" + + +//d:Delete Form Password Data query string +//l:popup_note_window +//w: +//r:3.1 +// +#define qtn_browser_form_data_delete_password "Clear password data?" +//---------------------------------------------------------------------------- +// Window selection +// + +//d:Menu item to selects the focused window. +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +// +#define qtn_browser_list_select_window "Select" + +//d:Menu item to close all windows except the current one. +//l:list_single_pane_t1_cp2 +//w: +//r:3.1 +// +#define qtn_browser_list_close_all_but_this "Close all but this window" + +//---------------------------------------------------------------------------- +// Web feeds settings +// + +//d: A list box item referring to settings categorised as Web Feeds +//d: When selected a settings list is displayed containing those settings +//l: list_single_large_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_fldr_feeds "Web feeds" + +//d: When the Web feeds Settings are opened, this should be displayed in the title pane +//l: title_pane_t2/opt9 +//w: +//r:3.1 +// +#define qtn_browsers_title_feeds "Web feeds settings" + +//d:Browser settings main list item texts for Automatic updating of web feeds +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_autoupdating "Automatic updating" + +//d: Selectable text for the Automatic updating setting +//d: If Off is selected, automatic updating does not occur +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_autoupdating_off "Off" + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done every 15 minutes +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_feeds_updating_interval_15min "Every 15 minutes" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done every hour +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_feeds_updating_interval_hourly "Every hour" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done every 4 hours +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_feeds_updating_interval_4hours "Every 4 hours" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done daily +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_feeds_updating_interval_daily "Every day" + + +//d: Selectable text for the Automatic updating setting +//d: Autoupdating is done weekly +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_feeds_updating_interval_weekly "Every week" + +//d:Browser settings main list item texts for Automatic updating of web feeds +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_browsers_sett_autoupdating_ap "Update via access point" + +//d:Browser settings main list item texts for Automatic updating of web feeds while roaming +//l: list_setting_pane_t1 +//w: +//r:3.2 +// +#define qtn_browsers_sett_autoupdating_roaming "Update while roaming" + +//d: Selectable text for the Automatic update setting while roaming +//d: If On is selected, automatic update happens even if the user is roaming +//l: list_set_graphic_pane_t1 +//w: +//r:3.2 +// +#define qtn_browsers_sett_val_autoupdating_roaming_on "On" + +//d: Selectable text for the Automatic update setting while roaming +//d: If Off is selected, automatic update does not occur while roaming +//l: list_set_graphic_pane_t1 +//w: +//r:3.2 +// +#define qtn_browsers_sett_val_autoupdating_roaming_off "Off" + +//d:Browser settings main list item texts +//l:popup_note_window +// + +#define qtn_browsers_sett_dataquery_autoupdate_ap "The access point has to be defined to enable automatic updating." + +//d: When the user enables automatic updating of feeds, a confirmation query is displayed to the user +//d: noting that turning the feature on may cost them money +//l: popup_note_window +//w: +//r:3.1 +// +#define qtn_browsers_sett_dataquery_autoupdatewarn "Enabling automatic updating may increase your monthly phone bill" +//d: Query user to close existing WML page when activating a link to a WML page +//d: from another window. Only one WML page can be opened at once. +//l: popup_note_window +//w: +//r:3.1 +// +#define qtn_browser_multiple_windows_wml "WML page in another window needs to be closed to proceed, close it?" + +//---------------------------------------------------------------------------- +// ToolBar Strings +// +//d: view sub menu item to show the toolbar +//l: list_single_popup_submenu_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_list_toolbar "Toolbar" +//d: Tooltip that is showns when the toolbar is activated via the Options menu +//l: popup_preview_text_window/opt3 +//w: +//r:3.1 +// +#define qtn_browser_tooltip_toolbar "Click an empty area of the page to show the toolbar" + + +//d:Browser settings main list item texts +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_sett_autoload_objects "Load content" + + +//d: Selectable text for the Load Content setting +//d: Only text is loaded if this option is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_sett_autoload_text "Text only" + + +//d: Selectable text for the Load Content setting +//d: Images are loaded if this option is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_sett_autoload_images_no_flash "Images no flash" + + +//d: Selectable text for the Load Content setting +//d: All content is loaded if this option is selected +//l: list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_browser_sett_autoload_all "All" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an anchor +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_list_show_address "Show address" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an image +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_save_image_to_gallery "Save to gallery" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an image +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_list_open_to_viewer "Open to viewer" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on a phone number +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_options_call "Call" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on a phone number +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_create_sms "Create text message" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on a phone number or e-mail +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_options_contacts "Add to contacts" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an e-mail +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_create_email "Create e-mail message" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an image placeholder +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_load_image "Load image" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an image placeholder +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_load_all_images "Load all images" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an image placeholder +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_enable_autoload_images "Enable images" + +//d: Label for stylus activated popup. +//d: Popup is shown when user taps on an image placeholder +//l: list_single_pane_t1_cp2 +//r: 3.2 +// +#define qtn_browser_enable_autoload_all "Enable images and flash" + + + +//d: Confirmation query shown before setting new home page +//l:popup_note_window +#define qtn_browser_query_set_as_home_page "Set as home page?" + + + +// ----------------------------------------------------------------- +// Toolbar related strings +// ----------------------------------------------------------------- + +//d: Tooltip that is showns when the toolbar is activated via the Options menu +//l: popup_preview_text_window/opt3 +//w: +//r:3.1 +// +#define qtn_browser_tooltip_toolbar "Click an empty area of the page to show the toolbar" + + + +// ----------------------------------------------------------------- +// Toolbar Button Command Settings Labels +// ----------------------------------------------------------------- + +//d: Toolbar Button 1 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button1 "Button 1" + +//d: Toolbar Button 2 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button2 "Button 2" + +//d: Toolbar Button 3 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button3 "Button 3" + +//d: Toolbar Button 4 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button4 "Button 4" + +//d: Toolbar Button 5 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button5 "Button 5" + +//d: Toolbar Button 6 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button6 "Button 6" + +//d: Toolbar Button 7 Command +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_toolbar_button7 "Button 7" + + +// ----------------------------------------------------------------- +// Toolbar Button Command Values +// ----------------------------------------------------------------- + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_show_keymap "Display key map" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_go_to_web_address "Go to web address" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_list_bookmarks "Bookmarks" //(toolbar only) + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_save_as_bookmark "Save as bookmark" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_recent_urls "Recent URLs" //(toolbar only) + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_find_keyword "Find keyword" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_reload "Reload" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_miniature_show "Page overview" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_previous_page "Back one page" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_go_to_hompage "Go to homepage" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_zoom_in "Zoom in" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_zoom_out "Zoom out" + +//d: Preferences for Zoom Mode: Options>Preferences>Shortcut keys>Key > Zoom Mode +//l: list_set_graphic_pane_t1 +//r: Browser 7.x +// +#define qtn_browser_setting_zoom_mode "Zoom Mode" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_settings "Settings" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_rotate_screen "Rotate screen" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_subscribe_to_feeds "Subscribe to feeds" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_manage_bookmarks "Manage bookmarks" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_visual_history "History" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_view_images "View images" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_save_page "Save page" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_send "Send" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_switch_window "Switch window" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_show_toolbar "Display toolbar" // (keymap only) + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_show_help "Help" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_none "None" + +//d: Toolbar button command Display Shortcut Keymap +//l: list_set_graphic_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_full_screen "Full screen" + +// ----------------------------------------------------------------- +// Toolbar Error Message +// ----------------------------------------------------------------- + +//d: Pop Up note if all toolbar buttons are set to "None" +//l: popup_note_window +//r: 5.0 +#define qtn_browser_setting_toolbar_save_dialog "You must assign a function to at least one of the toolbar buttons!" + + +// ----------------------------------------------------------------- +// Toolbar On/Off Setting Values +// ----------------------------------------------------------------- + +//d:Setting for Enabling or Disabling the Toolbar +//l: list_setting_pane_t1 +//r: 5.0 +#define qtn_browser_setting_toolbar_on_off "Toolbar On/Off" + +//d: Selectable text for the Toolbar On/Off setting +//l: set_value_pane_t1 +//r:5.0 +// +#define qtn_browser_setting_toolbar_on "On" + +//d: Selectable text for the Toolbar On/Off setting +//l: set_value_pane_t1 +//r:5.0 +// +#define qtn_browser_setting_toolbar_off "Off" + + +// ----------------------------------------------------------------- +// Toolbar Settings group label and title strings +// ----------------------------------------------------------------- +//d: Toolbar Settings group label +//l:list_single_graphic_pane_t1 +//r:5.0 +// +#define qtn_browser_setting_group_toolbar "Toolbar" + +//Toolbar Settings Group Title Pane +//l: title_pane_t2/opt9 +//r:5.0 +// +#define qtn_browser_setting_group_title_toolbar "Toolbar settings" + + +// ----------------------------------------------------------------- +// ShortCut Keys Settings group label and title strings +// ----------------------------------------------------------------- + +//Shortcut Keys Settings group label +//l:list_single_graphic_pane_t1 +//r:5.0 +// +#define qtn_browser_setting_group_shortcuts "Shortcut keys" + +//Shortcut Keys Settings Group Title Pane +//l: title_pane_t2/opt9 +//r:5.0 +// +#define qtn_browser_setting_group_title_shortcuts "Shortcut key settings" + + +// Shortcut Keys labels for settings + +//d: Shortcut key setting label for key "1" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key1 "1 Key" + +//d: Shortcut key setting label for key "2" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key2 "2 Key" + +//d: Shortcut key setting label for key "3" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key3 "3 Key" + +//d: Shortcut key setting label for key "4" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key4 "4 Key" + +//d: Shortcut key setting label for key "5" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key5 "5 Key" + +//d: Shortcut key setting label for key "6" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key6 "6 Key" + +//d: Shortcut key setting label for key "7" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key7 "7 Key" + +//d: Shortcut key setting label for key "8" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key8 "8 Key" + +//d: Shortcut key setting label for key "9" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key9 "9 Key" + +//d: Shortcut key setting label for key "0" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_key0 "0 Key" + +//d: Shortcut key setting label for key "*" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_starkey "* Key" + +//d: Shortcut key setting label for key "#" +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browser_setting_shortcuts_hashkey "# Key" + +//d:List of feeds to choose from . +//l:heading_pane_t1 +//r:5.0 +// +#define qtn_browser_subscribe_list "Subscribe to" + +//d: Options menu item for displaying the shortcut keymap in a browser submenu +//l: list_single_popup_submenu_pane_t1 +//r: 3.2.3, 5.0+ +#define qtn_browser_list_show_shortcut_keymap "Show Shortcut Keymap" + +//d: Options menu list item for displaying the shortcut keymap in the top level browser menu +//l: list_single_pane_t1_cp2 +//r: 3.2.3, 5.0+, browser 7.x +#define qtn_browser_list_main_show_shortcuts "Show shortcuts" + +//d:Command text associated to a softkey in the control pane. +//d:Configure Keymap functionality. +//l:control_pane_t1/opt7 +// +#define text_softkey_configure "Configure" + +// ----------------------------------------------------------------- +// ShortCut Keymap text strings +// ----------------------------------------------------------------- + +//d: Shortcut key function Display Keymap +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_show_keymap "Show Keymap" + +//d: Shortcut key function Go To Web Address +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_go_to_web_address "Go to Web Address" + +//d: Shortcut key function Save as bookmark +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_save_as_bookmark "Save as Bookmark" + +//d: Shortcut key function Find Keyword +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_find_keyword "Find Keyword" + +//d: Shortcut key function Reload +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_reload "Reload" + +//d: Shortcut key function Page Overview +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_miniature_show "Page Overview" + +//d: Shortcut key function Back One Page +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_previous_page "Back One Page" + +//d: Shortcut key function Go to Homepage +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_go_to_homepage "Go to Homepage" + +//d: Shortcut key function Zoom In +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_zoom_in "Zoom In" + +//d: Shortcut key function Zoom Out +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_zoom_out "Zoom Out" + +//d: Shortcut key function Zoom Mode +//l: cell_scut_pane +//r: Browser 7.x +// +#define qtn_browser_keymap_text_zoom_mode "Zoom Mode" + +//d: Shortcut key function Settings +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_settings "Settings" + +//d: Shortcut key function Rotate Screen +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_rotate_screen "Rotate Screen" + +//d: Shortcut key function Subscribe To Feeds +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_subscribe_to_feeds "Subscribe To Feeds" + +//d: Shortcut key function Manage Bookmarks +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_manage_bookmarks "Manage Bookmarks" + +//d: Shortcut key function History +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_visual_history "History" + +//d: Shortcut key function View Images +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_view_images "View Images" + +//d: Shortcut key function Save Page +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_save_page "Save Page" + +//d: Shortcut key function Switch Window +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_switch_window "Switch Window" + +//d: Shortcut key function Display Toolbar +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_show_toolbar "Display Toolbar" + +//d: Shortcut key function Help +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_show_help "Help" + +//d: Shortcut key function None +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_none "None" + +//d: Shortcut key function Full Screen +//l: cell_scut_pane +//r: 5.0 +// +#define qtn_browser_keymap_text_full_screen "Full Screen" + +// ----------------------------------------------------------------- +// Touch Toolbar Button strings +// ----------------------------------------------------------------- + +//--------------------------------- +// Main Toolbar Strings +//--------------------------------- +// Goto Address Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_gotoaddress_tt "Goto Address" + +// Show Zoom Slider Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_zoomshow_tt "Show Zoom Slider" + +// Hide Zoom Slider Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_zoomhide_tt "Hide Zoom Slider" + +//--------------------------------- +// Extended Toolbar Strings +//--------------------------------- +//d:Extended Toolbar Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_tt "Expand toolbar" + +//d:Bookmarks Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_bm "Bookmarks" + +//d:Bookmarks Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_bm_tt "Bookmarks" + +//d:Home Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_home "Home" + +//d:Home Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_home_tt "Home" + +//d:Settings Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_settings "Settings" + +//d:Settings Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_settings_tt "Settings" + + +//d:Save Bookmark Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_save_bookmark "Save Bookmark" + +//d:Save Bookmark Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_save_bookmark_tt "Save Bookmark" + + +//d:Find Keyword Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_find_keyword "Find Keyword" + +//d:Find Keyword Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_find_keyword_tt "Find Keyword" + +//d:Find Next Keyword Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_findnext_tt "Find Next" + +//d:Find Previous Keyword Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_findprevious_tt "Find Previous" + +//d:Navigate Back in History Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_history_back_tt "Back" + +//d:Navigate Forward in History Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_history_forward_tt "Forward" + +//d:Subscribe Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_subscribe_list "Subscribe" + +//d:Subscribe Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_subscribe_list_tt "Subscribe" + +//d:Reload Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_reload "Reload" + +//d:Reload Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_reload_tt "Reload" + +//d:Page Overview Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_miniature_show "Show Miniature" + +//d:Page Overview Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_miniature_show_tt "Show Miniature" + +//d:Help Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_help "Help" + +//d:Help Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_help_tt "Help" + +//d:Goto Address Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_gotoaddress "Goto Address" + +//d:Show Zoom Slider Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_zoomshow "Show Zoom Slider" + +//d:Full Screen Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_full_screen "Full Screen" + +//d:Full Screen Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_full_screen_tt "Full Screen" + +//d:Send Url Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_send_url "Send Url" + +//d:Send Url Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_send_url_tt "Send Url" +//d:Rotate Display Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_rotate "Rotate Display" + +//d:Rotate Display Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_rotate_tt "Rotate Display" + +//d:View Feeds Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_view_feeds "View Feeds" + +//d:View Feeds Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_view_feeds_tt "View Feeds" + +//d:Switch Window Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_ext_tb_switch_win "Switch Window" + +//d:Switch Window Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_ext_tb_switch_win_tt "Switch Window" + + +//--------------------------------- +// Bookmark Toolbar Strings +//--------------------------------- +//d:Add Bookmark Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_tb_add_bookmark "Add Bookmark" + +//d:Delete Button Label +//l:cell_tb_ext_pane_t1/opt1 +//r:5.0 +// +#define qtn_browser_tb_del_bookmark "Delete" + +// Add Bookmark Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_add_bookmark_tt "Add Bookmark" + +// Delete Button Tooltip +//l:popup_preview_text_window_t1 +//r:5.0 +// +#define qtn_browser_tb_del_bookmark_tt "Delete" + +// ----------------------------------------------------------------- +// Option menu sub-options +// ----------------------------------------------------------------- + +//d: "Go to" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_goto "Go to" + +//d: "Page Actions" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_pageactions "Page actions" + +//d: "Bookmark Actions" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_bmactions "Bookmark actions" + +//d: "Feeds Actions" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_feedsactions "Feeds actions" + +//d: "Edit" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_edit "Edit" + +//d: "Mark/Unmark" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_markunmark "Mark/Unmark" + +//d: "View" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_view "View" + +//d: "Clear" submenu access +//l: list_single_pane_t1_cp2/opt3 +//w: +//r: 5.0 +// +#define qtn_browser_options_clear "Clear" + +// ----------------------------------------------------------------- +// Go to sub-options +// ----------------------------------------------------------------- +//d: "Web feeds" menu item +//l: list_single_popup_submenu_pane_t1 +//w: +//r: 5.0 +// +#define qtn_browser_list_web_feeds "Web feeds" + +//d: "New web page" menu item +//l: list_single_popup_submenu_pane_t1 +//w: +//r: 5.0 +// +#define qtn_browser_list_new_web_page "New web page" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_next "Next Toolbar" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_back "Back" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_forward "Forward" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_pageoverview "Page Overview" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_reload "Reload" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_findkeyword "Find Keyword" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_home "Home" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_subscribe "subscribe" + +//d: Tooltip for toolbar button +//l: popup_preview_text_window/opt3 +//w: +//r: 3.2 +#define qtn_browser_toolbar_tooltip_go "Go" + +//d: List of feeds to choose from . +//l: heading_pane_t1 +// +#define qtn_browser_toolbar_subscribe_header "Select to subscribe" + +//d: Confirmation query shown before setting new home page +//l:popup_note_window +// +#define qtn_browser_query_set_as_home_page "Set as home page?" + +// ----------------------------------------------------------------- +// View sub-options +// ----------------------------------------------------------------- +//d: Full Screen menu item +//l: list_single_popup_submenu_pane_t1 +//w: +//r: 5.0 +// +#define qtn_browser_list_full_screen_enter "Full Screen" + +// ----------------------------------------------------------------- +// Search strings +// ----------------------------------------------------------------- +//d: Left softkey: (accept typing and activate search application) +//l: control_pane_t1/opt7 +//r: 5.0 +// +#define qtn_is_softkey_search "Search" +//d: Search second level options menu text +//l: list_single_popup_submenu_pane_t1 +//w: +//r: 5.0 +// +#define qtn_is_list_search "Search" +//d: Tooltip for go to/search icon +//l: popup_preview_text_window_t1 +//r: 5.0 +// +#define qtn_is_tooltip_goto_search "Go to web page or search" +//d: settings view menu item +//l: list_setting_pane_t1 +//r: 5.0 +// +#define qtn_browsers_sett_web_search_provider "Web search provider" +//d: setting text when it is not defined +//l: set_value_pane_t1 +//r: 5.0 +// +#define qtn_is_label_not_selected "Not selected" +//d: search editor default text +//l: query_popup_data_pane_t1/opt4 +//r: 5.0 +// +#define qtn_is_web_search "Web search" +// ----------------------------------------------------------------- +// Service strings +// ----------------------------------------------------------------- +//d: Here and now bookmark list item +//l: list_single_graphic_pane_t1 +//r: 5.0 +// +#define qtn_is_recommendations "Here and Now" + +//d: Confirmation to install add-on browser +//l: popup_note_window +//r: 7.2 +#define qtn_install_addon_browser "A new browser is available. Would you like to install it?" +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project build file for Browser UI +* +*/ + + +/* +* Order is important +*/ +#include "../browser/group/bld.inf" +#include "../operatormenu/group/bld.inf" +#include "../videoservices/group/bld.inf" + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/aif/OperatorMenuaif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/aif/OperatorMenuaif.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource file for creating AIF +* +*/ + + +#include + +RESOURCE AIF_DATA + { + app_uid=0x10008D5E; + num_icons=2; + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/aif/qgn_menu_operator_cxt.bmp Binary file browserui/operatormenu/aif/qgn_menu_operator_cxt.bmp has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/aif/qgn_menu_operator_cxt_mask.bmp Binary file browserui/operatormenu/aif/qgn_menu_operator_cxt_mask.bmp has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/aif/qgn_menu_operator_lst.bmp Binary file browserui/operatormenu/aif/qgn_menu_operator_lst.bmp has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/aif/qgn_menu_operator_lst_mask.bmp Binary file browserui/operatormenu/aif/qgn_menu_operator_lst_mask.bmp has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/cenrep/keys_operatormenu.xls Binary file browserui/operatormenu/cenrep/keys_operatormenu.xls has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/conf/operatormenu.confml Binary file browserui/operatormenu/conf/operatormenu.confml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/conf/operatormenu_10008D5E.crml Binary file browserui/operatormenu/conf/operatormenu_10008D5E.crml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/data/OperatorMenu_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/data/OperatorMenu_caption.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Caption file for OperatorMenu +* +*/ + + +#include "operatormenu.loc" +#include + +RESOURCE CAPTION_DATA +{ + caption=qtn_apps_operator_list; + shortcaption=qtn_apps_operator_grid; +} diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/data/OperatorMenu_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/data/OperatorMenu_reg.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RSS for registration file for OperatorMenu. +* +*/ + + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10008D5E + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "OperatorMenu"; + + localisable_resource_file = APP_RESOURCE_DIR"\\OperatorMenu"; + + localisable_resource_id = R_OPERATORMENU_LOCALISABLE_APP_INFO; + embeddability=KAppNotEmbeddable; + newfile = KAppDoesNotSupportNewFile; + } + + + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/data/operatormenu.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/data/operatormenu.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Operatormenu resource file +* +*/ + + +// RESOURCE IDENTIFIER +NAME OPME // For operator menu + +// INCLUDES + +#include +#include "operatormenu.hrh" +#include +#include +#include +#include +#include +#include +#include + + +// CONSTANTS + +// MACROS + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="OperatorMenu"; } + +RESOURCE EIK_APP_INFO + { + hotkeys=r_operatormenu_hotkeys; + menubar=r_operatormenu_menubar; + cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + + + +//---------------------------------------------------- +// +// r_operatormenu_localisable_app_info +// ?description +// +//---------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_operatormenu_localisable_app_info + { + short_caption = qtn_apps_operator_grid; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_apps_operator_list; + +#ifdef __SCALABLE_ICONS + number_of_icons = 1; + icon_file = + APP_RESOURCE_DIR"\\operatorMenu_aif.mif"; +#else + number_of_icons = 2; + + icon_file = + APP_RESOURCE_DIR"\\operatormenu_aif.mbm"; + +#endif // __SCALABLE_ICONS + }; + } + + +//---------------------------------------------------- +// +// r_operatormenu_hotkeys +// Hotkeys for operator menu +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_operatormenu_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + +//---------------------------------------------------- +// +// r_operatormenu_menubar +// MenuBar for operator menu (only the exit item) +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_operatormenu_menubar + { + titles= + { + MENU_TITLE { menu_pane=R_AVKON_MENUPANE_EXIT; } + }; + } + + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/group/OperatorMenu.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/group/OperatorMenu.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file for OperatorMenu +* +*/ + +#include +#include +#include + +TARGET OperatorMenu.exe +TARGETTYPE exe + +UID 0x100039CE 0x10008D5E +TARGETPATH /system/apps/OperatorMenu + +epocstacksize 0x5000 + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE OperatorMenuApp.cpp +SOURCE OperatorMenuAppUi.cpp +SOURCE OperatorMenuDocument.cpp + +START RESOURCE ../data/Operatormenu.rss +DEPENDS avkon.rsg +HEADER +TARGETPATH APP_RESOURCE_DIR +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +END + +START RESOURCE ../data/Operatormenu_reg.rss +DEPENDS operatormenu.rsg +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + +USERINCLUDE . ../inc + +SYSTEMINCLUDE . +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY browserlauncher.lib +LIBRARY CentralRepository.lib +LIBRARY FeatMgr.lib + +START WINS +// ?wins_specific_information +END + +START MARM +// ?marm_specific_information +END + +// DEFFILE ?filename + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build information file +* +* +*/ + +#include +#include +#include "../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +PRJ_PLATFORMS + +DEFAULT + +// Help exports +#include "../help/group/bld.inf" + +PRJ_EXPORTS +../rom/operatormenu.iby CORE_APP_LAYER_IBY_EXPORT_PATH(operatormenu.iby) +../rom/OperatorMenuResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(OperatorMenuResources.iby) +../loc/operatormenu.loc APP_LAYER_LOC_EXPORT_PATH(operatormenu.loc) + +../conf/operatormenu.confml APP_LAYER_CONFML(operatormenu.confml) +../conf/operatormenu_10008D5E.crml APP_LAYER_CRML(operatormenu_10008D5E.crml) + +#ifdef __SERIES60_32__ + +PRJ_MMPFILES + +#ifdef __SCALABLE_ICONS + gnumakefile opmenuaifsvgiconsdc.mk +#else + gnumakefile opmenuaificonsdc.mk +#endif + +./OperatorMenu.mmp + +#else + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE operatormenu_aif.mif +OPTION SOURCES -c8,8 qgn_menu_operator +END + +PRJ_MMPFILES +./OperatorMenu.mmp + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/group/opmenuaificons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/group/opmenuaificons.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,68 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\SYSTEM\APPS\OPERATORMENU +ICONTARGETFILENAME=$(TARGETDIR)\operatormenu_aif.mbm + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_operator_cxt.bmp\ + /c8,8 qgn_menu_operator_lst.bmp + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/group/opmenuaificonsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/group/opmenuaificonsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,68 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\operatormenu_aif.mbm + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_operator_lst.bmp \ + /c8,8 qgn_menu_operator_cxt.bmp + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/group/opmenuaifsvgicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/group/opmenuaifsvgicons.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\SYSTEM\APPS\OPERATORMENU +ICONTARGETFILENAME=$(TARGETDIR)\operatormenu_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_operator.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/group/opmenuaifsvgiconsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/group/opmenuaifsvgiconsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\operatormenu_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_operator.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/help/data/xhtml.zip Binary file browserui/operatormenu/help/data/xhtml.zip has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/help/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* Export help related files. +* +*/ + +#include +#include "../../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +#if !defined(__PLATFORM_VERSION_32__) && !defined(__PLATFORM_VERSION_5250__) && !defined(__PLATFORM_VERSION_S60_50__) + +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/ope.hlp.hrh APP_LAYER_PLATFORM_EXPORT_PATH(csxhelp/ope.hlp.hrh) +../rom/operatormenuhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(operatormenuhelps_variant.iby) + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/help/inc/ope.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/help/inc/ope.hlp.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,14 @@ +// +// ope.hlp.hrh +// + +// +// File generated by CSXHelp Utilities on 2009-04-17 +// + +#ifndef __OPE_HLP_HRH__ +#define __OPE_HLP_HRH__ + +_LIT(KOPERATOR_HLP_OPTIONS_LIST, "OPERATOR_HLP_OPTIONS_LIST"); // + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/help/rom/operatormenuhelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/help/rom/operatormenuhelps_variant.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for Operatormenu Help +* +*/ + +#ifndef __OPERATORMENUHELPS_VARIANT_IBY__ +#define __OPERATORMENUHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) && defined(__OPERATORMENU_USED) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D5E\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D5E\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D5E\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D5E\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D5E\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D5E\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D5E\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D5E\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/inc/OperatorMenuApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/inc/OperatorMenuApp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for COperatorMenuApp +* +*/ + + +#ifndef OPERATORMENUAPP_H +#define OPERATORMENUAPP_H + +// INCLUDES +#include + +// CONSTANTS +// UID of the application +const TUid KUidOperatorMenu = { 0x10008D5E }; + +// CLASS DECLARATION + +/** +* COperatorMenuApp application class. +* Provides factory to create concrete document object. +* +*/ +class COperatorMenuApp : public CAknApplication + { + + private: //From base class + + /** + * From CApaApplication, creates COperatorMenuDocument document object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication, returns application's UID (KUidOperatorMenu). + * @return The value of KUidOperatorMenu. + */ + TUid AppDllUid() const; + }; + +#endif + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/inc/OperatorMenuAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/inc/OperatorMenuAppUi.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for COperatorMenuAppUi +* +*/ + + +#ifndef OPERATORMENUAPPUI_H +#define OPERATORMENUAPPUI_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "OperatorMenuPrivateCRKeys.h" +#include //KFavouritesMaxUrl +#include + +// CONSTANTS +const TUid KUidBrowserApplication = { 0x10008d39 }; //Browser UID +const TUid KUidCacheManager = { 0x101f8557 }; //Cache manager UID +_LIT( KBrowserPath, "Z:\\system\\apps\\Browser\\Browser.app" ); //Browser path + +// FORWARD DECLARATIONS +class COperatorMenuContainer; +class COperatorMenuAppUi; + +// CLASS DECLARATION + +/** +* Class responsible for delayed browser lunching. +* +* @since Series 60 2.0 +*/ +class COperatorDelayedStarter : public CActive +{ +public: + COperatorDelayedStarter(COperatorMenuAppUi* aOperatorMenuAppUi); + ~COperatorDelayedStarter(); + //Start() puts the class to the active scheduler + void Start(); + // From CActive + void RunL(); + void DoCancel(); +private: + COperatorMenuAppUi* iOperatorMenuAppUi; +}; +/** +* Application UI class. +* Provides support for the EIKON control architecture +* +* @since Series 60 2.0 +*/ +class COperatorMenuAppUi : public CAknAppUi, + public MDownloadedContentHandler, + MApaEmbeddedDocObserver + { + public: // Constructors and destructor + + /** + * Default Constructor + */ + COperatorMenuAppUi(); + + /** + * Destructor. + */ + ~COperatorMenuAppUi(); + + public: // New functions + + public: // From MDownloadedContentHandler + /** + * Handle downloaded content that has been saved to a file, + * and return ETrue if it was handled successfully. + * @param aFileName File name with path. + * @param aParamList Generic parameter list. + * @param aContinue Output parameter: It must be ETrue if the caller wants + * Browser not to terminate after the content is handled. + * @return ETrue if the implementer has processed the content. If it is + * EFalse, BrowserLauncher opens that content in an + * appropriate viewer application. + */ + TBool HandleContentL( const TDesC& aFileName, const CAiwGenericParamList& aParamList, TBool& aContinue ); + + /** + * Reserved for future use. + */ + TAny* DownloadedContentHandlerReserved1( TAny* aAnyParam ); + + private: + /** + * EPOC Default Constructor + */ + void ConstructL(); + + /** + * From CEikAppUi, takes care of command handling. + * @param aCommand command to be handled + */ + void HandleCommandL( TInt aCommand ); + + /** + * From CEikAppUi, handles key events. + * @param aKeyEvent Event to handled. + * @param aType Type of the key event. + * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). + */ + virtual TKeyResponse HandleKeyEventL( + const TKeyEvent& aKeyEvent,TEventCode aType ); + + private: //From MApaEmbeddedDocObserver + /** + * From MApaEmbeddedDocObserver, observes when the + * embedded browser exits + * @param aMode The browser exit mode (ignored in OperatorMenu) + */ + void NotifyExit( TExitMode aMode ); + + private: //New functions + /** + * Launches browser with operator specific url as start page + * @since Series 60 2.0 + */ + void LaunchBrowserEmbeddedWithOperatorUrlL(); + + /** + * Launches browser in embedded mode with the default + * Access Point's homepage as start page + * @since Series 60 2.0 + */ + void LaunchBrowserEmbeddedWithDefaultAPHomepageL(); + public: + /** + * Launches the browser according to the available parameters + * ( operator specific url ) + * @since Series 60 2.0 + */ + void LaunchBrowserL(); + + public: // Functions from MEikStatusPaneObserver + + /** + * Handles status pane size change. + */ + void HandleStatusPaneSizeChange(); + + private: //Data + + //OperatorMenu App view container (not shown in final App) + COperatorMenuContainer* iAppContainer; + + // Access central repository of HttpCacheManager + CRepository* iRepository; + + // Access central repository of OperatorMenu + CRepository* iRepositoryOp; + + //Buffer where the url is read + TBuf iUrl; + + //settings to override + TBrowserOverriddenSettings *iOverriddenSettings; + + TBool iLaunched; + COperatorDelayedStarter* iDelayedStarter; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/inc/OperatorMenuDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/inc/OperatorMenuDocument.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for COperatorMenuDocument +* +*/ + +#ifndef OPERATORMENUDOCUMENT_H +#define OPERATORMENUDOCUMENT_H + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CEikAppUi; + +// CLASS DECLARATION + +/** +* COperatorMenuDocument application class. +*/ +class COperatorMenuDocument : public CAknDocument + { + public: // Constructor and destructor + /** + * Two-phased constructor. + * @param aApp Application instance + * @since Series 60 2.0 + */ + static COperatorMenuDocument* NewL( CEikApplication& aApp ); + + /** + * Destructor. + */ + ~COperatorMenuDocument(); + + private: + + /** + * Default constructor. + * @param aApp Application instance + */ + COperatorMenuDocument( CEikApplication& aApp ); + + /** + * Epoc Constructor + */ + void ConstructL(); + + private: + + /** + * From CEikDocument, create COperatorMenuAppUi "App UI" object. + */ + CEikAppUi* CreateAppUiL(); + }; + +#endif + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/inc/OperatorMenuPrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/inc/OperatorMenuPrivateCRKeys.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef OPERATORMENUPRIVATECRKEYS_H +#define OPERATORMENUPRIVATECRKEYS_H + +const TUid KCrUidOperatorMenu = {0x10008D5E}; + +// Vertical layout enabled in browserui when it is started +// from operator menu( 0 not enabled 1 enabled) +const TUint32 KOpMenuVerticalLayoutEnabled = 0x0000001; + +// Autoload images enabled in browserui when it is started +// from operator menu( 0 not enabled 1 enabled) +const TUint32 KOpMenuAutoLoadImages = 0x0000002; + +// Sets the font size for the browser ui when it is started +// from operator menu (values 0"All Large",1 "Large",2 "Normal",3 "Small", 4 "All Small") +const TUint32 KOpMenuFontSize = 0x0000003; + +// Full screen enabled in browserui when it is started from +// operator menu(1"Softkeys Only", 2 "Full Screen") +const TUint32 KOpMenuFullScreen = 0x0000004; + +// Custom access point provided by the operator. If specified, +// contains an id of a read only access point what is then set +// as default and it cannot be changed manually. If not defined, +// operator menu works as before. +// from operator menu( 0 - not specified, otherwise contains the access point id) +const TUint32 KOpMenuDefAp = 0x0000005; + +#endif // OPERATORMENUPRIVATECRKEYS_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/inc/operatormenu.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/inc/operatormenu.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declarations of constants of OperatorMenu +* +*/ + + +#ifndef OPERATORMENU_HRH +#define OPERATORMENU_HRH + + +#endif // OPERATORMENU_HRH diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/loc/operatormenu.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/loc/operatormenu.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: localisation strings for Operator menu +* +*/ + + +// LOCALISATION STRINGS + +//d:Caption strings for operator Menu in list view +//l:list_single_large_graphic_pane_t1 +//w: +//r: +// +#define qtn_apps_operator_list "Operator menu" + +//d:Caption strings for Operator Menu in list view +//l:cell_app_pane_t1 +//w: +//r: +// +#define qtn_apps_operator_grid "Operator menu" + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/rom/OperatorMenuResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/rom/OperatorMenuResources.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for those parts of Operatormenu that needs localization +* +*/ + + +#ifndef __OPERATORMENU_RESOURCES_IBY__ +#define __OPERATORMENU_RESOURCES_IBY__ + +S60_APP_CAPTION(Operatormenu) +S60_APP_RESOURCE(Operatormenu) +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/rom/operatormenu.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/rom/operatormenu.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for Operatormenu +* +*/ + + +#ifndef __OPERATORMENU_IBY__ +#define __OPERATORMENU_IBY__ + +#ifdef __OPERATOR_MENU +S60_APP_EXE(Operatormenu) +S60_APP_AIF_ICONS(Operatormenu) +S60_UPGRADABLE_APP_REG_RSC(Operatormenu) +#endif + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/src/OperatorMenuApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/src/OperatorMenuApp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: COperatorMenuApp Implementation +* +*/ + + +// INCLUDE FILES +#include "OperatorMenuApp.h" +#include "OperatorMenuDocument.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +LOCAL_C CApaApplication* NewApplication() + { + return new COperatorMenuApp; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + +// --------------------------------------------------------- +// COperatorMenuApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------- +// +TUid COperatorMenuApp::AppDllUid() const + { + return KUidOperatorMenu; + } + + +// --------------------------------------------------------- +// COperatorMenuApp::CreateDocumentL() +// Creates COperatorMenuDocument object +// --------------------------------------------------------- +// +CApaDocument* COperatorMenuApp::CreateDocumentL() + { + return COperatorMenuDocument::NewL( *this ); + } +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/src/OperatorMenuAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/src/OperatorMenuAppUi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,406 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: COperatorMenuAppUi implementation +* +*/ + + +// INCLUDE FILES +#include "OperatorMenuAppUi.h" + +#include +#include +#include + +#include +#include +// CONSTANTS +_LIT(KUrlLaunchParameter, "4 "); +_LIT(KLongZeroLaunchParameter, "5"); +const TInt KUrlLaunchParamLength = 2; + +const TInt KCenRepBufferSize = 255; +const TText KStrComma = ','; +#define KOperatorMenuUID 0x10008D5E + +// ================= LOCAL FUNCTIONS ======================== + +// ---------------------------------------------------------------------------- +// OperatorMenuUIDText +// +// @param aOperatorMenuUid buffer to set OperatorMenu UID as text +// ---------------------------------------------------------------------------- +// +void OperatorMenuUIDText( TDes& aOperatorMenuUid ) + { + // TUid method name return UID in format [UID], but we need only UID part. + TUidName uidName( TUid::Uid( KOperatorMenuUID ).Name() ); + aOperatorMenuUid.Copy( uidName.Mid( 1, KMaxUidName - 2 ) ); + aOperatorMenuUid.UpperCase(); + } + +// ---------------------------------------------------------------------------- +// SetOperatorMenuHiddenInAppShellL +// +// @param aHidden Whether OperatorMenu should be hidden +// ---------------------------------------------------------------------------- +// +void SetOperatorMenuHiddenInAppShellL( TBool aHidden ) + { + CRepository* appShellRepository = CRepository::NewL( KCRUidMenu ); + CleanupStack::PushL( appShellRepository ); + + // Read current value of the app shell hidden apps key + TBuf keyContent; + TInt err = appShellRepository->Get( KMenuHideApplication, keyContent ); + if ( err != KErrNone ) + { + User::Leave( err ); + } + + TBool updated( EFalse ); + + TBuf<8> OperatorMenuUid; + OperatorMenuUIDText( OperatorMenuUid ); + + // Search for PoC uid in the content (ignore case) + TInt offset = keyContent.FindC( OperatorMenuUid ); + if ( offset == KErrNotFound && aHidden ) + { + // PoC is not in the list but should be + // + __ASSERT_ALWAYS( keyContent.Length() + 9 < KCenRepBufferSize, + User::Leave( KErrOverflow ) ); + if ( keyContent.Length() > 0 ) + { + keyContent.Append( KStrComma ); + } + keyContent.Append( OperatorMenuUid ); + updated = ETrue; + } + else if ( offset != KErrNotFound && !aHidden ) + { + // PoC is in the list but shouldn't be + // + if ( offset == 0 ) + { + // Delete PoC uid and following comma (if any) + keyContent.Delete( 0, Min( 9, keyContent.Length() ) ); + updated = ETrue; + } + else if ( keyContent[offset - 1] == ',' ) + { + // Delete PoC uid and preceding comma + keyContent.Delete( offset - 1, 9 ); + updated = ETrue; + } + else + { + User::Leave( KErrCorrupt ); + } + } + + if ( updated ) + { + err = appShellRepository->Set( KMenuHideApplication, keyContent ); + if ( err != KErrNone ) + { + User::Leave( err ); + } + } + + CleanupStack::PopAndDestroy( appShellRepository ); + } + +// ---------------------------------------------------------- +// COperatorDelayedStarter::COperatorDelayedStarter(COperatorMenuAppUi* aOperatorMenuAppUi) +// ---------------------------------------------------------- +// +COperatorDelayedStarter::COperatorDelayedStarter(COperatorMenuAppUi* aOperatorMenuAppUi) +: CActive( EPriorityLow ) + { + CActiveScheduler::Add( this ); + iOperatorMenuAppUi = aOperatorMenuAppUi; + } + +// ---------------------------------------------------------- +// COperatorDelayedStarter::~COperatorDelayedStarter() +// ---------------------------------------------------------- +// +COperatorDelayedStarter::~COperatorDelayedStarter() + { + Cancel(); + Deque(); + } + +// ---------------------------------------------------------- +// COperatorDelayedStarter::Start() +// ---------------------------------------------------------- +// +void COperatorDelayedStarter::Start() + { + SetActive(); + TRequestStatus* reqStat= &iStatus; + User::RequestComplete( reqStat, KErrNone ); + } + +// ---------------------------------------------------------- +// COperatorDelayedStarter::RunL() +// ---------------------------------------------------------- +// +void COperatorDelayedStarter::RunL() + { + iOperatorMenuAppUi->LaunchBrowserL(); + } + +// ---------------------------------------------------------- +// COperatorDelayedStarter:: +// ---------------------------------------------------------- +// +void COperatorDelayedStarter::DoCancel() + { + } + +// ================= MEMBER FUNCTIONS ======================= +// + +// ---------------------------------------------------------- +// COperatorMenuAppUi::COperatorMenuAppUi() +// ---------------------------------------------------------- +// +COperatorMenuAppUi::COperatorMenuAppUi() + { + } + +// ---------------------------------------------------------- +// COperatorMenuAppUi::ConstructL() +// ---------------------------------------------------------- +// +void COperatorMenuAppUi::ConstructL() + { + BaseConstructL(/* ENoScreenFurniture |*/ ENonStandardResourceFile /*| ENoAppResourceFile | EAknEnableSkin*/ ); + + // Connect to HttpCacheManager central repository + iRepository = CRepository::NewL( KCRUidCacheManager ); + // Connect to OperatorMenu central repository + iRepositoryOp = CRepository::NewL( KCrUidOperatorMenu ); + + //Launch the browser with the Operator specific Url + //or with default AP's homepage if Operator domain url not available + //LaunchBrowserL(); + iLaunched = EFalse; + + TBool OperatorMenuSupport = FeatureManager::FeatureSupported( KFeatureIdOperatorMenu ); + if ( OperatorMenuSupport ) + { + iDelayedStarter = new (ELeave) COperatorDelayedStarter( this ); + iDelayedStarter->Start(); + } + else + { + SetOperatorMenuHiddenInAppShellL( ETrue ); + Exit(); + } + } +// ---------------------------------------------------- +// COperatorMenuAppUi::~COperatorMenuAppUi() +// ---------------------------------------------------- +// +COperatorMenuAppUi::~COperatorMenuAppUi() + { + delete iRepository; + delete iRepositoryOp; + + if( iOverriddenSettings ) + { + delete iOverriddenSettings; + iOverriddenSettings = NULL; + } + if( iDelayedStarter ) + { + delete iDelayedStarter; + iDelayedStarter = NULL; + } + } + + +// ---------------------------------------------------- +// COperatorMenuAppUi::HandleKeyEventL( +// ---------------------------------------------------- +// +TKeyResponse COperatorMenuAppUi::HandleKeyEventL( + const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/ ) + { + return EKeyWasNotConsumed; + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::HandleCommandL(TInt aCommand) +// ---------------------------------------------------- +// +void COperatorMenuAppUi::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EAknSoftkeyBack: + case EAknSoftkeyExit: + case EEikCmdExit: + case EAknCmdExit: + { + Exit(); + break; + } + default: + break; + } + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::HandleContentL +// Handles the content coming from the embedded browser. +// Returns EFalse: content will be passed on to framework +// ---------------------------------------------------- +// +TBool COperatorMenuAppUi::HandleContentL( const TDesC& /*aFileName*/, const CAiwGenericParamList& /*aParamList*/, TBool& aContinue ) + { + aContinue = EFalse; + return EFalse; + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::DownloadedContentHandlerReserved1 +// ( Reserved for future use ) +// ---------------------------------------------------- +// +TAny* COperatorMenuAppUi::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ) + { + // Empty implementation. + return NULL; + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::LaunchBrowserL() +// ---------------------------------------------------- +// +void COperatorMenuAppUi::LaunchBrowserL() + { + TBool LaunchWithUrl( EFalse ); + TInt value; + + if( !iLaunched ) + { + iLaunched = ETrue; + + //If centralrepository of HttpCahemanager is available... + if ( iRepository ) + { + // Read the URL from CacheManager central repository + if ( KErrNone == iRepository->Get( KOperatorDomainUrl, iUrl ) ) + { + LaunchWithUrl = ETrue; + } + } + + //If centralrepository of OperatorMenu is available... + if ( iRepositoryOp ) + { + delete iOverriddenSettings; + iOverriddenSettings = NULL; + + iOverriddenSettings = new (ELeave) TBrowserOverriddenSettings; + + //Read the values to override + if ( KErrNone == iRepositoryOp->Get( KOpMenuVerticalLayoutEnabled, value ) ) + { + iOverriddenSettings->SetBrowserSetting( EBrowserOverSettingsSmallScreen, (TUint) value); + } + if ( KErrNone == iRepositoryOp->Get( KOpMenuAutoLoadImages, value ) ) + { + iOverriddenSettings->SetBrowserSetting( EBrowserOverSettingsAutoLoadImages, (TUint) value); + } + if ( KErrNone == iRepositoryOp->Get( KOpMenuFontSize, value ) ) + { + iOverriddenSettings->SetBrowserSetting( EBrowserOverSettingsFontSize, (TUint) value); + } + if ( KErrNone == iRepositoryOp->Get( KOpMenuFullScreen, value ) ) + { + iOverriddenSettings->SetBrowserSetting( EBrowserOverSettingsFullScreen, (TUint) value); + } + if ( KErrNone == iRepositoryOp->Get( KOpMenuDefAp, value ) ) + { + iOverriddenSettings->SetBrowserSetting( EBrowserOverSettingsCustomAp, (TUint) value); + } + } + } + + // Launch browser according to the given launch type + if( LaunchWithUrl && iUrl.Length() ) + { + LaunchBrowserEmbeddedWithOperatorUrlL(); + } + else + { + LaunchBrowserEmbeddedWithDefaultAPHomepageL(); + } + Exit(); + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::LaunchBrowserEmbeddedWithUrlL +// ---------------------------------------------------- +// +void COperatorMenuAppUi::LaunchBrowserEmbeddedWithOperatorUrlL() + { + //Pass the operator specific url to browser + //(read from cachemanager ini file in LaunchBrowserL) + HBufC* url = NULL; + url = HBufC::NewLC( iUrl.Length() + KUrlLaunchParamLength ); + url->Des().Append( KUrlLaunchParameter ); + url->Des().Append( iUrl ); + + CBrowserLauncher* launcher = CBrowserLauncher::NewLC(); + + launcher->LaunchBrowserSyncEmbeddedL( url->Des(), this, iOverriddenSettings ); + + CleanupStack::PopAndDestroy(); //Launcher + CleanupStack::PopAndDestroy(); // url HBufC + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::NotifyExit +// ---------------------------------------------------- +// +void COperatorMenuAppUi::NotifyExit(TExitMode /*aMode*/) + { + } + +void COperatorMenuAppUi::LaunchBrowserEmbeddedWithDefaultAPHomepageL() + { + //Start the browser with parameter "5" to launch to default AP homepage + CBrowserLauncher* launcher = CBrowserLauncher::NewLC(); + + launcher->LaunchBrowserSyncEmbeddedL( KLongZeroLaunchParameter, this, iOverriddenSettings ); + + CleanupStack::PopAndDestroy(); + } + +// ---------------------------------------------------- +// COperatorMenuAppUi::HandleStatusPaneSizeChange +// ---------------------------------------------------- +// +void COperatorMenuAppUi::HandleStatusPaneSizeChange() + { + } +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/operatormenu/src/OperatorMenuDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/operatormenu/src/OperatorMenuDocument.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: COperatorMenuDocument implementation +* +*/ + + +// INCLUDE FILES +#include "OperatorMenuDocument.h" +#include "OperatorMenuAppUi.h" + +// ================= MEMBER FUNCTIONS ======================= + +// constructor +COperatorMenuDocument::COperatorMenuDocument( CEikApplication& aApp ) +: CAknDocument( aApp ) + { + } + +// destructor +COperatorMenuDocument::~COperatorMenuDocument() + { + } + +// EPOC default constructor can leave. +void COperatorMenuDocument::ConstructL() + { + } + +// Two-phased constructor. +COperatorMenuDocument* COperatorMenuDocument::NewL( CEikApplication& aApp ) + { + COperatorMenuDocument* self = new ( ELeave ) COperatorMenuDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------- +// COperatorMenuDocument::CreateAppUiL() +// constructs COperatorMenuAppUi +// ---------------------------------------------------- +// +CEikAppUi* COperatorMenuDocument::CreateAppUiL() + { + return new (ELeave) COperatorMenuAppUi; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/aif/VideoServicesaif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/aif/VideoServicesaif.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource file for creating AIF +* +*/ + + +#include + +RESOURCE AIF_DATA + { + app_uid=0x10281893; + num_icons=1; + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/cenrep/keys_videoservices.xls Binary file browserui/videoservices/cenrep/keys_videoservices.xls has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/conf/videoservices.confml Binary file browserui/videoservices/conf/videoservices.confml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/conf/videoservices_10281893.crml Binary file browserui/videoservices/conf/videoservices_10281893.crml has changed diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/data/VideoServices.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/data/VideoServices.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VideoServices resource file +* +*/ + + +// RESOURCE IDENTIFIER +NAME VIDS // For video Services + +// INCLUDES + +#include +#include "VideoServices.hrh" +#include "videoservices.loc" +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// MACROS + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="VideoServices"; } + +RESOURCE EIK_APP_INFO + { + hotkeys=r_videoservices_hotkeys; + menubar=r_videoservices_menubar; + cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +//---------------------------------------------------- +// +// r_videoservices_localisable_app_info +// ?description +// +//---------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_videoservices_localisable_app_info + { + short_caption = qtn_apps_video_grid; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_apps_video_list; + number_of_icons = 1; + icon_file = APP_RESOURCE_DIR"\\VideoServices_AIF.MIF"; + }; + } + + +//---------------------------------------------------- +// +// r_videoservices_hotkeys +// Hotkeys for video services +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_videoservices_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + +//---------------------------------------------------- +// +// r_videoservices_menubar +// MenuBar for video services (only the exit item) +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_videoservices_menubar + { + titles= + { + MENU_TITLE { menu_pane=R_AVKON_MENUPANE_EXIT; } + }; + } + + + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/data/VideoServices_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/data/VideoServices_caption.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Caption file for VideoServices +* +*/ + + +#include "videoservices.loc" +#include + +RESOURCE CAPTION_DATA +{ + caption=qtn_apps_video_list; + shortcaption=qtn_apps_video_grid; +} diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/data/VideoServices_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/data/VideoServices_reg.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RSS for registration file for VideoServices. +* +*/ + + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10281893 + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "VideoServices"; + + localisable_resource_file = APP_RESOURCE_DIR"\\VideoServices"; + + localisable_resource_id = R_VIDEOSERVICES_LOCALISABLE_APP_INFO; + embeddability=KAppNotEmbeddable; + newfile = KAppDoesNotSupportNewFile; + } + + + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/group/VideoServices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/group/VideoServices.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file for VideoServices +* +*/ + +#include +#include +#include + +TARGET VideoServices.exe +TARGETTYPE exe + +UID 0x100039CE 0x10281893 +TARGETPATH /system/apps/VideoServices + +epocstacksize 0x5000 + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE VideoServicesApp.cpp +SOURCE VideoServicesAppUi.cpp +SOURCE VideoServicesDocument.cpp +SOURCE VideoServicesContainer.cpp + +START RESOURCE ../data/VideoServices.rss +DEPENDS avkon.rsg +HEADER +TARGETPATH APP_RESOURCE_DIR + +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +END + +START RESOURCE ../data/VideoServices_reg.rss +DEPENDS videoservices.rsg +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + +USERINCLUDE . ../inc + +SYSTEMINCLUDE . +APP_LAYER_SYSTEMINCLUDE +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY browserlauncher.lib +LIBRARY CentralRepository.lib + +START WINS +// ?wins_specific_information +END + +START MARM +// ?marm_specific_information +END + +// DEFFILE ?filename + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build information file +* +* +*/ + +#include +#include +#include "../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/VideoServices.iby CORE_APP_LAYER_IBY_EXPORT_PATH(VideoServices.iby) +../rom/VideoServicesResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VideoServicesResources.iby) +../loc/videoservices.loc APP_LAYER_LOC_EXPORT_PATH(videoservices.loc) + +../conf/videoservices.confml APP_LAYER_CONFML(videoservices.confml) +../conf/videoservices_10281893.crml APP_LAYER_CRML(videoservices_10281893.crml) + +#ifdef __SERIES60_32__ + +PRJ_MMPFILES +gnumakefile videoservicesaifsvgiconsdc.mk + +./VideoServices.mmp + +#else + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE VideoServices_AIF.mif +OPTION SOURCES -c8,8 qgn_menu_mtv +END + +PRJ_MMPFILES + +./VideoServices.mmp + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/group/videoservicesaifsvgiconsdc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/group/videoservicesaifsvgiconsdc.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +ICONTARGETFILENAME=$(TARGETDIR)\VideoServices_AIF.MIF + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_mtv.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/inc/VideoServices.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/inc/VideoServices.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declarations of constants of VideoServices +* +*/ + + +#ifndef VIDEOSERVICES_HRH +#define VIDEOSERVICES_HRH + + +#endif // VIDEOSERVICES_HRH diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/inc/VideoServicesApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/inc/VideoServicesApp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CVideoServicesApp +* +*/ + + +#ifndef VIDEOSERVICESAPP_H +#define VIDEOSERVICESAPP_H + +// INCLUDES +#include + +// CONSTANTS +// UID of the application +const TUid KUidVideoServices = { 0x10281893 }; + +// CLASS DECLARATION + +/** +* CVideoServicesApp application class. +* Provides factory to create concrete document object. +* +*/ +class CVideoServicesApp : public CAknApplication + { + + private: //From base class + + /** + * From CApaApplication, creates CVideoServicesDocument document object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication, returns application's UID (KUidVideoServices). + * @return The value of KUidVideoServices. + */ + TUid AppDllUid() const; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/inc/VideoServicesAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/inc/VideoServicesAppUi.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CVideoServicesAppUi +* +*/ + + +#ifndef VideoServicesAPPUI_H +#define VideoServicesAPPUI_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "VideoServicesPrivateCRKeys.h" + +#include // KFavouritesMaxUrl +#include + +// CONSTANTS +const TUid KUidBrowserApplication = { 0x10008d39 }; //Browser UID +_LIT( KBrowserPath, "Z:\\system\\apps\\Browser\\Browser.app" ); //Browser path + +// FORWARD DECLARATIONS +class CVideoServicesContainer; +class CVideoServicesAppUi; + +// CLASS DECLARATION + +/** +* Application UI class. +* Provides support for the EIKON control architecture +* +* @since Series 60 3.1 +*/ +class CVideoServicesAppUi : public CAknAppUi, + public MDownloadedContentHandler, + MApaEmbeddedDocObserver + { + public: // Constructors and destructor + + /** + * Default Constructor + */ + CVideoServicesAppUi(); + + /** + * Destructor. + */ + ~CVideoServicesAppUi(); + + public: // From MDownloadedContentHandler + + /** + * Handle downloaded content that has been saved to a file, + * and return ETrue if it was handled successfully. + * @param aFileName File name with path. + * @param aParamList Generic parameter list. + * @param aContinue Output parameter: It must be ETrue if the caller wants + * Browser not to terminate after the content is handled. + * @return ETrue if the implementer has processed the content. If it is + * EFalse, BrowserLauncher opens that content in an + * appropriate viewer application. + */ + TBool HandleContentL( const TDesC& aFileName, const CAiwGenericParamList& aParamList, TBool& aContinue ); + + /** + * Reserved for future use. + */ + TAny* DownloadedContentHandlerReserved1( TAny* aAnyParam ); + + private: + /** + * EPOC Default Constructor + */ + void ConstructL(); + + /** + * From CEikAppUi, takes care of command handling. + * @param aCommand command to be handled + * @return void + * @since Series 60 3.1 + */ + void HandleCommandL( TInt aCommand ); + + /** + * From CEikAppUi, handles key events. + * @param aKeyEvent Event to handled. + * @param aType Type of the key event. + * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). + * @since Series 60 3.1 + */ + virtual TKeyResponse HandleKeyEventL( + const TKeyEvent& aKeyEvent,TEventCode aType ); + + private: // From MApaEmbeddedDocObserver + /** + * From MApaEmbeddedDocObserver, observes when the + * embedded browser exits + * @param aMode The browser exit mode (ignored in VideoServices) + * @return void + * @since Series 60 3.1 + */ + void NotifyExit( TExitMode aMode ); + + private: // New functions + /** + * Launches browser with "Operator-specified" url as start page + * @return void + * @since Series 60 3.1 + */ + void LaunchBrowserEmbeddedWithVideoUrlL(); + + public: // New functions + /** + * Launches the browser according to the available parameters + * ( "Operator-specified" video url ) + * @return void + * @since Series 60 3.1 + */ + void LaunchBrowserL(); + + public: // Functions from MEikStatusPaneObserver + + /** + * Handles status pane size change. + * @return void + * @since Series 60 3.1 + */ + void HandleStatusPaneSizeChange(); + + private: // Data + + // VideoServices App view container (not shown in final App) + CVideoServicesContainer* iAppContainer; + + // Access central repository of VideoServices + CRepository* iVideoServicesRepository; + + // Buffer where the url is read + TBuf iUrl; + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/inc/VideoServicesContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/inc/VideoServicesContainer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CVideoServicesContainer +* +*/ + + +#ifndef VIDEOSERVICESCONTAINER_H +#define VIDEOSERVICESCONTAINER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CEikLabel; // for example labels + +// CLASS DECLARATION + +/** +* CVideoServicesContainer container control class. +* +*/ +class CVideoServicesContainer : public CCoeControl, MCoeControlObserver + { + public: // Constructors and destructor + + /** + * Two phased constructor + * @param aRect Frame rectangle for container + * @since Series 60 3.0 + */ + static CVideoServicesContainer* NewL( const TRect& aRect ); + + /** + * Destructor. + */ + ~CVideoServicesContainer(); + + private: // Functions from base classes + + /** + * EPOC default constructor. + * @param aRect Frame rectangle for container. + * @return void + * @since Series 60 3.1 + */ + void ConstructL( const TRect& aRect ); + + /** + * From CCoeControl,Draw. + * @param aRect Frame rectangle to draw + * @return void + * @since Series 60 3.1 + */ + void Draw( const TRect& aRect ) const; + + /** + * From CCoeControl, HandleControlEventL + * @param aControl Active Control + * @param aEventType Type of control event + * @return void + * @since Series 60 3.1 + */ + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); + + private: // data + + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/inc/VideoServicesDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/inc/VideoServicesDocument.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for CVideoServicesDocument +* +*/ + +#ifndef VIDEOSERVICESDOCUMENT_H +#define VIDEOSERVICESDOCUMENT_H + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CEikAppUi; + +// CLASS DECLARATION + +/** +* CVideoServicesDocument application class. +*/ +class CVideoServicesDocument : public CAknDocument + { + public: // Constructor and destructor + /** + * Two-phased constructor. + * @param aApp Application instance + * @since Series 60 3.1 + */ + static CVideoServicesDocument* NewL( CEikApplication& aApp ); + + /** + * Destructor. + */ + ~CVideoServicesDocument(); + + private: + + /** + * Default constructor. + * @param aApp Application instance + */ + CVideoServicesDocument( CEikApplication& aApp ); + + /** + * Epoc Constructor + */ + void ConstructL(); + + private: + + /** + * From CEikDocument, create CVideoServicesAppUi "App UI" object. + */ + CEikAppUi* CreateAppUiL(); + }; + +#endif + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/inc/VideoServicesPrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/inc/VideoServicesPrivateCRKeys.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef VIDEOSERVICESPRIVATECRKEYS_H +#define VIDEOSERVICESPRIVATECRKEYS_H + +// The UID of the Video Services application +const TUid KCrUidVideoServices = {0x10281893}; + +// The default url used to launch the Video Services application. Can be customized +// to launch a url that is specified by an "Phone Operator/Vendor" +const TUint32 KVideoServicesUrl = 0x0000001; + +#endif // VIDEOSERVICESPRIVATECRKEYS_H diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/loc/VideoServices.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/loc/VideoServices.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: localisation strings for Video Services +* +*/ + + +// LOCALISATION STRINGS + +//d: Caption strings for Video Services in list view +//l: list_single_large_graphic_pane_t1 +//w: +//r: 3.1 +// +#define qtn_apps_video_list "Video Services" + +//d: Caption strings for Video Services in grid view +//l: cell_app_pane_t1 +//w: +//r: 3.1 +// +#define qtn_apps_video_grid "Video Services" + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/rom/VideoServices.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/rom/VideoServices.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for VideoServices +* +*/ + + +#ifndef __VideoServices_IBY__ +#define __VideoServices_IBY__ + +#ifdef __VIDEO_MENU +S60_APP_EXE(VideoServices) +S60_APP_AIF_ICONS(VideoServices) +S60_UPGRADABLE_APP_REG_RSC(VideoServices) +#endif + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/rom/VideoServicesResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/rom/VideoServicesResources.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for those parts of VideoServices that needs localization +* +*/ + + +#ifndef __VideoServices_RESOURCES_IBY__ +#define __VideoServices_RESOURCES_IBY__ + +S60_APP_CAPTION(VideoServices) +S60_APP_RESOURCE(VideoServices) +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/src/VideoServicesApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/src/VideoServicesApp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CVideoServicesApp Implementation +* +*/ + + +// INCLUDE FILES +#include "VideoServicesApp.h" +#include "VideoServicesDocument.h" + +// ================= MEMBER FUNCTIONS ======================= + +#include + +LOCAL_C CApaApplication* NewApplication() + { + return new CVideoServicesApp; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + + +// --------------------------------------------------------- +// CVideoServicesApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------- +// +TUid CVideoServicesApp::AppDllUid() const + { + return KUidVideoServices; + } + + +// --------------------------------------------------------- +// CVideoServicesApp::CreateDocumentL() +// Creates CVideoServicesDocument object +// --------------------------------------------------------- +// +CApaDocument* CVideoServicesApp::CreateDocumentL() + { + return CVideoServicesDocument::NewL( *this ); + } +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/src/VideoServicesAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/src/VideoServicesAppUi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CVideoServicesAppUi implementation +* +*/ + + +// INCLUDE FILES + +#include "VideoServicesAppUi.h" +#include "VideoServicesContainer.h" + +// CONSTANTS +_LIT(KUrlLaunchParameter, "4 "); +const TInt KUrlLaunchParamLength = 2; + + +// ================= MEMBER FUNCTIONS ======================= +// + +// ---------------------------------------------------------- +// CVideoServicesAppUi::CVideoServicesAppUi() +// ---------------------------------------------------------- +// +CVideoServicesAppUi::CVideoServicesAppUi() + { + } + +// ---------------------------------------------------------- +// CVideoServicesAppUi::ConstructL() +// ---------------------------------------------------------- +// +void CVideoServicesAppUi::ConstructL() + { + BaseConstructL( ENonStandardResourceFile | EAknEnableSkin /*| ENoScreenFurniture | ENoAppResourceFile*/ ); + iAppContainer = CVideoServicesContainer::NewL( ClientRect() ); + AddToStackL( iAppContainer ); + + // Connect to VideoServices central repository, leave if we don't have + // a VideoServices CR present + iVideoServicesRepository = CRepository::NewL( KCrUidVideoServices ); + + LaunchBrowserL(); + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::~CVideoServicesAppUi() +// ---------------------------------------------------- +// +CVideoServicesAppUi::~CVideoServicesAppUi() + { + if ( iAppContainer ) + { + RemoveFromStack( iAppContainer ); + delete iAppContainer; + iAppContainer = NULL; + } + + delete iVideoServicesRepository; + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::HandleKeyEventL( +// ---------------------------------------------------- +// +TKeyResponse CVideoServicesAppUi::HandleKeyEventL( + const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/ ) + { + return EKeyWasNotConsumed; + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::HandleCommandL(TInt aCommand) +// ---------------------------------------------------- +// +void CVideoServicesAppUi::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EAknSoftkeyBack: + case EAknSoftkeyExit: + case EEikCmdExit: + case EAknCmdExit: + { + Exit(); + break; + } + default: + break; + } + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::HandleContentL +// Handles the content coming from the embedded browser. +// Returns EFalse: content will be passed on to framework +// ---------------------------------------------------- +// + TBool CVideoServicesAppUi::HandleContentL( const TDesC& /*aFileName*/, const CAiwGenericParamList& /*aParamList*/, TBool& aContinue ) + { + aContinue = EFalse; + return EFalse; + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::DownloadedContentHandlerReserved1 +// ( Reserved for future use ) +// ---------------------------------------------------- +// + TAny* CVideoServicesAppUi::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ) + { + // Empty implementation. + return NULL; + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::LaunchBrowserL() +// ---------------------------------------------------- +// +void CVideoServicesAppUi::LaunchBrowserL() + { + // Read the video URL from Video Services central repository + if ( KErrNone == iVideoServicesRepository->Get( KVideoServicesUrl, iUrl ) ) + { + if ( iUrl.Length() ) + { + LaunchBrowserEmbeddedWithVideoUrlL(); + } + } + Exit(); + } + +// ---------------------------------------------------- +// CVideoServicesAppUi::LaunchBrowserEmbeddedWithVideoUrlL +// ---------------------------------------------------- +// +void CVideoServicesAppUi::LaunchBrowserEmbeddedWithVideoUrlL() +{ + // Pass the specified video url to browser (read from Central Repository) + HBufC* url = NULL; + url = HBufC::NewLC( iUrl.Length() + KUrlLaunchParamLength ); + url->Des().Append( KUrlLaunchParameter ); + url->Des().Append( iUrl ); + + CBrowserLauncher* launcher = CBrowserLauncher::NewLC(); + launcher->LaunchBrowserSyncEmbeddedL( url->Des(), this ); + + CleanupStack::PopAndDestroy(); // launcher + CleanupStack::PopAndDestroy(); // url +} + +// ---------------------------------------------------- +// CVideoServicesAppUi::NotifyExit +// ---------------------------------------------------- +// +void CVideoServicesAppUi::NotifyExit(TExitMode /*aMode*/) +{ +} + +// ---------------------------------------------------- +// CVideoServicesAppUi::HandleStatusPaneSizeChange +// ---------------------------------------------------- +// +void CVideoServicesAppUi::HandleStatusPaneSizeChange() +{ + iAppContainer->SetRect( ClientRect() ); +} + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/src/VideoServicesContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/src/VideoServicesContainer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CVideoServicesContainer implementation +* +*/ + + +// INCLUDE FILES +#include "VideoServicesContainer.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CVideoServicesContainer::NewL( const TRect& aRect ) +// EPOC two phased constructor +// --------------------------------------------------------- +// +CVideoServicesContainer* CVideoServicesContainer::NewL( const TRect& aRect ) + { + CVideoServicesContainer* self = new ( ELeave ) CVideoServicesContainer(); + CleanupStack::PushL( self ); + self->ConstructL( aRect ); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CVideoServicesContainer::ConstructL(const TRect& aRect) +// EPOC two phased constructor +// --------------------------------------------------------- +// +void CVideoServicesContainer::ConstructL( const TRect& aRect ) + { + CreateWindowL(); + SetRect( aRect ); + ActivateL(); + } + +// Destructor +CVideoServicesContainer::~CVideoServicesContainer() + { + } + + +// --------------------------------------------------------- +// CVideoServicesContainer::Draw(const TRect& aRect) const +// --------------------------------------------------------- +// +void CVideoServicesContainer::Draw( const TRect& aRect ) const + { + CWindowGc& gc = SystemGc(); + gc.SetPenStyle( CGraphicsContext::ENullPen ); + gc.SetBrushColor( KRgbWhite ); + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.DrawRect( aRect ); + } + +// --------------------------------------------------------- +// CVideoServicesContainer::HandleControlEventL( +// CCoeControl* aControl,TCoeEvent aEventType) +// --------------------------------------------------------- +// +void CVideoServicesContainer::HandleControlEventL( + CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/ ) + { + + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 browserui/videoservices/src/VideoServicesDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browserui/videoservices/src/VideoServicesDocument.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CVideoServicesDocument implementation +* +*/ + + +// INCLUDE FILES +#include "VideoServicesDocument.h" +#include "VideoServicesAppUi.h" + +// ================= MEMBER FUNCTIONS ======================= + +// constructor +CVideoServicesDocument::CVideoServicesDocument( CEikApplication& aApp ) +: CAknDocument( aApp ) + { + } + +// destructor +CVideoServicesDocument::~CVideoServicesDocument() + { + } + +// EPOC default constructor can leave. +void CVideoServicesDocument::ConstructL() + { + } + +// Two-phased constructor. +CVideoServicesDocument* CVideoServicesDocument::NewL( CEikApplication& aApp ) + { + CVideoServicesDocument* self = new ( ELeave ) CVideoServicesDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------- +// CVideoServicesDocument::CreateAppUiL() +// constructs CVideoServicesAppUi +// ---------------------------------------------------- +// +CEikAppUi* CVideoServicesDocument::CreateAppUiL() + { + return new (ELeave) CVideoServicesAppUi; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 group/bld.inf --- a/group/bld.inf Tue Aug 31 15:16:11 2010 +0300 +++ b/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -18,6 +18,9 @@ /* * Order is important */ +#include "../browserui/group/bld.inf" +#include "../browserplugins/group/bld.inf" +#include "../pushmtm/group/bld.inf" PRJ_PLATFORMS DEFAULT diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Data/PushMtmUi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Data/PushMtmUi.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,274 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resources for the Mtm Ui Data +* +*/ + + + +NAME PMTM + +// INCLUDES +#include +#include "PushMtmCommands.hrh" +#include "PushMtmUi.hrh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +//============================================================================= +// +// MTM UI Data framework related resources +// +//============================================================================= + +RESOURCE MTUD_FUNCTION_ARRAY r_push_mtm_ui_data_function_array + { + functions = + { + MTUD_FUNCTION + { + functiontext = qtn_mce_fetch; + command = EPushMtmCmdLoadService; + flags = EMtudContextSpecific | EMtudAsynchronous | + EMtudCommandTransferReceive; + }, + MTUD_FUNCTION + { + functiontext = qtn_mce_info; + command = KMtmUiFunctionMessageInfo; + flags = EMtudContextSpecific | EMtudAsynchronous | + EMtudCommandTransferReceive; + }, + MTUD_FUNCTION + { + functiontext = qtn_mce_settings_push; + command = KMtmUiMceSettings; + flags = EMtudCommandTransferReceive; + } + }; + } + +//============================================================================= +// +// Push Settings Dialog related resources +// +//============================================================================= + +RESOURCE TITLE_PANE r_pushsd_title_pane + { + txt = qtn_mce_title_settings_push; + } + +RESOURCE CBA r_pushsd_softkeys + { + buttons = + { + CBA_BUTTON { id = EPushSettingsDialogCmdOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EPushSettingsDialogCmdBack; txt = text_softkey_back; }, + CBA_BUTTON { id = EPushSettingsDialogCmdChangeWithoutSettingPage; txt = qtn_msk_change; } + }; + } + +RESOURCE MENU_BAR r_pushsd_menu + { + titles= + { + MENU_TITLE { menu_pane = r_pushsd_options_menu_pane; } + }; + } + +RESOURCE MENU_PANE r_pushsd_options_menu_pane + { + items= + { + MENU_ITEM + { + command = EPushSettingsDialogCmdChange; + txt = qtn_mce_settings_change; +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + flags = EEikMenuItemAction; +#endif + }, +#ifdef __SERIES60_HELP + MENU_ITEM + { + command = EPushSettingsDialogCmdHelp; + txt = qtn_options_help; + }, +#endif //__SERIES60_HELP + MENU_ITEM + { + command = EPushSettingsDialogCmdAknExit; + txt = qtn_mce_settings_exit; + } + }; + } + +RESOURCE ARRAY r_pushsd_listboxarray + { + items= + { + LBUF { txt = " \tIgnore this\t\tIgnore this"; } + }; + } + +RESOURCE DIALOG r_pushsd_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagFillAppClientRect; + buttons = r_pushsd_softkeys; + items = + { + DLG_LINE + { + type = EAknCtSettingListBox; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + id = EPushSettingsDialogCntrlListBox; + control = LISTBOX + { + flags = 0; + height = 3; + width = 80; + array_id = r_pushsd_listboxarray; + }; + } + }; + } + +RESOURCE TBUF r_pushsd_recept { buf = qtn_mce_settings_push_recept; } +RESOURCE TBUF r_pushsd_recep_on { buf = qtn_wml_push_setting_recep_on; } +RESOURCE TBUF r_pushsd_recep_off { buf = qtn_wml_push_setting_recep_off; } + +RESOURCE TBUF r_pushsd_loading { buf = qtn_mce_settings_push_loading; } +RESOURCE TBUF r_pushsd_load_autom { buf = qtn_wml_push_setting_load_autom; } +RESOURCE TBUF r_pushsd_load_man { buf = qtn_wml_push_setting_load_man; } + +RESOURCE LISTBOX r_pushsd_sp_radiobutton_listbox + { + flags = EEikListBoxMultipleSelection; + } + +RESOURCE AVKON_SETTING_PAGE r_pushsd_sp_radiobutton + { + type = EAknSetListBox; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + menubar = R_AVKON_MENUPANE_EMPTY; + editor_resource_id = r_pushsd_sp_radiobutton_listbox; + } + +RESOURCE DIALOG r_pushsd_autoload_sett_confirm + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_wml_push_sttng_autom_conf_q; + }; + } + }; + } + +//============================================================================= +// +// Push Message Info Dialog related resources +// +//============================================================================= + +RESOURCE TBUF r_pushmid_title { buf = qtn_wml_push_title_msginfo; } +RESOURCE TBUF r_pushmid_from { buf = qtn_wml_push_msginfo_from; } +RESOURCE TBUF r_pushmid_url { buf = qtn_wml_push_msginfo_url; } +RESOURCE TBUF r_pushmid_body { buf = qtn_wml_push_msginfo_body; } +RESOURCE TBUF r_pushmid_type { buf = qtn_wml_push_msginfo_type; } +RESOURCE TBUF r_pushmid_type_str { buf = qtn_wml_push_msgnfo_type_srv_msg; } +RESOURCE TBUF r_pushmid_content_type { buf = qtn_wml_push_msg_content_type; } +RESOURCE TBUF r_pushmid_created { buf = qtn_wml_push_msginfo_created; } +RESOURCE TBUF r_pushmid_expires { buf = qtn_wml_push_msginfo_expires; } +RESOURCE TBUF r_pushmid_size { buf = qtn_wml_push_msginfo_size; } +RESOURCE TBUF r_pushmid_rcvd { buf = qtn_wml_push_msginfo_rcvd; } + +//============================================================================= +// +// Push Load Service related resources +// +//============================================================================= + +RESOURCE TBUF r_pushls_expired_note { buf = qtn_wml_push_note_msg_expired; } + +RESOURCE DIALOG r_pushls_sl_not_auth + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_service_inbox_sl_not_trusted; + }; + } + }; + } + +RESOURCE DIALOG r_pushls_sl_cache_not_auth + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_service_inbox_sl_cache_not_trusted; + }; + } + }; + } + +//============================================================================= +// +// Misc +// +//============================================================================= + +RESOURCE TBUF r_pushmisc_unk_sender { buf = qtn_mce_push_inbox_sender_unkw; } +RESOURCE TBUF r_pushmisc_inbox_serv_msg { buf = qtn_mce_push_inbox_message; } +RESOURCE TBUF r_pushmisc_info_replaced { buf = qtn_service_inbox_updating_message_received; } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Data/PushRegistry.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Data/PushRegistry.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the resources for the Mtm registry file +* +*/ + + + +// INCLUDES + +#include +#include "PushMtmDef.hrh" +#include +#include +#include + +// RESOURCE DEFINITIONS + +// --------------------------------------------------------- +// +// MTM info resource for pushed Service messages +// +// --------------------------------------------------------- +// +RESOURCE MTM_INFO_FILE + { + mtm_type_uid = EUidPushMtmWapPush; // = KUidMtmWapPush in PushEntry.h + technology_type_uid = EUidPushMtmTechnologyGroup; + components = + { + MTM_COMPONENT_V2 + { + human_readable_name = qtn_mce_settings_type_srv_msg; + component_uid = KUidMtmServerComponentVal; + entry_point = 2; + version = VERSION_V2 {}; + filename = "PushMtmCliSrv.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_mce_settings_type_srv_msg; + component_uid = KUidMtmClientComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "PushMtmCliSrv.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_mce_settings_type_srv_msg; + component_uid = KUidMtmUiComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "PushMtmUi.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_mce_settings_type_srv_msg; + component_uid = KUidMtmUiDataComponentVal; + entry_point = 2; + version = VERSION_V2 {}; + filename = "PushMtmUi.dll"; + } + }; + } + +RESOURCE MTM_CAPABILITIES + { + send_capability = 1; + body_capability = 1; + } + +RESOURCE MTM_SECURITY_CAPABILITY_SET + { + capabilities = { ECapabilityNetworkServices }; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Data/PushViewer.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Data/PushViewer.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the resources for the PushViewer.app. +* +*/ + + + +// RESOURCE IDENTIFIER + +NAME PSHV + +// INCLUDES + +#include "PushViewer.hrh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } // This is not a file based application + +RESOURCE EIK_APP_INFO + { + menubar = r_pushviewer_menu; + cba = r_pushviewer_softkeys_open; + status_pane = r_pushviewer_status_pane; + } + +#include + +RESOURCE LOCALISABLE_APP_INFO r_pushviewer_localisable_app_info + { + } + +RESOURCE STATUS_PANE_APP_MODEL r_pushviewer_status_pane + { + panes = + { + SPANE_PANE + { + id = EEikStatusPaneUidTitle; + type = EAknCtTitlePane; + resource = r_pushviewer_title_pane; + } + }; + } + +RESOURCE TITLE_PANE r_pushviewer_title_pane + { + txt = qtn_wml_push_title_viewer; + } + +RESOURCE IMAGE r_pushviewer_navi_image + { + bmpfile = APP_BITMAP_DIR"\\msgeditor.mbm"; + bmpid = EMbmMsgeditorQgn_prop_folder_sms_tab1; + bmpmask = EMbmMsgeditorQgn_prop_folder_sms_tab1_mask; + } + +RESOURCE CBA r_pushviewer_softkeys + { + buttons = + { + CBA_BUTTON { id = EPushViewerCmdOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EPushViewerCmdBack; txt = text_softkey_back; }, + CBA_BUTTON { id = EAknSoftkeyEmpty; txt = text_softkey_empty; } + }; + } + +RESOURCE CBA r_pushviewer_softkeys_open + { + buttons = + { + CBA_BUTTON { id = EPushViewerCmdOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EPushViewerCmdBack; txt = text_softkey_back; }, + CBA_BUTTON { id = EPushViewerCmdLoadService; txt = qtn_mce_inbox_open; } + }; + } + +RESOURCE MENU_BAR r_pushviewer_menu + { + titles= + { + MENU_TITLE { menu_pane = r_pushviewer_options_menu_pane; } + }; + } + +RESOURCE MENU_PANE r_pushviewer_options_menu_pane + { + items= + { + MENU_ITEM + { + command = EPushViewerCmdLoadService; + txt = qtn_mce_inbox_fetch; + }, + MENU_ITEM + { + command = EPushViewerCmdDelete; + txt = qtn_wml_push_cmd_delete; + }, + MENU_ITEM + { + command = EPushViewerCmdMessageInfo; + txt = qtn_wml_push_cmd_info; + }, +#ifdef __SERIES60_HELP + MENU_ITEM + { + command = EPushViewerCmdHelp; + txt = qtn_options_help; + }, +#endif //__SERIES60_HELP + MENU_ITEM + { + command = EPushViewerCmdAknExit; + txt = qtn_wml_push_cmd_exit; + } + }; + } + +RESOURCE TBUF r_pushviewer_mainpane_text { buf = qtn_service_inbox_push_viewer_view_text; } + +RESOURCE DIALOG r_pushviewer_entry_delete_confirm + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_wml_push_view_query_del; + }; + } + }; + } + +RESOURCE TBUF r_pushviewer_expired_note { buf = qtn_wml_push_note_msg_expired; } + +// Deleting message & replacement info notes. +RESOURCE TBUF r_pushviewer_info_deleted { buf = qtn_wml_push_note_msg_expired; } +RESOURCE TBUF r_pushviewer_info_replaced { buf = qtn_service_inbox_updating_message_received; } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Data/PushViewerAif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Data/PushViewerAif.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file contains all the resources for the PushViewer.app. +* +*/ + + + +#include "PushMtmDef.hrh" +#include + +RESOURCE AIF_DATA + { + app_uid = EUidPushViewerApp; + hidden = KAppIsHidden; + embeddability = KAppEmbeddable; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Data/PushViewer_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Data/PushViewer_caption.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDES + +#include + + +RESOURCE CAPTION_DATA + { + caption = ""; + shortcaption = ""; + } + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Data/PushViewer_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Data/PushViewer_reg.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RSS for registration file. +* +*/ + + +#include "PushMtmDef.hrh" +#include +#include +#include +#include +#include + + +UID2 KUidAppRegistrationResourceFile +UID3 0x10008D3C + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "PushViewer"; + + hidden = KAppIsHidden; + embeddability = KAppEmbeddable; + + service_list = + { + SERVICE_INFO { uid = KMuiuMsgEditorServiceUid; + opaque_data = r_push_service_view; } + }; + } + +RESOURCE MSG_SERVICE_STRUCT r_push_service_view + { + mtm_id = EUidPushMtmWapPush; + type = KMsgServiceView; + } + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Group/Bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Group/Bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build specification file +* +*/ + + +#include +#include "../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +PRJ_PLATFORMS +DEFAULT + +// Help exports +#include "../help/group/bld.inf" + +PRJ_EXPORTS +../Inc/PushMtmCommands.hrh APP_LAYER_PLATFORM_EXPORT_PATH(PushMtmCommands.hrh) +../rom/PushMtm.iby CORE_APP_LAYER_IBY_EXPORT_PATH(PushMtm.iby) +../rom/PushMtmResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(PushMtmResources.iby) +../rom/S60SiSlWapPush.iby CORE_APP_LAYER_IBY_EXPORT_PATH(S60SiSlWapPush.iby) +#ifndef __S60_32__ +../rom/wappush.iby CORE_APP_LAYER_IBY_EXPORT_PATH(wappush.iby) +#endif +../loc/pushmtmui.loc APP_LAYER_LOC_EXPORT_PATH(pushmtmui.loc) +../loc/pushviewer.loc APP_LAYER_LOC_EXPORT_PATH(pushviewer.loc) + +../conf/pushmtm.confml APP_LAYER_CONFML(pushmtm.confml) +../conf/pushmtm_10008D42.crml APP_LAYER_CRML(pushmtm_10008D42.crml) + +#ifdef __SERIES60_32__ + +PRJ_MMPFILES + +// MTM registry files +//gnumakefile PushRegistry.mk +gnumakefile PushMtmIcons.mk +// Push Mtm Utility +PushMtmUtil.mmp +// Push Server Mtm, Client Mtm and Ui Mtm +PushMtmCliSrv.mmp +// Ui Data Mtm +PushMtmUi.mmp +// Push Viewer +PushViewer.mmp + +#include "../Plugins/Group/Bld.inf" + +#else + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE pushmtm.mif +OPTION HEADERFILE pushmtm.mbg +OPTION SOURCES -c8,1 qgn_prop_mce_push_unread -c8,1 qgn_prop_mce_push_read +END + +PRJ_MMPFILES + +// MTM registry files +// Push Mtm Utility +PushMtmUtil.mmp +// Push Server Mtm, Client Mtm and Ui Mtm +PushMtmCliSrv.mmp +// Ui Data Mtm +PushMtmUi.mmp +// Push Viewer +PushViewer.mmp + +#include "../Plugins/Group/Bld.inf" + +#endif + +PRJ_TESTMMPFILES + + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Group/PushMtmCliSrv.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Group/PushMtmCliSrv.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file +* +*/ + +#include +#include +#include +#include + +TARGET PushMtmCliSrv.dll +TARGETTYPE dll +UID 0x10004845 0x10008D42 +TARGETPATH SHARED_LIB_DIR + +CAPABILITY CAP_GENERAL_DLL + +VENDORID VID_DEFAULT + +USERINCLUDE ../MtmCliSrvInc +USERINCLUDE ../Inc +USERINCLUDE ../MtmUtilInc +USERINCLUDE ../MtmUiInc + +APP_LAYER_SYSTEMINCLUDE +#if defined(__PLATFORM_VERSION_32__) +SYSTEMINCLUDE APP_LAYER_PUBLIC_EXPORT_PATH(push) +#endif + +SOURCEPATH ../MtmCliSrvSrc +SOURCE PushMtmClient.cpp +SOURCE PushMtmCliSrvPanic.cpp +SOURCE PushMtmGcOperation.cpp +SOURCE PushMtmServer.cpp + +// Define the following __TEST_LOG_MMP macro if logging is required. +// Uncomment it if you want logging. This macro is used only in the mmp file. +// In the source files use __TEST_LOG__. +//#define __TEST_LOG_MMP + +#ifdef __TEST_LOG_MMP +MACRO __TEST_LOG__ +#endif + +LIBRARY euser.lib +LIBRARY msgs.lib +LIBRARY PushMtmUtil.lib +LIBRARY SISLPushMsgUtils.lib + +#ifdef __TEST_LOG_MMP +DEBUGLIBRARY flogger.lib +#endif + +#if defined(ARMCC) + DEFFILE ../EABI/PUSHMTMCLISRVU_EKA2.def +#else + DEFFILE ../BWinsCw/PUSHMTMCLISRVU_EKA2.def +#endif + +START RESOURCE ../Data/PushRegistry.rss +TARGET PushRegistry.rsc +TARGETPATH MTM_INFO_FILE_DIR +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +END + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Group/PushMtmIcons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Group/PushMtmIcons.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +HEADERDIR=\epoc32\include +ICONTARGETFILENAME=$(TARGETDIR)\pushmtm.mif +HEADERFILENAME=$(HEADERDIR)\pushmtm.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,1 qgn_prop_mce_push_unread.bmp \ + /c8,1 qgn_prop_mce_push_read.bmp + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Group/PushMtmUi.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Group/PushMtmUi.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file +* +*/ + +#include +#include +#include +#include + +TARGET PushMtmUi.dll +TARGETTYPE dll +UID 0x10004845 0x10008D43 +TARGETPATH SHARED_LIB_DIR + +CAPABILITY CAP_GENERAL_DLL + +VENDORID VID_DEFAULT + +START RESOURCE ../Data/PushMtmUi.rss +DEPENDS avkon.rsg +HEADER +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +TARGETPATH MTM_RESOURCE_DIR +END // RESOURCE + +USERINCLUDE ../MtmUiInc +USERINCLUDE ../Inc +USERINCLUDE ../MtmUtilInc +USERINCLUDE ../ViewerInc + +APP_LAYER_SYSTEMINCLUDE +#if defined(__PLATFORM_VERSION_32__) +SYSTEMINCLUDE APP_LAYER_PUBLIC_EXPORT_PATH(push) +#endif + +SOURCEPATH ../MtmUiSrc +SOURCE PushLoadServiceOp.cpp +SOURCE PushMessageInfoDialog.cpp +SOURCE PushMessageInfoOp.cpp +SOURCE PushMtmUi.cpp +SOURCE PushMtmUiData.cpp +SOURCE PushMtmUiOperation.cpp +SOURCE PushMtmUiPanic.cpp +SOURCE PushSettingsDialog.cpp +SOURCE PushViewMessageOp.cpp + +#ifdef __SERIES60_PUSH_SP +SOURCE PushViewServiceOp.cpp +#endif // __SERIES60_PUSH_SP + +// Define the following __TEST_LOG_MMP macro if logging is required. +// Uncomment it if you want logging. This macro is used only in the mmp file. +// In the source files use __TEST_LOG__. +//#define __TEST_LOG_MMP + +#if defined __TEST_LOG_MMP +MACRO __TEST_LOG__ +#endif + +LIBRARY apparc.lib +LIBRARY AknSkins.lib +LIBRARY apmime.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY CdlEngine.lib +LIBRARY CommonEngine.lib +LIBRARY commonui.lib +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikdlg.lib +LIBRARY euser.lib +LIBRARY featmgr.lib +LIBRARY inetprotutil.lib +#ifdef __SERIES60_PUSH_SP +LIBRARY MiscPushMsgUtils.lib // For CUnknownPushMsgEntry. +#endif // __SERIES60_PUSH_SP +LIBRARY msgs.lib +LIBRARY mtur.lib +LIBRARY muiu.lib +LIBRARY PushMtmUtil.lib +LIBRARY PushMsgEntry.lib +LIBRARY SISLPushMsgUtils.lib +LIBRARY CENTRALREPOSITORY.lib + +#ifdef __SERIES60_HELP +LIBRARY hlplch.lib // for "Help" options menu +#endif // __SERIES60_HELP + +#ifdef __TEST_LOG_MMP +DEBUGLIBRARY flogger.lib +#endif + +#if defined(ARMCC) + DEFFILE ../EABI/PUSHMTMUIU_EKA2.def +#else + DEFFILE ../BWinsCw/PUSHMTMUIU_EKA2.def +#endif diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Group/PushMtmUtil.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Group/PushMtmUtil.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file +* +*/ + +#include +#include +#include +#include +#include + +TARGET PushMtmUtil.dll +TARGETTYPE dll +UID 0x1000008d 0x10008D44 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +USERINCLUDE ../MtmUtilInc +USERINCLUDE ../Inc + +APP_LAYER_SYSTEMINCLUDE +#if defined(__PLATFORM_VERSION_32__) +SYSTEMINCLUDE APP_LAYER_PUBLIC_EXPORT_PATH(push) +#endif + +SOURCEPATH ../MtmUtilSrc +SOURCE PushAsyncOpRunner.cpp +#ifdef __PUSH_WHITELIST +SOURCE PushAuthenticationUtilitiesWL.cpp +#else // __PUSH_WHITELIST +SOURCE PushAuthenticationUtilitiesPure.cpp +#endif // __PUSH_WHITELIST +SOURCE PushInitiator.cpp +SOURCE PushInitiatorList.cpp +SOURCE PushMtmOperation.cpp +SOURCE PushMtmSettings.cpp +SOURCE PushMtmUtil.cpp +SOURCE PushMtmUtilPanic.cpp +#ifdef __PUSH_WHITELIST +SOURCE WhiteListImporterWL.cpp +#else // __PUSH_WHITELIST +SOURCE WhiteListImporterDummy.cpp +#endif // __PUSH_WHITELIST + +// Define the following __TEST_LOG_MMP macro if logging is required. +// Uncomment it if you want logging. This macro is used only in the mmp file. +// In the source files use __TEST_LOG__. +//#define __TEST_LOG_MMP + +#if defined __TEST_LOG_MMP +MACRO __TEST_LOG__ +#endif + +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY featmgr.lib +#ifdef __TEST_LOG_MMP +DEBUGLIBRARY flogger.lib +#endif +LIBRARY inetprotutil.lib +LIBRARY msgs.lib +#ifdef __PUSH_WHITELIST +LIBRARY PushMsgEntry.lib +LIBRARY WapPushUtils.lib +#endif // __PUSH_WHITELIST +LIBRARY SISLPushMsgUtils.lib +LIBRARY CENTRALREPOSITORY.lib + +#if defined(ARMCC) + DEFFILE ../EABI/PUSHMTMUTILU_EKA2.def +#else + DEFFILE ../BWinsCw/PUSHMTMUTILU_EKA2.def +#endif + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Group/PushViewer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Group/PushViewer.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file +* +*/ + +#include +#include +#include +#include + +TARGET PushViewer.exe +EPOCSTACKSIZE 0x5000 +TARGETTYPE exe +UID 0x100039CE 0x10008D3C + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +USERINCLUDE ../ViewerInc +USERINCLUDE ../Inc +USERINCLUDE ../MtmUiInc +USERINCLUDE ../MtmUtilInc + +APP_LAYER_SYSTEMINCLUDE +#if defined(__PLATFORM_VERSION_32__) +SYSTEMINCLUDE APP_LAYER_PUBLIC_EXPORT_PATH(push) +#endif + +SOURCEPATH ../ViewerSrc +SOURCE PushViewerApp.cpp +SOURCE PushViewerAppServer.cpp +SOURCE PushViewerDoc.cpp +SOURCE PushViewerPanic.cpp +SOURCE PushViewerMsgEdAppUi.cpp + +// Define the following __TEST_LOG_MMP macro if logging is required. +// Uncomment it if you want logging. This macro is used only in the mmp file. +// In the source files use __TEST_LOG__. +//#define __TEST_LOG_MMP + +#if defined __TEST_LOG_MMP +MACRO __TEST_LOG__ +#endif + +LIBRARY CommonUI.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY euser.lib +LIBRARY MsgEditorAppUi.lib +LIBRARY MsgEditorModel.lib +LIBRARY MsgEditorView.lib +LIBRARY msgs.lib +LIBRARY muiu.lib +LIBRARY PushMtmUtil.lib +LIBRARY SISLPushMsgUtils.lib + +#ifdef __SERIES60_HELP +LIBRARY hlplch.lib // for "Help" options menu +#endif // __SERIES60_HELP + +#ifdef __TEST_LOG_MMP +LIBRARY efsrv.lib +DEBUGLIBRARY flogger.lib +#endif + +START RESOURCE ../Data/PushViewer.rss +DEPENDS avkon.rsg +HEADER +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +TARGETPATH APP_RESOURCE_DIR +END // RESOURCE + +START RESOURCE ../Data/PushViewer_reg.rss +DEPENDS pushviewer.rsg +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Inc/PushMtmCommands.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Inc/PushMtmCommands.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declarations command IDs. +* +*/ + + + +#ifndef PUSHMTMCOMMANDS_HRH +#define PUSHMTMCOMMANDS_HRH + +// INCLUDE FILES + +#include + +/** +* The following enum constants define those Push MTM specific commands that +* are supported by the client or the UI MTM components. +*/ +enum TPushMtmCommands + { + EPushMtmCmdLoadService = KMtmUiFirstFreePlatformMTMFunctionId, + EPushMtmCmdViewService, + EPushMtmCmdCollectGarbage, + EPushMtmCmdFetchContent, + EPushMtmCmdViewMessage + }; + +#endif // PUSHMTMCOMMANDS_HRH diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Inc/PushMtmDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Inc/PushMtmDef.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Miscellaneous definitions for the Push MTM modules. +* +*/ + + + +#ifndef PUSHMTMDEF_H +#define PUSHMTMDEF_H + + +struct TMessageInfoParam ///< Parameter for the Message info UI function + { + TBool iDontShowNotification; ///< Set to ETrue not to show info note. + }; + +/// TMessageInfoParam packaged into a package buffer. +typedef TPckgBuf TMessageInfoParamBuf; + +/// TMessageInfoParam packaged into a pointer. +typedef TPckgC TMessageInfoParamPckg; + + +#endif // PUSHMTMDEF_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Inc/PushMtmDef.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Inc/PushMtmDef.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Macro definitions and enums for the Push MTM modules. +* +*/ + + + +#ifndef PUSHMTMDEF_HRH +#define PUSHMTMDEF_HRH + + +/// Push technology UID. +#define EUidPushMtmTechnologyGroup 0x10009157 + +/// Uid defines for Push MTM and Push Message Types (see PushEntry.h). +#define EUidPushMtmWapPush 0x10009158 +#define EUidPushMtmMsgSI 0x10009159 +#define EUidPushMtmMsgSL 0x1000915A +#define EUidPushMtmMsgMultiPart 0x1000915B +#define EUidPushMtmMsgUnknown 0x1000915C + +/// 3rd UID of the Push Viewer application. +#define EUidPushViewerApp 0x10008D3C + + +#endif // PUSHMTMDEF_HRH diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Inc/PushMtmProgress.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Inc/PushMtmProgress.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of class TPushMtmProgress. +* +*/ + + + +#ifndef PUSHMTMPROGRESS_H +#define PUSHMTMPROGRESS_H + +// INCLUDE FILES + +#include + +// CLASS DECLARATION + +/** +* This class provides progress information for the client side Push MTM +* operations. This class is packaged into an 8 bit descriptor. +* This information packaged is returned by CMsvOperation::ProgressL(), for +* example. +*/ +class TPushMtmProgress + { + public: // Constructors + + inline TPushMtmProgress(); + + public: // New functions + + inline void Reset(); + + public: // Data + + TInt iTotalValue; ///< Final progress value. + TInt iCurrentValue; ///< Current progress value. + TInt iErrorCode1; ///< Error code. + TInt iErrorCode2; ///< Error code. + TInt iErrorCode3; ///< Error code. + }; + + +/// TPushMtmProgress packaged into a package buffer. +typedef TPckgBuf TPushMtmProgressBuf; + +/// TPushMtmProgress packaged into a pointer. +typedef TPckgC TPushMtmProgressPckg; + + +#include "PushMtmProgress.inl" + +#endif // PUSHMTMPROGRESS_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Inc/PushMtmProgress.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Inc/PushMtmProgress.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of class TPushMtmProgress. +* +*/ + + + +//********************************** +// TPushMtmProgress +//********************************** + +inline TPushMtmProgress::TPushMtmProgress() + { + Reset(); + } + +inline void TPushMtmProgress::Reset() + { + iTotalValue = 0; + iCurrentValue = 0; + iErrorCode1 = KErrNone; + iErrorCode2 = KErrNone; + iErrorCode3 = KErrNone; + }; + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvInc/PushMtmCliSrvPanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvInc/PushMtmCliSrvPanic.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +#ifndef PUSHMTMCLISRVPANIC_H +#define PUSHMTMCLISRVPANIC_H + +// INCLUDE FILES + +#include + +enum TPushMtmCliSrvPanic + { + EPushMtmCliSrvPanCommandNotSupported = 1, ///< Not supported command. + EPushMtmCliSrvPanBadType, ///< Unsupported message type for an operation. + EPushMtmCliSrvPanFoldersNotSupported, ///< MTM loaded with bad message entry. + EPushMtmCliSrvPanEmptySelection, ///< Entry selection is empty. + EPushMtmCliSrvPanNotInitUrl, + EPushMtmCliSrvPanNoContext, + EPushMtmCliSrvPanAlreadyInitialized + }; + +GLREF_C void CliSrvPanic( TPushMtmCliSrvPanic aReason ); + +#endif // PUSHMTMCLISRVPANIC_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvInc/PushMtmClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvInc/PushMtmClient.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client Mtm class declaration +* +*/ + + + +#ifndef PUSHMTMCLIENT_H +#define PUSHMTMCLIENT_H + +// INCLUDE FILES + +#include +#include +#include + +// FORWARD DECLARATIONS + +class CMsvOperation; +class CMsvEntrySelection; + +// CLASS DECLARATION + +/** +* Client MTM for pushed messages. +*/ +class CPushMtmClient : public CBaseMtm + { + public: // construction + + /** + * Two-phased constructor (exported factory function). + * Leaves on failure. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @param CMsvSession Message Server Session to be used by this client. + * @return The constructed client. + */ + IMPORT_C static CPushMtmClient* NewL + ( CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession ); + + /** + * Destructor. + */ + virtual ~CPushMtmClient(); + + private: // construction + + /** + * Constructor. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @param CMsvSession Message Server Session to be used by this client. + */ + CPushMtmClient + ( CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession ); + + /** + * Second phase constructor. Derivde classes should call this first + * during construction. + */ + void ConstructL(); + + private: // from CBaseMtm + + /** + * (Not supported) Save the message. + */ + void SaveMessageL(); + + /** + * (Not supported) Load the message. + */ + void LoadMessageL(); + + /** + * Validate the current context. + * @param aPartList Message parts for which validation is requested. + * @return + * - Bitmask of the TMsvPartList IDs for each invalid part, or + * - KErrNone if all parts are valid. + */ + TMsvPartList ValidateMessage( TMsvPartList aPartList ); + + /** + * (Not supported) Find text in the current context. + * @param aTextToFind Text to find. + * @param aPartList Message parts to search. + * @return 0 (not supported). + */ + TMsvPartList Find + ( const TDesC& aTextToFind, TMsvPartList aPartList ); + + /** + * (Not supported) Create a reply to the current context. + * @param aReplyEntryId The entry to which to assign the reply. + * @param aPartList Message parts to include in the reply. + * @param aCompletionStatus Completion request status. + * @return A completed operation with status KErrNotSupported. + */ + CMsvOperation* ReplyL + ( + TMsvId aReplyEntryId, + TMsvPartList aPartlist, + TRequestStatus& aCompletionStatus + ); + + /** + * (Not supported) Create a reply to the current context. + * @param aReplyEntryId The entry to which to assign the forwarded + * message. + * @param aPartList Message parts to include in the forwarded message. + * @param aCompletionStatus Completion request status. + * @return A completed operation with status KErrNotSupported. + */ + CMsvOperation* ForwardL + ( + TMsvId aForwardEntryId, + TMsvPartList aPartList, + TRequestStatus& aCompletionStatus + ); + + /** + * (Not supported) Add an addressee. + * @param aRealAddress Real address. + * @throw KErrNotSupported The specified function is not supported. + */ + void AddAddresseeL( const TDesC& aRealAddress ); + + /** + * (Not supported) Add an addressee. + * @param aRealAddress Real address. + * @param aAlias Alias information. + * @throw KErrNotSupported The specified function is not supported. + */ + void AddAddresseeL( const TDesC& aRealAddress, + const TDesC& aAlias ); + + /** + * (Not supported) Remove an addressee. + * @param aIndex Index of addressee. + */ + void RemoveAddressee( TInt aIndex ); + + /** + * Call CBaseMtmUiData::QueryCapability. + * @param aCapability UID of capability to be queried. + * @param aResponse Response value. + * @return + * - KErrNone: aCapability is a recognised value + * and a response is returned. + * - KErrNotSupported: aCapability is not a recognised value. + */ + TInt QueryCapability( TUid aCapability, TInt& aResponse ); + + /** + * Invoke synchronous functions. + * Supported function(s): + * - EPushMtmCmdCollectGarbage Deleting expired SIs + * @param aFunctionId ID of the requested operation. + * @param aSelection Selection of message entries to operate on. + * EPushMtmCmdFetchContent does not use it. It operates on the + * current MTM context. + * EPushMtmCmdCollectGarbage uses it. If it is not empty, then + * the first element is used as folder specifier, otherwise + * if the list s empty then KMsvNullIndexEntryId is passed to + * the GC operation. + * @param aParameter Ignored. + * @return None. + * @throw KErrNotSupported The specified function is not supported. + */ + void InvokeSyncFunctionL + ( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter + ); + + /** + * Invoke asynchronous operation. + * Supported functions: + * - EPushMtmCmdFetchContent (SL specific!) + * - EPushMtmCmdCollectGarbage Deleting expired SIs + * @param aFunctionId ID of the requested operation. + * @param aSelection Selection of message entries to operate on. + * EPushMtmCmdFetchContent does not use it. It operates on the + * current MTM context. + * EPushMtmCmdCollectGarbage uses it. If it is not empty, then + * the first element is used as folder specifier, otherwise + * if the list s empty then KMsvNullIndexEntryId is passed to + * the GC operation. + * @param aParameter Buffer containing input and output parameters. + * @param aCompletionStatus Completion status. + * @return + * - If successful, an asynchronously completing operation. + * - If failed, a completed operation, with status set to the + * relevant error code. + * @throw KErrNotSupported The specified function is not supported. + */ + CMsvOperation* InvokeAsyncFunctionL + ( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter, + TRequestStatus& aCompletionStatus + ); + + /** + * Context changed callback function. It does nothing. + */ + void ContextEntrySwitched(); + }; + +#endif // PUSHMTMCLIENT_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvInc/PushMtmGcOperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvInc/PushMtmGcOperation.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushMtmGcOperation. +* +*/ + + + +#ifndef PUSHMTMGCOPERATION_H +#define PUSHMTMGCOPERATION_H + +// INCLUDE FILES + +#include "PushMtmOperation.h" +#include +#include +#include + +// FORWARD DECLARATIONS + +class CMsvSession; +class CPushMtmUtil; +class CMsvEntrySelection; +class CSIPushMsgEntry; + +// CLASS DECLARATION + +/** +* Garbage collection operation. It removes some or all expired SIs from the +* Message Server. +*/ +class CPushMtmGcOperation : public CPushMtmOperation + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aSession Message server session to be used by this operation. + * @param aFolderId aFolderId Garbage collection is made in this folder. + * If it's KMsvNullIndexEntryId, then gc is made in all the + * folders that may contain push messages. + * @param aObserverRequestStatus Observer's status. + * @return The constructed operation. + */ + static CPushMtmGcOperation* NewL( CMsvSession& aSession, + TMsvId aFolderId, + TRequestStatus& aObserverRequestStatus ); + + /** + * Destructor. + */ + virtual ~CPushMtmGcOperation(); + + public: // New functions + + /** + * Do the garbage collection synchronously. + */ + void DoSyncL(); + + protected: // Constructors + + /** + * Constructor. + * @param aSession Message server session to be used by this operation. + * @param aFolderId Garbage collection is made in this folder. + * @param aObserverRequestStatus Observer's status. + */ + CPushMtmGcOperation( CMsvSession& aSession, + TMsvId aFolderId, + TRequestStatus& aObserverRequestStatus ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + protected: // New functions + + /** + * Initialize the operation. Creates an array of SI messages. + */ + void InitL(); + + /** + * Delete the current entry if it is expired. + */ + void GcCurrentL(); + + protected: // Functions from base classes + + /** + * Do garbage collection. Initializes an array of SI messages + * and check the expiration state: one check per one RunL shot. + */ + void RunL(); + + /** + * Cancel protocol implementation. CPushMtmOperation::DoCancel() is + * called. + */ + void DoCancel(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. It continues the operation if the current entry is not + * found, otherwise it is stopped. + */ + TInt RunError( TInt aError ); + + protected: // Data members + + enum TState + { + EInit, + EGarbageCollecting + }; + + TState iState; ///< Operation state. + TMsvId iFolderId; /**< Gc is done only in this specific folder, + * if it is not KMsvNullIndexEntryId. */ + CPushMtmUtil* iUtil; ///< Utility class. Owned. + CMsvEntrySelection* iEntrySel; ///< Selection of entries to be deleted. Owned. + CSIPushMsgEntry* iEntryWrapper; ///< Msg class. Owned. + TInt iCount; ///< Count of the selection. + TInt iCurrentIndex; ///< Index of the current entry in the selection. + }; + +#endif // PUSHMTMGCOPERATION_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvInc/PushMtmServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvInc/PushMtmServer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server Mtm class declaration +* +*/ + + + +#ifndef PUSHMTMSERVER_H +#define PUSHMTMSERVER_H + +// INCLUDES + +#include "PushMtmProgress.h" +#include + +// CLASS DECLARATION + +/** +* Server MTM for pushed messages. Currently, all operations are executed +* in the Client MTM, so this class is a collection of dummy implementations. +* +* @lib ?library +* @since ?Series60_version +*/ +class CPushMtmServer : public CBaseServerMtm + { + public: // Constructors and destructor + + /** + * Two-phased constructor (exported factory function). + * Leaves on failure. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @param aInitialEntry Initial entry. + * @return The constructed Server MTM. + */ + IMPORT_C static CPushMtmServer* NewL( + CRegisteredMtmDll& aRegisteredMtmDll, + CMsvServerEntry* aInitialEntry ); + + /** + * Destructor. + */ + virtual ~CPushMtmServer(); + + private: // Constructors + + /** + * Constructor. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @param aInitialEntry Initial entry. + */ + CPushMtmServer( + CRegisteredMtmDll& aRegisteredMtmDll, + CMsvServerEntry* aInitialEntry ); + + /** + * Second phase constructor. Leaves on failure. + * Add this active object to the scheduler. + */ + void ConstructL(); + + private: // Functions from base classes + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void CopyToLocalL( + const CMsvEntrySelection& aSelection, + TMsvId aDestination, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void CopyFromLocalL( + const CMsvEntrySelection& aSelection, + TMsvId aDestination, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void CopyWithinServiceL( + const CMsvEntrySelection& aSelection, + TMsvId aDestination, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void MoveToLocalL( + const CMsvEntrySelection& aSelection, + TMsvId aDestination, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void MoveFromLocalL( + const CMsvEntrySelection& aSelection, + TMsvId aDestination, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void MoveWithinServiceL( + const CMsvEntrySelection& aSelection, + TMsvId aDestination, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void DeleteAllL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void CreateL( TMsvEntry aNewEntry, TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void ChangeL( TMsvEntry aNewEntry, TRequestStatus& aStatus ); + + /** + * Do nothing, but leave with KErrNotSupported. + */ + void StartCommandL( + CMsvEntrySelection& aSelection, + TInt aCommand, + const TDesC8& aParameter, + TRequestStatus& aStatus ); + + /** + * Do nothing, but return EFalse. + */ + TBool CommandExpected(); + + /** + * Return iProgressPckg. + */ + const TDesC8& Progress(); + + /** + * Do nothing. + */ + void DoRunL(); + + /** + * Do nothing. + */ + void DoComplete( TInt aError ); + + /** + * Do nothing. + */ + void DoCancel(); + + protected: // Data + + TPushMtmProgress iProgress; ///< Progress information. + /// Reference to progress information as a buffer pointer. + TPushMtmProgressPckg iProgressPckg; + }; + +#endif // PUSHMTMSERVER_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvSrc/PushMtmCliSrvPanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvSrc/PushMtmCliSrvPanic.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmCliSrvPanic.h" + +// LOCAL CONSTANTS AND MACROS + +_LIT( KCliSrvPanicString, "PushMtmCliSrv" ); + +// --------------------------------------------------------- +// CliSrvPanic +// --------------------------------------------------------- +// +GLDEF_C void CliSrvPanic( TPushMtmCliSrvPanic aReason ) + { + User::Panic( KCliSrvPanicString, aReason ); + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvSrc/PushMtmClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvSrc/PushMtmClient.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,262 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client Mtm class definition +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmClient.h" +#include "PushMtmCommands.hrh" +#include "PushMtmProgress.h" +#include "PushMtmCliSrvPanic.h" +#include "PushMtmGcOperation.h" +#include +#include +#include +#include + +// LOCAL CONSTANTS AND MACROS + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmClient::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushMtmClient* CPushMtmClient::NewL + ( CRegisteredMtmDll& aRegisteredMtmDll, + CMsvSession& aMsvSession ) + { + CPushMtmClient* client = + new (ELeave) CPushMtmClient( aRegisteredMtmDll, aMsvSession ); + CleanupStack::PushL( client ); + client->ConstructL(); + CleanupStack::Pop(); // client + return client; + } + +// --------------------------------------------------------- +// CPushMtmClient::~CPushMtmClient +// --------------------------------------------------------- +// +CPushMtmClient::~CPushMtmClient() + { + } + +// --------------------------------------------------------- +// CPushMtmClient::CPushMtmClient +// --------------------------------------------------------- +// +CPushMtmClient::CPushMtmClient( CRegisteredMtmDll& aRegisteredMtmDll, + CMsvSession& aMsvSession ) +: CBaseMtm( aRegisteredMtmDll, aMsvSession ) + { + } + +// --------------------------------------------------------- +// CPushMtmClient::ConstructL +// --------------------------------------------------------- +// +void CPushMtmClient::ConstructL() + { + SwitchCurrentEntryL( KMsvRootIndexEntryId ); + } + +// --------------------------------------------------------- +// CPushMtmClient::SaveMessageL +// --------------------------------------------------------- +// +void CPushMtmClient::SaveMessageL() + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmClient::LoadMessageL +// --------------------------------------------------------- +// +void CPushMtmClient::LoadMessageL() + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmClient::ReplyL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmClient::ReplyL + ( + TMsvId /*aReplyEntryId*/, + TMsvPartList /*aPartlist*/, + TRequestStatus& /*aCompletionStatus*/ + ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmClient::ForwardL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmClient::ForwardL + ( + TMsvId /*aForwardEntryId*/, + TMsvPartList /*aPartList*/, + TRequestStatus& /*aCompletionStatus*/ + ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmClient::AddAddresseeL +// --------------------------------------------------------- +// +void CPushMtmClient::AddAddresseeL( const TDesC& /*aRealAddress*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmClient::AddAddresseeL +// --------------------------------------------------------- +// +void CPushMtmClient::AddAddresseeL( const TDesC& /*aRealAddress*/, + const TDesC& /*aAlias*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmClient::RemoveAddressee +// --------------------------------------------------------- +// +void CPushMtmClient::RemoveAddressee( TInt /*aIndex*/ ) + { + // Not suppored. + } + +// --------------------------------------------------------- +// CPushMtmClient::ValidateMessage +// --------------------------------------------------------- +// +TMsvPartList CPushMtmClient::ValidateMessage( TMsvPartList /*aPartList*/ ) + { + // Not supported. KErrNone means that the current context is valid. + return KErrNone; + } + +// --------------------------------------------------------- +// CPushMtmClient::Find +// --------------------------------------------------------- +// +TMsvPartList CPushMtmClient::Find( const TDesC& /*aTextToFind*/, + TMsvPartList /*aPartList*/ ) + { + // Not supported. + return 0; + } + +// --------------------------------------------------------- +// CPushMtmClient::QueryCapability +// --------------------------------------------------------- +// +TInt CPushMtmClient::QueryCapability( TUid /*aCapability*/, TInt& /*aResponse*/ ) + { + return KErrNotSupported; // No supported capabilities here. + } + +// --------------------------------------------------------- +// CPushMtmClient::InvokeSyncFunctionL +// --------------------------------------------------------- +// +void CPushMtmClient::InvokeSyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& /*aParameter*/ ) + { + if ( aFunctionId == EPushMtmCmdCollectGarbage ) + { + TRequestStatus dummyStat; // We call the sync op. + CPushMtmGcOperation* op = CPushMtmGcOperation::NewL( + Session(), + aSelection.Count() ? + aSelection.At( 0 ) : + KMsvNullIndexEntryId, + dummyStat ); + CleanupStack::PushL( op ); + op->DoSyncL(); + CleanupStack::PopAndDestroy( op ); // op + } + else + { + User::Leave( KErrNotSupported ); + } + } + +// --------------------------------------------------------- +// CPushMtmClient::InvokeAsyncFunctionL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmClient::InvokeAsyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& /*aParameter*/, + TRequestStatus& aCompletionStatus ) + { + CMsvOperation* operation = NULL; + + switch ( aFunctionId ) + { + case EPushMtmCmdCollectGarbage: + { + CPushMtmGcOperation* + op = CPushMtmGcOperation::NewL( Session(), + aSelection.Count() ? + aSelection.At( 0 ) : + KMsvNullIndexEntryId, + aCompletionStatus ); + CleanupStack::PushL( op ); + op->StartL(); + operation = op; + CleanupStack::Pop( op ); // op + break; + } + + default: + { + User::Leave( KErrNotSupported ); + break; + } + } + + return operation; + } + +// --------------------------------------------------------- +// CPushMtmClient::ContextEntrySwitched +// --------------------------------------------------------- +// +void CPushMtmClient::ContextEntrySwitched() + { + // Does nothing + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvSrc/PushMtmGcOperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvSrc/PushMtmGcOperation.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,317 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMtmGcOperation. +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmGcOperation.h" +#include "PushMtmCliSrvPanic.h" +#include "PushMtmUtil.h" +#include "PushMtmLog.h" +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmGcOperation::NewL +// --------------------------------------------------------- +// +CPushMtmGcOperation* CPushMtmGcOperation::NewL( + CMsvSession& aSession, + TMsvId aFolderId, + TRequestStatus& aObserverRequestStatus ) + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::NewL") + + CPushMtmGcOperation* self = new (ELeave) CPushMtmGcOperation + ( aSession, aFolderId, aObserverRequestStatus ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::NewL") + return self; + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::~CPushMtmGcOperation +// --------------------------------------------------------- +// +CPushMtmGcOperation::~CPushMtmGcOperation() + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::~CPushMtmGcOperation") + + Cancel(); + delete iEntrySel; + delete iEntryWrapper; + delete iUtil; + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::~CPushMtmGcOperation") + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::DoSyncL +// --------------------------------------------------------- +// +void CPushMtmGcOperation::DoSyncL() + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::DoSyncL") + + InitL(); + + for ( iCurrentIndex = 0; iCurrentIndex < iCount; ++iCurrentIndex ) + { + // iCurrentIndex indicate the current entry in the selection. + GcCurrentL(); + } + + // Release unnecessary resources. + delete iEntrySel; + iEntrySel = NULL; + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::DoSyncL") + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::CPushMtmGcOperation +// --------------------------------------------------------- +// +CPushMtmGcOperation::CPushMtmGcOperation( CMsvSession& aSession, + TMsvId aFolderId, + TRequestStatus& aObserverRequestStatus ) +: CPushMtmOperation( aSession, KMsvNullIndexEntryId, aObserverRequestStatus ), + iState( EInit ), iFolderId( aFolderId ), iCurrentIndex( 0 ) + { + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::ConstructL +// --------------------------------------------------------- +// +void CPushMtmGcOperation::ConstructL() + { + // Do nothing here. + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::InitL +// --------------------------------------------------------- +// +void CPushMtmGcOperation::InitL() + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::InitL") + + if ( !iUtil ) + { + iUtil = CPushMtmUtil::NewL( iMsvSession ); + } + + CMsvEntrySelection* folders = NULL; + if ( iFolderId == KMsvNullIndexEntryId ) + { + folders = iUtil->FindPushFoldersL(); + CleanupStack::PushL( folders ); + } + else + { + folders = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( folders ); + folders->AppendL( iFolderId ); + } + + // Get SIs from the given folder(s). + delete iEntrySel; + iEntrySel = NULL; + iEntrySel = iUtil->FindMessagesL( *folders, KUidWapPushMsgSI ); + CleanupStack::PopAndDestroy(); // folders + + // Reset count. + iCount = iEntrySel->Count(); + PUSHLOG_WRITE_FORMAT(" iCount: %d",iCount) + // Reset index. + iCurrentIndex = 0; + + // We need a wrapper only if there is entry to delete. + if ( iCount && !iEntryWrapper ) + { + iEntryWrapper = CSIPushMsgEntry::NewL(); + } + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::InitL") + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::GcCurrentL +// --------------------------------------------------------- +// +void CPushMtmGcOperation::GcCurrentL() + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::GcCurrentL") + + PUSHLOG_WRITE_FORMAT(" iCurrentIndex: %d",iCurrentIndex) + TMsvId entryId( iEntrySel->At(iCurrentIndex) ); + +#ifdef _DEBUG + TMsvEntry tEntry; + TMsvId dummyService; + User::LeaveIfError + ( iMsvSession.GetEntry( entryId, dummyService, tEntry ) ); + + __ASSERT_DEBUG( tEntry.iMtm == KUidMtmWapPush && + tEntry.iBioType == KUidWapPushMsgSI.iUid, + CliSrvPanic( EPushMtmCliSrvPanBadType ) ); +#endif // _DEBUG + + iEntryWrapper->RetrieveL( iMsvSession, entryId ); + // Check expiration if expiration time was set. + if ( iEntryWrapper->Expires() != Time::NullTTime() ) + { + TTime today; + today.UniversalTime(); + if ( iEntryWrapper->Expires() < today ) + { + PUSHLOG_WRITE(" Expired") + // The message has expired. Delete it. + CMsvEntry* cParent = + iMsvSession.GetEntryL( iEntryWrapper->Entry().Parent() ); + CleanupStack::PushL( cParent ); + // Delete the message. + cParent->DeleteL( entryId ); + CleanupStack::PopAndDestroy(); // cParent + } + } + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::GcCurrentL") + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::RunL +// --------------------------------------------------------- +// +void CPushMtmGcOperation::RunL() + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::RunL") + + if ( iState == EInit ) + { + InitL(); + if ( !iCount ) + { + // Ready. + SignalObserver( KErrNone ); + } + else + { + iState = EGarbageCollecting; + SetActive(); + InvokeRun(); + } + } + else if ( iState == EGarbageCollecting ) + { + __ASSERT_DEBUG( iCount, + CliSrvPanic( EPushMtmCliSrvPanEmptySelection ) ); + // iCurrentIndex indicate the current entry in the selection. + GcCurrentL(); + if ( ++iCurrentIndex < iCount ) + { + // Delete next. + SetActive(); + InvokeRun(); + } + else + { + // No more to delete. + SignalObserver( KErrNone ); + } + } + else + { + __ASSERT_DEBUG( EFalse, + CliSrvPanic( EPushMtmCliSrvPanCommandNotSupported ) ); + } + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::RunL") + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::DoCancel +// --------------------------------------------------------- +// +void CPushMtmGcOperation::DoCancel() + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::DoCancel") + + CPushMtmOperation::DoCancel(); + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::DoCancel") + } + +// --------------------------------------------------------- +// CPushMtmGcOperation::RunError +// --------------------------------------------------------- +// +TInt CPushMtmGcOperation::RunError( TInt aError ) + { + PUSHLOG_ENTERFN("CPushMtmGcOperation::RunError") + PUSHLOG_WRITE_FORMAT(" aError: %d",aError) + + TBool doContinue( EFalse ); + + PUSHLOG_WRITE_FORMAT(" iState: %d",iState) + if ( iState == EInit ) + { + // We cannot continue. + } + else if ( iState == EGarbageCollecting ) + { + if ( aError == KErrNotFound ) + { + // Try to continue with next. + if ( ++iCurrentIndex < iCount ) + { + // Delete next. + doContinue = ETrue; + SetActive(); + InvokeRun(); + } + } + } + else + { + __ASSERT_DEBUG( EFalse, + CliSrvPanic( EPushMtmCliSrvPanCommandNotSupported ) ); + } + + TInt ret = KErrNone; + if ( doContinue ) + { + ret = KErrNone; + } + else + { + // Report error. + ret = CPushMtmOperation::RunError( aError ); + } + + PUSHLOG_LEAVEFN("CPushMtmGcOperation::RunError") + return ret; + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmCliSrvSrc/PushMtmServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmCliSrvSrc/PushMtmServer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Server Mtm class definition +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmServer.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmServer::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushMtmServer* CPushMtmServer::NewL + ( CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry ) + { + CPushMtmServer* server = + new (ELeave) CPushMtmServer( aRegisteredMtmDll, aInitialEntry ); + CleanupStack::PushL( server ); + server->ConstructL(); + CleanupStack::Pop(); // server + return server; + } + +// --------------------------------------------------------- +// CPushMtmServer::~CPushMtmServer +// --------------------------------------------------------- +// +CPushMtmServer::~CPushMtmServer() + { + Cancel(); + } + +// --------------------------------------------------------- +// CPushMtmServer::CPushMtmServer +// --------------------------------------------------------- +// +CPushMtmServer::CPushMtmServer +( CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry ) + : CBaseServerMtm( aRegisteredMtmDll, aInitialEntry ), + iProgressPckg( iProgress ) + { + } + +// --------------------------------------------------------- +// CPushMtmServer::ConstructL +// --------------------------------------------------------- +// +void CPushMtmServer::ConstructL() + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CPushMtmServer::CopyToLocalL +// --------------------------------------------------------- +// +void CPushMtmServer::CopyToLocalL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aDestination*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::CopyFromLocalL +// --------------------------------------------------------- +// +void CPushMtmServer::CopyFromLocalL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aDestination*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::CopyWithinServiceL +// --------------------------------------------------------- +// +void CPushMtmServer::CopyWithinServiceL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aDestination*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::MoveToLocalL +// --------------------------------------------------------- +// +void CPushMtmServer::MoveToLocalL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aDestination*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::MoveFromLocalL +// --------------------------------------------------------- +// +void CPushMtmServer::MoveFromLocalL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aDestination*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::MoveWithinServiceL +// --------------------------------------------------------- +// +void CPushMtmServer::MoveWithinServiceL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aDestination*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::DeleteAllL +// --------------------------------------------------------- +// +void CPushMtmServer::DeleteAllL +( const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::CreateL +// --------------------------------------------------------- +// +void CPushMtmServer::CreateL +( TMsvEntry /*aNewEntry*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::ChangeL +// --------------------------------------------------------- +// +void CPushMtmServer::ChangeL +( TMsvEntry /*aNewEntry*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::StartCommandL +// --------------------------------------------------------- +// +void CPushMtmServer::StartCommandL( CMsvEntrySelection& /*aSelection*/, + TInt /*aCommand*/, const TDesC8& /*aParameter*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------- +// CPushMtmServer::CommandExpected +// --------------------------------------------------------- +// +TBool CPushMtmServer::CommandExpected() + { + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmServer::Progress +// --------------------------------------------------------- +// +const TDesC8& CPushMtmServer::Progress() + { + return iProgressPckg; + } + +// --------------------------------------------------------- +// CPushMtmServer::DoComplete +// --------------------------------------------------------- +// +void CPushMtmServer::DoComplete( TInt /*aError*/ ) + { + } + +// --------------------------------------------------------- +// CPushMtmServer::DoRunL +// --------------------------------------------------------- +// +void CPushMtmServer::DoRunL() + { + } + +// --------------------------------------------------------- +// CPushMtmServer::DoCancel +// --------------------------------------------------------- +// +void CPushMtmServer::DoCancel() + { + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushLoadServiceOp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushLoadServiceOp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushLoadServiceOp. +* +*/ + + + +#ifndef PUSHLOADSERVICEOP_H +#define PUSHLOADSERVICEOP_H + +// INCLUDE FILES + +//#include "PushMtmOperation.h" +#include "PushMtmUiOperation.h" +#include +#include +#include +#include +// FORWARD DECLARATIONS + +class CSchemeHandler; +class CPushMsgEntryBase; +class CPushMtmSettings; + +// CLASS DECLARATION + +/** +* This asynchronous operation is responsible for downloading service that is +* indicated by the URL field of the pushed service message. It means that it +* is applicable only for SI and SL pushed messages. +* The operation uses the Scheme Handler to launch the appropriate handler +* application for the given URL. +*/ +class CPushLoadServiceOp : public CPushMtmUiOperation, + public MAknServerAppExitObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aSession Message Server Session to be used by this operation. + * @param aEntryId Id of entry to operate on. + * @param aObserverStatus Observer's status. + * @return The constructed object. + */ + static CPushLoadServiceOp* NewL( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ); + + /** + * Destructor. + */ + virtual ~CPushLoadServiceOp(); + + public: // Functions from CPushMtmOperation + + /** + * Start or restart the operation. The expiration state of the entry + * is checked (of course only in case of SI) and if it is expired, + * then the entry is deleted and the operation is cancelled. + * @return None. + */ + void StartL(); + + protected: // Constructors + + /** + * Constructor. + * @param aSession Message Server Session to be used by this operation. + * @param aEntryId Id of entry to operate on. + * @param aObserverStatus Observer's status. + */ + CPushLoadServiceOp( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + protected: // New functions + + /** + * Check the expiration state of the context. It is SI specific. + * In case of other push messages it returns EFalse. + * @return ETrue or EFalse. + */ + TBool IsExpiredL( const TMsvEntry& aTEntry ) const; + + /** + * Retrieve the context and get the URL from the context. + * @param aUrl The URL filled from the context. + * @return The context entry. + */ + CPushMsgEntryBase* RetrieveContextAndGetUrlLC( TPtrC& aUrl ) const; + + /** + * Authenticate the message and display user query if necessary. + * @param aPushMsg The push message to be authenticated. + * @param aMtmSettings The push settings. + * @return ETrue if the message is authenticated. + */ + TBool AuthenticateL( const CPushMsgEntryBase& aPushMsg, + const CPushMtmSettings& aMtmSettings ) const; + + /** + * Execute a query which asks the user if (s)he wants to download + * the service anyway. + * @param aResId Resource to be used. + * @return ETrue, if the user wants to download it. + */ + TBool ExecuteUserQueryL( TInt aResId ) const; + + /** + * If no scheme exists in the URL, then "http://" is insetred. + * @param aUrl The original URL. + * @return The validated URL. + */ + HBufC* ValidateLC( TDesC& aUrl ) const; + + protected: // Functions from base classes + + /** + * If the operation was not cancelled in StartL, then it extracts + * the URL from the message and launches the Document Handler to + * execute the proper handler for the scheme. + * @return None. + */ + void RunL(); + + /** + * Cancel protocol implementation. + */ + void DoCancel(); + + /** + * It calls CPushMtmOperation::RunError( aError ). + */ + TInt RunError( TInt aError ); + + void HandleServerAppExit(TInt aReason); + + private: + + TMsvEntry iTEntry; ///< Current context. + TBool iDone; ///< Indicates that the operation is ready. + CSchemeHandler* iSchemeHandler; ///< Handles the URL. Owned. + }; + +#endif // PUSHLOADSERVICEOP_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMessageInfoDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMessageInfoDialog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class definition of CPushMessageInfoDialog. +* +*/ + + + +#ifndef PUSHMESSAGEINFODIALOG_H +#define PUSHMESSAGEINFODIALOG_H + +// INCLUDES + +#include +#include +#include + +// FORWARD DECLARATIONS + +class CMsvSession; +class CAknSingleHeadingPopupMenuStyleListBox; +class CFont; + +// CLASS DECLARATION + +/** +* Avkon environment is required. +* It executes a waiting dialog. +* Usage. +* #include "PushMessageInfoDialog.h" +* CPushMessageInfoDialog* dlg = new (ELeave) CPushMessageInfoDialog; +* CleanupStack::PushL( dlg ); +* dlg->ExecuteLD( msvSession, id ); +* CleanupStack::Pop( dlg ); +* +* Note that this class is independent from CMsgInfoMessageInfoDialog defined +* in muiumsginfo.h. The mentioned class cannot be used, because it does not +* support Push message information. +*/ +class CPushMessageInfoDialog : public CAknPopupList + { + public: // Constructors + + /** + * Constructor. + */ + CPushMessageInfoDialog(); + + /** + * Destructor. + */ + virtual ~CPushMessageInfoDialog(); + + public: // New functions + + /** + * Execute the dialog with this member. + * @param aMsvSession Message Server session. + * @param aId The id of the entry. + * @return None. + */ + void ExecuteLD( CMsvSession& aMsvSession, TMsvId aId ); + + private: // Constructors and destructor + + /** + * Symbian OS constructor. + * @param aMsvSession Message Server session. + * @param aId The id of the entry. + * @return None. + */ + void ConstructL( CMsvSession& aMsvSession, TMsvId aId ); + + private: // New functions + + /** + * Add a message info item. + * @param aHeaderResourceId Res id of the header text. + * @param aText The value text of the item. + * @return None. + */ + void AddMessageInfoItemL + ( TInt aHeaderResourceId, const TDesC& aText ) const; + + /** + * Convert UTC time to Home Time. + * @param aUniversalTime Universal (UTC) time to be converted. + * @return Home time. + */ + TTime ConvertUniversalToHomeTime( const TTime& aUniversalTime ) const; + + /** + * Add message info items to the dialog. + * @param aMsvSession Message Server session. + * @param aId The id of the entry. + * @return None. + */ + void AddMessageInfoItemsL( CMsvSession& aMsvSession, + TMsvId aId ) const; + + private: // Data + + CAknSingleHeadingPopupMenuStyleListBox* iListBox; ///< Owns. + CDesCArrayFlat* iListBoxModel; ///< Owns. + RConeResourceLoader iResourceLoader; + TFileName iResourceFile; + // The following members help wrapping text. + const CFont* iSecondColumnFont; ///< Reference to the font. Not owned. + TInt iSecondColumnWidth; + TInt iPushSLEnabled; +; + }; + +#endif // PUSHMESSAGEINFODIALOG_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMessageInfoOp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMessageInfoOp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushMessageInfoOp. +* +*/ + + + +#ifndef PUSHMESSAGEINFOOP_H +#define PUSHMESSAGEINFOOP_H + +// INCLUDE FILES + +#include "PushMtmUiOperation.h" +#include + +// FORWARD DECLARATIONS + +class CPushMessageInfoDialog; + +// CLASS DECLARATION + +/** +* This asynchronous operation is responsible for executing the Message Info +* dialog. +*/ +class CPushMessageInfoOp : public CPushMtmUiOperation + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aSession Message Server Session to be used by this operation. + * @param aEntryId Id of entry to operate on. + * @param aDontShowNotification ETrue: don't show info notes. + * @param aObserverStatus Observer's status. + */ + CPushMessageInfoOp( CMsvSession& aSession, + TMsvId aEntryId, + TBool aDontShowNotification, + TRequestStatus& aObserverStatus ); + + /** + * Destructor. + */ + virtual ~CPushMessageInfoOp(); + + public: // Functions from CPushMtmOperation + + /** + * Start or restart the operation. + * Current implementation calls Cancel and invokes RunL. + * Derived classes may override this. + */ + void StartL(); + + protected: // New functions + + /** + * Decide if content changed and act accordingly. + */ + void HandleEntryChangeL(); + + /** + * Show information note and cancel the operation. + */ + void NotifyAndCancelL( TInt aResId ); + + protected: // Functions from base classes + + /** + * TODO. + */ + void RunL(); + + /** + * Cancel protocol implementation. + */ + void DoCancel(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. The observer is signaled if a leave occures. + * The leave code is not forwarded to the scheduler. + */ + TInt RunError( TInt aError ); + + /** + * Call-back for entry event handling. + */ + void HandleEntryEventL( TMsvEntryEvent aEvent, + TAny* aArg1, TAny* aArg2, TAny* aArg3 ); + + private: // Data + + CPushMessageInfoDialog* iDialog; ///< Owned. + TBool iDontShowNotification; + TBool iObserverCompleted; + TBool* iDeletedFlag; + }; + +#endif // PUSHMESSAGEINFOOP_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMtmUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMtmUi.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,369 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Ui Mtm class declaration +* +*/ + + + +#ifndef PUSHMTMUI_H +#define PUSHMTMUI_H + +// INCLUDE FILES + +#include + +// CLASS DECLARATION + +/** +* UI MTM for pushed messages. +*/ +class CPushMtmUi: public CBaseMtmUi + { + public: // Constructors and destructor + + /** + * Two-phased constructor (exported factory function). + * Leaves on failure. + * @param aBaseMtm The client MTM. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @return The constructed UI. + */ + IMPORT_C static CPushMtmUi* NewL + ( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); + + /** + * Destructor. + */ + virtual ~CPushMtmUi(); + + private: // Constructors + + /** + * Constructor. + * @param aBaseMtm The client MTM. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @return The constructed UI. + */ + CPushMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); + + private: // New functions + + /** + * Utility to set a TMsvLocalOperationProgress completed. + * @param aProgress Progress package buffer to set. + * @param aId Id to set in the buffer. + */ + void SetProgressSuccess + ( TPckgBuf& aProgress, TMsvId aId ); + + /** + * Create a CMsvCompletedOperation object. + * @param aObserverStatus Observer's status. + * @return The operation object. + */ + CMsvOperation* CompletedOperationL( TRequestStatus& aObserverStatus ); + + /** + * Ensure that a service entry exists with which the settings can be + * reached from a messaging application. It creates a service entry + * if necessary. + * @return None. + */ + void EnsureServiceEntryL() const; + + private: // Functions from base classes + + /** + * Unsupported, leaves with KErrNotSupported. + * @param aEntry (Unused) The data to be copied into the new entry. + * @param aParent (Unused) The parent of the new entry. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* CreateL( + const TMsvEntry& aEntry, + CMsvEntry& aParent, + TRequestStatus& aStatus ); + + // -------------------------------------------------- + // --- Functions dependent on the current context --- + // -------------------------------------------------- + + /** + * Open the current context. If it is a KUidMsvMessageEntry then it is + * equivalent to ViewL. If it is a KUidMsvServiceEntry then it is + * equivalent to EditL. Otherwise it leaves with KErrNotSupported. + * @param aStatus Completion status. + * @return The operation object. + */ + CMsvOperation* OpenL( TRequestStatus& aStatus ); + + /** + * Close the current context. It does nothing just returns a completed + * operation. + * @param aStatus Completion status. + * @return The operation object. + */ + CMsvOperation* CloseL( TRequestStatus& aStatus ); + + /** + * Edit the current context. For KUidMsvServiceEntry it executes the + * "Service Settings" dialog. It returns a completed operation. For + * other entry types it leaves with KErrNotSupported. + * @param aStatus Completion status. + * @return The operation object. + */ + CMsvOperation* EditL( TRequestStatus& aStatus ); + + /** + * View the current context. Only for KUidMsvMessageEntry. It launches the + * Push Viewer application embedded for SI and it lauches the viewer + * application embedded for SP. For other entry types it leaves + * with KErrNotSupported. + * @param aStatus Completion status. + * @return The operation object. + */ + CMsvOperation* ViewL( TRequestStatus& aStatus ); + + // -------------------------------------------------- + // -- Functions independent on the current context -- + // -------------------------------------------------- + + // --- Actions upon message selections --- + // Selections must be in same folder and all of the correct MTM type. + // Context may change after calling these functions. + + /** + * This function is supported only for one selected entry. If the selection + * contains more than one entry then it leaves with KErrNotSupported. + * @param aStatus Completion status. + * @param aSelection Entry selection to operate on. + * @return The operation object. + */ + CMsvOperation* OpenL + ( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); + + /** + * This function is supported only for one selected entry. If the selection + * contains more than one entry then it leaves with KErrNotSupported. + * Close the first entry from the selection. It does nothing however. + * @param aStatus Completion status. + * @param aSelection Entry selection to operate on. + * @return The operation object. + */ + CMsvOperation* CloseL + ( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); + + /** + * This function is supported only for one selected entry. If the selection + * contains more than one entry then it leaves with KErrNotSupported. + * Edit the first selected entry. + * @param aStatus Completion status. + * @param aSelection Entry selection to operate on. + * @return The operation object. + */ + CMsvOperation* EditL + ( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); + + /** + * This function is supported only for one selected entry. If the selection + * contains more than one entry then it leaves with KErrNotSupported. + * View the first entry from the selection. + * @param aStatus Completion status. + * @param aSelection Entry selection to operate on. + * @return The operation object. + */ + CMsvOperation* ViewL + ( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aStatus Completion status. + * @param aSelection Entry selection to operate on. + * @return The operation object. + */ + CMsvOperation* CancelL + ( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ); + + // --- Deletion --- + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aSelection Entry selection to operate on. + * @param aStatus Completion status. + * @return The operation object. + */ + CMsvOperation* DeleteFromL + ( const CMsvEntrySelection& aSelection, TRequestStatus& aStatus ); + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aSelection (Unused) Entry selection to operate on. They must + * be children of the current context. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* UnDeleteFromL + ( const CMsvEntrySelection& aSelection, TRequestStatus& aStatus ); + + /* * + * It does nothing just leaves with KErrNotSupported. + * @param (Unused) aService Service to delete. + * @param (Unused) aStatus Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* DeleteServiceL + ( const TMsvEntry& aService, TRequestStatus& aStatus ); + + // --- Message responding --- + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aDestination (Unused) The entry to which to assign the reply. + * @param aPartList (Unused) Parts to be contained in the reply. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* ReplyL( + TMsvId aDestination, + TMsvPartList aPartlist, + TRequestStatus& aCompletionStatus ); + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aDestination (Unused) The entry to which to assign the + * forwarded message. + * @param aPartList (Unused) Parts to be contained in the forwarded + * message. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* ForwardL( + TMsvId aDestination, + TMsvPartList aPartList, + TRequestStatus& aCompletionStatus ); + + // --- Copy and move functions --- + // Context should be set to folder or entry of this MTM. + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aSelection (Unused) Entry selection to operate on. They all + * must have the same parent. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* CopyToL + ( const CMsvEntrySelection& aSelection, TRequestStatus& aStatus ); + + /* * + * It does nothing just leaves with KErrNotSupported. + * @param aSelection (Unused) Entry selection to operate on. They all + * must have the same parent. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* MoveToL + ( const CMsvEntrySelection& aSelection, TRequestStatus& aStatus ); + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aSelection (Unused) Entry selection to operate on. They all + * must have the same parent. + * @param aTargetId (Unused) The ID of the entry to own the copies. + * @param aStatus (Unused) Completion status. + * @return (NULL) The operation object. + */ + CMsvOperation* CopyFromL( + const CMsvEntrySelection& aSelection, + TMsvId aTargetId, + TRequestStatus& aStatus ); + + /** + * It does nothing just leaves with KErrNotSupported. + * @param aSelection Entry selection to operate on. They all + * must have the same parent. + * @param aTargetId The ID of the entry to move to. + * @param aStatus Completion status. + * @return The operation object. + */ + + CMsvOperation* MoveFromL( + const CMsvEntrySelection& aSelection, + TMsvId aTargetId, + TRequestStatus& aStatus ); + + /** + * Query if the MTM supports a particular (standard) capability. + * This feunction is also called by CPushMtmClient::QueryCapability. + * @param aCapability UID of capability to be queried. + * @param aResponse Response value. + * @return + * - KErrNone: aCapability is a recognized value + * and a response is returned. + * - KErrNotSupported: aCapability is not a recognized value. + */ + TInt QueryCapability( TUid aCapability, TInt& aResponse ); + + /** + * Invoke synchronous operation. + * Only KMtmUiMessagingInitialisation and + * KMtmUiFunctionRestoreFactorySettings are supported. + * It will leave with KErrNotSupported otherwise. + * @param aFunctionId ID of the requested operation. + * @param aSelection Selection of message entries to operate on. + * @param aParameter Buffer containing input and output parameters. + * @return None. + * @throw KErrNotSupported The selected function is not supported. + */ + void InvokeSyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter ); + + /** + * Invoke asynchronous operation. + * Supported operations: + * - KMtmUiFunctionMessageInfo Launch message info dialog. + * - EPushMtmCmdLoadService Handle the URL in SI (or SL). + * - EPushMtmCmdViewService Render the content of the SP. + * - otherwise it calls CBaseMtmUi::InvokeAsyncFunctionL + * @param aFunctionId ID of the requested operation. + * @param aSelection Selection of message entries to operate on. + * @param aCompletionStatus Completion status. + * @param aParameter Buffer containing input and output parameters. + * @return + * - If successful, an asynchronously completing operation. + * - If failed, a completed operation, with status set to the + * relevant error code. + * @throw KErrNotSupported The selected function is not supported. + */ + CMsvOperation* InvokeAsyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TRequestStatus& aCompletionStatus, + TDes8& aParameter ); + + /** + * Get the resource file name for this MTM UI. + */ + void GetResourceFileName( TFileName& aFileName ) const; + private: + TInt iPushSLEnabled; + }; + +#endif // PUSHMTMUI_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMtmUi.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMtmUi.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HRH file for the Mtm Ui and Mtm Ui Data components +* +*/ + + + +#ifndef PUSHMTMUI_HRH +#define PUSHMTMUI_HRH + +#include +#include +#include + +enum TPushSettingsDialogCommand + { + // Dialog specific command ids. + // + EPushSettingsDialogCmdChangeWithoutSettingPage = EAknSoftkeyChange, + // + // Ui framework defined command ids. + // + EPushSettingsDialogCmdChange = EAknSoftkeySelect,// Required by CAknSettingPage::OfferKeyEventL. + EPushSettingsDialogCmdOptions = EAknSoftkeyOptions,// = 3000 +#ifdef __SERIES60_HELP + EPushSettingsDialogCmdHelp = EAknCmdHelp, // = 4003 +#endif //__SERIES60_HELP + EPushSettingsDialogCmdBack = EAknSoftkeyBack, // = 3001 + EPushSettingsDialogCmdExit = EEikCmdExit, // = 0x100. Use in HandleCommanL. + EPushSettingsDialogCmdAknExit = EAknCmdExit // = 4011. Use in resources. + }; + +enum TPushSettingsDialogControl + { + EPushSettingsDialogCntrlListBox = 1 + }; + +enum TPushLoadWaitNoteControl + { + EPushLoadWaitNoteCntrl = 1 + }; + +#endif // PUSHMTMUI_HRH + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMtmUiData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMtmUiData.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Push Ui Data Mtm class declaration +* +*/ + + + +#ifndef PUSHMTMUIDATA_H +#define PUSHMTMUIDATA_H + +// INCLUDE FILES + +#include +#include + +// CLASS DECLARATION + +/** +* UI Data MTM for pushed messages. +*/ +class CPushMtmUiData: public CBaseMtmUiData + { + public: // construction + + /** + * Two-phased constructor (exported factory function). + * Leaves on failure. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + * @return The constructed UI Data. + */ + IMPORT_C static CPushMtmUiData* NewL( CRegisteredMtmDll& aRegisteredDll ); + + /** + * Destructor. + */ + virtual ~CPushMtmUiData(); + + private: // construction + + /** + * Constructor. + * @param aRegisteredMtmDll Registration data for the MTM DLL. + */ + CPushMtmUiData( CRegisteredMtmDll& aRegisteredDll ); + + private: // from CBaseMtmUiData + + /** + * Get an array of bitmaps relevant to the passed context entry. + * @param aContext Context entry to return the icons for. + * @param aStateFlags + * @return Bitmap array for the given context. + */ + const CBaseMtmUiData::CBitmapArray& ContextIcon + ( const TMsvEntry& aContext, TInt aStateFlags ) const; + + /** + * Check if aNewEntry can be created as a child of aContext. + * (Yes for services in the root). + * @param aParent The entry under which aNewEntry should be created. + * @param aNewEntry The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanCreateEntryL( const TMsvEntry& aParent,TMsvEntry& aNewEntry, + TInt& aReasonResourceId ) const; + + /** + * Check if a delete operation is supported for aContext (yes). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanDeleteFromEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if the service aService can be deleted (yes). + * @param aService The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanDeleteServiceL + ( const TMsvEntry& aService, TInt& aReasonResourceId ) const; + + /** + * Check if aContext can be replied to (no). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanReplyToEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if aContext can be forwarded (no). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanForwardEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if aContext can be edited (no). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanEditEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if aContext can be viewed (yes for messages). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanViewEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if aContext can be opened (yes for messages). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanOpenEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if aContext can be closed (yes for messages). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanCloseEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if a copy to or move to operation is supported + * for aContext (yes). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanCopyMoveToEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if a copy from or move from operation is supported + * for aContext (yes). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanCopyMoveFromEntryL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if a cancel operation is supported for aContext (no). + * @param aContext The entry to which the operation applies. + * @param aReasonResourceId On return, a resource string ID or 0. + */ + TBool CanCancelL + ( const TMsvEntry& aContext, TInt& aReasonResourceId ) const; + + /** + * Check if an MTM-specific operation is appropriate to the entry + * specified in aContext. + * @param aOperationId ID of operation to query. + * @param aContext The entry to which the operation applies. + * @return + * - KErrNone if operation is supported, + * - KErrCancel if the operation is not supported. + */ + TInt OperationSupportedL + ( TInt aOperationId, const TMsvEntry& aContext ) const; + + /** + * Query if the MTM supports a particular (standard) capability. + * This function is also called by CPushMtmBaseClient::QueryCapability. + * @param aCapability UID of capability to be queried. + * @param aResponse Response value. + * @return + * - KErrNone: aCapability is a recognised value + * and a response is returned. + * - KErrNotSupported: aCapability is not a recognised value. + */ + TInt QueryCapability( TUid aCapability, TInt& aResponse ) const; + + /** + * Since we don't support sending, we don't need to support this + * function. + * @param aContext + * @return NULL. + */ + HBufC* StatusTextL( const TMsvEntry& aContext ) const; + + /** + * Load and populate icons and functions. + */ + void PopulateArraysL(); + + /** + * Get the resource file name for this component. + */ + void GetResourceFileName( TFileName& aFileName ) const; + + private: // New functions + + /** + * Create skinned icons in iIconArrays. + */ + void CreateSkinnedBitmapsL(); + }; + +#endif // PUSHMTMUIDATA_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMtmUiDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMtmUiDef.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic definition file. Internal usage only. +* +*/ + + + +#ifndef PUSHMTMUIDEF_H +#define PUSHMTMUIDEF_H + +// CONSTANTS + +/// Resource file for the Push Ui Data Mtm. +_LIT( KPushMtmUiDataResourceFileAndDrive, "z:PushMtmUi.rsc" ); + +/// Bitmap file for the Push Ui Data Mtm. +_LIT( KPushMtmUiDataBitmapFileAndDrive, "z:PushMtm.mbm" ); + +/// Resource file for the Push Ui Mtm. +_LIT( KPushMtmUiResourceFileAndDrive, "z:PushMtmUi.rsc" ); + +#endif // PUSHMTMUIDEF_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMtmUiOperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMtmUiOperation.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushMtmUiOperation. +* +*/ + + + +#ifndef PUSHMTMUIOPERATION_H +#define PUSHMTMUIOPERATION_H + +// INCLUDES + +#include "PushMtmOperation.h" +#include +#include + +// FORWARD DECLARATIONS + +class CCoeEnv; +class CPushMtmUtil; + +// CLASS DECLARATION + +/** +* Base class for UI operations. It extends CPushMtmOperation with +* AssureResourceL(). +*/ +class CPushMtmUiOperation : public CPushMtmOperation + { + protected: // Constructors and destructor + + /** + * Constructor. + * @param aSession Message Server Session to be used by this operation. + * @param aId Id of entry to operate on. + * @param aObserverStatus Observer's status. + */ + CPushMtmUiOperation( CMsvSession& aSession, + TMsvId aId, + TRequestStatus& aObserverStatus ); + + /** + * Symbian OS constructor. Derived classes must call this! + */ + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CPushMtmUiOperation(); + + protected: // New functions + + /** + * Add the resource file to the Cone. + * Must be called before using a resource from this file to ensure that + * the resource file is loaded. Only one file can be loaded that is + * closed only in the destructor. + * @param aResourceFile Resource file name to be loaded. + * @return None. + */ + void AssureResourceL( const TDesC& aResourceFile ); + + /** + * Show a global error note using CErrorUI. + * @param aError Error code. + * @return None. + */ + void ShowGlobalErrorNoteL( TInt aError ) const; + + protected: // Data members + + CCoeEnv& iCoeEnv; + CPushMtmUtil* iMtmUtil; ///< Utility. Has. + RConeResourceLoader iResourceLoader; ///< Resource loader. + TBool iResourceOpened; ///< Indicate if the resource is opened. + }; + +#endif // PUSHMTMUIOPERATION_H + +// End of file. + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushMtmUiPanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushMtmUiPanic.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +#ifndef PUSHMTMUIPANIC_H +#define PUSHMTMUIPANIC_H + +// INCLUDE FILES + +#include + +enum TPushMtmUiPanic + { + EPushMtmUiPanCommandNotSupported = 1, ///< Not supported command. + EPushMtmUiPanBadType, ///< Unsupported message type for an operation. + EPushMtmUiPanFoldersNotSupported, ///< MTM loaded with bad message entry. + EPushMtmUiPanEmptySelection, ///< Entry selection is empty. + EPushMtmUiPanAlreadyExistingTitle, + EPushMtmUiPanMissingTitle, + EPushMtmUiPanAlreadyExistingModel, + EPushMtmUiPanMissingModel, + EPushMtmUiPanNotInitialized, + EPushMtmUiPanAlreadyInitialized, + EPushMtmUiPanMissingListBox, + EPushMtmUiPanBadEvent, + EPushMtmUiPanBadMtm, ///< Bad MTM type. + EPushMtmUiPanBadBioType, ///< Bad BIO type. + EPushMtmUiPanCodeReached, ///< The code line shouldn't be reached. + EPushMtmUiPanTooManyServiceEntries + }; + +GLREF_C void UiPanic( TPushMtmUiPanic aReason ); + +#endif // PUSHMTMUIPANIC_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushSettingsDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushSettingsDialog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class definition of CPushSettingsDialog. +* +*/ + + + +#ifndef PUSHSETTINGSDIALOG_H +#define PUSHSETTINGSDIALOG_H + +// INCLUDES + +#include "PushMtmSettings.h" +#include +#include +#include + +// FORWARD DECLARATIONS + +class CMsvSession; +class CAknSettingStyleListBox; +class CEikImage; + +// CLASS DECLARATION + +/** +* Avkon environment is required. +* Waiting dialog. +* Usage. +* #include "PushSettingsDialog.h" +* CPushSettingsDialog* dlg = new (ELeave) CPushSettingsDialog; +* dlg->ExecuteLD( msvSession ); +* +* Note that we could use CMuiuSettingsArray defined in MuiuSettingsArray.h, +* but it seems that our PI list handling (Ignore services from) makes +* this dialog so complicated, that it is better not to use CMuiuSettingsArray, +* which would make the desing more complicated, because it does not support +* such functionality that PI list handling requires. +*/ +class CPushSettingsDialog : public CAknDialog, + public MEikListBoxObserver + { + public: // Constructors + + /** + * Constructor. + * @param aMsvSession Message Server session. + */ + CPushSettingsDialog( CMsvSession& aMsvSession ); + + public: // New functions + + /** + * Execute the dialog with this member. + * @return None. + */ + void ExecuteLD(); + + private: // New data types + + enum TSettingType + { + EServiceReception, ///< On or Off + EServiceLoadingType ///< Automatic or Manual + }; + + private: // Constructors and destructor + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CPushSettingsDialog(); + + private: // New functions + + /** + * Set up title text. + * @return none + */ + void SetUpStatusPaneL(); + + /** + * Restore the previous title text. + * @return none + */ + void RestoreStatusPaneL(); + + /** + * Construct model. + * @return none + */ + void ConstructModelL(); + + /** + * Update setting page model. + * @return none + */ + void UpdateSettingListBoxModelL(); + + /** + * Update setting page view. + * @return none + */ + void UpdateSettingListBoxViewL() const; + + /** + * Apply changes of the model. + * @return None. + */ + void ApplyModelChangesL(); + + /** + * Show radio button setting page for all + * items except for EIgnoreServicesFrom. + * @return none + */ + void ShowRadioButtonSettingPageL( const TSettingType aSettingType ); + + /** + * Show the confirmation dialog about the changing of the service loading + * type from 'manual' to 'automatic'. + * @return ETrue if the user confirmed. EFalse otherwise. + */ + TBool ShowServiceLoadingTypeConfirmationL() const; + + /** + * Change current setting. No setting page usage is preferred. + * @return none + */ + void ChangeCurrentSettingWithoutSettingPageL(); + + /** + * Change current setting with the usage of setting page. + * @return none + */ + void ChangeCurrentSettingL(); + + /** + * Append an item to the list box' item text array. + * @param aSettingType Setting item type. + * @param aTitleResId Title resource id. If it is KErrNotFound, + * then aTitleText is used. + * @param aValueResId Value resource id. If it is KErrNotFound, + * then aValueText is used. + * @param aTitleText See above. + * @param aValueText See above. + * @return none + */ + void ConstructAndAppendItemTextL + ( const TSettingType aSettingType, + const TInt aTitleResId, const TInt aValueResId, + const TDesC& aTitleText = KNullDesC(), + const TDesC& aValueText = KNullDesC() ); + + /** + * Construct the title text for a setting. + * param aSettingType Type of the setting. + * @return The constructed title text. + */ + HBufC* ConstructSettingTitleL( const TSettingType aSettingType ) const; + + /** + * Get the resource ids of those strings that a given binary setting can have. + * Note. The following functions have strong relations: + * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, + * ConstructSettingValueArrayL, UpdateSettingL! + * param aSettingType Type of the setting. + * param aVal1ResId The id of the first value string. + * param aVal2ResId The id of the second value string. + * @return None. + */ + void ConstructSettingValueArray + ( const TSettingType aSettingType, TInt& aVal1ResId, TInt& aVal2ResId ) const; + + /** + * Get the resource ids of the currently set value string. + * Note. The following functions have strong relations: + * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, + * ConstructSettingValueArrayL, UpdateSettingL! + * param aSettingType Type of the setting. + * param aIndex The index of this currently selected value is also returned. + * @return Resource id. + */ + TInt CurrentlySelectedSettingValueResId + ( const TSettingType aSettingType, TInt& aIndex ) const; + + /** + * Get the value strings of those strings that a given binary setting can have. + * Note. The following functions have strong relations: + * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, + * ConstructSettingValueArrayL, UpdateSettingL! + * param aSettingType Type of the setting. + * param aIndex The index of this currently selected value is also returned. + * @return The value array. + */ + CDesCArrayFlat* ConstructSettingValueArrayL + ( const TSettingType aSettingType, TInt& index ) const; + + /** + * Set in the model the right setting value using the given index. + * Note. The following functions have strong relations: + * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, + * ConstructSettingValueArrayL, UpdateSettingL! + * param aSettingType Type of the setting. + * param aIndex The index of the selected value. + * @return None. + */ + void UpdateSettingL + ( const TSettingType aSettingType, const TInt index ) const; + + private: // Functions from base classes + + TKeyResponse OfferKeyEventL + ( const TKeyEvent& aKeyEvent, TEventCode aType ); + + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + void PreLayoutDynInitL(); + + void ProcessCommandL( TInt aCommand ); + + TBool OkToExitL( TInt aButtonId ); + + void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); + +#ifdef __SERIES60_HELP + + void GetHelpContext( TCoeHelpContext& aContext ) const; + +#endif //__SERIES60_HELP + + private: // Data members + + CPushMtmSettings* iModel; ///< Settings: the model. Has. + CMsvSession& iMsvSession; ///< Message Server session. + RConeResourceLoader iResourceLoader; ///< Resource file loader. + TFileName iResourceFile; + CAknSettingStyleListBox* iSettingListBox; ///< List box contained by the dialog. Uses. + CDesCArrayFlat* iSettingListBoxItemTextArray; ///< List box' item text array. Uses. + CArrayFixFlat* iSettingType; /**< A given array item + * determines the type of + * the item of the list + * with the same index. Has. + */ + TBool iNewTitleTextUsed; ///< Indicate if new title text is used. + HBufC* iPreviousTitleText; ///< Restore it on termination. Has. + TBool iRestoreSP; /**< EFalse, if it is not necessary + * to restore status pane. */ + TInt iPushSLEnabled; + }; + +#endif // PUSHSETTINGSDIALOG_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushViewMessageOp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushViewMessageOp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushViewMessageOp. +* +*/ + + + +#ifndef PUSHVIEWMESSAGEOP_H +#define PUSHVIEWMESSAGEOP_H + +// INCLUDE FILES + +#include "PushMtmUiOperation.h" +#include +#include +#include + +// FORWARD DECLARATIONS + +class CDocumentHandler; + +// CLASS DECLARATION + +/** +* This asynchronous operation is responsible for launching the appropriate +* application (embedded if possible) that is capable of rendering the text +* of an SI message. +* The operation uses the Document Handler to lauch the appropriate handler +* application. +*/ +class CPushViewMessageOp : public CPushMtmUiOperation, + public MAknServerAppExitObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aSession Message Server Session to be used by this operation. + * @param aEntryId Id of entry to operate on. + * @param aObserverStatus Observer's status. + * @return The constructed object. + */ + static CPushViewMessageOp* NewL( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ); + + /** + * Destructor. + */ + virtual ~CPushViewMessageOp(); + + public: // Functions from CPushMtmOperation + + /** + * Start or restart the operation. + * Current implementation calls Cancel and invokes RunL. + * Derived classes may override this. + */ + void StartL(); + + protected: // Constructors + + /** + * Constructor. + * @param aSession Message Server Session to be used by this operation. + * @param aEntryId Id of entry to operate on. + * @param aObserverStatus Observer's status. + */ + CPushViewMessageOp( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + protected: // New functions + + /** + * Show information note and cancel the operation. + */ + void NotifyAndCancelL( TInt aResId ); + + protected: // Functions from base classes + + /** + * Current implementation calls SignalObserver( KErrNone ). + * Derived classes should override this and also should + * call SignalObserver. + */ + void RunL(); + + /** + * Cancel protocol implementation. + */ + void DoCancel(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. The observer is signaled if a leave occures. + * The leave code is not forwarded to the scheduler. + */ + TInt RunError( TInt aError ); + + /** + * Call-back for entry event handling. + */ + void HandleEntryEventL( TMsvEntryEvent aEvent, + TAny* aArg1, TAny* aArg2, TAny* aArg3 ); + + protected: // From MAknServerAppExitObserver + + void HandleServerAppExit( TInt aReason ); + + private: // Data + + CDocumentHandler* iDocHandler; ///< Owned. + TBool iIsCancelled; + }; + +#endif // PUSHVIEWMESSAGEOP_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiInc/PushViewServiceOp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiInc/PushViewServiceOp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushViewServiceOp. +* +*/ + + + +#ifndef PUSHVIEWSERVICEOP_H +#define PUSHVIEWSERVICEOP_H + +// INCLUDE FILES + +#include "PushMtmUiOperation.h" +#include +#include +#include + +// FORWARD DECLARATIONS + +class CDocumentHandler; + +// CLASS DECLARATION + +/** +* This asynchronous operation is responsible for launching the appropriate +* application (embedded if possible) that is capable of rendering the content +* of a SP simple push message. +* The operation uses the Document Handler to lauch the appropriate handler +* application for the given content. +*/ +class CPushViewServiceOp : public CPushMtmUiOperation, + public MAknServerAppExitObserver + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aSession Message Server Session to be used by this operation. + * @param aEntryId Id of entry to operate on. + * @param aObserverStatus Observer's status. + */ + CPushViewServiceOp( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ); + + /** + * Destructor. + */ + virtual ~CPushViewServiceOp(); + + public: // Functions from CPushMtmOperation + + /** + * Start or restart the operation. + * Current implementation calls Cancel and invokes RunL. + * Derived classes may override this. + */ + void StartL(); + + protected: // Functions from base classes + + /** + * Current implementation calls SignalObserver( KErrNone ). + * Derived classes should override this and also should + * call SignalObserver. + */ + void RunL(); + + /** + * Cancel protocol implementation. + */ + void DoCancel(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. The observer is signaled if a leave occures. + * The leave code is not forwarded to the scheduler. + */ + TInt RunError( TInt aError ); + + protected: // From MAknServerAppExitObserver + + void HandleServerAppExit( TInt aReason ); + + private: // Data + + CDocumentHandler* iDocHandler; ///< Owned. + }; + +#endif // PUSHVIEWSERVICEOP_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushLoadServiceOp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushLoadServiceOp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,443 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushLoadServiceOp. +* +*/ + + + +// INCLUDE FILES + +#include "PushLoadServiceOp.h" +#include "PushMtmUiDef.h" +#include "PushMtmUiPanic.h" +#include "PushMtmLog.h" +#include "PushMtmUtil.h" +#include "PushMtmSettings.h" +#include "PushAuthenticationUtilities.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +_LIT( KDefaultScheme, "http://" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushLoadServiceOp::NewL +// --------------------------------------------------------- +// +CPushLoadServiceOp* CPushLoadServiceOp::NewL( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ) + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::NewL") + + CPushLoadServiceOp* self = + new (ELeave) CPushLoadServiceOp( aSession, aEntryId, aObserverStatus ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::NewL") + return self; + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::~CPushLoadServiceOp +// --------------------------------------------------------- +// +CPushLoadServiceOp::~CPushLoadServiceOp() + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::~CPushLoadServiceOp") + + Cancel(); + delete iSchemeHandler; + FeatureManager::UnInitializeLib(); + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::~CPushLoadServiceOp") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::StartL +// --------------------------------------------------------- +// +void CPushLoadServiceOp::StartL() + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::StartL") + + Cancel(); + + // Check expiration (SI specific). + if ( IsExpiredL( iTEntry ) ) + { + PUSHLOG_WRITE(" Msg is expired.") + // The entry is expired. + + // Display a confirmation dialog. + TParse* fileParser = new (ELeave) TParse; + CleanupStack::PushL( fileParser ); + fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); + AssureResourceL( fileParser->FullName() ); + CleanupStack::PopAndDestroy( fileParser ); // fileParser + fileParser = NULL; + + HBufC* value = iCoeEnv.AllocReadResourceLC( R_PUSHLS_EXPIRED_NOTE ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); + note->ExecuteLD( *value ); + CleanupStack::PopAndDestroy( value ); // value + + // Delete the expired message. + CMsvEntry* cParent = iMsvSession.GetEntryL( iTEntry.Parent() ); + CleanupStack::PushL( cParent ); + cParent->DeleteL( iEntryId ); + CleanupStack::PopAndDestroy( cParent ); // cParent + + // Nothing to do. + iDone = ETrue; + } + + CPushMtmUiOperation::StartL(); + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::StartL") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::CPushLoadServiceOp +// --------------------------------------------------------- +// +CPushLoadServiceOp::CPushLoadServiceOp( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ) +: CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ), + iDone( EFalse ) + { + PUSHLOG_WRITE("CPushLoadServiceOp constructing") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::ConstructL +// --------------------------------------------------------- +// +void CPushLoadServiceOp::ConstructL() + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::ConstructL") + + FeatureManager::InitializeLibL(); + + CPushMtmUiOperation::ConstructL(); + + // Initialize iTEntry. + TMsvId service; + User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, iTEntry ) ); + __ASSERT_ALWAYS( iTEntry.iMtm == KUidMtmWapPush, + UiPanic( EPushMtmUiPanBadMtm ) ); + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::ConstructL") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::IsExpiredL +// --------------------------------------------------------- +// +TBool CPushLoadServiceOp::IsExpiredL( const TMsvEntry& aTEntry ) const + { + TBool ret( EFalse ); + + if ( aTEntry.iBioType == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = CSIPushMsgEntry::NewL(); + CleanupStack::PushL( si ); + si->RetrieveL( iMsvSession, iEntryId ); + // Check expiration if expiration time was set. + if ( si->Expires() != Time::NullTTime() ) + { + TTime today; + today.UniversalTime(); + if ( si->Expires() < today ) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy( si ); // si + } + + return ret; + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::RetrieveContextAndGetUrlLC +// --------------------------------------------------------- +// +CPushMsgEntryBase* CPushLoadServiceOp::RetrieveContextAndGetUrlLC + ( TPtrC& aUrl ) const + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::RetrieveContextAndGetUrlLC"); + + CPushMsgEntryBase* context = NULL; + const TInt32 bioType( iTEntry.iBioType ); + + if ( bioType == KUidWapPushMsgSI.iUid ) + { + context = CSIPushMsgEntry::NewL(); + } + else if ( bioType == KUidWapPushMsgSL.iUid && + FeatureManager::FeatureSupported( KFeatureIdPushSL ) ) + { + context = CSLPushMsgEntry::NewL(); + } + else + { + __ASSERT_DEBUG( EFalse, UiPanic( EPushMtmUiPanBadBioType ) ); + User::Leave( KErrNotSupported ); + } + + CleanupStack::PushL( context ); + context->RetrieveL( iMsvSession, iEntryId ); + + if ( bioType == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, context ); + aUrl.Set( si->Url() ); + } + else if ( bioType == KUidWapPushMsgSL.iUid ) + { + CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, context ); + aUrl.Set( sl->Url() ); + } + else + { + __ASSERT_DEBUG( EFalse, UiPanic( EPushMtmUiPanBadBioType ) ); + } + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::RetrieveContextAndGetUrlLC"); + return context; + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::AuthenticateL +// --------------------------------------------------------- +// +TBool CPushLoadServiceOp::AuthenticateL( const CPushMsgEntryBase& aPushMsg, + const CPushMtmSettings& aMtmSettings ) const + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::AuthenticateL"); + + TBool isAuthenticated = ETrue; // by default. + + if ( iTEntry.iBioType != KUidWapPushMsgSL.iUid ) + { + PUSHLOG_WRITE(" Not SL"); + isAuthenticated = ETrue; // No authentication needed. + } + else + { + // SL cache & execute-high message requires additional authentication. + CSLPushMsgEntry& sl = (CSLPushMsgEntry&)aPushMsg; + + if ( sl.Action() == CSLPushMsgEntry::ESLPushMsgExecuteCache ) + { + PUSHLOG_WRITE(" SL cache"); + isAuthenticated = TPushAuthenticationUtil:: + AuthenticateMsgL( aMtmSettings, aPushMsg ); + if ( !isAuthenticated ) + { + // Ask the user... + isAuthenticated = ExecuteUserQueryL( R_PUSHLS_SL_CACHE_NOT_AUTH ); + } + } + else if + ( + sl.Action() == CSLPushMsgEntry::ESLPushMsgExecuteHigh && + aMtmSettings.ServiceLoadingType() == CPushMtmSettings::EAutomatic + ) + { + PUSHLOG_WRITE(" SL high + auto"); + isAuthenticated = TPushAuthenticationUtil:: + AuthenticateMsgL( aMtmSettings, aPushMsg ); + if ( !isAuthenticated ) + { + // Ask the user... + isAuthenticated = ExecuteUserQueryL( R_PUSHLS_SL_NOT_AUTH ); + } + } + else + { + PUSHLOG_WRITE(" Other SL"); + isAuthenticated = ETrue; // No authentication needed. + } + } + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::AuthenticateL"); + return isAuthenticated; + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::ExecuteUserQueryL +// --------------------------------------------------------- +// +TBool CPushLoadServiceOp::ExecuteUserQueryL( TInt aResId ) const + { + CAknQueryDialog* queryDlg = CAknQueryDialog::NewL(); + TInt userResponse = queryDlg->ExecuteLD( aResId ); + TBool userWantsToDownload = ( userResponse == EAknSoftkeyYes ); + + return userWantsToDownload; + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::ValidateLC +// --------------------------------------------------------- +// +HBufC* CPushLoadServiceOp::ValidateLC( TDesC& aUrl ) const + { + TUriParser uriParser; + TInt err = uriParser.Parse( aUrl ); + User::LeaveIfError( err ); + HBufC* validated = NULL; + + if ( uriParser.IsPresent( EUriScheme ) ) + { + // Just copy the original URL. + validated = aUrl.AllocLC(); + } + else + { + // Add default scheme. + validated = HBufC::NewLC( aUrl.Length() + KDefaultScheme().Length() ); + validated->Des().Copy( KDefaultScheme ); + validated->Des().Append( aUrl ); + } + + return validated; + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::RunL +// --------------------------------------------------------- +// +void CPushLoadServiceOp::RunL() + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::RunL") + + if ( iDone ) + { + PUSHLOG_WRITE(" Done") + SignalObserver( KErrNone ); + } + else + { + TPtrC url; + CPushMsgEntryBase* context = RetrieveContextAndGetUrlLC( url ); + + CPushMtmSettings* mtmSettings = CPushMtmSettings::NewLC(); + TBool msgAuthenticated = AuthenticateL( *context, *mtmSettings ); + CleanupStack::PopAndDestroy( mtmSettings ); // mtmSettings + + if ( !msgAuthenticated ) + { + // Ready. + SignalObserver( KErrNone ); + } + else + { + // OK, authenticated. Can be downloaded. + + // Mark service read. + iMtmUtil->MarkServiceUnreadL( iEntryId, EFalse ); + + // Download the URL. + delete iSchemeHandler; + iSchemeHandler = NULL; + HBufC* validatedUrl = ValidateLC( url ); + iSchemeHandler = CSchemeHandler::NewL( *validatedUrl ); + + if( (url.Mid(0,7).Compare(_L("http://")) == 0) || (url.Mid(0,8).Compare(_L("https://")) == 0)) + { + TRAPD( err, iSchemeHandler->HandleUrlStandaloneL()); + CleanupStack::PopAndDestroy( validatedUrl ); // validatedUrl + SignalObserver( err ); + } + else + { + iSchemeHandler->Observer( this ); + TRAPD(err, iSchemeHandler->HandleUrlEmbeddedL()); + CleanupStack::PopAndDestroy( validatedUrl ); // validatedUrl + if( err != KErrNone) + SignalObserver( err ); + } + + } + + CleanupStack::PopAndDestroy( context ); // context, needed for 'url' + } + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::RunL") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::DoCancel +// --------------------------------------------------------- +// +void CPushLoadServiceOp::DoCancel() + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::DoCancel") + SignalObserver( KErrCancel ); + PUSHLOG_LEAVEFN("CPushLoadServiceOp::DoCancel") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::RunError +// --------------------------------------------------------- +// +TInt CPushLoadServiceOp::RunError( TInt aError ) + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::RunError") + PUSHLOG_WRITE_FORMAT(" CPushLoadServiceOp::RunError <%d>",aError) + + TRAP_IGNORE( ShowGlobalErrorNoteL( aError ) ); + return CPushMtmUiOperation::RunError( aError ); + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::RunError") + } + +// --------------------------------------------------------- +// CPushLoadServiceOp::HandleServerAppExit +// --------------------------------------------------------- +// +void CPushLoadServiceOp::HandleServerAppExit(TInt LOG_ONLY(aReason)) + { + PUSHLOG_ENTERFN("CPushLoadServiceOp::HandleServerAppExit") + PUSHLOG_WRITE_FORMAT(" CPushLoadServiceOp::HandleServerAppExit <%d>",aReason) + + // Ready. + SignalObserver( KErrNone ); + + PUSHLOG_LEAVEFN("CPushLoadServiceOp::HandleServerAppExit") + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushMessageInfoDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushMessageInfoDialog.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,536 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Member definitions of CPushMessageInfoDialog. +* +*/ + + + +// INCLUDES + +#include "PushMessageInfoDialog.h" +#include "PushMtmUiDef.h" +#include "PushMtmUiPanic.h" +#include "PushMtmUtil.h" +#include "PushMtmLog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "PushMtmPrivateCRKeys.h" +#include +// CONSTANTS +LOCAL_D const TInt KNoResource = 0; +LOCAL_D const TInt KArrayGranularity = 16; +LOCAL_D const TReal KReal1024 = 1024.0; +_LIT( KTab, "\t" ); +_LIT( KSpace, " " ); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMessageInfoDialog::CPushMessageInfoDialog +// --------------------------------------------------------- +// +CPushMessageInfoDialog::CPushMessageInfoDialog() +: CAknPopupList(), + iResourceLoader( *iCoeEnv ) + { + } + +// --------------------------------------------------------- +// CPushMessageInfoDialog::~CPushMessageInfoDialog +// --------------------------------------------------------- +// +CPushMessageInfoDialog::~CPushMessageInfoDialog() + { + iSecondColumnFont = 0; + iResourceLoader.Close(); + delete iListBox; + delete iListBoxModel; + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------- +// CPushMessageInfoDialog::ExecuteLD +// --------------------------------------------------------- +// +void CPushMessageInfoDialog::ExecuteLD( CMsvSession& aMsvSession, TMsvId aId ) + { + ConstructL( aMsvSession, aId ); + CAknPopupList::ExecuteLD(); + } + +// --------------------------------------------------------- +// CPushMessageInfoDialog::ConstructL +// --------------------------------------------------------- +// +void CPushMessageInfoDialog::ConstructL( CMsvSession& aMsvSession, TMsvId aId ) + { + PUSHLOG_ENTERFN("CPushMessageInfoDialog::ConstructL"); + __ASSERT_DEBUG( !iListBox && + !iListBoxModel, + UiPanic( EPushMtmUiPanAlreadyInitialized ) ); + + FeatureManager::InitializeLibL(); + + CRepository* PushSL = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( PushSL ); + User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) ); + PUSHLOG_WRITE_FORMAT(" iPushSLEnabled: <%d>",iPushSLEnabled); + CleanupStack::PopAndDestroy( PushSL ); + + // Add resource file. + TParse* fileParser = new (ELeave) TParse; + // Unnecessary to call CleanupStack::PushL( fileParser ); + fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); + iResourceFile = fileParser->FullName(); + PUSHLOG_WRITE_FORMAT(" iResourceFile: <%S>",&iResourceFile); + delete fileParser; + fileParser = NULL; + iResourceLoader.OpenL( iResourceFile ); + PUSHLOG_WRITE(" iResourceFile opened"); + + // Construct list box's model first + // This list box will be used by an CAknPopupList object. + __ASSERT_DEBUG( !iListBoxModel && !iListBox, + UiPanic( EPushMtmUiPanAlreadyInitialized ) ); + iListBoxModel = new (ELeave) CDesCArrayFlat( KArrayGranularity ); + // Construct list box. + iListBox = new (ELeave) CAknSingleHeadingPopupMenuStyleListBox; + + // ======================================================== + // Layout info of CAknSingleHeadingPopupMenuStyleListBox + TAknTextLineLayout textLayout = + AknLayout::List_pane_texts__menu_single_heading__Line_2(0); + + // Font of the second column of the given list box + iSecondColumnFont = AknLayoutUtils::FontFromId( textLayout.FontId() ); + + // Line width of the second column of the given list box + TInt itemCount = 0; // No need to set + TInt titleVisible = 1; // known value (we always have title) + TRect main_pane = iAvkonAppUi->ClientRect(); + + TAknLayoutRect popup_menu_graphic_window; + popup_menu_graphic_window.LayoutRect( main_pane, + AknLayout::popup_menu_graphic_window(itemCount) ); + + TAknLayoutRect menu_heading_pane; + menu_heading_pane.LayoutRect( popup_menu_graphic_window.Rect(), + AknLayout::list_menu_heading_pane(titleVisible, itemCount) ); + + TAknLayoutRect list_item; + list_item.LayoutRect( menu_heading_pane.Rect(), + AknLayout::list_single_heading_popup_menu_pane(itemCount) ); + + TAknLayoutText text; + text.LayoutText( list_item.Rect(), textLayout ); + + iSecondColumnWidth = text.TextRect().Width(); + // ======================================================== + + // Add items to the list. + AddMessageInfoItemsL( aMsvSession, aId ); + + CAknPopupList::ConstructL( iListBox, + R_AVKON_SOFTKEYS_OK_EMPTY__OK, + AknPopupLayouts::EMenuGraphicHeadingWindow ); + + iListBox->ConstructL( this, EAknListBoxViewerFlags ); + iListBox->CreateScrollBarFrameL( ETrue ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL + ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + + CTextListBoxModel* listBoxModel = iListBox->Model(); + listBoxModel->SetItemTextArray( iListBoxModel ); + listBoxModel->SetOwnershipType( ELbmDoesNotOwnItemArray ); + + // Get title text of popup list + HBufC* title = iCoeEnv->AllocReadResourceLC( R_PUSHMID_TITLE ); + PUSHLOG_WRITE(" R_PUSHMID_TITLE read"); + SetTitleL( *title ); + CleanupStack::PopAndDestroy( title ); // title + + PUSHLOG_LEAVEFN("CPushMessageInfoDialog::ConstructL"); + } + +// --------------------------------------------------------- +// CPushMessageInfoDialog::AddMessageInfoItemL +// --------------------------------------------------------- +// +void CPushMessageInfoDialog::AddMessageInfoItemL( TInt aHeaderResourceId, + const TDesC& aText ) const + { + __ASSERT_DEBUG( iListBoxModel, UiPanic( EPushMtmUiPanNotInitialized ) ); + + // Make some necessary conversion. + HBufC* paramTextCopy = aText.AllocLC(); + TPtr paramTextCopyPtr = paramTextCopy->Des(); + // Remove tabs, because of the list box... + AknTextUtils::StripCharacters( paramTextCopyPtr, KAknStripListControlChars ); + // Number conversion + if ( paramTextCopyPtr.Length() > 0 ) + { + AknTextUtils::DisplayTextLanguageSpecificNumberConversion( paramTextCopyPtr ); + } + + HBufC* header = ( aHeaderResourceId == KNoResource ? + KNullDesC().AllocLC() : + iCoeEnv->AllocReadResourceLC( aHeaderResourceId ) ); + + CArrayFix* wrappedArray = + new ( ELeave ) CArrayFixFlat( KArrayGranularity ); + CleanupStack::PushL( wrappedArray ); + + AknTextUtils::WrapToArrayL + ( paramTextCopyPtr, iSecondColumnWidth, + *iSecondColumnFont, *wrappedArray ); + // visual is directly not used, but wrappedArray points to it + + // Add the lines in wrappedArray to the list + const TInt lines = wrappedArray->Count(); + for ( TInt loop = 0; loop < lines; ++loop ) + { + TPtrC current = ( *wrappedArray )[loop]; + // Allocate a buffer for the new list box item text + // (including header, separator and wrapped text) + HBufC* currentFormattedLine = HBufC::NewLC + ( ((loop==0) ? header->Length() : /*KSpace().Length()*/1) + + /*KTab().Length()*/1 + current.Length() ); + TPtr currentFormattedLinePtr = currentFormattedLine->Des(); // writeable + + if ( loop == 0 ) + { currentFormattedLinePtr.Copy( *header ); } + else + { currentFormattedLinePtr.Copy( KSpace ); } + + currentFormattedLinePtr.Append( KTab ); + currentFormattedLinePtr.Append( current ); + iListBoxModel->AppendL( currentFormattedLinePtr ); + + CleanupStack::PopAndDestroy( currentFormattedLine ); // currentFormattedLine + } + + CleanupStack::PopAndDestroy( 1, wrappedArray ); // wrappedArray + CleanupStack::PopAndDestroy( 2, paramTextCopy ); // header, paramTextCopy + } + +// --------------------------------------------------------- +// CPushMessageInfoDialog::ConvertUniversalToHomeTime +// --------------------------------------------------------- +// +TTime CPushMessageInfoDialog::ConvertUniversalToHomeTime + ( const TTime& aUniversalTime ) const + { + TTime time( aUniversalTime ); // time stores UTC time. + + TLocale locale; + TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() ); + // Add locale's universal time offset to universal time. + time += universalTimeOffset; // time stores Local Time. + + // If home daylight saving in effect, add one hour offset. + if ( locale.QueryHomeHasDaylightSavingOn() ) + { + TTimeIntervalHours daylightSaving(1); + time += daylightSaving; // Now it is Home Time. + } + +#ifdef __TEST_LOG__ + // The following section will call LEAVEable functions, but + // they are only for logging purposes. + _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" ); + _LIT( KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B" ); + TBuf<32> dateHolder; + TBuf<32> timeHolder; + aUniversalTime.FormatL( dateHolder, KDateFormat ); + aUniversalTime.FormatL( timeHolder, KTimeFormat ); + PUSHLOG_WRITE_FORMAT(" UTC date: <%S>",&dateHolder); + PUSHLOG_WRITE_FORMAT(" UTC time: <%S>",&timeHolder); + time.FormatL( dateHolder, KDateFormat ); + time.FormatL( timeHolder, KTimeFormat ); + PUSHLOG_WRITE_FORMAT(" Home date: <%S>",&dateHolder); + PUSHLOG_WRITE_FORMAT(" Home time: <%S>",&timeHolder); +#endif // __TEST_LOG__ + + return time; // Home Time. + } + +// --------------------------------------------------------- +// CPushMessageInfoDialog::AddMessageInfoItemsL +// --------------------------------------------------------- +// +void CPushMessageInfoDialog::AddMessageInfoItemsL( CMsvSession& aMsvSession, + TMsvId aId ) const + { + PUSHLOG_ENTERFN("CPushMessageInfoDialog::AddMessageInfoItemsL"); + + TMsvEntry tEntry; + TMsvId dummyService; + User::LeaveIfError( aMsvSession.GetEntry( aId, dummyService, tEntry ) ); + PUSHLOG_WRITE(" Entry got"); + __ASSERT_DEBUG + ( tEntry.iMtm == KUidMtmWapPush, UiPanic( EPushMtmUiPanBadType ) ); + + // Construct model. + CPushMsgEntryBase* msg = NULL; + const TInt32 bioType( tEntry.iBioType ); + if ( bioType == KUidWapPushMsgSI.iUid ) + { + msg = CSIPushMsgEntry::NewL(); + PUSHLOG_WRITE(" SI"); + } + else if(iPushSLEnabled && bioType == KUidWapPushMsgSL.iUid) + { + msg = CSLPushMsgEntry::NewL(); + PUSHLOG_WRITE(" SL"); + } +#ifdef __SERIES60_PUSH_SP + else if ( bioType == KUidWapPushMsgUnknown.iUid ) + { + msg = CUnknownPushMsgEntry::NewL(); + PUSHLOG_WRITE(" Unknown"); + } +#endif // __SERIES60_PUSH_SP + else + { + PUSHLOG_WRITE(" Bad message type"); + User::Leave( KErrNotSupported ); + } + + CleanupStack::PushL( msg ); + msg->RetrieveL( aMsvSession, tEntry.Id() ); + PUSHLOG_WRITE(" RetreiveL OK"); + + // ************************************************************************ + // Information item: From (push initiator). + // This can be MSISDN number, URL, etc. + // ************************************************************************ + TPtrC8 from8( msg->From() ); + if ( from8.Length() ) + { + // Copy the 8-bit text into a 16-bit one and convert the string to + // decoded form. + HBufC* from16 = HBufC::NewMaxLC( from8.Length() ); + from16->Des().Copy( from8 ); + + HBufC* convertedFrom = + CPushMtmUtil::ConvertUriToDisplayFormL( *from16 ); + CleanupStack::PushL( convertedFrom ); + // + AddMessageInfoItemL( R_PUSHMID_FROM, *convertedFrom ); + PUSHLOG_WRITE(" From added"); + // + CleanupStack::PopAndDestroy( 2, from16 ); // convertedFrom, from16 + } + + // ************************************************************************ + // Information item: Address/URL (SI and SL specific). + // ************************************************************************ + if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg ); + const TPtrC url = si->Url(); + if ( url.Length() ) + { + // + HBufC* convertedUrl = + CPushMtmUtil::ConvertUriToDisplayFormL( url ); + CleanupStack::PushL( convertedUrl ); + // + AddMessageInfoItemL( R_PUSHMID_URL, *convertedUrl ); + PUSHLOG_WRITE(" URL added"); + // + CleanupStack::PopAndDestroy( convertedUrl ); + } + } + else if ( iPushSLEnabled && msg->PushMsgType() == KUidWapPushMsgSL.iUid ) + { + CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, msg ); + const TPtrC url = sl->Url(); + if ( url.Length() ) + { + // + HBufC* convertedUrl = + CPushMtmUtil::ConvertUriToDisplayFormL( url ); + CleanupStack::PushL( convertedUrl ); + // + AddMessageInfoItemL( R_PUSHMID_URL, sl->Url() ); + PUSHLOG_WRITE(" URL added"); + // + CleanupStack::PopAndDestroy( convertedUrl ); + } + } + + // ************************************************************************ + // Information item: Message body/text (SI specific). + // ************************************************************************ + if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg ); + if ( si->Text().Length() ) + { + TPtrC siText = si->Text(); + PUSHLOG_WRITE_FORMAT(" SI text: <%S>",&siText); + AddMessageInfoItemL( R_PUSHMID_BODY, siText ); + PUSHLOG_WRITE(" SI text added"); + } + } + + // ************************************************************************ + // Information item: Type. + // ************************************************************************ + HBufC* value = iCoeEnv->AllocReadResourceLC( R_PUSHMID_TYPE_STR ); + AddMessageInfoItemL( R_PUSHMID_TYPE, *value ); + CleanupStack::PopAndDestroy( value ); // value + PUSHLOG_WRITE(" Msg. type added"); + +#ifdef __SERIES60_PUSH_SP + // ************************************************************************ + // Information item: Content type (SP specific) + // ************************************************************************ + if ( msg->PushMsgType() == KUidWapPushMsgUnknown.iUid ) + { + CUnknownPushMsgEntry* sp = STATIC_CAST( CUnknownPushMsgEntry*, msg ); + TPtrC contType = sp->ContentType(); + if ( contType.Length() ) + { + AddMessageInfoItemL( R_PUSHMID_CONTENT_TYPE, contType ); + PUSHLOG_WRITE(" Content type added "); + } + } +#endif // __SERIES60_PUSH_SP + + TBuf<32> time; + TBuf<32> date; + HBufC* dateFormatString = + iCoeEnv->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO ); + HBufC* timeFormatString = + iCoeEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO ); + + // ************************************************************************ + // SI specific information item: creation time and date. + // ************************************************************************ + if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg ); + const TTime created( si->Created() ); + // Check if created time was set. + if ( created != Time::NullTTime() ) + { + // OK. this attribute was set. Render it to the user. + TTime creLocal = ConvertUniversalToHomeTime( created ); + creLocal.FormatL( time, *timeFormatString ); + creLocal.FormatL( date, *dateFormatString ); + AddMessageInfoItemL( R_PUSHMID_CREATED, time ); + AddMessageInfoItemL( KNoResource, date ); + PUSHLOG_WRITE(" Created added"); + } + } + + // ************************************************************************ + // Information item: Arrival time and date. + // ************************************************************************ + const TTime arrivalTime( msg->ReceivedDate() ); + // Arrival time is always set by the wappush framework. Render it to the user. + TTime arrLocal = ConvertUniversalToHomeTime( arrivalTime ); + arrLocal.FormatL( time, *timeFormatString ); + arrLocal.FormatL( date, *dateFormatString ); + AddMessageInfoItemL( R_PUSHMID_RCVD, time ); + AddMessageInfoItemL( KNoResource, date ); + PUSHLOG_WRITE(" Received added"); + + // ************************************************************************ + // SI specific information item: expiration time and date. + // ************************************************************************ + if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg ); + const TTime expires( si->Expires() ); + // Check expiration if expiration time was set. + if ( expires != Time::NullTTime() ) + { + TTime expLocal = ConvertUniversalToHomeTime( expires ); + expLocal.FormatL( time, *timeFormatString ); + expLocal.FormatL( date, *dateFormatString ); + AddMessageInfoItemL( R_PUSHMID_EXPIRES, time ); + AddMessageInfoItemL( KNoResource, date ); + PUSHLOG_WRITE(" Expires added"); + } + } + + CleanupStack::PopAndDestroy( 2, dateFormatString ); + // timeFormatString, dateFormatString + + // ************************************************************************ + // Information item: Size. + // Convert the message size given in bytes into kilobytes. Round the + // value up, if necessary. + // ************************************************************************ + TReal messageSize( 0 ); + if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg ); + messageSize = (TReal)si->Text().Size() / KReal1024; + } + else if ( iPushSLEnabled && msg->PushMsgType() == KUidWapPushMsgSL.iUid ) + { + CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, msg ); + messageSize = (TReal)sl->Url().Size() / KReal1024; + } +#ifdef __SERIES60_PUSH_SP + else if ( msg->PushMsgType() == KUidWapPushMsgUnknown.iUid ) + { + CUnknownPushMsgEntry* sp = STATIC_CAST( CUnknownPushMsgEntry*, msg ); + messageSize = (TReal)sp->MessageData().Size() / KReal1024; + } +#endif // __SERIES60_PUSH_SP + TInt32 messageSizeInt; + User::LeaveIfError( Math::Int( messageSizeInt, messageSize ) ); + TReal fraction; + User::LeaveIfError( Math::Frac( fraction, messageSize ) ); + if ( fraction ) + { + ++messageSizeInt; + } + HBufC* size = + StringLoader::LoadLC( R_QTN_SIZE_KB, messageSizeInt, iCoeEnv ); + // From avkon.loc: + // #define qtn_size_kb " %N kB" + // We don't need white spaces at the beginning of the size string, so + // remove them: + size->Des().Trim(); + AddMessageInfoItemL( R_PUSHMID_SIZE, *size ); + PUSHLOG_WRITE(" Size added"); + CleanupStack::PopAndDestroy( size ); // size + + CleanupStack::PopAndDestroy( msg ); // msg + + PUSHLOG_LEAVEFN("CPushMessageInfoDialog::AddMessageInfoItemsL"); + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushMessageInfoOp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushMessageInfoOp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,261 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMessageInfoOp. +* +*/ + +// INCLUDE FILES + +#include "PushMessageInfoOp.h" +#include "PushMessageInfoDialog.h" +#include "PushMtmUtil.h" +#include "PushMtmUiDef.h" +#include "PushMtmUiPanic.h" +#include "PushMtmLog.h" +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMessageInfoOp::CPushMessageInfoOp +// --------------------------------------------------------- +// +CPushMessageInfoOp::CPushMessageInfoOp( CMsvSession& aSession, + TMsvId aEntryId, + TBool aDontShowNotification, + TRequestStatus& aObserverStatus ) +: CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ), + iDontShowNotification( aDontShowNotification ), + iObserverCompleted( EFalse ) + { + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::~CPushMessageInfoOp +// --------------------------------------------------------- +// +CPushMessageInfoOp::~CPushMessageInfoOp() + { + Cancel(); + delete iDialog; + if ( iDeletedFlag ) + { + *iDeletedFlag = ETrue; + } + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::StartL +// --------------------------------------------------------- +// +void CPushMessageInfoOp::StartL() + { + Cancel(); + iObserverCompleted = EFalse; + CPushMtmOperation::StartL(); + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::RunL +// --------------------------------------------------------- +// +void CPushMessageInfoOp::RunL() + { + __ASSERT_DEBUG( !iDialog, UiPanic( EPushMtmUiPanAlreadyInitialized ) ); + + if ( iObserverCompleted ) + { + return; + } + + TBool deleted( EFalse ); + iDeletedFlag = &deleted; + + // Time to set up entry observation (delete & replacement case). + ObserveEntryEventL(); + + iDialog = new (ELeave) CPushMessageInfoDialog; + // Workaround for Cancel(): SetActive() is called. + // CMsvSingleOpWatcher::DoCancel() will wait for this observed object to + // complete that. iDialog->ExecuteLD() allows other RunL's to run, so + // that it may happen that CMsvSingleOpWatcher::DoCancel() is called + // when iDialog->ExecuteLD() is running. It means that this object must + // be active in that time in order DoCancel() will be called. + iStatus = KRequestPending; + iDialog->ExecuteLD( iMsvSession, iEntryId ); + SetActive(); + // Ready. + if ( !deleted ) + { + iDialog = NULL; + iDeletedFlag = NULL; + // Consider what happens if this object is cancelled in ExecuteLD! + // In this case the observer is already completed (DoCancel), so + // avoid completeing it twice. iObserverCompleted indicates it. + if ( !iObserverCompleted ) + { + SignalObserver( KErrNone ); + iObserverCompleted = ETrue; + // Due to SetActive() call RunL again, but it will do nothing + // (see above). + InvokeRun(); + } + } + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::DoCancel +// --------------------------------------------------------- +// +void CPushMessageInfoOp::DoCancel() + { + PUSHLOG_WRITE("CPushMessageInfoOp::DoCancel"); + CancelObserveEntryEvent(); + + if ( iDialog ) + { + delete iDialog; + iDialog = NULL; + // Due to SetActive() in RunL we must call InvokeRun(): the dialog + // does not completes this operation. + InvokeRun(); + } + if ( !iObserverCompleted ) + { + SignalObserver( KErrCancel ); + iObserverCompleted = ETrue; + } + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::RunError +// --------------------------------------------------------- +// +TInt CPushMessageInfoOp::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CPushMessageInfoOp::RunError: %d",aError); + CancelObserveEntryEvent(); + + if ( !iObserverCompleted ) + { + SignalObserver( aError ); + iObserverCompleted = ETrue; + } + return aError; + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::HandleEntryEventL +// --------------------------------------------------------- +// +void CPushMessageInfoOp::HandleEntryEventL( TMsvEntryEvent aEvent, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ ) + { + PUSHLOG_ENTERFN("CPushMessageInfoOp::HandleEntryEventL"); + + if ( aEvent == EMsvEntryChanged ) + { + PUSHLOG_WRITE(" Changed"); + HandleEntryChangeL(); + } + else if ( aEvent == EMsvEntryDeleted ) + { + PUSHLOG_WRITE(" Deleted"); + NotifyAndCancelL( R_PUSHLS_EXPIRED_NOTE ); + } + else + { + // Nothing to do. + } + + PUSHLOG_LEAVEFN("CPushMessageInfoOp::HandleEntryEventL"); + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::HandleEntryChangeL +// --------------------------------------------------------- +// +void CPushMessageInfoOp::HandleEntryChangeL() + { + PUSHLOG_ENTERFN("CPushMessageInfoOp::HandleEntryChangeL"); + + // We have to act only in case of such changes where the content + // of the message changes, not only the unread/read flag. + // The content handlers and the Push subsystem behave so that + // the content is changed only when the entry becomes 'unread', + // except one case where the CH changes the content, but the + // message becomes 'read' (SL-execute-high). In this case + // a flag indicates that the content was changed. + + // Get an up-to-date entry and check the necessary flags: + TMsvEntry tEntry; + TMsvId service; + User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, tEntry ) ); + TBool isChangeToUnread = tEntry.Unread(); + TBool contentChangedFlagSet = + CPushMtmUtil::Attrs( tEntry ) & EPushMtmReadButContentChanged; + + if ( !isChangeToUnread && !contentChangedFlagSet ) + { + // Nothing to do. Somebody has just marked it 'read'. + PUSHLOG_WRITE(" Content not changed"); + } + else + { + NotifyAndCancelL( R_PUSHMISC_INFO_REPLACED ); + } + + PUSHLOG_LEAVEFN("CPushMessageInfoOp::HandleEntryChangeL") + } + +// --------------------------------------------------------- +// CPushMessageInfoOp::NotifyAndCancelL +// --------------------------------------------------------- +// +void CPushMessageInfoOp::NotifyAndCancelL( TInt aResId ) + { + PUSHLOG_ENTERFN("CPushMessageInfoOp::NotifyAndCancelL"); + + if ( iDontShowNotification ) + { + // Don't show. + } + else + { + // Add resource file. + TParse* fileParser = new (ELeave) TParse; + CleanupStack::PushL( fileParser ); + fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); + AssureResourceL( fileParser->FullName() ); + CleanupStack::PopAndDestroy( fileParser ); // fileParser + fileParser = NULL; + + // Show note about the message deletion. + HBufC* noteText = iCoeEnv.AllocReadResourceLC( aResId ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); + note->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); // noteText + } + + // Close the dialog anyway. + Cancel(); + + PUSHLOG_LEAVEFN("CPushMessageInfoOp::NotifyAndCancelL"); + } + +// End of file. + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushMtmUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushMtmUi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,635 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Ui Mtm class definition +* +*/ + + + +// INCLUDE FILES + +#include +#include "PushMtmUi.h" +#include "PushMtmUiPanic.h" +#include "PushMtmUiDef.h" +#include "PushViewerDef.h" +#include "PushMtmCommands.hrh" +#include "PushMtmSettings.h" +#include "PushSettingsDialog.h" +#include "PushMessageInfoOp.h" +#include "PushLoadServiceOp.h" +#ifdef __SERIES60_PUSH_SP +#include "PushViewServiceOp.h" +#endif // __SERIES60_PUSH_SP +#include "PushViewMessageOp.h" +#include "PushMtmLog.h" +#include "PushMtmDef.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "PushMtmPrivateCRKeys.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmUi::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushMtmUi* CPushMtmUi::NewL( CBaseMtm& aBaseMtm, + CRegisteredMtmDll& aRegisteredMtmDll ) + { + CPushMtmUi* ui = new (ELeave) CPushMtmUi( aBaseMtm, aRegisteredMtmDll ); + CleanupStack::PushL( ui ); + ui->ConstructL(); + CleanupStack::Pop(); // ui + return ui; + } + +// --------------------------------------------------------- +// CPushMtmUi::~CPushMtmUi +// --------------------------------------------------------- +// +CPushMtmUi::~CPushMtmUi() + { + } + +// --------------------------------------------------------- +// CPushMtmUi::CPushMtmUi +// --------------------------------------------------------- +// +CPushMtmUi::CPushMtmUi( CBaseMtm& aBaseMtm, + CRegisteredMtmDll& aRegisteredMtmDll ) +: CBaseMtmUi( aBaseMtm, aRegisteredMtmDll ) + { + CRepository* PushSL = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( PushSL ); + User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) ); + CleanupStack::PopAndDestroy( PushSL ); + } + +// --------------------------------------------------------- +// CPushMtmUi::SetProgressSuccess +// --------------------------------------------------------- +// +void CPushMtmUi::SetProgressSuccess +( TPckgBuf& aProgress, TMsvId aId ) + { + aProgress().iTotalNumberOfEntries = 1; + aProgress().iNumberCompleted = 1; + aProgress().iId = aId; + } + +// --------------------------------------------------------- +// CPushMtmUi::CompletedOperationL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CompletedOperationL +( TRequestStatus& aObserverStatus ) + { + TPckgBuf progress; + SetProgressSuccess( progress, BaseMtm().Entry().Entry().Id() ); + CMsvCompletedOperation* operation = + CMsvCompletedOperation::NewL( Session(), Type(), progress, + KMsvLocalServiceIndexEntryId, aObserverStatus ); + + return operation; + } + +// --------------------------------------------------------- +// CPushMtmUi::EnsureServiceEntryL +// --------------------------------------------------------- +// +void CPushMtmUi::EnsureServiceEntryL() const + { + PUSHLOG_ENTERFN("CPushMtmUi::EnsureServiceEntryL") + + // Get root entry. + CMsvEntry* rootMsvEntry = Session().GetEntryL( KMsvRootIndexEntryId ); + CleanupStack::PushL( rootMsvEntry ); + + // The Push MTM service entry is invisible. Set selection ordering + // to find the invisible entries also. + TMsvSelectionOrdering msvSelectionOrdering = rootMsvEntry->SortType();; + msvSelectionOrdering.SetShowInvisibleEntries( ETrue ); + rootMsvEntry->SetSortTypeL( msvSelectionOrdering ); + + // The service entry is the child entry of the root entry. + // KUidMtmWapPush is used to identify the mtm type of the service entry! + CMsvEntrySelection* msvEntrySelection = + rootMsvEntry->ChildrenWithMtmL( KUidMtmWapPush ); + CleanupStack::PushL( msvEntrySelection ); + + const TInt serviceEntryCount = msvEntrySelection->Count(); + PUSHLOG_WRITE_FORMAT(" serviceEntryCount <%d>",serviceEntryCount) + __ASSERT_DEBUG( serviceEntryCount <= 1, + UiPanic( EPushMtmUiPanTooManyServiceEntries ) ); + // If there is no push service entry in Message Server, create one. + // If there is more than one, then delete the unnecessary entries. + if ( serviceEntryCount == 0 ) + { + TMsvEntry newEntryData; + newEntryData.iType = KUidMsvServiceEntry; + newEntryData.iMtm = KUidMtmWapPush; + newEntryData.SetVisible( EFalse ); + rootMsvEntry->CreateL( newEntryData ); + } + else if ( 1 < serviceEntryCount ) + { + for ( TInt i = 1; i < serviceEntryCount; ++i ) // i starts from 1. + { + rootMsvEntry->DeleteL( msvEntrySelection->At(i) ); + } + } + + CleanupStack::PopAndDestroy( 2, rootMsvEntry ); + // msvEntrySelection, rootMsvEntry + + PUSHLOG_LEAVEFN("CPushMtmUi::EnsureServiceEntryL") + } + +// --------------------------------------------------------- +// CPushMtmUi::CreateL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CreateL( + const TMsvEntry& /*aEntry*/, + CMsvEntry& /*aParent*/, + TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::OpenL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::OpenL( TRequestStatus& aStatus ) + { + __ASSERT_DEBUG( BaseMtm().Entry().Entry().iMtm == Type(), + UiPanic( EPushMtmUiPanBadMtm ) ); + + const TUid type( BaseMtm().Entry().Entry().iType ); + + CMsvOperation* operation = NULL; + + if ( type == KUidMsvMessageEntry ) + { + operation = ViewL( aStatus ); + } + else + { + User::Leave( KErrNotSupported ); + } + + return operation; + } + +// --------------------------------------------------------- +// CPushMtmUi::CloseL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CloseL( TRequestStatus& aStatus ) + { + __ASSERT_DEBUG( BaseMtm().Entry().Entry().iType == KUidMsvMessageEntry, + UiPanic( EPushMtmUiPanBadType ) ); + return CompletedOperationL( aStatus ); + } + +// --------------------------------------------------------- +// CPushMtmUi::EditL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::EditL( TRequestStatus& aStatus ) + { + __ASSERT_DEBUG( BaseMtm().Entry().Entry().iMtm == Type(), + UiPanic( EPushMtmUiPanBadMtm ) ); + + if ( BaseMtm().Entry().Entry().iType != KUidMsvServiceEntry ) + { + // All push messages are read only ones. + User::Leave( KErrNotSupported ); + } + + CPushSettingsDialog* dlg = new (ELeave) CPushSettingsDialog( Session() ); + dlg->ExecuteLD(); + return CompletedOperationL( aStatus ); + } + +// --------------------------------------------------------- +// CPushMtmUi::ViewL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::ViewL( TRequestStatus& aStatus ) + { + const TMsvEntry tEntry( BaseMtm().Entry().Entry() ); + + __ASSERT_DEBUG( tEntry.iMtm == Type(), UiPanic( EPushMtmUiPanBadMtm ) ); + __ASSERT_DEBUG( tEntry.iType == KUidMsvMessageEntry, + UiPanic( EPushMtmUiPanBadType ) ); + + if ( tEntry.iType != KUidMsvMessageEntry ) + { + User::Leave( KErrNotSupported ); + } + + CMsvOperation* operation = NULL; + + if ( + tEntry.iBioType == KUidWapPushMsgSI.iUid || (iPushSLEnabled && tEntry.iBioType == KUidWapPushMsgSL.iUid) + ) + { + TEditorParameters editorParameters; + editorParameters.iId = tEntry.Id(); + editorParameters.iFlags = EMsgLaunchEditorThenWait | + EMsgReadOnly | + EMsgLaunchEditorEmbedded; + + // Get the application name. + HBufC* appFileName = + MsvUiEditorUtilities::ResolveAppFileNameL( KUidPushViewerApp ); + CleanupStack::PushL( appFileName ); + + operation = MsgEditorLauncher::LaunchEditorApplicationL + ( BaseMtm().Session(), + tEntry.iMtm, + aStatus, + editorParameters, + *appFileName ); + + CleanupStack::PopAndDestroy( appFileName ); // appFileName + } + +#ifdef __SERIES60_PUSH_SP + + else if ( tEntry.iBioType == KUidWapPushMsgUnknown.iUid ) + { + // Don't launch the PushViewer, but the embedded viewer. + // It's unnecessary to call + // BaseMtm().SwitchCurrentEntryL( tEntry.Id() ); + TBuf8<1> dummyPar; + CMsvEntrySelection* dummySel = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( dummySel ); + + operation = InvokeAsyncFunctionL( EPushMtmCmdViewService, + *dummySel, + aStatus, + dummyPar ); + + CleanupStack::PopAndDestroy( dummySel ); // dummySel + } + +#endif // __SERIES60_PUSH_SP + + else + { + __ASSERT_DEBUG( EFalse, UiPanic( EPushMtmUiPanBadBioType ) ); + User::Leave( KErrNotSupported ); + } + + return operation; + } + +// --------------------------------------------------------- +// CPushMtmUi::OpenL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::OpenL +( TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::CloseL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CloseL +( TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::EditL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::EditL +( TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::ViewL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::ViewL +( TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::CancelL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CancelL +( TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::DeleteFromL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::DeleteFromL +( const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::UnDeleteFromL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::UnDeleteFromL +( const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::DeleteServiceL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::DeleteServiceL +( const TMsvEntry& /*aService*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::ReplyL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::ReplyL( + TMsvId /*aDestination*/, + TMsvPartList /*aPartlist*/, + TRequestStatus& /*aCompletionStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::ForwardL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::ForwardL( + TMsvId /*aDestination*/, + TMsvPartList /*aPartlist*/, + TRequestStatus& /*aCompletionStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::CopyToL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CopyToL +( const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + + +// --------------------------------------------------------- +// CPushMtmUi::MoveToL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::MoveToL +( const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + + +// --------------------------------------------------------- +// CPushMtmUi::CopyFromL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::CopyFromL( + const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aTargetId*/, + TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::MoveFromL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::MoveFromL( + const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aTargetId*/, + TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUi::QueryCapability +// --------------------------------------------------------- +// +TInt CPushMtmUi::QueryCapability( TUid aCapability, TInt& aResponse ) + { + TInt ret( KErrNone ); + + switch ( aCapability.iUid ) + { + case KUidMsvMtmUiQueryMessagingInitialisation: + case KUidMsvMtmQueryFactorySettings: + case KUidMsvMtmQueryMessageInfo: + { + aResponse = ETrue; + break; + } + default: + { + ret = BaseMtm().QueryCapability( aCapability, aResponse ); + break; + } + } + + return ret; + } + +// --------------------------------------------------------- +// CPushMtmUi::InvokeSyncFunctionL +// --------------------------------------------------------- +// +void CPushMtmUi::InvokeSyncFunctionL( TInt aFunctionId, + const CMsvEntrySelection& /*aSelection*/, + TDes8& /*aParameter*/ ) + { + PUSHLOG_WRITE_FORMAT + ("CPushMtmUi::InvokeSyncFunctionL <%d>",aFunctionId) + + if ( aFunctionId == KMtmUiMessagingInitialisation || + aFunctionId == KMtmUiFunctionRestoreFactorySettings ) + { + // Restore the settings... + CPushMtmSettings* pushMtmSettings = CPushMtmSettings::NewLC(); + pushMtmSettings->RestoreFactorySettingsL(); + CleanupStack::PopAndDestroy( pushMtmSettings ); // pushMtmSettings + // ...and ensure that a service entry exists with which + // the settings can be reached from a messaging application. + EnsureServiceEntryL(); + } + else + { + User::Leave( KErrNotSupported ); + } + } + +// --------------------------------------------------------- +// CPushMtmUi::InvokeAsyncFunctionL +// --------------------------------------------------------- +// +CMsvOperation* CPushMtmUi::InvokeAsyncFunctionL + ( TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TRequestStatus& aCompletionStatus, + TDes8& aParameter ) + { + PUSHLOG_WRITE_FORMAT + ("CPushMtmUi::InvokeAsyncFunctionL <%d>",aFunctionId) + + CMsvOperation* operation = NULL; + + switch ( aFunctionId ) + { + case KMtmUiFunctionMessageInfo: + { + TBool dontShowNotification = EFalse; + if ( 0 < aParameter.Length() ) + { + TMessageInfoParam par; + TMessageInfoParamPckg parPckg( par ); + parPckg.Set( aParameter ); + dontShowNotification = par.iDontShowNotification; + } + + CPushMessageInfoOp* op = new (ELeave) CPushMessageInfoOp + ( Session(), + BaseMtm().Entry().EntryId(), + dontShowNotification, + aCompletionStatus ); + CleanupStack::PushL( op ); + op->StartL(); + operation = op; + CleanupStack::Pop( op ); // op + break; + } + + case EPushMtmCmdLoadService: + { + CPushLoadServiceOp* op = CPushLoadServiceOp::NewL + ( Session(), + BaseMtm().Entry().EntryId(), + aCompletionStatus ); + CleanupStack::PushL( op ); + op->StartL(); + operation = op; + CleanupStack::Pop( op ); // op + break; + } + +#ifdef __SERIES60_PUSH_SP + + case EPushMtmCmdViewService: + { + CPushViewServiceOp* op = new (ELeave) CPushViewServiceOp + ( Session(), + BaseMtm().Entry().EntryId(), + aCompletionStatus ); + CleanupStack::PushL( op ); + op->StartL(); + operation = op; + CleanupStack::Pop( op ); // op + break; + } + +#endif // __SERIES60_PUSH_SP + + case EPushMtmCmdViewMessage: + { + CPushViewMessageOp* op = CPushViewMessageOp::NewL + ( Session(), + BaseMtm().Entry().EntryId(), + aCompletionStatus ); + CleanupStack::PushL( op ); + op->StartL(); + operation = op; + CleanupStack::Pop( op ); // op + break; + } + + default: + { + operation = CBaseMtmUi::InvokeAsyncFunctionL + ( aFunctionId, aSelection, aCompletionStatus, aParameter ); + break; + } + } + + return operation; + } + +// --------------------------------------------------------- +// CPushMtmUi::GetResourceFileName +// --------------------------------------------------------- +// +void CPushMtmUi::GetResourceFileName( TFileName& aFileName ) const + { + // Extract the file name and extension from the constant + TParsePtrC fileParser( KPushMtmUiResourceFileAndDrive ); + aFileName = fileParser.NameAndExt(); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushMtmUiData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushMtmUiData.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,457 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Push Ui Data Mtm class definition +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmUiData.h" +#include "PushMtmCommands.hrh" +#include "PushMtmUiDef.h" +#include "PushMtmUiPanic.h" +#include "PushMtmUtil.h" +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// Number of zoom states. +LOCAL_C const TInt KPushIconArrayGranularity = 2; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmUiData::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushMtmUiData* CPushMtmUiData::NewL +( CRegisteredMtmDll& aRegisteredDll ) + { + CPushMtmUiData* uiData = new (ELeave) CPushMtmUiData( aRegisteredDll ); + CleanupStack::PushL( uiData ); + uiData->ConstructL(); + CleanupStack::Pop(); // uiData + return uiData; + } + +// --------------------------------------------------------- +// CPushMtmUiData::~CPushMtmUiData +// --------------------------------------------------------- +// +CPushMtmUiData::~CPushMtmUiData() + { + } + +// --------------------------------------------------------- +// CPushMtmUiData::CPushMtmUiData +// --------------------------------------------------------- +// +CPushMtmUiData::CPushMtmUiData( CRegisteredMtmDll& aRegisteredDll ) +: CBaseMtmUiData( aRegisteredDll ) + { + } + +// --------------------------------------------------------- +// CPushMtmUiData::ContextIcon +// --------------------------------------------------------- +// +const CBaseMtmUiData::CBitmapArray& CPushMtmUiData::ContextIcon +( const TMsvEntry& aContext, TInt /*aStateFlags*/ ) const + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + __ASSERT_DEBUG( aContext.iType.iUid != KUidMsvFolderEntryValue, + UiPanic( EPushMtmUiPanFoldersNotSupported ) ); + + return *iIconArrays->At( aContext.Unread() ? 0 : 1 ); + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanCreateEntryL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanCreateEntryL( const TMsvEntry& /*aParent*/, + TMsvEntry& aNewEntry, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanCreateEntryL( const TMsvEntry& /*aParent*/, + TMsvEntry& /*aNewEntry*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aNewEntry.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + aReasonResourceId = KErrNotSupported; + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanDeleteFromEntryL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanDeleteFromEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanDeleteFromEntryL +( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + aReasonResourceId = KErrNotSupported; + return ETrue; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanDeleteServiceL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanDeleteServiceL +( const TMsvEntry& aService, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanDeleteServiceL +( const TMsvEntry& /*aService*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aService.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + aReasonResourceId = KErrNotSupported; + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanReplyToEntryL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanReplyToEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanReplyToEntryL +( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + aReasonResourceId = KErrNotSupported; + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanForwardEntryL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanForwardEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanForwardEntryL +( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + aReasonResourceId = KErrNotSupported; + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanEditEntryL +// --------------------------------------------------------- +// +TBool CPushMtmUiData::CanEditEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + + aReasonResourceId = KErrNotSupported; + + if ( aContext.iType == KUidMsvServiceEntry ) + { + // Only the service entry can be changed. + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanViewEntryL +// --------------------------------------------------------- +// +TBool CPushMtmUiData::CanViewEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + + aReasonResourceId = KErrNotSupported; + + if ( aContext.iType != KUidMsvMessageEntry ) + { + // Only the messages can be viewed(this function + // should not be available on a service entry) + return EFalse; + } + return ETrue; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanOpenEntryL +// --------------------------------------------------------- +// +TBool CPushMtmUiData::CanOpenEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const + { + return CanViewEntryL( aContext, aReasonResourceId ); + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanCloseEntryL +// --------------------------------------------------------- +// +TBool CPushMtmUiData::CanCloseEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const + { + return CanOpenEntryL( aContext, aReasonResourceId ); + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanCopyMoveToEntryL +// --------------------------------------------------------- +// +TBool CPushMtmUiData::CanCopyMoveToEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + + aReasonResourceId = KErrNotSupported; + + if ( aContext.iType != KUidMsvMessageEntry ) + { + // Only the messages can be moved(this function + // should not be available on a service entry) + return EFalse; + } + return ETrue; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanCopyMoveFromEntryL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanCopyMoveFromEntryL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanCopyMoveFromEntryL +( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + + aReasonResourceId = KErrNotSupported; + + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::CanCancelL +// --------------------------------------------------------- +// +#ifdef _DEBUG +TBool CPushMtmUiData::CanCancelL +( const TMsvEntry& aContext, TInt& aReasonResourceId ) const +#else // _DEBUG +TBool CPushMtmUiData::CanCancelL +( const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const +#endif // _DEBUG + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + + aReasonResourceId = KErrNotSupported; + + return EFalse; + } + +// --------------------------------------------------------- +// CPushMtmUiData::OperationSupportedL +// --------------------------------------------------------- +// +TInt CPushMtmUiData::OperationSupportedL +( TInt aOperationId, const TMsvEntry& aContext ) const + { + __ASSERT_DEBUG( aContext.iMtm == Type(), UiPanic( EPushMtmUiPanBadType ) ); + __ASSERT_DEBUG( aContext.iType.iUid != KUidMsvFolderEntryValue, + UiPanic( EPushMtmUiPanFoldersNotSupported ) ); + + TInt ret( KErrCancel ); + + switch ( aOperationId ) + { + + case KMtmUiFunctionMessageInfo: + { + // The message info operation is always supported. + ret = ( aContext.iType.iUid == KUidMsvMessageEntryValue ) ? + KErrNone : KErrCancel; + break; + } + + case EPushMtmCmdLoadService: + { + // This function is available only if the message has URL in it. + if ( aContext.iType.iUid != KUidMsvMessageEntryValue ) + { + // LoadService is not supported. + ret = KErrCancel; + } + else + { + if ( aContext.iBioType == KUidWapPushMsgSI.iUid && + CPushMtmUtil::Attrs( aContext ) & EPushMtmAttrHasHref ) + { + // SI with not empty URL: LoadService is supported. + ret = KErrNone; + } + else if ( aContext.iBioType == KUidWapPushMsgSL.iUid && + CPushMtmUtil::Attrs( aContext ) & EPushMtmAttrHasHref ) + { + // SL with not empty URL: LoadService is supported. + ret = KErrNone; + } + else + { + // LoadService is not supported. + ret = KErrCancel; + } + } + break; + } + + default: + { + // No other operations are supported. + ret = KErrCancel; + break; + } + } + + return ret; + } + +// --------------------------------------------------------- +// CPushMtmUiData::QueryCapability +// --------------------------------------------------------- +// +TInt CPushMtmUiData::QueryCapability( TUid aCapability, TInt& aResponse ) const + { + TInt ret( KErrNotSupported ); + + if ( aCapability.iUid == KUidMsvMtmQueryMessageInfo ) + { + aResponse = ETrue; + ret = KErrNone; + } + + return ret; + } + +// --------------------------------------------------------- +// CPushMtmUiData::StatusTextL +// --------------------------------------------------------- +// +HBufC* CPushMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const + { + return NULL; + } + +// --------------------------------------------------------- +// CPushMtmUiData::PopulateArraysL +// --------------------------------------------------------- +// +void CPushMtmUiData::PopulateArraysL() + { + ReadFunctionsFromResourceFileL( R_PUSH_MTM_UI_DATA_FUNCTION_ARRAY ); + CreateSkinnedBitmapsL(); + } + +// --------------------------------------------------------- +// CPushMtmUiData::GetResourceFileName +// --------------------------------------------------------- +// +void CPushMtmUiData::GetResourceFileName( TFileName& aFileName ) const + { + // Extract the file name and extension from the constant + TParsePtrC fileParser( KPushMtmUiDataResourceFileAndDrive ); + aFileName = fileParser.NameAndExt(); + } + +// --------------------------------------------------------- +// CPushMtmUiData::CreateSkinnedBitmapsL +// --------------------------------------------------------- +// +void CPushMtmUiData::CreateSkinnedBitmapsL() + { + TParse fileParser; + fileParser.Set( KPushMtmUiDataBitmapFileAndDrive, &KDC_APP_BITMAP_DIR, NULL ); + + MAknsSkinInstance* skins = AknsUtils::SkinInstance(); + TAknsItemID id; + CFbsBitmap* bitmap; + CFbsBitmap* bitmapMask; + TBool found = ETrue; + + for( TInt i = EMbmPushmtmQgn_prop_mce_push_unread; + i < EMbmPushmtmQgn_prop_mce_push_read_mask + 1; + i++ ) + { + found = ETrue; + switch( i ) + { + // Add to iIconArrays in this order + case EMbmPushmtmQgn_prop_mce_push_unread: + id.Set( KAknsIIDQgnPropMcePushUnread ); + break; + case EMbmPushmtmQgn_prop_mce_push_read: + id.Set( KAknsIIDQgnPropMcePushRead ); + break; + default: + found = EFalse; + break; + } + if( found ) + { + CArrayPtrFlat* array = + new (ELeave) CArrayPtrFlat( KPushIconArrayGranularity ); + CleanupStack::PushL( array ); + + array->SetReserveL( KPushIconArrayGranularity ); // AppendLs will not LEAVE + AknsUtils::CreateIconL( skins, id, bitmap, bitmapMask, + fileParser.FullName(), i, i + 1 ); + // bitmap & bitmapMask is not on the Cleanup Stack, but it is not + // necessary, because AppendLs will not LEAVE. + array->AppendL( bitmap ); + bitmap = 0; + array->AppendL( bitmapMask ); + bitmapMask = 0; + iIconArrays->AppendL( array ); + CleanupStack::Pop( array ); // array + } + } + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushMtmUiOperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushMtmUiOperation.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMtmUiOperation. +* +*/ + + + +// INCLUDES + +#include "PushMtmUiOperation.h" +#include "PushMtmUtil.h" +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmUiOperation::CPushMtmUiOperation +// --------------------------------------------------------- +// +CPushMtmUiOperation::CPushMtmUiOperation( CMsvSession& aSession, + TMsvId aId, + TRequestStatus& aObserverStatus ) +: CPushMtmOperation( aSession, aId, aObserverStatus ), + iCoeEnv( *CCoeEnv::Static() ), + iResourceLoader( iCoeEnv ), + iResourceOpened( EFalse ) + { + } + +// --------------------------------------------------------- +// CPushMtmUiOperation::ConstructL +// --------------------------------------------------------- +// +void CPushMtmUiOperation::ConstructL() + { + iMtmUtil = CPushMtmUtil::NewL( iMsvSession ); + } + +// --------------------------------------------------------- +// CPushMtmUiOperation::~CPushMtmUiOperation +// --------------------------------------------------------- +// +CPushMtmUiOperation::~CPushMtmUiOperation() + { + Cancel(); + delete iMtmUtil; + iResourceLoader.Close(); + } + +// --------------------------------------------------------- +// CPushMtmUiOperation::AssureResourceL +// --------------------------------------------------------- +// +void CPushMtmUiOperation::AssureResourceL( const TDesC& aResourceFile ) + { + if ( !iResourceOpened ) + { + // Add resource file. + TFileName resourceFileName( aResourceFile ); + iResourceLoader.OpenL( resourceFileName ); + iResourceOpened = ETrue; + } + } + +// --------------------------------------------------------- +// CPushMtmUiOperation::ShowGlobalErrorNoteL +// --------------------------------------------------------- +// +void CPushMtmUiOperation::ShowGlobalErrorNoteL( TInt aError ) const + { + CErrorUI* errorUi = CErrorUI::NewLC( iCoeEnv ); + if ( errorUi->ShowGlobalErrorNoteL( aError ) == EFalse ) + { + User::Leave( KErrGeneral ); + } + CleanupStack::PopAndDestroy( errorUi ); + } + +// End of file. + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushMtmUiPanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushMtmUiPanic.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmUiPanic.h" + + +_LIT( KUiPanicString, "PushMtmUi" ); + +GLDEF_C void UiPanic( TPushMtmUiPanic aReason ) + { + User::Panic( KUiPanicString, aReason ); + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushSettingsDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushSettingsDialog.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,726 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Member definitions of CPushSettingsDialog. +* +*/ + + + +// INCLUDES +#include "browser_platform_variant.hrh" +#include "PushSettingsDialog.h" +#include "PushMtmUiDef.h" +#include "PushMtmUiPanic.h" +#include +#include "PushMtmUi.hrh" +#include "PushMtmDef.hrh" +#include +#include +#include +#include +#include +#include +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include +#include +#endif // __SERIES60_HELP +#include +#include +#include +#include "PushMtmPrivateCRKeys.h" +#include +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushSettingsDialog::CPushSettingsDialog +// --------------------------------------------------------- +// +CPushSettingsDialog::CPushSettingsDialog( CMsvSession& aMsvSession ) +: CAknDialog(), + iMsvSession( aMsvSession ), + iResourceLoader( *iCoeEnv ), + iNewTitleTextUsed( EFalse ), + iRestoreSP( ETrue ) + { + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ExecuteLD +// --------------------------------------------------------- +// +void CPushSettingsDialog::ExecuteLD() + { + CleanupStack::PushL( this ); + ConstructL(); + CAknDialog::ConstructL( R_PUSHSD_MENU ); + CleanupStack::Pop( this ); + CAknDialog::ExecuteLD( R_PUSHSD_DIALOG ); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ConstructL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ConstructL() + { + // Add resource file. + CRepository* PushSL = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( PushSL ); + User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) ); + CleanupStack::PopAndDestroy( PushSL ); + + TParse* fileParser = new (ELeave) TParse; + // Unnecessary to call CleanupStack::PushL( fileParser ); + fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); + iResourceFile = fileParser->FullName(); + delete fileParser; + fileParser = NULL; + iResourceLoader.OpenL( iResourceFile ); + + // Construct model. + ConstructModelL(); + + // Now model is ready for view. + const TInt KGranularity( 8 ); + iSettingType = new (ELeave) CArrayFixFlat( KGranularity ); + + // Set up Title Pane and Context Pane. + SetUpStatusPaneL(); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::~CPushSettingsDialog +// --------------------------------------------------------- +// +CPushSettingsDialog::~CPushSettingsDialog() + { + if ( iRestoreSP ) + { + TRAP_IGNORE( RestoreStatusPaneL() ); + } + iResourceLoader.Close(); + delete iPreviousTitleText; + delete iModel; + delete iSettingType; + iSettingListBox = NULL; + iSettingListBoxItemTextArray = NULL; + } + +// --------------------------------------------------------- +// CPushSettingsDialog::SetUpStatusPaneL +// --------------------------------------------------------- +// +void CPushSettingsDialog::SetUpStatusPaneL() + { + if ( !iNewTitleTextUsed ) + { + __ASSERT_DEBUG( !iPreviousTitleText, + UiPanic( EPushMtmUiPanAlreadyExistingTitle ) ); + // Set up Title Pane. + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* titlePane = + STATIC_CAST( CAknTitlePane*, + statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + // Save content. + iPreviousTitleText = titlePane->Text()->AllocL(); + // Set new content. + TResourceReader reader; + iCoeEnv->CreateResourceReaderLC( reader, R_PUSHSD_TITLE_PANE ); + titlePane->SetFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader + iNewTitleTextUsed = ETrue; + } + } + +// --------------------------------------------------------- +// CPushSettingsDialog::RestoreStatusPaneL +// --------------------------------------------------------- +// +void CPushSettingsDialog::RestoreStatusPaneL() + { + if ( iNewTitleTextUsed ) + { + __ASSERT_DEBUG( iPreviousTitleText, + UiPanic( EPushMtmUiPanMissingTitle ) ); + // Restore Title Pane. + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* titlePane = + STATIC_CAST( CAknTitlePane*, + statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + titlePane->SetTextL( *iPreviousTitleText ); + delete iPreviousTitleText; + iPreviousTitleText = NULL; + iNewTitleTextUsed = EFalse; + } + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ConstructModelL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ConstructModelL() + { + __ASSERT_DEBUG( !iModel, UiPanic( EPushMtmUiPanAlreadyExistingModel ) ); + + // This will be the model. + iModel = CPushMtmSettings::NewL(); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::UpdateSettingListBoxModelL +// --------------------------------------------------------- +// +void CPushSettingsDialog::UpdateSettingListBoxModelL() + { + __ASSERT_DEBUG( iModel && + iSettingListBox && + iSettingListBoxItemTextArray && + iSettingType, UiPanic( EPushMtmUiPanNotInitialized ) ); + + // Reset the list box' item text array and the setting type array. + iSettingListBoxItemTextArray->Reset(); + iSettingType->Reset(); + + // Service reception. + ConstructAndAppendItemTextL + ( EServiceReception, R_PUSHSD_RECEPT, + iModel->ServiceReception() ? R_PUSHSD_RECEP_ON : R_PUSHSD_RECEP_OFF ); + + +if(iPushSLEnabled) + { + // Service loading (SL specific). + ConstructAndAppendItemTextL + ( EServiceLoadingType, R_PUSHSD_LOADING, + ( iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic ) ? + R_PUSHSD_LOAD_AUTOM : R_PUSHSD_LOAD_MAN ); + } + } + +// --------------------------------------------------------- +// CPushSettingsDialog::UpdateSettingListBoxViewL +// --------------------------------------------------------- +// +void CPushSettingsDialog::UpdateSettingListBoxViewL() const + { + __ASSERT_DEBUG( iSettingListBox, UiPanic( EPushMtmUiPanMissingListBox ) ); + //iSettingListBox->DrawItem( iSettingListBox->CurrentItemIndex() ); + TInt currentItemIndex( iSettingListBox->CurrentItemIndex() ); + iSettingListBox->DrawNow(); + iSettingListBox->SetCurrentItemIndex( currentItemIndex ); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ApplyModelChangesL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ApplyModelChangesL() + { + UpdateSettingListBoxModelL(); + UpdateSettingListBoxViewL(); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ShowRadioButtonSettingPageL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ShowRadioButtonSettingPageL + ( const TSettingType aSettingType ) + { + __ASSERT_DEBUG( iModel, UiPanic( EPushMtmUiPanMissingModel ) ); + + TInt index; + HBufC* settingTitle = ConstructSettingTitleL( aSettingType ); + CleanupStack::PushL( settingTitle ); + CDesCArrayFlat* itemArray = + ConstructSettingValueArrayL( aSettingType, index ); + CleanupStack::PushL( itemArray ); + CAknRadioButtonSettingPage* settingPage = + new (ELeave) CAknRadioButtonSettingPage + ( R_PUSHSD_SP_RADIOBUTTON, index, itemArray ); + CleanupStack::PushL( settingPage ); + settingPage->SetSettingTextL( *settingTitle ); + + const TInt previousIndex = index; + CleanupStack::Pop(); // settingPage + if ( settingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) + { + if ( previousIndex != index ) + { + // Set the changes in the model. + UpdateSettingL( aSettingType, index ); + } + } + + CleanupStack::PopAndDestroy( 2 ); // itemArray, settingTitle + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ShowServiceLoadingTypeConfirmationL +// --------------------------------------------------------- +// +TBool CPushSettingsDialog::ShowServiceLoadingTypeConfirmationL() const + { + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + return dlg->ExecuteLD( R_PUSHSD_AUTOLOAD_SETT_CONFIRM ) == EAknSoftkeyYes; + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ChangeCurrentSettingWithoutSettingPageL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ChangeCurrentSettingWithoutSettingPageL() + { + __ASSERT_DEBUG( iModel && iSettingListBox, + UiPanic( EPushMtmUiPanNotInitialized ) ); + + switch ( iSettingType->At( iSettingListBox->CurrentItemIndex() ) ) + { + case EServiceReception: + { + iModel->SetServiceReception( !iModel->ServiceReception() ); + break; + } + + case EServiceLoadingType: + { + if(iPushSLEnabled){ + if ( iModel->ServiceLoadingType() == CPushMtmSettings::EManual ) + { + // Display a confirmation dialog first. + if ( ShowServiceLoadingTypeConfirmationL() ) + { + iModel->SetServiceLoadingType + ( CPushMtmSettings::EAutomatic ); + } + } + else + { + // Do not show confirmation dialog. + iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); + } + }//End iPushSLEnabled + break; + } + + + default: + { + __ASSERT_DEBUG( EFalse, + UiPanic( EPushMtmUiPanCommandNotSupported ) ); + break; + } + } + + // Apply changes. + iModel->SaveL(); + ApplyModelChangesL(); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ChangeCurrentSettingL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ChangeCurrentSettingL() + { + __ASSERT_DEBUG( iModel && iSettingListBox, + UiPanic( EPushMtmUiPanNotInitialized ) ); + ShowRadioButtonSettingPageL + ( iSettingType->At( iSettingListBox->CurrentItemIndex() ) ); + // Apply changes. + iModel->SaveL(); + ApplyModelChangesL(); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ConstructAndAppendItemTextL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ConstructAndAppendItemTextL +( const TSettingType aSettingType, + const TInt aTitleResId, const TInt aValueResId, + const TDesC& aTitleText, const TDesC& aValueText ) + { + __ASSERT_DEBUG( iSettingListBoxItemTextArray && iSettingType, + UiPanic( EPushMtmUiPanNotInitialized ) ); + + // Define separator text. + _LIT( KHeadOfItemText, " \t" ); + // Define separator text. + _LIT( KSeparatorOfItemText, "\t\t" ); + + HBufC* titleText = ( aTitleResId != KErrNotFound ) ? + iEikonEnv->AllocReadResourceLC( aTitleResId ) : aTitleText.AllocLC(); + HBufC* valueText = ( aValueResId != KErrNotFound ) ? + iEikonEnv->AllocReadResourceLC( aValueResId ) : aValueText.AllocLC(); + + // Define a heap descriptor to hold all the item text. + HBufC* itemText = HBufC::NewMaxLC( + KHeadOfItemText().Length() + titleText->Length() + + KSeparatorOfItemText().Length() + valueText->Length() ); + TPtr itemTextPtr = itemText->Des(); + itemTextPtr = KHeadOfItemText; + itemTextPtr += *titleText; + itemTextPtr += KSeparatorOfItemText; + itemTextPtr += *valueText; + iSettingListBoxItemTextArray->AppendL( itemTextPtr ); + iSettingType->AppendL( aSettingType ); + + CleanupStack::PopAndDestroy( 3 ); // itemText, valueText, titleText + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ConstructSettingTitleL +// --------------------------------------------------------- +// +HBufC* CPushSettingsDialog::ConstructSettingTitleL +( const TSettingType aSettingType ) const + { + TInt titleResId = 0; + + if(aSettingType == EServiceReception ) + titleResId = R_PUSHSD_RECEPT; + + else if (aSettingType == EServiceLoadingType) + { + if(iPushSLEnabled ) + titleResId = R_PUSHSD_LOADING; + } + + else + titleResId = KErrNotFound; + + + __ASSERT_DEBUG( titleResId != KErrNotFound, + UiPanic( EPushMtmUiPanNotInitialized ) ); + + return iEikonEnv->AllocReadResourceL( titleResId ); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ConstructSettingValueArray +// --------------------------------------------------------- +// +void CPushSettingsDialog::ConstructSettingValueArray + ( + const TSettingType aSettingType, + TInt& aVal1ResId, + TInt& aVal2ResId + ) const + { + if( aSettingType == EServiceReception) + aVal1ResId = R_PUSHSD_RECEP_ON; + + else if((aSettingType == EServiceLoadingType) && iPushSLEnabled ) + { + aVal1ResId = R_PUSHSD_LOAD_AUTOM; + } + else + aVal1ResId = KErrNotFound; + + + if( aSettingType == EServiceReception ) + aVal2ResId = R_PUSHSD_RECEP_OFF; + else if( aSettingType == EServiceLoadingType && iPushSLEnabled) + aVal2ResId = R_PUSHSD_LOAD_MAN; + else + aVal2ResId = KErrNotFound; + + + __ASSERT_DEBUG( aVal1ResId != KErrNotFound && + aVal2ResId != KErrNotFound, + UiPanic( EPushMtmUiPanNotInitialized ) ); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::CurrentlySelectedSettingValueResId +// --------------------------------------------------------- +// +TInt CPushSettingsDialog::CurrentlySelectedSettingValueResId +( const TSettingType aSettingType, TInt& aIndex ) const + { + TInt val1ResId( KErrNotFound ); + TInt val2ResId( KErrNotFound ); + ConstructSettingValueArray( aSettingType, val1ResId, val2ResId ); + + TBool firstSelected; + + if(aSettingType == EServiceReception ) + firstSelected = iModel->ServiceReception(); + + else if( aSettingType == EServiceLoadingType && iPushSLEnabled ) + { + firstSelected = (iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic); + } + else + firstSelected = EFalse; + + + + aIndex = firstSelected ? 0 : 1; + return firstSelected ? val1ResId : val2ResId; + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ConstructSettingValueArrayL +// --------------------------------------------------------- +// +CDesCArrayFlat* CPushSettingsDialog::ConstructSettingValueArrayL +( const TSettingType aSettingType, TInt& aIndex ) const + { + CDesCArrayFlat* valueArray = new (ELeave) CDesCArrayFlat( 2 ); + CleanupStack::PushL( valueArray ); + + TInt val1ResId( KErrNotFound ); + TInt val2ResId( KErrNotFound ); + ConstructSettingValueArray( aSettingType, val1ResId, val2ResId ); + HBufC* value1Text = iEikonEnv->AllocReadResourceLC( val1ResId ); + HBufC* value2Text = iEikonEnv->AllocReadResourceLC( val2ResId ); + valueArray->AppendL( *value1Text ); + valueArray->AppendL( *value2Text ); + CleanupStack::PopAndDestroy( 2 ); // value2Text, value1Text + + // Returned val. is ignored. + CurrentlySelectedSettingValueResId( aSettingType, aIndex ); + + CleanupStack::Pop(); // valueArray + return valueArray; + } + +// --------------------------------------------------------- +// CPushSettingsDialog::UpdateSettingL +// --------------------------------------------------------- +// +void CPushSettingsDialog::UpdateSettingL +( const TSettingType aSettingType, const TInt aIndex ) const + { + switch ( aSettingType ) + { + case EServiceReception: + { + iModel->SetServiceReception( aIndex == 0 ? ETrue : EFalse ); + break; + } + + case EServiceLoadingType: + { + if(iPushSLEnabled) + { + if ( aIndex == 0 ) + // iModel->ServiceLoadingType() == CPushMtmSettings::EManual + { + // Display a confirmation dialog first. + if ( ShowServiceLoadingTypeConfirmationL() ) + { + iModel->SetServiceLoadingType + ( CPushMtmSettings::EAutomatic ); + } + } + else + { + // Do not show confirmation dialog. + iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); + } + } + break; + } + + default: + { + __ASSERT_DEBUG( EFalse, + UiPanic( EPushMtmUiPanCommandNotSupported ) ); + break; + } + } + } + +// --------------------------------------------------------- +// CPushSettingsDialog::OfferKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CPushSettingsDialog::OfferKeyEventL +( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) + { + // Shutting down. Do not restore SP. + iRestoreSP = EFalse; + } + return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::DynInitMenuPaneL +// --------------------------------------------------------- +// +void CPushSettingsDialog::DynInitMenuPaneL + ( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) + { + } + +// --------------------------------------------------------- +// CPushSettingsDialog::PreLayoutDynInitL +// --------------------------------------------------------- +// +void CPushSettingsDialog::PreLayoutDynInitL() + { + __ASSERT_DEBUG( !iSettingListBox && + !iSettingListBoxItemTextArray, + UiPanic( EPushMtmUiPanAlreadyInitialized ) ); + + iSettingListBox = STATIC_CAST( CAknSettingStyleListBox*, + Control( EPushSettingsDialogCntrlListBox ) ); + iSettingListBoxItemTextArray = STATIC_CAST( CDesCArrayFlat*, + iSettingListBox->Model()->ItemTextArray() ); + iSettingListBox->SetListBoxObserver( this ); + TRect rect = Rect(); + iSettingListBox->SetRect( rect ); + // Set up scroll bar. + iSettingListBox->CreateScrollBarFrameL( ETrue ); + iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL + ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + + // Update setting list box model. + UpdateSettingListBoxModelL(); + } + +// --------------------------------------------------------- +// CPushSettingsDialog::ProcessCommandL +// --------------------------------------------------------- +// +void CPushSettingsDialog::ProcessCommandL( TInt aCommand ) + { + HideMenu(); + + switch ( aCommand ) + { + case EPushSettingsDialogCmdChangeWithoutSettingPage: + { + ChangeCurrentSettingWithoutSettingPageL(); + break; + } + + case EPushSettingsDialogCmdChange: + { + ChangeCurrentSettingL(); + break; + } + +#ifdef __SERIES60_HELP + + case EPushSettingsDialogCmdHelp: + { + HlpLauncher::LaunchHelpApplicationL + ( iEikonEnv->WsSession(), + iEikonEnv->EikAppUi()->AppHelpContextL() ); + break; + } + +#endif //__SERIES60_HELP + + case EPushSettingsDialogCmdBack: + case EPushSettingsDialogCmdExit: + { + TryExitL( EPushSettingsDialogCmdAknExit ); + break; + } + + case EPushSettingsDialogCmdAknExit: + { + STATIC_CAST( MEikCommandObserver*, iEikonEnv->EikAppUi() )-> + ProcessCommandL( EPushSettingsDialogCmdAknExit ); + break; + } + + default: + { + break; + } + } + } + +// --------------------------------------------------------- +// CPushSettingsDialog::OkToExitL +// --------------------------------------------------------- +// +TBool CPushSettingsDialog::OkToExitL( TInt aButtonId ) + { + TBool ret( EFalse ); + + switch ( aButtonId ) + { + case EPushSettingsDialogCmdOptions: + { + if ( !MenuShowing() ) + { + DisplayMenuL(); + } + break; + } + case EPushSettingsDialogCmdChangeWithoutSettingPage: + { + ChangeCurrentSettingWithoutSettingPageL(); + break; + } + case EPushSettingsDialogCmdBack: + case EPushSettingsDialogCmdExit: + case EPushSettingsDialogCmdAknExit: + { + RestoreStatusPaneL(); + ret = ETrue; + break; + } + default: + { + break; + } + } + + return ret; + } + +// --------------------------------------------------------- +// CPushSettingsDialog::HandleListBoxEventL +// --------------------------------------------------------- +// +void CPushSettingsDialog::HandleListBoxEventL +( CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) + { + // Generate change command only if double tapped/center key is pressed. + //Removed single tap check from here + if ( aEventType == EEventEnterKeyPressed || + aEventType == EEventItemDoubleClicked +#ifdef BRDO_SINGLE_CLICK_ENABLED_FF + || aEventType == EEventItemSingleClicked +#endif + ) + { + ProcessCommandL( EPushSettingsDialogCmdChangeWithoutSettingPage ); + } + } + +#ifdef __SERIES60_HELP +// --------------------------------------------------------- +// CPushSettingsDialog::GetHelpContext +// --------------------------------------------------------- +// +void CPushSettingsDialog::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = TUid::Uid( EUidPushViewerApp ); + aContext.iContext = KWPUSH_HLP_SETTINGS; + } +#endif //__SERIES60_HELP + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushViewMessageOp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushViewMessageOp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,316 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushViewMessageOp. +* +*/ + + + +// INCLUDE FILES + +#include "PushViewMessageOp.h" +#include "PushMtmUiDef.h" +#include "PushMtmUiPanic.h" +#include "PushMtmLog.h" +#include "PushMtmUtil.h" +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include + +// CONSTANTS + +_LIT8( KTextPlainString, "text/plain" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushLoadServiceOp::NewL +// --------------------------------------------------------- +// +CPushViewMessageOp* CPushViewMessageOp::NewL( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ) + { + PUSHLOG_ENTERFN("CPushViewMessageOp::NewL") + + CPushViewMessageOp* self = + new (ELeave) CPushViewMessageOp( aSession, aEntryId, aObserverStatus ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PUSHLOG_LEAVEFN("CPushViewMessageOp::NewL") + return self; + } + +// --------------------------------------------------------- +// CPushViewMessageOp::~CPushViewMessageOp +// --------------------------------------------------------- +// +CPushViewMessageOp::~CPushViewMessageOp() + { + PUSHLOG_ENTERFN("CPushViewMessageOp::~CPushViewMessageOp") + + Cancel(); + delete iDocHandler; + + PUSHLOG_LEAVEFN("CPushViewMessageOp::~CPushViewMessageOp") + } + +// --------------------------------------------------------- +// CPushViewMessageOp::StartL +// --------------------------------------------------------- +// +void CPushViewMessageOp::StartL() + { + PUSHLOG_WRITE("CPushViewMessageOp StartL") + + Cancel(); + + // Mark service read. + iMtmUtil->MarkServiceUnreadL( iEntryId, EFalse ); + + CPushMtmUiOperation::StartL(); + } + +// --------------------------------------------------------- +// CPushViewMessageOp::CPushViewMessageOp +// --------------------------------------------------------- +// +CPushViewMessageOp::CPushViewMessageOp( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ) +: CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ), + iIsCancelled( EFalse ) + { + PUSHLOG_WRITE("CPushViewMessageOp constructing") + } + +// --------------------------------------------------------- +// CPushViewMessageOp::ConstructL +// --------------------------------------------------------- +// +void CPushViewMessageOp::ConstructL() + { + CPushMtmUiOperation::ConstructL(); + } + +// --------------------------------------------------------- +// CPushViewMessageOp::RunL +// --------------------------------------------------------- +// +void CPushViewMessageOp::RunL() + { + PUSHLOG_ENTERFN("CPushViewMessageOp::RunL"); + + if ( iDocHandler ) + { + // Content handler is running; we just need to close it, + // NotifyExit has already been called. + delete iDocHandler; + iDocHandler = NULL; + CancelObserveEntryEvent(); + + // Ready. + SignalObserver( KErrNone ); + } + else + { + // Lauch the content handler. + TMsvEntry tEntry; + TMsvId service; + User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, tEntry ) ); + + __ASSERT_ALWAYS( tEntry.iMtm == KUidMtmWapPush, + UiPanic( EPushMtmUiPanBadMtm ) ); + + CSIPushMsgEntry* si = NULL; + const TInt32 bioType( tEntry.iBioType ); + + if ( bioType == KUidWapPushMsgSI.iUid ) + { + si = CSIPushMsgEntry::NewL(); + } + else + { + __ASSERT_DEBUG( EFalse, UiPanic( EPushMtmUiPanBadBioType ) ); + User::Leave( KErrNotSupported ); + } + + CleanupStack::PushL( si ); + si->RetrieveL( iMsvSession, iEntryId ); + + PUSHLOG_WRITE("CPushViewMessageOp SI retrieved") + + __ASSERT_DEBUG( !iDocHandler, UiPanic( EPushMtmUiPanAlreadyInitialized ) ); + iDocHandler = CDocumentHandler::NewL( CEikonEnv::Static()->Process() ); + + iDocHandler->SetExitObserver( this ); // (1) + const TPtrC text = si->Text(); + // Copy the text to an 8-bit buffer: + HBufC8* text8 = HBufC8::NewMaxLC( text.Length() ); + text8->Des().Copy( text ); + TDataType dataType( KTextPlainString ); + + CAiwGenericParamList& paramList = iDocHandler->InParamListL(); + RFile tempFile; + iDocHandler->SaveTempFileL + ( *text8, dataType, KNullDesC, tempFile ); + PUSHLOG_WRITE(" SaveTempFileL OK"); + CleanupClosePushL( tempFile ); + iDocHandler->OpenFileEmbeddedL( tempFile, dataType, paramList ); + PUSHLOG_WRITE(" OpenFileEmbeddedL OK"); + CleanupStack::PopAndDestroy( &tempFile ); // tempFile + PUSHLOG_WRITE(" PopAndDestroy( &tempFile ) OK"); + + CleanupStack::PopAndDestroy( 2, si ); // text8, si + PUSHLOG_WRITE(" PopAndDestroy( 2, si ) OK"); + + // Signal the observer when the viewer is terminated. + // Until then we are observeing the message + // (delete & replacement notification). + //ObserveEntryEventL(); // (2) + // Now we are observing two things: the viewer (1) and the entry (2). + + iStatus = KRequestPending; + SetActive(); + } + + PUSHLOG_LEAVEFN("CPushViewMessageOp::RunL") + } + +// --------------------------------------------------------- +// CPushViewMessageOp::DoCancel +// --------------------------------------------------------- +// +void CPushViewMessageOp::DoCancel() + { + PUSHLOG_ENTERFN("CPushViewMessageOp::DoCancel"); + + iIsCancelled = ETrue; + + CancelObserveEntryEvent(); + // If there is DocHandler, then it means that we are active and + // waiting for NotifyExit to be called. + if ( iDocHandler ) + { + // Terminate the embedded viewer. TODO + // Complete us. + InvokeRun(); + } + + SignalObserver( KErrCancel ); + + PUSHLOG_LEAVEFN("CPushViewMessageOp::DoCancel"); + } + +// --------------------------------------------------------- +// CPushViewMessageOp::RunError +// --------------------------------------------------------- +// +TInt CPushViewMessageOp::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CPushViewMessageOp::RunError: %d",aError); + + CancelObserveEntryEvent(); + + delete iDocHandler; + iDocHandler = NULL; + + TRAP_IGNORE( ShowGlobalErrorNoteL( aError ) ); + return CPushMtmUiOperation::RunError( aError ); + } + +// --------------------------------------------------------- +// CPushViewMessageOp::HandleEntryEventL +// --------------------------------------------------------- +// +void CPushViewMessageOp::HandleEntryEventL( TMsvEntryEvent aEvent, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ ) + { + PUSHLOG_ENTERFN("CPushViewMessageOp::HandleEntryEventL"); + + if ( aEvent == EMsvEntryChanged ) + { + PUSHLOG_WRITE(" Changed"); + // We don't have to bother with such case that the + // content changes, but the entry is saved as 'read' in + // this case, because this operation handles only SI messages. + //TODO NotifyAndCancelL( R_PUSHMISC_INFO_REPLACED ); + } + else if ( aEvent == EMsvEntryDeleted ) + { + PUSHLOG_WRITE(" Deleted"); + //TODO NotifyAndCancelL( R_PUSHLS_EXPIRED_NOTE ); + } + else + { + // Nothing to do. + } + + PUSHLOG_LEAVEFN("CPushViewMessageOp::HandleEntryEventL"); + } + +// --------------------------------------------------------- +// CPushViewMessageOp::NotifyAndCancelL +// --------------------------------------------------------- +// +void CPushViewMessageOp::NotifyAndCancelL( TInt aResId ) + { + PUSHLOG_ENTERFN("CPushViewMessageOp::NotifyAndCancelL"); + + // Add resource file. + TParse* fileParser = new (ELeave) TParse; + CleanupStack::PushL( fileParser ); + fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); + AssureResourceL( fileParser->FullName() ); + CleanupStack::PopAndDestroy( fileParser ); // fileParser + fileParser = NULL; + + // Show note about the message deletion. + HBufC* noteText = iCoeEnv.AllocReadResourceLC( aResId ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); + note->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); // noteText + + // Close the dialog. + Cancel(); + + PUSHLOG_LEAVEFN("CPushViewMessageOp::NotifyAndCancelL"); + } + +// ----------------------------------------------------------------------------- +// CPushViewMessageOp::HandleServerAppExit +// ----------------------------------------------------------------------------- +// +void CPushViewMessageOp::HandleServerAppExit( TInt LOG_ONLY( aReason ) ) + { + PUSHLOG_WRITE_FORMAT("CPushViewMessageOp::HandleServerAppExit: %d",aReason); + + if ( !iIsCancelled ) + { + // Ready. The application was terminated normally. + InvokeRun(); + } + } + +// End of file. + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUiSrc/PushViewServiceOp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUiSrc/PushViewServiceOp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushViewServiceOp. +* +*/ + + + +// INCLUDE FILES + +#include "PushViewServiceOp.h" +#include "PushMtmUiPanic.h" +#include "PushMtmLog.h" +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushViewServiceOp::CPushViewServiceOp +// --------------------------------------------------------- +// +CPushViewServiceOp::CPushViewServiceOp( CMsvSession& aSession, + TMsvId aEntryId, + TRequestStatus& aObserverStatus ) +: CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ) + { + PUSHLOG_WRITE("CPushViewServiceOp constructing") + } + +// --------------------------------------------------------- +// CPushViewServiceOp::~CPushViewServiceOp +// --------------------------------------------------------- +// +CPushViewServiceOp::~CPushViewServiceOp() + { + Cancel(); + delete iDocHandler; + } + +// --------------------------------------------------------- +// CPushViewServiceOp::StartL +// --------------------------------------------------------- +// +void CPushViewServiceOp::StartL() + { + PUSHLOG_ENTERFN("CPushViewServiceOp::~CPushViewServiceOp") + + Cancel(); + CPushMtmOperation::StartL(); + + PUSHLOG_LEAVEFN("CPushViewServiceOp::~CPushViewServiceOp") + } + +// --------------------------------------------------------- +// CPushViewServiceOp::RunL +// --------------------------------------------------------- +// +void CPushViewServiceOp::RunL() + { + PUSHLOG_ENTERFN("CPushViewServiceOp::RunL") + + TMsvEntry tEntry; + TMsvId service; + User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, tEntry ) ); + + __ASSERT_ALWAYS( tEntry.iMtm == KUidMtmWapPush, + UiPanic( EPushMtmUiPanBadMtm ) ); + + CUnknownPushMsgEntry* context = NULL; + const TInt32 bioType( tEntry.iBioType ); + + if ( bioType == KUidWapPushMsgUnknown.iUid ) + { + context = CUnknownPushMsgEntry::NewL(); + } + else + { + __ASSERT_DEBUG( EFalse, UiPanic( EPushMtmUiPanBadBioType ) ); + User::Leave( KErrNotSupported ); + } + + CleanupStack::PushL( context ); + context->RetrieveL( iMsvSession, iEntryId ); + + const TPtrC contentType = context->ContentType(); + const TPtrC8 content = context->MessageData(); + + __ASSERT_DEBUG( !iDocHandler, UiPanic( EPushMtmUiPanAlreadyInitialized ) ); + iDocHandler = CDocumentHandler::NewL( CEikonEnv::Static()->Process() ); + + iDocHandler->SetExitObserver( this ); + HBufC8* contentType8 = HBufC8::NewMaxLC( contentType.Length() ); + contentType8->Des().Copy( contentType ); + TDataType dataType( *contentType8 ); + + CAiwGenericParamList& paramList = iDocHandler->InParamListL(); + RFile tempFile; + iDocHandler->SaveTempFileL + ( content, dataType, KNullDesC, tempFile ); + PUSHLOG_WRITE(" SaveTempFileL OK"); + CleanupClosePushL( tempFile ); + iDocHandler->OpenFileEmbeddedL( tempFile, dataType, paramList ); + PUSHLOG_WRITE(" OpenFileEmbeddedL OK"); + CleanupStack::PopAndDestroy( &tempFile ); // tempFile + PUSHLOG_WRITE(" PopAndDestroy( &tempFile ) OK"); + + CleanupStack::PopAndDestroy( 2, context ); // contentType8, context + + // Signal the observer when the viewer is terminated. + + PUSHLOG_LEAVEFN("CPushViewServiceOp::RunL") + } + +// --------------------------------------------------------- +// CPushViewServiceOp::DoCancel +// --------------------------------------------------------- +// +void CPushViewServiceOp::DoCancel() + { + PUSHLOG_WRITE("CPushViewServiceOp::DoCancel") + SignalObserver( KErrCancel ); + } + +// --------------------------------------------------------- +// CPushViewServiceOp::RunError +// --------------------------------------------------------- +// +TInt CPushViewServiceOp::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CPushViewServiceOp::RunError <%d>",aError) + TRAP_IGNORE( ShowGlobalErrorNoteL( aError ) ); + return CPushMtmOperation::RunError( aError ); + } + +// ----------------------------------------------------------------------------- +// CPushViewServiceOp::HandleServerAppExit +// ----------------------------------------------------------------------------- +// +void CPushViewServiceOp::HandleServerAppExit( TInt aReason ) + { + PUSHLOG_WRITE_FORMAT("CPushViewServiceOp::HandleServerAppExit <%d>",aReason) + aReason = 0; // Just to avoid warnings. + // Ready. + SignalObserver( KErrNone ); + } + +// End of file. + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushAsyncOpRunner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushAsyncOpRunner.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This file contains the class definition of CPushAsyncOpRunner. +* +* +*/ + + + +#ifndef PUSHASYNCOPRUNNER_H +#define PUSHASYNCOPRUNNER_H + +// INCLUDES + +#include "PushMtmOperation.h" +#include +#include + +// FORWARD DECLARATIONS + +class CMsvSession; +class CMsvOperation; + +// CLASS DECLARATION + +/** +* This class is intended as a base class of asynchronous ui operations. +* It provides the syntax, and the semantics should be implemented by derived classes: +* default implementations are provided, and derived classes may override this. +* The main goal was to make those Push Mtm Ui's functions asynchronous, that are +* really asynchronous, and avoid making them synchronous with using +* CActiveScheduler::Start() and CActiveScheduler::Stop(). This makes the +* design clearer and may prevent some problems raised by the usage of Start()'s and +* Stop()'s. +*/ +class CPushAsyncOpRunner : public CPushMtmOperation + { + public: // Functions from base classes + + /** + * Start or restart the operation. OnStartupL is called. See OnStartupL. + * @return None. + */ + IMPORT_C void StartL(); + + /** + * Get progress information. + * @return A package buffer (of type TPushMtmProgressBuf), containing + * progress information. + */ + IMPORT_C const TDesC8& ProgressL(); + + protected: // Constructors and destructor + + /** + * Constructor. CActiveScheduler::Add( this ) is called. Derived + * classes shouldn't call CActiveScheduler::Add( this ) in their constructor. + * @param aSession Msv session to use. + * @param aEntryId Id of the context to operate on. + * @param aObserverStatus Observer status. + * @return None. + */ + IMPORT_C CPushAsyncOpRunner( CMsvSession& aSession, + const TMsvId aEntryId, + TRequestStatus& aObserverStatus ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CPushAsyncOpRunner(); + + protected: // New functions + + /** + * This method is called from StartL. Default implementation returns ETrue + * and sets aIsObserving to EFalse. + * @param aIsObserving Used only if the function returns EFalse. + * In this case + * indicate in this variable if this operation observes + * an other one. If so, then it is set to active, but + * not completed - this will be made by the observed + * operation. + * Derived classes may override this. + * @return Return ETrue if the operation has completed. Return EFalse + * if the operation has not completed yet. In the latter case + * parameter aIsObserving is also used. + */ + IMPORT_C virtual TBool OnStartupL( TBool& aIsObserving ); + + /** + * This method is called from RunL. Default implementation returns ETrue + * and sets aIsObserving to EFalse. + * @param aIsObserving Used only if the function returns EFalse. + * In this case + * indicate in this variable if this operation observes + * an other one. If so, then it is set to active, but + * not completed - this will be made by the observed + * operation. + * Derived classes may override this. + * @return Return ETrue if the operation has completed. Return EFalse + * if the operation has not completed yet. In the latter case + * parameter aIsObserving is also used. + */ + IMPORT_C virtual TBool OnRunLActionL( TBool& aIsObserving ); + + /** + * Set observed operation and take ownership. + * @param aOp The operation. + * @return None. + */ + IMPORT_C void SetOperation( CMsvOperation* aOp ); + + /** + * Delete the observed operation. + * @return None. + */ + IMPORT_C void DeleteOperation(); + + /** + * Return the observed operation. + * @return The operation. + */ + IMPORT_C CMsvOperation& Operation(); + + protected: // Functions from base classes + + /** + * RunL protocol implementation. See OnRunLActionL. + * @return None. + */ + IMPORT_C void RunL(); + + /** + * Default implementation cancels the observed operation, and + * completes the observer with KErrCancel. + * Derived classes may override this. + * @return None. + */ + IMPORT_C void DoCancel(); + + /** + * Default implementation cancels the observed operation, + * completes the observer with aError and forwards the + * error to the scheduler. + * Derived classes may override this. + * @param aError Leave code. + * @return aError. + */ + IMPORT_C TInt RunError( TInt aError ); + + private: // Data members + + TBool iReady; ///< ETrue, if the operation is ready. + CMsvOperation* iOperation; ///< The observed operation. Has. + TBufC8<1> iDummyProgressBuf; ///< Dummy progress buffer. Ignored. + }; + +#endif // PUSHASYNCOPRUNNER_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushAuthenticationUtilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushAuthenticationUtilities.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Authentication utilities. +* +*/ + + + +#ifndef PUSHAUTHENTICATIONUTILITIES_H +#define PUSHAUTHENTICATIONUTILITIES_H + +// INCLUDE FILES + +#include + +// FORWARD DECLARATIONS + +class CPushMtmSettings; +class CPushMessage; +class CPushMsgEntryBase; + +// CLASS DECLARATION + +/** +* Utility class. +*/ +class TPushAuthenticationUtil + { + public: // New functions + + /** + * Authenticate the push message. + * @param aMtmSettings The push settings. + * @param aPushMsg The push message. + * @return ETrue if authenticated. EFalse otherwise. + */ + IMPORT_C static TBool AuthenticateMsgL + ( + const CPushMtmSettings& aMtmSettings, + const CPushMessage& aPushMsg + ); + + /** + * Authenticate the push message. + * @param aMtmSettings The push settings. + * @param aPushMsg The push message. + * @return ETrue if authenticated. EFalse otherwise. + */ + IMPORT_C static TBool AuthenticateMsgL + ( + const CPushMtmSettings& aMtmSettings, + const CPushMsgEntryBase& aPushMsg + ); + + }; + +#endif // PUSHAUTHENTICATIONUTILITIES_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushInitiator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushInitiator.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This header file contains the declaration of TPushInitiator. +* +*/ + + + +#ifndef PUSHINITIATOR_H +#define PUSHINITIATOR_H + +// INCLUDE FILES + +#include +#include + +// CONSTANTS + +const TUint32 ENullInitiatorEntryId = 0; + +// CLASS DECLARATION + +/** +* This class represents a push initiator's address. +*/ +class CPushInitiator : public CBase + { + public: // Data type + + enum TAddrType ///< Address type + { + ETypeIpv4, ///< IPv4 + ETypeIpv6, ///< IPv6 + ETypeE164, ///< MSISDN + ETypeAlpha, ///< Alphanumeric + ETypeAny ///< Any + }; + + public: // Constructors + + IMPORT_C CPushInitiator(); + IMPORT_C ~CPushInitiator(); + + public: // New functions + + IMPORT_C void SetAddressL( const TDesC& aAddr, + TAddrType aType ); + + inline const TDesC& Addr() const; + inline TAddrType Type() const; + + inline void SetEntryID( TUint32 aEntryID ); + inline TUint32 EntryID() const; + + inline CPushInitiator* AllocL() const; + inline CPushInitiator* AllocLC() const; + + /** + * Compares two initiators for equality. It compares the address and + * type. Note that ETypeAny matches any! + * @param aPushInitiator The other push initiator. + * @return ETrue if they are equal. + */ + inline TBool operator==( const CPushInitiator& aOther ) const; + inline TBool operator!=( const CPushInitiator& aOther ) const; + + private: // Data members + + HBufC* iAddress; ///< Address string. Owned. + TAddrType iType; ///< Address type. + TUint32 iEntryID; ///< Unique ID of the entry. + }; + +#include "PushInitiator.inl" + +#endif // PUSHINITIATOR_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushInitiator.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushInitiator.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions of CPushInitiator. +* +*/ + + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushInitiator::Addr +// --------------------------------------------------------- +// +inline const TDesC& CPushInitiator::Addr() const + { + return *iAddress; + } + +// --------------------------------------------------------- +// CPushInitiator::Type +// --------------------------------------------------------- +// +inline CPushInitiator::TAddrType CPushInitiator::Type() const + { + return iType; + } + +// --------------------------------------------------------- +// CPushInitiator::SetEntryID +// --------------------------------------------------------- +// +inline void CPushInitiator::SetEntryID( TUint32 aEntryID ) + { + iEntryID = aEntryID; + } + +// --------------------------------------------------------- +// CPushInitiator::EntryID +// --------------------------------------------------------- +// +inline TUint32 CPushInitiator::EntryID() const + { + return iEntryID; + } + +// --------------------------------------------------------- +// CPushInitiator::AllocL +// --------------------------------------------------------- +// +inline CPushInitiator* CPushInitiator::AllocL() const + { + CPushInitiator* temp = AllocLC(); + CleanupStack::Pop( temp ); + return temp; + } + +// --------------------------------------------------------- +// CPushInitiator::AllocLC +// --------------------------------------------------------- +// +inline CPushInitiator* CPushInitiator::AllocLC() const + { + CPushInitiator* temp = new (ELeave) CPushInitiator; + CleanupStack::PushL( temp ); + temp->SetAddressL( Addr(), Type() ); + return temp; + } + +// --------------------------------------------------------- +// CPushInitiator::operator== +// --------------------------------------------------------- +// +inline TBool CPushInitiator:: + operator==( const CPushInitiator& aOther ) const + { + return (Addr().Compare(aOther.Addr())==KErrNone) && + ( (Type()==aOther.Type()) || + Type()==ETypeAny || + aOther.Type()==ETypeAny ); + } + +// --------------------------------------------------------- +// CPushInitiator::operator!= +// --------------------------------------------------------- +// +inline TBool CPushInitiator:: + operator!=( const CPushInitiator& aOther ) const + { + return (*this==aOther) == EFalse; + } + +// End of File. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushInitiatorList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushInitiatorList.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This header file contains the declaration of CPushInitiatorList. +* +*/ + + + +#ifndef PUSHINITIATORLIST_H +#define PUSHINITIATORLIST_H + +// INCLUDE FILES + +#include "PushInitiator.h" +#include + +// FORWARD DECLARATIONS + +class CRepository; + +// CLASS DECLARATION + +/** +* This class is used to store push initiator addresses. +*/ +class CPushInitiatorList : protected CArrayPtrFlat + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return New CPushInitiatorList object. + */ + IMPORT_C static CPushInitiatorList* NewL(); + + /** + * Destructor. + */ + IMPORT_C ~CPushInitiatorList(); + + public: // New functions + + /** + * Append the initiator to the list. An Initiator is defined by an + * address and an address type together. + * The address with the given type is added to the list even if an + * initiator with the same address & type already exists in it. + * @param aPushInitiator The push initiator. + * @return A unique ID of the Initiator in the list (greater than 0). + */ + IMPORT_C TUint32 AddL( const CPushInitiator& aPushInitiator ); + + /** + * Append the initiator to the list. An Initiator is defined by an + * address and an address type together. + * The address with the given type is added to the list even if an + * initiator with the same address & type already exists in it. + * @param aPushInitiator The push initiator. Ownership is taken! + * @return A unique ID of the Initiator in the list (greater than 0). + */ + IMPORT_C TUint32 AddL( CPushInitiator* aPushInitiator ); + + /** + * Give a reference to the indicated initiator. + * @param aIndex Index of the initiator starting from zero. + * @return Reference to the initiator. + */ + IMPORT_C CPushInitiator& At( TInt aIndex ) const; + + /** + * Delete the initiator at index. + * @param aIndex Index of the initiator starting from zero. + * @return None. + */ + IMPORT_C void Delete( TInt aIndex ); + + /** + * Number of initiators in the list. + * @return Item count. + */ + IMPORT_C TInt Count() const; + + /** + * Get a free ID that is not used by the list members yet. + * The smallest ID got is 1. + * See CPushInitiator::EntryID()! + * @return The largest ID used plus 1 is returned. + */ + TUint32 FreeId() const; + + /** + * Return the "changed" flag. + * @return See above. + */ + TBool Changed() const; + + /** + * Reset the "changed" flag. + * @return None. + */ + void ResetChanged(); + + /** + * Delete the items in the list. + * @return None. + */ + IMPORT_C void ResetAndDestroy(); + + /** + * Find the first occurrence of the given initiator in the list. + * This method uses only the address & type properties of the + * Initiator - it does not use the ID property! + * @param aPushInitiator The push initiator to be found. + * @param aIndex If found, the index of it starting from zero. + * @return KErrNone if found, KErrNotFound otherwise. + */ + IMPORT_C TInt Find( const CPushInitiator& aPushInitiator, + TInt& aIndex ) const; + + IMPORT_C TBool operator==( const CPushInitiatorList& aList ) const; + IMPORT_C TBool operator!=( const CPushInitiatorList& aList ) const; + + /** + * Externalize into the Repository. + * @param aRepository CenRep + * @return none + */ + void ExternalizeL( CRepository& aRepository ) const; + + /** + * Internalize from the Repository. + * @param aRepository CenRep + * @return none + */ + void InternalizeL( CRepository& aRepository ); + + void ParseAndProcessBuf2ListL( const TDesC& aStreamedBuf ); + + HBufC* ParseAndProcessList2BufL() const; + + private: // Constructors and operators + + CPushInitiatorList( const TInt aGranularity ); + + private: // Data + + /// The following members indicate if a value has been changed. + TBool iPushInitiatorListChanged; + }; + +#endif // PUSHINITIATORLIST_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmLog.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logger facility for the Push MTM modules. +* +*/ + + + +#ifndef PUSHMTMLOG_H +#define PUSHMTMLOG_H + +// +#ifdef __TEST_LOG__ +// + +#include +#include +#include + +_LIT( KPushLogDir, "PushMtm" ); +_LIT( KPushLogFile, "PushLog.txt" ); +_LIT( KPushLogEnterFn, "-> %S" ); +_LIT( KPushLogLeaveFn, "<- %S" ); +_LIT( KPushLogTimeFormatString, "%H:%T:%S:%*C2" ); +_LIT( KPushLogTimeStampFormatString, "%S %S" ); + +#define PUSHLOG_ENTERFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, KPushLogEnterFn, &temp);} +#define PUSHLOG_LEAVEFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, KPushLogLeaveFn, &temp);} +#define PUSHLOG_WRITE(a) {_LIT(temp, a); RFileLogger::Write(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, temp);} +#define PUSHLOG_WRITE_FORMAT(a,b) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, temp, b);} +#define PUSHLOG_WRITE_FORMAT2(a,b,c) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, temp, b, c);} +#define PUSHLOG_WRITE_TIMESTAMP(a) {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<32> timeBuf; TRAPD(err, time.FormatL( timeBuf, KPushLogTimeFormatString )); if (!err) {RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, KPushLogTimeStampFormatString, &temp, &timeBuf);} } +// Use HEXDUMP with a TDesC8-derived parameter. +#define PUSHLOG_HEXDUMP(aBuf) {RFileLogger::HexDump(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, _S(" "), _S(" "), aBuf.Ptr(), aBuf.Size());} +// Guard "log-only" argument name with this (expands to argument). +#define LOG_ONLY( argName ) argName + +// +#else // #ifndef __TEST_LOG__ +// + +#define PUSHLOG_ENTERFN(a) +#define PUSHLOG_LEAVEFN(a) +#define PUSHLOG_WRITE(a) +#define PUSHLOG_WRITE_FORMAT(a,b) +#define PUSHLOG_WRITE_FORMAT2(a,b,c) +#define PUSHLOG_WRITE_TIMESTAMP(a) +#define PUSHLOG_HEXDUMP(aBuf) +// Guard "log-only" argument name with this (expands to nothing). +#define LOG_ONLY( argName ) + +// +#endif // __TEST_LOG__ +// +#endif // PUSHMTMLOG_H + +// End of File. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmOperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmOperation.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushMtmOperation. +* +*/ + + + +#ifndef PUSHMTMOPERATION_H +#define PUSHMTMOPERATION_H + +// INCLUDE FILES + +#include "PushMtmProgress.h" +#include +#include + +// CLASS DECLARATION + +/** +* Base class for mtm operations controlling asynchronous functions on the +* client side. +*/ +class CPushMtmOperation : public CMsvOperation, + public MMsvEntryObserver + { + public: // Constructors and destructor + + /** + * Destructor. + */ + IMPORT_C virtual ~CPushMtmOperation(); + + public: // New functions + + /** + * Start or restart the operation. + * Current implementation calls Cancel and invokes RunL. + * Derived classes may override this. + */ + IMPORT_C virtual void StartL(); + + public: // Functions from base classes + + /** + * Get progress information. + * @return A package buffer (of type TPushMtmProgressBuf), containing + * progress information. + */ + IMPORT_C const TDesC8& ProgressL(); + + protected: // Constructors + + /** + * Constructor. Calls CActiveScheduler::Add( this )! + * @param aSession Message Server Session to be used by this operation. + * @param aId Id of entry to operate on. + * @param aObserverRequestStatus Observer's status. + */ + IMPORT_C CPushMtmOperation( CMsvSession& aSession, + TMsvId aId, + TRequestStatus& aObserverRequestStatus ); + + protected: // New functions + + /** + * Invoke RunL. Complete request with KErrNone. + * @return None. + */ + IMPORT_C void InvokeRun(); + + /** + * Signal the observer that the asynchronous request is complete. + * @param aCompletionCode The value for which the observer's request + * status is set. + */ + IMPORT_C void SignalObserver( TInt aCompletionCode ); + + /** + * Request entry event observation. + * @return None. + */ + IMPORT_C void ObserveEntryEventL(); + + /** + * Cancel the request for entry event observation. + * @return None. + */ + IMPORT_C void CancelObserveEntryEvent(); + + protected: // Functions from base classes + + /** + * Current implementation calls SignalObserver( KErrNone ). + * Derived classes should override this and also should + * call SignalObserver. + */ + IMPORT_C void RunL(); + + /** + * Cancel protocol implementation. + */ + IMPORT_C void DoCancel(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. The observer is signaled if a leave occures. + * The leave code is not forwarded to the scheduler. + */ + IMPORT_C TInt RunError( TInt aError ); + + /** + * Call-back for entry event handling. Derived classes may override it. + */ + IMPORT_C void HandleEntryEventL( TMsvEntryEvent aEvent, + TAny* aArg1, TAny* aArg2, TAny* aArg3 ); + + protected: // Data + + TMsvId iEntryId; ///< Id of entry to operate on. + CMsvEntry* iCEntry; ///< Context. Owned. + TPushMtmProgress iProgress; ///< Progress information. + /// 8 bit descriptor package pointing to the progress information. + TPushMtmProgressPckg iProgressPckg; + }; + +#endif // PUSHMTMOPERATION_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmPrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmPrivateCRKeys.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef PUSHMTMPRIVATECRKEYS_H +#define PUSHMTMPRIVATECRKEYS_H + +const TUid KCRUidPushMtm = {0x10008D42}; + +// Service reception: on/off +const TUint32 KPushMtmServiceReception = 0x0000001; + +// Service loading: automatic/manual +const TUint32 KPushMtmServiceLoading = 0x0000002; + +// Read only White List +const TUint32 KPushMtmWhiteList = 0x0000003; + +//To Enable to Disable PUSH_SL Service in Run-time +const TUint32 KPushMtmServiceEnabled = 0x0000004; + +#endif // PUSHMTMPRIVATECRKEYS_H \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmSettings.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Push Mtm settings class declaration +* +*/ + + + +#ifndef PUSHMTMSETTINGS_H +#define PUSHMTMSETTINGS_H + +// INCLUDE FILES + +#include +#include + +// FORWARD DECLARATIONS + +class CPushInitiatorList; +class CRepository; + +// CLASS DECLARATION + +/** +* CPushMtmSettings supports an API with which push mtm settings can be +* read or edited. These settings are stored in Central Repository. +* +* On construction with the static NewL or NewLC methods the new instance is +* initialized with the stored values (with the usage of the LoadL method). +* Changes made are stored in the associated file if the SaveL method +* is called. It is possible that there are more than one instances of this +* class. The instances manipulate on the same CenRep. +* +* The instances do not update their settings values from the Repository +* automatically if it is modified. If an instance's owner wants that the +* settings values be up-to-date, then it should call LoadL or reconstruct a +* new CPushMtmSettings object. +*/ +class CPushMtmSettings : public CBase + { + public: // Type definitions + + enum TServiceLoading ///< Service loading type + { + EAutomatic, ///< Automatic loading + EManual ///< Manual loading + }; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return New CPushMtmSettings object. + */ + IMPORT_C static CPushMtmSettings* NewL(); + + /** + * Two-phased constructor. + * @return New CPushMtmSettings object. + */ + IMPORT_C static CPushMtmSettings* NewLC(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CPushMtmSettings(); + + public: // New functions + + // ==================== Setters ===================== + + /** + * Set service reception. + * @param aReceive If this parameter is ETrue, service + * reception is on. Otherwise it is off. + * @return none + */ + IMPORT_C void SetServiceReception( TBool aReceive ); + + /** + * Set service loading type. + * @param aType Service loading type. + * @return none + */ + IMPORT_C void SetServiceLoadingType( TServiceLoading aType ); + + // ==================== Getters ===================== + + /** + * Return wap push service reception setting. + * @return Message reception setting. + * It is ETrue, if setting is on. + * It is EFalse, if setting is off. + */ + IMPORT_C TBool ServiceReception() const; + + /** + * Return wap push service loading type setting. + * @return Service loading type setting. + */ + IMPORT_C TServiceLoading ServiceLoadingType() const; + + /** + * Return the 'White list' i.e. list of the addresses of push + * initiators from where we accept push messages. + * @return The push initiator list. + */ + IMPORT_C CPushInitiatorList& PushInitiatorList() const; + + // ==================== Saving and loading ===================== + + /** + * The data stored in the permanent store is internalized into the + * instance of this class. + * The existing values will be overwritten. + * @return none + */ + IMPORT_C void LoadL(); + + /** + * Save changes if one ore more of then have been changed. + * @param aForce Force saving to permanent store. + * @return None. + */ + IMPORT_C void SaveL( const TBool aForce = EFalse ); + + /** + * Restore factory settings from the Shared Data. + * Note that it issues SaveL() to persist the settings! + * @return None. + */ + IMPORT_C void RestoreFactorySettingsL(); + + private: // Constructors + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + /** + * Constructor. + */ + CPushMtmSettings(); + + private: // New functions + + /** + * Reset data members. + * It is called at the beginning of LoadL(), for example. + * @return none + */ + void Reset(); + + /** + * Externalize into the Repository. + * @param aRepository Central Repository + * @return none + */ + void ExternalizeL( CRepository& aRepository ) const; + + /** + * Internalize from the Repository. + * @param aRepository Central Repository + * @return none + */ + void InternalizeL( CRepository& aRepository ); + + /** + * Parse and process the streamed White List. + * @param aStreamedBuf The streamed White List. + * @return None. + */ + void ParseAndProcessWhiteListBufL( const TDesC& aStreamedBuf ); + + private: // Data + + TBool iServiceReception; ///< Setting value. + TServiceLoading iServiceLoadingType; ///< Setting value. + CPushInitiatorList* iPushInitiatorList; ///< The 'white list'. Owned. + + /// The following members indicate if a value has been changed. + TBool iServiceReceptionChanged; + TBool iServiceLoadingTypeChanged; + + TBool iFeatureManagerInitialized; + }; + +#endif // PUSHMTMSETTINGS_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmUtil.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushMtmUtil. +* +*/ + + + +#ifndef PUSHMTMUTIL_H +#define PUSHMTMUTIL_H + +// INCLUDE FILES + +#include +#include +#include + +// CONSTANTS + +/** +* Defines for masking values used to extract information from iMtmData2. +* Note that iMtmData1 is used by CPushMsgEntryBase and derived classes! +*/ +const TUint32 KPushMtmMaskOnlyAttrs = 0x000000FF; +const TUint32 KPushMtmShiftOnlyAttrs = 0; +const TUint32 KPushMtmMaskEverythingButAttrs = 0xFFFFFF00; +/** +* Attributes. The maximum number of attribute is determined by +* **************** KPushMtmMaskOnlyAttrs ****************** +* Each attribute can be set (1) or reseted (0). +*/ +const TUint32 EPushMtmAttrHasHref = 0x00000001; +const TUint32 EPushMtmReadButContentChanged = 0x00000002; +const TUint32 EPushMtmNotUsed1 = 0x00000004; +const TUint32 EPushMtmNotUsed2 = 0x00000008; +const TUint32 EPushMtmNotUsed3 = 0x00000010; +const TUint32 EPushMtmNotUsed4 = 0x00000020; +const TUint32 EPushMtmNotUsed5 = 0x00000040; +const TUint32 EPushMtmNotUsed6 = 0x00000080; + +// FORWARD DECLARATIONS + +class CMsvSession; + +// CLASS DECLARATION + +/** +* Utility class. +*/ +class CPushMtmUtil : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aMsvSession Message Server Session to be used by this operation. + * @return The constructed object. + */ + IMPORT_C static CPushMtmUtil* NewL( CMsvSession& aMsvSession ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CPushMtmUtil(); + + public: // New functions + + /** + * Mark the given entry unread and new. + * @param aEntryId The entry id to use. + * @param aUnread ETrue=mark unread, EFalse=mark read. + * @return None. + */ + IMPORT_C void MarkServiceUnreadL( TMsvId aEntryId, TBool aUnread ); + + /** + * Find all the push messages of the specified type in the given folder + * and its subfolders recursively (if specified). + * @param aFolderId The given folder. + * @param aMsgType Push message type. + * @param aRecursive Is recursive search desired. + * @return TMsvIds of the messages. + */ + IMPORT_C CMsvEntrySelection* FindMessagesL( TMsvId aFolderId, + TUid aMsgType, + TBool aRecursive ); + + /** + * Find all the push messages of the specified type in the given folders. + * @param aFolders Selection of folders. + * @param aMsgType Push message type. + * @return TMsvIds of the messages. + */ + IMPORT_C CMsvEntrySelection* FindMessagesL + ( const CMsvEntrySelection& aFolders, TUid aMsgType ); + + /** + * Find all the push messages of the specified type in the 'push' folders. + * @param aMsgType Push message type. + * @return TMsvIds of the messages. + */ + IMPORT_C CMsvEntrySelection* FindMessagesL( TUid aMsgType ); + + /** + * Find all the folders that may contain push messages. + * @return TMsvIds of the folders. + */ + IMPORT_C CMsvEntrySelection* FindPushFoldersL(); + + /** + * Locates SI entries with the specified SI-ID. Search is made in the + * 'push' folders returned by FindPushFoldersL(). + * @param aSiId Id of SI message to locate. + * @return Selection of entry IDs found. + */ + IMPORT_C CMsvEntrySelection* FindSiIdLC( const TDesC& aSiId ); + + /** + * Finds SI or SL entries with the specified Url and Push Message Type. + * Search is made in the 'push' folders returned by FindPushFoldersL(). + * @param aUrl URL to find + * @param aPushType Push Message type to filter entries by. + * @return Selection of entry IDs found. + */ + IMPORT_C CMsvEntrySelection* FindUrlLC( const TDesC& aUrl, + TUid aPushType ); + + /** + * Delete the given entry. + * @param aId Id of the message to locate. + * @return None. + */ + IMPORT_C void DeleteEntryL( TMsvId aId ); + + /** + * Convert the "From" information to the format required by the UI spec: + * it extracts the Host part of the URI. If it is ampty string, then + * it returns the copy of the original string. + * @param aFrom The sender information of a push message. + * @return The converted string in unicode. + */ + IMPORT_C HBufC* ConvertDetailsL( const TDesC8& aFrom ) const; + + /** + * Sets the given attributes of the context + * @param aContext Context entry that is modified. + * @param aAttr Attributes to be set. + * @return None. + */ + IMPORT_C static void SetAttrs( TMsvEntry& aContext, TUint32 aAttrs ); + + /** + * Resets the given attributes of the context. + * @param aContext Context entry that is modified. + * @param aAttr Attributes to be reset. + * @return None. + */ + IMPORT_C static void ResetAttrs( TMsvEntry& aContext, TUint32 aAttrs ); + + /** + * Get the value of the attributes of the context. + * @param aContext Context entry. + * @return The attributes. + */ + IMPORT_C static TUint32 Attrs( const TMsvEntry& aContext ); + + /** + * Convert the given URI to an appropriate form to be displayed. + * See UriUtils::ConvertToDisplayFormL for more information. + * @param aUri URI to be converted. + * @return The converted URI. + */ + IMPORT_C static HBufC* ConvertUriToDisplayFormL( const TDesC& aUri ); + + protected: // Constructors + + /** + * Constructor. + * @param aMsvSession Message server session. + */ + CPushMtmUtil( CMsvSession& aMsvSession ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + protected: // New functions + + /** + * Find all the push messages of the specified type in the given folder + * and its subfolders recursively (if specified). + * @param aFolderId The given folder. + * @param aMsgType Push message type. + * @param aRecursive Is recursive search desired. + * @param aResult The result (TMsvIds of the messages) is appended to + * this array. + * @return None. + */ + void FindMessagesL( TMsvId aFolderId, + TUid aMsgType, + TBool aRecursive, + CMsvEntrySelection& aResult ); + + private: // Data + + CMsvSession& iMsvSession; ///< Message Server session. + }; + +#endif // PUSHMTMUTIL_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmUtilDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmUtilDef.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic definition file. Internal usage only. +* +*/ + + + +#ifndef PUSHMTMUTILDEF_H +#define PUSHMTMUTILDEF_H + +#endif // PUSHMTMUTILDEF_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/PushMtmUtilPanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/PushMtmUtilPanic.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +#ifndef PUSHMTMUTILPANIC_H +#define PUSHMTMUTILPANIC_H + +// INCLUDE FILES + +#include + +enum TPushMtmUtilPanic + { + EPushMtmUtilPanNull = 1, + EPushMtmUtilPanNotNull, + EPushMtmUtilPanNotSupported, + EPushMtmUtilPanBadMtm, + EPushMtmUtilPanBadBioType + }; + +GLREF_C void UtilPanic( TPushMtmUtilPanic aReason ); + +#endif // PUSHMTMUTILPANIC_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilInc/WhiteListImporter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilInc/WhiteListImporter.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declatarion of CWhiteListImporter. +* +*/ + + +#ifndef WHITE_LIST_CONVERTER_H +#define WHITE_LIST_CONVERTER_H + +// INCLUDE FILES + +#include +#include + +// FORWARD DECLARATIONS + +class CPushInitiatorList; + +// CLASS DECLARATION + +/** +* Converter utility. +* Import White List data from a comma and semicolon separated descriptor to +* push initiator list, or export that to a descriptor. +*/ +class CWhiteListConverter : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aPushInitiatorList PushInitiatorList. + * @return The constructed importer. + */ + static CWhiteListConverter* NewL( CPushInitiatorList& aPushInitiatorList ); + + /** + * Destructor. + */ + virtual ~CWhiteListConverter(); + + public: // New methods + + /** + * Import White List data from a comma and semicolon + * separated descriptor. + * @param aSource Input descriptor. + * @throw KErrOverflow No more space in input buffer. + * @throw KErrCorrupt Corrupt input. + */ + void Buffer2ListL( const TDesC& aSource ); + + /** + * Export White List data to a comma and semicolon separated descriptor. + * @return Output descriptor. Ownership transferred to the caller. + * @throw KErrOverflow No more space in input buffer. + * @throw KErrCorrupt Corrupt input. + */ + HBufC* List2BufferL(); + + private: // Constructors and destructor + + /** + * Constructor. + */ + CWhiteListConverter( CPushInitiatorList& aPushInitiatorList ); + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + private: // New methods + + /** + * Get next character and store it in iCurCh. + */ + inline void GetChar(); + + /** + * Process next line = Record. + * @return ETrue if more lines to go, EFalse on EOS. + */ + TBool NextLineL(); + + /** + * Parse next token = Unit. + * Next token spans from current character up to (but excluding) + * to the next stop character. + * @param aStopChar Stop character (terminate the token). + * @return Pointer to token. This may be empty string. Note that the + * returned pointer is valid until next call (consecutive calls reuse + * the same buffer). + */ + TPtrC NextTokenL( TUint aStopChar ); + + /** + * Parse the separated list of White List entries and + * add it to PushMtmSettings. + */ + void AttrsL(); + + private: // data + + CPushInitiatorList& iPushInitiatorList; ///< The initiator list. + TLex iSource; ///< Helper to parse iSource. + TUint iCurCh; ///< Current (lookahead) character. + TText* iBuf; ///< Token buffer. Owned. + TText* iNextCh; ///< Next character is stored here. Not owned. + TText* iMaxCh; ///< End of buffer (points past the buffer). Not owned. + HBufC* iConverterBuf; ///< Owned. + }; + +#endif // WHITE_LIST_CONVERTER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushAsyncOpRunner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushAsyncOpRunner.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This file contains the member definitions of CPushAsyncOpRunner. +* +* +*/ + + + +// INCLUDES + +#include "PushAsyncOpRunner.h" +#include "PushMtmUtilPanic.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushAsyncOpRunner::StartL +// --------------------------------------------------------- +// +EXPORT_C void CPushAsyncOpRunner::StartL() + { + Cancel(); + TBool isObserving( EFalse ); + iReady = OnStartupL( isObserving ); + SetActive(); + if ( !isObserving ) + { + InvokeRun(); + } + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::ProgressL +// --------------------------------------------------------- +// +EXPORT_C const TDesC8& CPushAsyncOpRunner::ProgressL() + { + if ( iOperation ) + { + return iOperation->ProgressL(); + } + else + { + return iDummyProgressBuf; + } + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::CPushAsyncOpRunner +// --------------------------------------------------------- +// +EXPORT_C CPushAsyncOpRunner::CPushAsyncOpRunner( CMsvSession& aSession, + const TMsvId aEntryId, + TRequestStatus& aObserverStatus ) +: CPushMtmOperation( aSession, aEntryId, aObserverStatus ), + iReady( EFalse ), + iDummyProgressBuf( KNullDesC8 ) + { + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::~CPushAsyncOpRunner +// --------------------------------------------------------- +// +EXPORT_C CPushAsyncOpRunner::~CPushAsyncOpRunner() + { + Cancel(); + delete iOperation; + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::OnStartupL +// --------------------------------------------------------- +// +EXPORT_C TBool CPushAsyncOpRunner::OnStartupL( TBool& aIsObserving ) + { + aIsObserving = EFalse; + return ETrue; + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::OnRunLActionL +// --------------------------------------------------------- +// +EXPORT_C TBool CPushAsyncOpRunner::OnRunLActionL( TBool& aIsObserving ) + { + aIsObserving = EFalse; + return ETrue; + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::SetOperation +// --------------------------------------------------------- +// +EXPORT_C void CPushAsyncOpRunner::SetOperation( CMsvOperation* aOp ) + { + delete iOperation; + iOperation = NULL; + iOperation = aOp; + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::SetOperation +// --------------------------------------------------------- +// +EXPORT_C void CPushAsyncOpRunner::DeleteOperation() + { + delete iOperation; + iOperation = NULL; + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::Operation +// --------------------------------------------------------- +// +EXPORT_C CMsvOperation& CPushAsyncOpRunner::Operation() + { + __ASSERT_DEBUG( iOperation, UtilPanic( EPushMtmUtilPanNull ) ); + return *iOperation; + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::DoCancel +// --------------------------------------------------------- +// +EXPORT_C void CPushAsyncOpRunner::DoCancel() + { + if ( iOperation ) + { + iOperation->Cancel(); + } + CPushMtmOperation::DoCancel(); + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::RunError +// --------------------------------------------------------- +// +EXPORT_C TInt CPushAsyncOpRunner::RunError( TInt aError ) + { + if ( iOperation ) + { + iOperation->Cancel(); + delete iOperation; + iOperation = NULL; + } + return CPushMtmOperation::RunError( aError ); + } + +// --------------------------------------------------------- +// CPushAsyncOpRunner::RunL +// --------------------------------------------------------- +// +EXPORT_C void CPushAsyncOpRunner::RunL() + { + if ( iReady ) + { + SignalObserver( KErrNone ); + } + else + { + TBool isObserving( EFalse ); + iReady = OnRunLActionL( isObserving ); + if ( iReady ) + { + SignalObserver( KErrNone ); + } + else + { + // Invoke RunL again and run OnRunLActionL in it again. + SetActive(); + if ( !isObserving ) + { + InvokeRun(); + } + } + } + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushAuthenticationUtilitiesPure.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushAuthenticationUtilitiesPure.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Authentication utilities not using White List. +* +*/ + + + +// INCLUDE FILES + +#include "PushAuthenticationUtilities.h" +#include "PushMtmUtilPanic.h" +#include "PushMtmLog.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TPushAuthenticationUtil::AuthenticateMsgL +// --------------------------------------------------------- +// +EXPORT_C TBool TPushAuthenticationUtil::AuthenticateMsgL + ( + const CPushMtmSettings& /*aMtmSettings*/, + const CPushMessage& /*aPushMsg*/ + ) + { + PUSHLOG_ENTERFN("TPushAuthenticationUtil::AuthenticateMsgL") + PUSHLOG_WRITE(" Nothing done.") + PUSHLOG_LEAVEFN("TPushAuthenticationUtil::AuthenticateMsgL") + return ETrue; + } + +// --------------------------------------------------------- +// TPushAuthenticationUtil::AuthenticateMsgL +// --------------------------------------------------------- +// +EXPORT_C TBool TPushAuthenticationUtil::AuthenticateMsgL + ( + const CPushMtmSettings& /*aMtmSettings*/, + const CPushMsgEntryBase& /*aPushMsg*/ + ) + { + PUSHLOG_ENTERFN("TPushAuthenticationUtil::AuthenticateMsgL 2") + PUSHLOG_WRITE(" Nothing done.") + PUSHLOG_LEAVEFN("TPushAuthenticationUtil::AuthenticateMsgL 2") + return ETrue; + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushAuthenticationUtilitiesWL.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushAuthenticationUtilitiesWL.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Authentication utilities using White List. +* +*/ + + + +// INCLUDE FILES + +#include "PushAuthenticationUtilities.h" +#include "PushInitiatorList.h" +#include "PushInitiator.h" +#include "PushMtmSettings.h" +#include "PushMtmUtilPanic.h" +#include "PushMtmLog.h" +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// TPushAuthenticationUtil::AuthenticateMsgL +// --------------------------------------------------------- +// +EXPORT_C TBool TPushAuthenticationUtil::AuthenticateMsgL + ( + const CPushMtmSettings& aMtmSettings, + const CPushMessage& aPushMsg + ) + { + PUSHLOG_ENTERFN("TPushAuthenticationUtil::AuthenticateMsgL") + + // In case of white listing by default do not accept messages. + TBool msgAuthenticated = EFalse; + + // Get server address. + TPtrC8 srvAddress; + if ( !aPushMsg.GetServerAddress( srvAddress ) ) + { + srvAddress.Set( KNullDesC8 ); + } + + if ( srvAddress.Length() == 0 ) + { + PUSHLOG_WRITE(" No Server address") + } + else + { + PUSHLOG_WRITE_FORMAT(" Server address: <%S>",&srvAddress) + + CPushInitiator* sender = new (ELeave) CPushInitiator; + CleanupStack::PushL( sender ); + + // Copy the 8-bit text into a 16-bit one. + HBufC* from = HBufC::NewMaxLC( srvAddress.Length() ); + + from->Des().Copy( srvAddress ); + sender->SetAddressL( *from, CPushInitiator::ETypeAny ); + + CleanupStack::PopAndDestroy( from ); // from + + CPushInitiatorList& whiteList = aMtmSettings.PushInitiatorList(); + TInt index( 0 ); + TInt err = whiteList.Find( *sender, index ); + if ( !err ) + { + // Sender is in White list. + msgAuthenticated = ETrue; + PUSHLOG_WRITE(" Is in White List: msg accepted") + } + + CleanupStack::PopAndDestroy( sender ); // sender + } + + PUSHLOG_WRITE_FORMAT(" msgAuthenticated <%d>",msgAuthenticated) + PUSHLOG_LEAVEFN("TPushAuthenticationUtil::AuthenticateMsgL") + return msgAuthenticated; + } + +// --------------------------------------------------------- +// TPushAuthenticationUtil::AuthenticateMsgL +// --------------------------------------------------------- +// +EXPORT_C TBool TPushAuthenticationUtil::AuthenticateMsgL + ( + const CPushMtmSettings& aMtmSettings, + const CPushMsgEntryBase& aPushMsg + ) + { + PUSHLOG_ENTERFN("TPushAuthenticationUtil::AuthenticateMsgL 2") + + // In case of white listing by default do not accept messages. + TBool msgAuthenticated = EFalse; + + // Get server address. + TPtrC8 srvAddress = aPushMsg.From(); + + if ( srvAddress.Length() == 0 ) + { + PUSHLOG_WRITE(" Empty server address") + } + else + { + PUSHLOG_WRITE_FORMAT(" Server address: <%S>",&srvAddress) + + CPushInitiator* sender = new (ELeave) CPushInitiator; + CleanupStack::PushL( sender ); + + // Copy the 8-bit text into a 16-bit one. + HBufC* from = HBufC::NewMaxLC( srvAddress.Length() ); + + from->Des().Copy( srvAddress ); + sender->SetAddressL( *from, CPushInitiator::ETypeAny ); + + CleanupStack::PopAndDestroy( from ); // from + + CPushInitiatorList& whiteList = aMtmSettings.PushInitiatorList(); + TInt index( 0 ); + TInt err = whiteList.Find( *sender, index ); + if ( !err ) + { + // Sender is in White list. + msgAuthenticated = ETrue; + PUSHLOG_WRITE(" Is in White List: msg accepted") + } + + CleanupStack::PopAndDestroy( sender ); // sender + } + + PUSHLOG_WRITE_FORMAT(" msgAuthenticated <%d>",msgAuthenticated) + PUSHLOG_LEAVEFN("TPushAuthenticationUtil::AuthenticateMsgL 2") + return msgAuthenticated; + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushInitiator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushInitiator.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushInitiator. +* +*/ + + + +// INCLUDE FILES + +#include "PushInitiator.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushInitiator::CPushInitiator +// --------------------------------------------------------- +// +EXPORT_C CPushInitiator::CPushInitiator() +: CBase(), + iType( ETypeIpv4 ) + {} + +// --------------------------------------------------------- +// CPushInitiator::~CPushInitiator +// --------------------------------------------------------- +// +EXPORT_C CPushInitiator::~CPushInitiator() + { + delete iAddress; + } + +// --------------------------------------------------------- +// CPushInitiator::SetAddressL +// --------------------------------------------------------- +// +EXPORT_C void CPushInitiator::SetAddressL( const TDesC& aAddr, + TAddrType aType ) + { + HBufC* temp = aAddr.AllocL(); + delete iAddress; + iAddress = temp; + iType = aType; + } + +// End of File. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushInitiatorList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushInitiatorList.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,358 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The definition of CPushInitiatorList. +* +*/ + + + +// INCLUDE FILES + +#include "PushInitiatorList.h" +#include "PushMtmLog.h" +#include "PushMtmUtilPanic.h" +#include "WhiteListImporter.h" +#include "PushMtmPrivateCRKeys.h" +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushInitiatorList::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushInitiatorList* CPushInitiatorList::NewL() + { + const TInt KGranularity( 8 ); + return new (ELeave) CPushInitiatorList( KGranularity ); + } + +// --------------------------------------------------------- +// CPushInitiatorList::~CPushInitiatorList +// --------------------------------------------------------- +// +EXPORT_C CPushInitiatorList::~CPushInitiatorList() + { + ResetAndDestroy(); + } + +// --------------------------------------------------------- +// CPushInitiatorList::AddL +// --------------------------------------------------------- +// +EXPORT_C TUint32 CPushInitiatorList::AddL + ( const CPushInitiator& aPushInitiator ) + { + CPushInitiator* temp = aPushInitiator.AllocLC(); + TUint32 entryId = AddL( temp ); + CleanupStack::Pop( temp ); + return entryId; + } + +// --------------------------------------------------------- +// CPushInitiatorList::AddL +// --------------------------------------------------------- +// +EXPORT_C TUint32 CPushInitiatorList::AddL( CPushInitiator* aPushInitiator ) + { + PUSHLOG_ENTERFN("CPushInitiatorList::AddL") + + __ASSERT_DEBUG( aPushInitiator, UtilPanic( EPushMtmUtilPanNull ) ); + + TUint32 entryId( ENullInitiatorEntryId ); + + if ( !aPushInitiator ) + { + // Nothing to insert. + } + else + { + // Get an ID for the new entry before we insert it to the list if it + // has not set yet: + entryId = aPushInitiator->EntryID(); + if ( entryId == ENullInitiatorEntryId ) + { + entryId = FreeId(); + // Give this new ID to the new entry: + aPushInitiator->SetEntryID( entryId ); + } + __ASSERT_DEBUG( entryId != ENullInitiatorEntryId, + UtilPanic( EPushMtmUtilPanNull ) ); + // And append it to the list: + AppendL( aPushInitiator ); + // Set flag that indicates that the list has changed: + iPushInitiatorListChanged = ETrue; + } + + PUSHLOG_WRITE_FORMAT(" entryId <%d>",entryId) + PUSHLOG_LEAVEFN("CPushInitiatorList::AddL") + return entryId; + } + +// --------------------------------------------------------- +// CPushInitiatorList::At +// --------------------------------------------------------- +// +EXPORT_C CPushInitiator& CPushInitiatorList::At( TInt aIndex ) const + { + return (CPushInitiator&) + (*CArrayPtrFlat::At( aIndex )); + } + +// --------------------------------------------------------- +// CPushInitiatorList::Delete +// --------------------------------------------------------- +// +EXPORT_C void CPushInitiatorList::Delete( TInt aIndex ) + { + delete &At( aIndex ); + CArrayPtrFlat::Delete( aIndex ); + // Set indicator flag. + iPushInitiatorListChanged = ETrue; + } + +// --------------------------------------------------------- +// CPushInitiatorList::Count +// --------------------------------------------------------- +// +EXPORT_C TInt CPushInitiatorList::Count() const + { + return CArrayPtrFlat::Count(); + } + +// --------------------------------------------------------- +// CPushInitiatorList::FreeId +// --------------------------------------------------------- +// +TUint32 CPushInitiatorList::FreeId() const + { + TUint32 largestId( 0 ); + // Find the largest ID: + const TInt count( Count() ); + for ( TInt i = 0; i < count; ++i ) + { + if ( largestId < At(i).EntryID() ) + { + largestId = At(i).EntryID(); + } + } + if ( largestId == KMaxTUint32 ) + { + return 0; + } + + return ( largestId + 1 ); + } + +// --------------------------------------------------------- +// CPushInitiatorList::Changed +// --------------------------------------------------------- +// +TBool CPushInitiatorList::Changed() const + { + return iPushInitiatorListChanged; + } + +// --------------------------------------------------------- +// CPushInitiatorList::ResetChanged +// --------------------------------------------------------- +// +void CPushInitiatorList::ResetChanged() + { + iPushInitiatorListChanged = EFalse; + } + +// --------------------------------------------------------- +// CPushInitiatorList::ResetAndDestroy +// --------------------------------------------------------- +// +EXPORT_C void CPushInitiatorList::ResetAndDestroy() + { + CArrayPtrFlat::ResetAndDestroy(); + // Set indicator flag. + iPushInitiatorListChanged = ETrue; + } + +// --------------------------------------------------------- +// CPushInitiatorList::Find +// --------------------------------------------------------- +// +EXPORT_C TInt CPushInitiatorList::Find( const CPushInitiator& aPushInitiator, + TInt& aIndex ) const + { + PUSHLOG_ENTERFN("CPushInitiatorList::Find") + + TInt ret( KErrNotFound ); + + PUSHLOG_WRITE_FORMAT2(" Searching for: <%S>, <%d>", + &aPushInitiator.Addr(),aPushInitiator.Type()) + + const TInt count( Count() ); + for ( TInt i = 0; i < count; ++i ) + { + PUSHLOG_WRITE_FORMAT2(" Item: <%S>, <%d>", + &At( i ).Addr(),At( i ).Type()) + + if ( At( i ) == aPushInitiator ) + { + // We have found push initiator which is identical with the one + // given in the parameter. + PUSHLOG_WRITE(" WL Found!") + aIndex = i; + ret = KErrNone; + break; + } + } + + PUSHLOG_LEAVEFN("CPushInitiatorList::Find") + return ret; + } + +// --------------------------------------------------------- +// CPushInitiatorList::operator== +// --------------------------------------------------------- +// +EXPORT_C TBool CPushInitiatorList::operator== + ( const CPushInitiatorList& aList ) const + { + TBool equal( EFalse ); + const TInt count = Count(); + + if ( count == aList.Count() ) + { + TBool inequalFound( EFalse ); + for ( TInt i = 0; i < count; ++i ) + { + if ( At(i) != aList.At(i) ) + { + inequalFound = ETrue; + break; + } + } + equal = !inequalFound; + } + + return equal; + } + +// --------------------------------------------------------- +// CPushInitiatorList::operator!= +// --------------------------------------------------------- +// +EXPORT_C TBool CPushInitiatorList::operator!= + ( const CPushInitiatorList& aList ) const + { + return !( *this == aList ); + } + +// --------------------------------------------------------- +// CPushInitiatorList::ExternalizeL +// --------------------------------------------------------- +// +void CPushInitiatorList::ExternalizeL( CRepository& aRepository ) const + { + PUSHLOG_ENTERFN("CPushInitiatorList::ExternalizeL"); + + HBufC* wlBuf = ParseAndProcessList2BufL(); + CleanupStack::PushL( wlBuf ); + User::LeaveIfError( aRepository.Set( KPushMtmWhiteList, *wlBuf ) ); + CleanupStack::PopAndDestroy( wlBuf ); // wlBuf + + PUSHLOG_LEAVEFN("CPushInitiatorList::ExternalizeL"); + } + +// --------------------------------------------------------- +// CPushInitiatorList::InternalizeL +// --------------------------------------------------------- +// +void CPushInitiatorList::InternalizeL( CRepository& aRepository ) + { + PUSHLOG_ENTERFN("CPushInitiatorList::InternalizeL"); + + HBufC* wlBuf = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength ); + TPtr nonConstWLBuf = wlBuf->Des(); + User::LeaveIfError( aRepository.Get( KPushMtmWhiteList, nonConstWLBuf ) ); + ParseAndProcessBuf2ListL( *wlBuf ); + CleanupStack::PopAndDestroy( wlBuf ); // wlBuf + + PUSHLOG_LEAVEFN("CPushInitiatorList::InternalizeL"); + } + +// --------------------------------------------------------- +// CPushInitiatorList::CPushInitiatorList +// --------------------------------------------------------- +// +CPushInitiatorList::CPushInitiatorList( const TInt aGranularity ) +: CArrayPtrFlat( aGranularity ), + iPushInitiatorListChanged( EFalse ) + { + } + +// --------------------------------------------------------- +// CPushInitiatorList::ParseAndProcessBuf2ListL +// --------------------------------------------------------- +// +void CPushInitiatorList::ParseAndProcessBuf2ListL + ( const TDesC& aStreamedBuf ) + { + PUSHLOG_ENTERFN("CPushInitiatorList::ParseAndProcessBuf2ListL"); + PUSHLOG_WRITE_FORMAT(" param: <%S>",&aStreamedBuf) + + CWhiteListConverter* converter = CWhiteListConverter::NewL( *this ); + CleanupStack::PushL( converter ); + + TRAPD( err, converter->Buffer2ListL( aStreamedBuf ) ); + PUSHLOG_WRITE_FORMAT(" <%d>",err); + if ( err == KErrOverflow || err == KErrCorrupt ) + { + // The input is corrupted. Leave the White List as is and + // do not forward these LEAVE values, because it would + // terminate the RFS of Push. + } + else + { + // Other error. Must be forwarded. + User::LeaveIfError( err ); + } + + CleanupStack::PopAndDestroy( converter ); // converter + + PUSHLOG_LEAVEFN("CPushInitiatorList::ParseAndProcessBuf2ListL"); + } + +// --------------------------------------------------------- +// CPushInitiatorList::ParseAndProcessList2BufL +// --------------------------------------------------------- +// +HBufC* CPushInitiatorList::ParseAndProcessList2BufL() const + { + PUSHLOG_ENTERFN("CPushInitiatorList::ParseAndProcessList2BufL"); + + CPushInitiatorList& nonConstPiList = (CPushInitiatorList&)*this; + CWhiteListConverter* converter = CWhiteListConverter::NewL( nonConstPiList ); + CleanupStack::PushL( converter ); + + HBufC* retBuf(0); + TRAPD( err, retBuf = converter->List2BufferL() ); + PUSHLOG_WRITE_FORMAT(" <%d>",err); + User::LeaveIfError( err ); + + CleanupStack::PopAndDestroy( converter ); // converter + + PUSHLOG_WRITE_FORMAT(" ret: <%S>",retBuf) + PUSHLOG_LEAVEFN("CPushInitiatorList::ParseAndProcessList2BufL"); + return retBuf; + } + +// End of File. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushMtmOperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushMtmOperation.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMtmOperation. +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmOperation.h" +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmOperation::~CPushMtmOperation +// --------------------------------------------------------- +// +EXPORT_C CPushMtmOperation::~CPushMtmOperation() + { + Cancel(); + delete iCEntry; + } + +// --------------------------------------------------------- +// CPushMtmOperation::StartL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::StartL() + { + // Enable restart. + Cancel(); + SetActive(); + InvokeRun(); + } + +// --------------------------------------------------------- +// CPushMtmOperation::ProgressL +// --------------------------------------------------------- +// +EXPORT_C const TDesC8& CPushMtmOperation::ProgressL() + { + return iProgressPckg; + } + +// --------------------------------------------------------- +// CPushMtmOperation::CPushMtmOperation +// --------------------------------------------------------- +// +EXPORT_C CPushMtmOperation::CPushMtmOperation( CMsvSession& aSession, + TMsvId aId, + TRequestStatus& aObserverRequestStatus ) +: CMsvOperation( aSession, EPriorityStandard, aObserverRequestStatus ), + iEntryId( aId ), + iProgressPckg( iProgress ) + { + iProgress.Reset(); + // The Push MTM has no services. + iService = KMsvLocalServiceIndexEntryId; + // The operation belongs to the Push MTM. + iMtm = KUidMtmWapPush; + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CPushMtmOperation::InvokeRun +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::InvokeRun() + { + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + +// --------------------------------------------------------- +// CPushMtmOperation::SignalObserver +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::SignalObserver( TInt aCompletionCode ) + { + TRequestStatus* status = &iObserverRequestStatus; + User::RequestComplete( status, aCompletionCode ); + } + +// --------------------------------------------------------- +// CPushMtmOperation::ObserveEntryEventL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::ObserveEntryEventL() + { + if ( iCEntry == NULL ) + { + iCEntry = iMsvSession.GetEntryL( iEntryId ); + } + iCEntry->AddObserverL( *this ); + } + +// --------------------------------------------------------- +// CPushMtmOperation::CancelObserveEntryEvent +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::CancelObserveEntryEvent() + { + if ( iCEntry ) + { + iCEntry->RemoveObserver( *this ); + } + } + +// --------------------------------------------------------- +// CPushMtmOperation::RunL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::RunL() + { + SignalObserver( KErrNone ); + } + +// --------------------------------------------------------- +// CPushMtmOperation::DoCancel +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::DoCancel() + { + CancelObserveEntryEvent(); + SignalObserver( KErrCancel ); + } + +// --------------------------------------------------------- +// CPushMtmOperation::RunError +// --------------------------------------------------------- +// +EXPORT_C TInt CPushMtmOperation::RunError( TInt aError ) + { + CancelObserveEntryEvent(); + if ( aError ) + { + // Signal the observer that a leave has occured. + SignalObserver( aError ); + } + return KErrNone; + } + +// --------------------------------------------------------- +// CPushMtmOperation::HandleEntryEventL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmOperation::HandleEntryEventL( TMsvEntryEvent /*aEvent*/, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ ) + { + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushMtmSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushMtmSettings.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,320 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CPushMtmSettings class definition. +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmSettings.h" +#include "PushInitiatorList.h" +#include "PushMtmUtilPanic.h" +#include "PushMtmLog.h" +#include "PushMtmPrivateCRKeys.h" +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmSettings::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushMtmSettings* CPushMtmSettings::NewL() + { + CPushMtmSettings* self = CPushMtmSettings::NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CPushMtmSettings::NewLC +// --------------------------------------------------------- +// +EXPORT_C CPushMtmSettings* CPushMtmSettings::NewLC() + { + PUSHLOG_ENTERFN("CPushMtmSettings::NewLC") + + CPushMtmSettings* self = new (ELeave) CPushMtmSettings(); + CleanupStack::PushL( self ); + self->ConstructL(); + + PUSHLOG_LEAVEFN("CPushMtmSettings::NewLC") + return self; + } + +// --------------------------------------------------------- +// CPushMtmSettings::~CPushMtmSettings +// --------------------------------------------------------- +// +EXPORT_C CPushMtmSettings::~CPushMtmSettings() + { + PUSHLOG_ENTERFN("CPushMtmSettings::~CPushMtmSettings") + delete iPushInitiatorList; + if ( iFeatureManagerInitialized ) + { + FeatureManager::UnInitializeLib(); + iFeatureManagerInitialized = EFalse; + } + PUSHLOG_LEAVEFN("CPushMtmSettings::~CPushMtmSettings") + } + +// --------------------------------------------------------- +// CPushMtmSettings::SetServiceReception +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmSettings::SetServiceReception( TBool aReceive ) + { + PUSHLOG_WRITE_FORMAT + ("CPushMtmSettings::SetServiceReception <%d>",aReceive?1:0) + if ( iServiceReception != aReceive ) + { + iServiceReception = aReceive; + iServiceReceptionChanged = ETrue; + } + } + +// --------------------------------------------------------- +// CPushMtmSettings::SetServiceLoadingType +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmSettings::SetServiceLoadingType( TServiceLoading aType ) + { + PUSHLOG_WRITE_FORMAT + ("CPushMtmSettings::SetServiceLoadingType <%d>",(TInt)aType) + if ( iServiceLoadingType != aType ) + { + iServiceLoadingType = aType; + iServiceLoadingTypeChanged = ETrue; + } + } + +// --------------------------------------------------------- +// CPushMtmSettings::ServiceReception +// --------------------------------------------------------- +// +EXPORT_C TBool CPushMtmSettings::ServiceReception() const + { + PUSHLOG_WRITE_FORMAT + ("CPushMtmSettings::ServiceReception <%d>",(TInt)iServiceReception) + return iServiceReception; + } + +// --------------------------------------------------------- +// CPushMtmSettings::ServiceLoadingType +// --------------------------------------------------------- +// +EXPORT_C CPushMtmSettings::TServiceLoading + CPushMtmSettings::ServiceLoadingType() const + { + PUSHLOG_WRITE_FORMAT + ("CPushMtmSettings::ServiceLoadingType <%d>",(TInt)iServiceLoadingType) + return iServiceLoadingType; + } + +// --------------------------------------------------------- +// CPushMtmSettings::PushInitiatorList +// --------------------------------------------------------- +// +EXPORT_C CPushInitiatorList& CPushMtmSettings::PushInitiatorList() const + { + __ASSERT_DEBUG( iPushInitiatorList, UtilPanic( EPushMtmUtilPanNull ) ); + return *iPushInitiatorList; + } + +// --------------------------------------------------------- +// CPushMtmSettings::LoadL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmSettings::LoadL() + { + PUSHLOG_ENTERFN("CPushMtmSettings::LoadL") + + Reset(); // Remove outdated data. + + // Open the Repository for reading: + CRepository* repository = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( repository ); + + InternalizeL( *repository ); + + CleanupStack::PopAndDestroy( repository ); // repository + + // ******************** Reset indicators *********************** + iServiceReceptionChanged = EFalse; + iServiceLoadingTypeChanged = EFalse; + __ASSERT_DEBUG( iPushInitiatorList, UtilPanic( EPushMtmUtilPanNull ) ); + iPushInitiatorList->ResetChanged(); + + PUSHLOG_LEAVEFN("CPushMtmSettings::LoadL") + } + +// --------------------------------------------------------- +// CPushMtmSettings::SaveL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmSettings::SaveL( const TBool aForce ) + { + PUSHLOG_ENTERFN("CPushMtmSettings::SaveL") + PUSHLOG_WRITE_FORMAT(" aForce <%d>",aForce?1:0) + PUSHLOG_WRITE_FORMAT(" SR changed <%d>",iServiceReceptionChanged?1:0) + PUSHLOG_WRITE_FORMAT(" SL changed <%d>",iServiceLoadingTypeChanged?1:0) + __ASSERT_DEBUG( iPushInitiatorList, UtilPanic( EPushMtmUtilPanNull ) ); + PUSHLOG_WRITE_FORMAT(" WL changed <%d>",iPushInitiatorList->Changed()?1:0) + + if ( aForce || ( iServiceReceptionChanged || + iServiceLoadingTypeChanged || + iPushInitiatorList->Changed() ) ) + { + // Save the settings to Repository. + CRepository* repository = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( repository ); + + ExternalizeL( *repository ); + + CleanupStack::PopAndDestroy( repository ); // repository + + // ***************** Reset indicators *********************** + iServiceReceptionChanged = EFalse; + iServiceLoadingTypeChanged = EFalse; + __ASSERT_DEBUG( iPushInitiatorList, + UtilPanic( EPushMtmUtilPanNull ) ); + iPushInitiatorList->ResetChanged(); + } + + PUSHLOG_LEAVEFN("CPushMtmSettings::SaveL") + } + +// --------------------------------------------------------- +// CPushMtmSettings::RestoreFactorySettingsL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmSettings::RestoreFactorySettingsL() + { + PUSHLOG_ENTERFN("CPushMtmSettings::RestoreFactorySettingsL") + + // The factory settings are stored in the shared data. + CRepository* repository = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( repository ); + User::LeaveIfError( repository->Reset() ); + PUSHLOG_WRITE(" repository->Reset OK") + CleanupStack::PopAndDestroy( repository ); // repository + + // Load up-to-date values. + LoadL(); + + PUSHLOG_LEAVEFN("CPushMtmSettings::RestoreFactorySettingsL") + } + +// --------------------------------------------------------- +// CPushMtmSettings::ConstructL +// --------------------------------------------------------- +// +void CPushMtmSettings::ConstructL() + { + // Create an empty push initiator list. + iPushInitiatorList = CPushInitiatorList::NewL(); + FeatureManager::InitializeLibL(); + iFeatureManagerInitialized = ETrue; + // Initialize: + LoadL(); + } + +// --------------------------------------------------------- +// CPushMtmSettings::CPushMtmSettings +// --------------------------------------------------------- +// +CPushMtmSettings::CPushMtmSettings() +: CBase(), + iServiceReception( ETrue ), + iServiceLoadingType( EManual ), + iServiceReceptionChanged ( EFalse ), + iServiceLoadingTypeChanged ( EFalse ), + iFeatureManagerInitialized( EFalse ) + { + } + +// --------------------------------------------------------- +// CPushMtmSettings::Reset +// --------------------------------------------------------- +// +void CPushMtmSettings::Reset() + { + PUSHLOG_ENTERFN("CPushMtmSettings::Reset") + __ASSERT_DEBUG( iPushInitiatorList, UtilPanic( EPushMtmUtilPanNull ) ); + iPushInitiatorList->ResetAndDestroy(); + PUSHLOG_LEAVEFN("CPushMtmSettings::Reset") + } + +// --------------------------------------------------------- +// CPushMtmSettings::ExternalizeL +// --------------------------------------------------------- +// +void CPushMtmSettings::ExternalizeL( CRepository& aRepository ) const + { + PUSHLOG_ENTERFN("CPushMtmSettings::ExternalizeL") + + __ASSERT_DEBUG( iPushInitiatorList, UtilPanic( EPushMtmUtilPanNull ) ); + + TInt value; + PUSHLOG_WRITE_FORMAT + (" iServiceReception <%d>",(TInt)iServiceReception) + value = iServiceReception ? 1 : 0; + User::LeaveIfError( aRepository.Set( KPushMtmServiceReception, value ) ); + PUSHLOG_WRITE(" SR written") + + PUSHLOG_WRITE_FORMAT + (" iServiceLoadingType <%d>",(TInt)iServiceLoadingType) + value = ( iServiceLoadingType == CPushMtmSettings::EManual ) ? 1 : 0; + User::LeaveIfError( aRepository.Set( KPushMtmServiceLoading, value ) ); + PUSHLOG_WRITE(" SL written") + + iPushInitiatorList->ExternalizeL( aRepository ); + + PUSHLOG_LEAVEFN("CPushMtmSettings::ExternalizeL") + } + +// --------------------------------------------------------- +// CPushMtmSettings::InternalizeL +// --------------------------------------------------------- +// +void CPushMtmSettings::InternalizeL( CRepository& aRepository ) + { + PUSHLOG_ENTERFN("CPushMtmSettings::InternalizeL") + + __ASSERT_DEBUG( iPushInitiatorList, UtilPanic( EPushMtmUtilPanNull ) ); + + TInt value(0); + User::LeaveIfError( aRepository.Get( KPushMtmServiceReception, value ) ); + PUSHLOG_WRITE_FORMAT(" KPushMtmServiceReception <%d>",(TInt)value) + iServiceReception = ( value == 1 ) ? ETrue : EFalse; + PUSHLOG_WRITE(" SR loaded") + + User::LeaveIfError( aRepository.Get( KPushMtmServiceLoading, value ) ); + PUSHLOG_WRITE_FORMAT(" KPushMtmServiceLoading <%d>",(TInt)value) + iServiceLoadingType = ( value == 1 ) ? CPushMtmSettings::EManual : + CPushMtmSettings::EAutomatic; + PUSHLOG_WRITE(" SL loaded") + + iPushInitiatorList->InternalizeL( aRepository ); + + PUSHLOG_LEAVEFN("CPushMtmSettings::InternalizeL") + } + +// End of File. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushMtmUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushMtmUtil.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,461 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CPushMtmUtil class definition. +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmUtil.h" +#include "PushMtmUtilPanic.h" +#include "PushMtmLog.h" +#include +#include +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmUtil::NewL +// --------------------------------------------------------- +// +EXPORT_C CPushMtmUtil* CPushMtmUtil::NewL( CMsvSession& aMsvSession ) + { + CPushMtmUtil* self = new (ELeave) CPushMtmUtil( aMsvSession ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; + } + +// --------------------------------------------------------- +// CPushMtmUtil::~CPushMtmUtil +// --------------------------------------------------------- +// +EXPORT_C CPushMtmUtil::~CPushMtmUtil() + { + } + +// --------------------------------------------------------- +// CPushMtmUtil::MarkServiceUnreadL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmUtil::MarkServiceUnreadL( TMsvId aEntryId, + TBool aUnread ) + { + PUSHLOG_ENTERFN("CPushMtmUtil::MarkServiceUnreadL") + + CMsvEntry* cEntry = iMsvSession.GetEntryL( aEntryId ); + CleanupStack::PushL( cEntry ); + + TMsvEntry tEntry( cEntry->Entry() ); + // Change the context only if necessary. + if ( tEntry.New() != aUnread || tEntry.Unread() != aUnread ) + { + tEntry.SetNew( aUnread ); + tEntry.SetUnread( aUnread ); + cEntry->ChangeL( tEntry ); + } + + CleanupStack::PopAndDestroy( cEntry ); // cEntry + + PUSHLOG_LEAVEFN("CPushMtmUtil::MarkServiceUnreadL") + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindMessagesL +// --------------------------------------------------------- +// +EXPORT_C CMsvEntrySelection* CPushMtmUtil::FindMessagesL + ( TMsvId aFolderId, + TUid aMsgType, + TBool aRecursive ) + { + CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( sel ); + + FindMessagesL( aFolderId, aMsgType, aRecursive, *sel ); + + CleanupStack::Pop(); // sel + return sel; + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindMessagesL +// --------------------------------------------------------- +// +EXPORT_C CMsvEntrySelection* CPushMtmUtil::FindMessagesL +( const CMsvEntrySelection& aFolders, TUid aMsgType ) + { + CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( sel ); + + const TInt count( aFolders.Count() ); + for ( TInt i = 0; i < count; ++i ) + { + FindMessagesL( aFolders[i], aMsgType, EFalse, *sel ); + } + + CleanupStack::Pop(); // sel + return sel; + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindMessagesL +// --------------------------------------------------------- +// +EXPORT_C CMsvEntrySelection* CPushMtmUtil::FindMessagesL( TUid aMsgType ) + { + CMsvEntrySelection* pushFolders = FindPushFoldersL(); + CleanupStack::PushL( pushFolders ); + + CMsvEntrySelection* msgs = FindMessagesL( *pushFolders, aMsgType ); + + CleanupStack::PopAndDestroy( pushFolders ); // pushFolders + return msgs; + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindPushFoldersL +// --------------------------------------------------------- +// +EXPORT_C CMsvEntrySelection* CPushMtmUtil::FindPushFoldersL() + { + // Only the Inbox, the Documents folder and the user + // defined folders can contain push messages. + // The user defined folders can only be in the Documents folder. + // (See the definition of CMsgFolderSelectionListArray::ConstructL + // in msgavkon for more details.) + CMsvEntrySelection* pushFolders = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( pushFolders ); + + // Check if Inbox folder exists. + TMsvEntry dummyFolder; + TMsvId dummyService; + TInt err( iMsvSession.GetEntry + ( KMsvGlobalInBoxIndexEntryId, dummyService, dummyFolder) ); + + if ( !err ) + { + pushFolders->AppendL( KMsvGlobalInBoxIndexEntryId ); + } + + // Check if Documents folder exists. + const TMsvId KDocumentsIndexEntryId( 0x1008 ); + err = iMsvSession.GetEntry + ( KDocumentsIndexEntryId, dummyService, dummyFolder); + + if ( !err ) + { + pushFolders->AppendL( KDocumentsIndexEntryId ); + // Get the user defined folders in Documents. + const TMsvSelectionOrdering selOrd + ( KMsvGroupByType, EMsvSortByDescription, ETrue ); + CMsvEntry* documentsFolder = CMsvEntry::NewL + ( iMsvSession, KDocumentsIndexEntryId, selOrd ); + CleanupStack::PushL( documentsFolder ); + + CMsvEntrySelection* userDefFolders = + documentsFolder->ChildrenWithTypeL( KUidMsvFolderEntry ); + CleanupStack::PopAndDestroy(); // documentsFolder + CleanupStack::PushL( userDefFolders ); + + const TMsvId KTemplatesIndexEntryId( 0x1009 ); + const TInt count( userDefFolders->Count() ); + for ( TInt i = 0; i < count; ++i ) + { + // However Templates folder is in Documents, no messages + // can be moved there - it cannot contain push messages. + if ( userDefFolders->At( i ) != KTemplatesIndexEntryId ) + { + pushFolders->AppendL( userDefFolders->At( i ) ); + } + } + + CleanupStack::PopAndDestroy(); // userDefFolders + } + + CleanupStack::Pop(); // pushFolders + return pushFolders; + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindSiIdLC +// --------------------------------------------------------- +// +EXPORT_C CMsvEntrySelection* CPushMtmUtil::FindSiIdLC( const TDesC& aSiId ) + { + CMsvEntrySelection* matching = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( matching ); + + CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL(); + CleanupStack::PushL( siEntry ); + + CMsvEntrySelection* allSi = FindMessagesL( KUidWapPushMsgSI ); + CleanupStack::PushL( allSi ); + + // loop until we find a match or reach the end of the SI entries + const TInt numEntries( allSi->Count() ); + for (TInt count = 0; count < numEntries; ++count ) + { + siEntry->RetrieveL( iMsvSession, allSi->At( count ) ); + if ( aSiId.CompareF( siEntry->Id() ) == 0 ) // Found a match + { + matching->AppendL( allSi->At( count ) ); + } + } + + CleanupStack::PopAndDestroy( 2 ); // allSi, siEntry + + return matching; //Still on CleanupStack + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindUrlLC +// --------------------------------------------------------- +// +EXPORT_C CMsvEntrySelection* CPushMtmUtil::FindUrlLC( const TDesC& aUrl, + TUid aPushType ) + { + __ASSERT_ALWAYS( aPushType == KUidWapPushMsgSI || + aPushType == KUidWapPushMsgSL, + UtilPanic( EPushMtmUtilPanBadBioType ) ); + + CMsvEntrySelection* matching = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( matching ); + + CMsvEntrySelection* all = FindMessagesL( aPushType ); + CleanupStack::PushL( all ); + + // loop until we find a match or reach the end of the SI entries + const TInt numEntries( all->Count() ); + + if ( aPushType == KUidWapPushMsgSI ) + { + CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL(); + CleanupStack::PushL( siEntry ); + + for (TInt count = 0; count < numEntries; ++count ) + { + siEntry->RetrieveL( iMsvSession, all->At( count ) ); + if ( aUrl.CompareF( siEntry->Url() ) == 0 ) // Found a match + { + matching->AppendL( all->At( count ) ); + } + } + + CleanupStack::PopAndDestroy( siEntry ); // siEntry + } + else // aPushType == KUidWapPushMsgSL + { + CSLPushMsgEntry* slEntry = CSLPushMsgEntry::NewL(); + CleanupStack::PushL( slEntry ); + + for (TInt count = 0; count < numEntries; ++count ) + { + slEntry->RetrieveL( iMsvSession, all->At( count ) ); + if ( aUrl.CompareF( slEntry->Url() ) == 0 ) // Found a match + { + matching->AppendL( all->At( count ) ); + } + } + + CleanupStack::PopAndDestroy( slEntry ); // slEntry + } + + CleanupStack::PopAndDestroy( all ); // all + + return matching; //Still on CleanupStack + } + +// --------------------------------------------------------- +// CPushMtmUtil::DeleteEntryL +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmUtil::DeleteEntryL( TMsvId aId ) + { + CMsvEntry* cEntry = iMsvSession.GetEntryL( aId ); + CleanupStack::PushL( cEntry ); + // Set as parent. + cEntry->SetEntryL( cEntry->Entry().Parent() ); + // Delete the child. + cEntry->DeleteL( aId ); + CleanupStack::PopAndDestroy( cEntry ); // cEntry + } + +// --------------------------------------------------------- +// CPushMtmUtil::ConvertDetailsL +// --------------------------------------------------------- +// +EXPORT_C HBufC* CPushMtmUtil::ConvertDetailsL( const TDesC8& aFrom ) const + { + HBufC* from = HBufC::NewMaxLC( aFrom.Length() ); + from->Des().Copy( aFrom ); + + TUriParser pars; + User::LeaveIfError( pars.Parse( *from ) ); + + HBufC* res = NULL; + if ( pars.IsPresent( EUriHost ) ) + { + res = pars.Extract( EUriHost ).AllocL(); + } + else + { + res = from->AllocL(); + } + + CleanupStack::PopAndDestroy( from ); // from + return res; + } + +// --------------------------------------------------------- +// CPushMtmUtil::SetAttrs +// --------------------------------------------------------- +// +EXPORT_C void CPushMtmUtil::SetAttrs( TMsvEntry& aContext, TUint32 aAttrs ) + { + aContext.iMtmData2 = aContext.iMtmData2 | + (aAttrs<> KPushMtmShiftOnlyAttrs) & + KPushMtmMaskOnlyAttrs; + } + +// --------------------------------------------------------- +// CPushMtmUtil::ConvertUriToDisplayFormL +// --------------------------------------------------------- +// +EXPORT_C HBufC* CPushMtmUtil::ConvertUriToDisplayFormL( const TDesC& aUri ) + { + HBufC8* uri8 = HBufC8::NewMaxLC( aUri.Length() ); + uri8->Des().Copy( aUri ); + TUriParser8 uriParser8; + User::LeaveIfError( uriParser8.Parse( *uri8 ) ); + CUri* convertedCUri = UriUtils::ConvertToDisplayFormL( uriParser8 ); + CleanupStack::PopAndDestroy( uri8 ); + CleanupStack::PushL( convertedCUri ); + HBufC* convertedUri = convertedCUri->Uri().UriDes().AllocL(); + CleanupStack::PopAndDestroy( convertedCUri ); + return convertedUri; + } + +// --------------------------------------------------------- +// CPushMtmUtil::CPushMtmUtil +// --------------------------------------------------------- +// +CPushMtmUtil::CPushMtmUtil( CMsvSession& aMsvSession ) +: iMsvSession( aMsvSession ) + { + } + +// --------------------------------------------------------- +// CPushMtmUtil::ConstructL +// --------------------------------------------------------- +// +void CPushMtmUtil::ConstructL() + { + } + +// --------------------------------------------------------- +// CPushMtmUtil::FindMessagesL +// --------------------------------------------------------- +// +void CPushMtmUtil::FindMessagesL( TMsvId aFolderId, + TUid aMsgType, + TBool aRecursive, + CMsvEntrySelection& aResult ) + { + // Find the push entries of the specified type in the specified folder. + CMsvEntry* thisFolder = iMsvSession.GetEntryL( aFolderId ); + CleanupStack::PushL( thisFolder ); + + TMsvSelectionOrdering selOrd( thisFolder->SortType() ); + selOrd.SetShowInvisibleEntries( EFalse ); + thisFolder->SetSortTypeL( selOrd ); + CMsvEntrySelection* msgSel = thisFolder->ChildrenWithMtmL( KUidMtmWapPush ); + CleanupStack::PushL( msgSel ); + + // The selection may contain any kind of push message. + // Select only those that have the specified type. + TMsvEntry tEntry; + TMsvId service; + TInt err; + const TInt msgCnt( msgSel->Count() ); + for ( TInt i = 0; i < msgCnt; ++i ) + { + err = iMsvSession.GetEntry( msgSel->At(i), service, tEntry ); + if ( err == KErrNotFound ) + { + // Do nothing, just continue. + } + else if ( !err ) + { + if ( tEntry.iBioType == aMsgType.iUid ) + { + // We have found an entry of the requested type. + aResult.AppendL( msgSel->At(i) ); + } + } + else + { + User::Leave( err ); + } + } + + CleanupStack::PopAndDestroy( msgSel ); // msgSel + + // Find messages in the subfolders if required. + if ( aRecursive ) + { + CMsvEntrySelection* subFolders = + thisFolder->ChildrenWithTypeL( KUidMsvFolderEntry ); + CleanupStack::PushL( subFolders ); + + const TInt count( subFolders->Count() ); + for ( TInt i = 0; i < count; ++i ) + { + FindMessagesL( subFolders->At(i), aMsgType, aRecursive, aResult ); + } + + CleanupStack::PopAndDestroy( subFolders ); // subFolders + } + + CleanupStack::PopAndDestroy( thisFolder ); // thisFolder + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/PushMtmUtilPanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/PushMtmUtilPanic.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmUtilPanic.h" + + +_LIT( KUtilPanicString, "PushMtmUtil" ); + +GLDEF_C void UtilPanic( TPushMtmUtilPanic aReason ) + { + User::Panic( KUtilPanicString, aReason ); + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/WhiteListImporterDummy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/WhiteListImporterDummy.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Dummy implementation of CWhiteListConverter. +* +*/ + + +// INCLUDE FILES + +#include "WhiteListImporter.h" +#include "PushMtmLog.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWhiteListConverter::NewL +// --------------------------------------------------------- +// +CWhiteListConverter* CWhiteListConverter::NewL + ( CPushInitiatorList& aPushInitiatorList ) + { + PUSHLOG_ENTERFN("CWhiteListConverter::NewL Dummy"); + CWhiteListConverter* converter = + new (ELeave) CWhiteListConverter( aPushInitiatorList ); + return converter; + PUSHLOG_LEAVEFN("CWhiteListConverter::NewL Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::~CWhiteListConverter +// --------------------------------------------------------- +// +CWhiteListConverter::~CWhiteListConverter() + { + PUSHLOG_ENTERFN("CWhiteListConverter::~CWhiteListConverter Dummy"); + delete iBuf; + iNextCh = NULL; // Only used. + iMaxCh = NULL; // Only used. + PUSHLOG_LEAVEFN("CWhiteListConverter::~CWhiteListConverter Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::Buffer2ListL +// --------------------------------------------------------- +// +void CWhiteListConverter::Buffer2ListL( const TDesC& /*aSource*/ ) + { + PUSHLOG_ENTERFN("CWhiteListConverter::Buffer2ListL Dummy"); + PUSHLOG_LEAVEFN("CWhiteListConverter::Buffer2ListL Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::List2BufferL +// --------------------------------------------------------- +// +HBufC* CWhiteListConverter::List2BufferL() + { + PUSHLOG_ENTERFN("CWhiteListConverter::Buffer2ListL Dummy"); + PUSHLOG_WRITE("Returning KNullDesC"); + return KNullDesC().AllocL(); + PUSHLOG_LEAVEFN("CWhiteListConverter::Buffer2ListL Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::CWhiteListConverter +// --------------------------------------------------------- +// +CWhiteListConverter::CWhiteListConverter( CPushInitiatorList& aPushInitiatorList ) +: iPushInitiatorList( aPushInitiatorList ) + { + PUSHLOG_ENTERFN("CWhiteListConverter::CWhiteListConverter Dummy"); + PUSHLOG_LEAVEFN("CWhiteListConverter::CWhiteListConverter Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::ConstructL +// --------------------------------------------------------- +// +void CWhiteListConverter::ConstructL() + { + PUSHLOG_ENTERFN("CWhiteListConverter::ConstructL Dummy"); + PUSHLOG_LEAVEFN("CWhiteListConverter::ConstructL Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::GetChar +// --------------------------------------------------------- +// +inline void CWhiteListConverter::GetChar() + { + PUSHLOG_ENTERFN("CWhiteListConverter::GetChar Dummy"); + PUSHLOG_LEAVEFN("CWhiteListConverter::GetChar Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::NextLineL +// --------------------------------------------------------- +// +TBool CWhiteListConverter::NextLineL() + { + PUSHLOG_ENTERFN("CWhiteListConverter::NextLineL Dummy"); + PUSHLOG_WRITE("Returning ETrue"); + return ETrue; + PUSHLOG_LEAVEFN("CWhiteListConverter::NextLineL Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::NextTokenL +// --------------------------------------------------------- +// +TPtrC CWhiteListConverter::NextTokenL( TUint /*aStopChar*/ ) + { + PUSHLOG_ENTERFN("CWhiteListConverter::NextTokenL Dummy"); + PUSHLOG_WRITE("Returning TPtrC"); + return TPtrC(); + PUSHLOG_LEAVEFN("CWhiteListConverter::NextTokenL Dummy"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::AttrsL +// --------------------------------------------------------- +// +void CWhiteListConverter::AttrsL() + { + PUSHLOG_ENTERFN("CWhiteListConverter::AttrsL Dummy"); + PUSHLOG_LEAVEFN("CWhiteListConverter::AttrsL Dummy"); + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/MtmUtilSrc/WhiteListImporterWL.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/MtmUtilSrc/WhiteListImporterWL.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CWhiteListConverter. +* +*/ + + +// INCLUDE FILES + +#include "WhiteListImporter.h" +#include "PushMtmSettings.h" +#include "PushInitiatorList.h" +#include "PushInitiator.h" +#include "PushMtmLog.h" +#include + +// CONSTANTS + +/// Max length allowed. +LOCAL_C const TInt KMaxLength = 2048; + +/* +* Special characters. +*/ +/// ',' character. +LOCAL_C const TUint KComma = ','; +/// ';' character. +LOCAL_C const TUint KSemicolon = ';'; +/// Escape '\' character. +LOCAL_C const TUint KEscape = '\\'; + +/* +* Characters considered as EOS. +*/ +/// '\r' character. +LOCAL_C const TUint KCr = '\r'; +/// '\n' character. +LOCAL_C const TUint KLf = '\n'; + +/* +* Separator characters. +*/ +/// End-Of-String (0) character. It is a separator. +LOCAL_C const TUint KEos = 0; +/// Record separator (30) character. +LOCAL_C const TUint KRecordSeparator = 30; +/// Unit separator (31) character. +LOCAL_C const TUint KUnitSeparator = 31; + +/* +* Keywords. +*/ +/// "Ipv4" keyword. +_LIT( KIpv4, "Ipv4" ); +/// "Ipv6" keyword. +_LIT( KIpv6, "Ipv6" ); +/// "E164" keyword. +_LIT( KE164, "E164" ); +/// "Alpha" keyword. +_LIT( KAlpha, "Alpha" ); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWhiteListConverter::NewL +// --------------------------------------------------------- +// +CWhiteListConverter* CWhiteListConverter::NewL( CPushInitiatorList& aPushInitiatorList ) + { + CWhiteListConverter* converter = + new (ELeave) CWhiteListConverter( aPushInitiatorList ); + CleanupStack::PushL( converter ); + converter->ConstructL(); + CleanupStack::Pop( converter ); // converter + return converter; + } + +// --------------------------------------------------------- +// CWhiteListConverter::~CWhiteListConverter +// --------------------------------------------------------- +// +CWhiteListConverter::~CWhiteListConverter() + { + delete iConverterBuf; + delete iBuf; + iNextCh = NULL; // Only used. + iMaxCh = NULL; // Only used. + } + +// --------------------------------------------------------- +// CWhiteListConverter::Buffer2ListL +// --------------------------------------------------------- +// +void CWhiteListConverter::Buffer2ListL( const TDesC& aSource ) + { + PUSHLOG_ENTERFN("CWhiteListConverter::Buffer2ListL"); + + iSource.Assign( aSource ); + iCurCh = KRecordSeparator; // Cannot be 0, because of GetChar() + GetChar(); + while( NextLineL() ) + { + }; + + PUSHLOG_LEAVEFN("CWhiteListConverter::Buffer2ListL"); + } + +// --------------------------------------------------------- +// CWhiteListConverter::List2BufferL +// --------------------------------------------------------- +// +HBufC* CWhiteListConverter::List2BufferL() + { + PUSHLOG_ENTERFN("CWhiteListConverter::List2BufferL"); + + HBufC* newConverterBuf = KNullDesC().AllocL(); // initial zero length buffer + delete iConverterBuf; + iConverterBuf = newConverterBuf; + TPtr writableConvBuf = iConverterBuf->Des(); + writableConvBuf.SetLength(0); + TInt itemsToExport = iPushInitiatorList.Count(); + // temp buffers + TBuf<16> type; + TBuf<16> entryId; + + for ( TInt i=0; i < itemsToExport; ++i ) + { + CPushInitiator& curr = iPushInitiatorList.At(i); + switch ( curr.Type() ) + { + case CPushInitiator::ETypeIpv4: type=KIpv4; break; + case CPushInitiator::ETypeIpv6: type=KIpv6; break; + case CPushInitiator::ETypeE164: type=KE164; break; + case CPushInitiator::ETypeAlpha: type=KAlpha; break; + default: type=KE164; break; + } + entryId.Format( _L("%d"), curr.EntryID() ); + + // check available space + // 3 is required for 2 commas and 1 semicolon. + TInt newItemLength = curr.Addr().Length()+type.Length()+entryId.Length()+3; + if ( writableConvBuf.MaxLength() < writableConvBuf.Length() + newItemLength ) + { + // reallocate a greater buffer + TInt currentMaxLength = writableConvBuf.MaxLength(); + iConverterBuf = iConverterBuf->ReAllocL( currentMaxLength + newItemLength ); + writableConvBuf.Set( iConverterBuf->Des() ); // re-initialize + } + + writableConvBuf.Append( curr.Addr() ); + writableConvBuf.Append( TChar(KComma) ); + writableConvBuf.Append( type ); + writableConvBuf.Append( TChar(KComma) ); + writableConvBuf.Append( entryId ); + if ( i+1 < itemsToExport ) + { + // there are still items to add + writableConvBuf.Append( TChar(KSemicolon) ); + } + } + + HBufC* ret = iConverterBuf; // ownersip is transferred to the caller. + iConverterBuf = 0; + + PUSHLOG_LEAVEFN("CWhiteListConverter::List2BufferL"); + return ret; + } + +// --------------------------------------------------------- +// CWhiteListConverter::CWhiteListConverter +// --------------------------------------------------------- +// +CWhiteListConverter::CWhiteListConverter( CPushInitiatorList& aPushInitiatorList ) +: iPushInitiatorList( aPushInitiatorList ) + { + } + +// --------------------------------------------------------- +// CWhiteListConverter::ConstructL +// --------------------------------------------------------- +// +void CWhiteListConverter::ConstructL() + { + iBuf = new (ELeave) TText[KMaxLength]; + iMaxCh = iBuf + KMaxLength; + } + +// --------------------------------------------------------- +// CWhiteListConverter::GetChar +// --------------------------------------------------------- +// +inline void CWhiteListConverter::GetChar() + { + // Do not continue if we already reached EOS: + if ( iCurCh == KEos ) + { + return; + } + + iCurCh = iSource.Get(); + + if ( iCurCh == KCr || iCurCh == KLf ) + { + // They are considered as EOS. + iCurCh = KEos; + } + else if ( iCurCh == KEscape ) + { + // Drop the Escape character and get the next as is. + iCurCh = iSource.Get(); + } + else if ( iCurCh == KComma ) + { + // It is a Unit Separator. + iCurCh = KUnitSeparator; + } + else if ( iCurCh == KSemicolon ) + { + // It is a Record Separator. + iCurCh = KRecordSeparator; + } + } + +// --------------------------------------------------------- +// CWhiteListConverter::NextLineL +// --------------------------------------------------------- +// +TBool CWhiteListConverter::NextLineL() + { + switch( iCurCh ) + { + case KEos: + // EOS + return EFalse; + + default: + // Parse White List attributes and process them. + AttrsL(); + break; + } + + return ETrue; + } + +// --------------------------------------------------------- +// CWhiteListConverter::NextTokenL +// --------------------------------------------------------- +// +TPtrC CWhiteListConverter::NextTokenL( TUint aStopChar ) + { + iNextCh = iBuf; // Start storing token at start of buffer. + while ( iNextCh < iMaxCh ) + { + if ( iCurCh == aStopChar || iCurCh == KEos ) + { + // Stop character found - return what we have stored so far. + // This may be an empty string as well. + return TPtrC( iBuf, iNextCh - iBuf ); + } + else + { + *iNextCh = STATIC_CAST( TText16, iCurCh ); + iNextCh++; + GetChar(); + } + } + // No more space in buffer to store token. + User::Leave( KErrOverflow ); + /*NOTREACHED*/ + return TPtrC(); + } + +// --------------------------------------------------------- +// CWhiteListConverter::AttrsL +// --------------------------------------------------------- +// +void CWhiteListConverter::AttrsL() + { + CPushInitiator* newInitiator = new (ELeave) CPushInitiator; + CleanupStack::PushL( newInitiator ); + + TPtrC token; + + // Address. + token.Set( NextTokenL( KUnitSeparator ) ); + HBufC* address = token.AllocLC(); // Copy the token to a separate area. + GetChar(); + + // Address type and/or entry ID. + token.Set( NextTokenL( KRecordSeparator ) ); + HBufC* addressTypeBuf = 0; + HBufC* entryIdBuf = 0; + // check if it contains an entry ID separated with a comma (KUnitSeparator) + TInt offset = token.Locate( TChar(KUnitSeparator) ); + if ( offset == KErrNotFound ) + { + // the whole token is address type + addressTypeBuf = token.AllocLC(); // Copy the token to a separate area. + entryIdBuf = 0; + } + else + { + addressTypeBuf = token.Mid(0,offset).AllocLC(); + TInt tokenLength = token.Length(); + entryIdBuf = token.Mid((offset+1),tokenLength-(offset+1)).AllocLC(); + } + + // Convert the address type string to enum. + // addressTypeBuf must not be NULL. + CPushInitiator::TAddrType addrType = CPushInitiator::ETypeE164; + if ( !(*addressTypeBuf).Compare( KIpv4 ) ) + { + addrType = CPushInitiator::ETypeIpv4; + } + else if ( !(*addressTypeBuf).Compare( KIpv6 ) ) + { + addrType = CPushInitiator::ETypeIpv6; + } + else if ( !(*addressTypeBuf).Compare( KE164 ) ) + { + addrType = CPushInitiator::ETypeE164; + } + else if ( !(*addressTypeBuf).Compare( KAlpha ) ) + { + addrType = CPushInitiator::ETypeAlpha; + } + else + { + User::Leave( KErrCorrupt ); + } + PUSHLOG_WRITE_FORMAT2("WL Importer: <%S> <%S>",&(address->Des()), + &(addressTypeBuf->Des())); + + TUint32 entryId(0); + if ( entryIdBuf ) + { + PUSHLOG_WRITE_FORMAT("WL Importer entryIdBuf: <%S>",&(entryIdBuf->Des())); + TLex lex( *entryIdBuf ); + lex.Val( entryId, EDecimal ); + CleanupStack::PopAndDestroy( entryIdBuf ); // entryIdBuf + } + + GetChar(); + + // No more attribute to parse. + + // Add the new initiator data to the Push settings. + newInitiator->SetAddressL( *address, addrType ); + newInitiator->SetEntryID( entryId ); + CleanupStack::PopAndDestroy( 2, address ); // addressTypeBuf, address + + iPushInitiatorList.AddL( newInitiator ); + CleanupStack::Pop( newInitiator ); // newInitiator + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/Data/10008D3E.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/Data/10008D3E.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: White List Adapter registration resources. +* +*/ + + +// INCLUDE FILES + // System includes +#include + + // User includes +#include "WhiteListAdapterUids.h" + +// RESOURCE DEFINITIONS + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KWhiteListAdapterDllUid; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KProvisioningAdapterInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KWhiteListAdapterImplementationUid; + version_no = 2; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/Group/Bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/Group/Bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build specification file +* +*/ + +#include +#include "../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +PRJ_PLATFORMS + +DEFAULT + + +PRJ_EXPORTS + + +PRJ_MMPFILES +#if defined( __S60_32__) || defined( __PLATFORM_VERSION_S60_50__) || defined( __PLATFORM_VERSION_5250__) +// Remove Symbian Push Content Handler +gnumakefile PushContentHandlerClean.mk +#endif +// Build our Push Content Handler +PushMtmPushContentHandler.mmp + +#ifdef __PUSH_WHITELIST + +// Build our White List Adapter plug-in +PushMtmWhiteListAdapter.mmp + +#endif // __PUSH_WHITELIST + + +PRJ_TESTMMPFILES + + +PRJ_TESTEXPORTS + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/Group/PushContentHandlerClean.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/Group/PushContentHandlerClean.mk Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,102 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# +# Remove Symbian Push Content Handler DLL and registry resource files. +# These push content handlers are replaced by the content handlers delivered +# in the Push MTM. +# + +LANGUAGE=sc + +# +# Files to be removed: ECOM DLLs and registry files. +# + +# The old-named push content handler DLL left by PushMtm or Symbian: +TARGETDLL1=pushcontenthandler.dll +# ECOM resource left by Symbian +TARGETRESOURCE1=pushcontenthandler.r$(LANGUAGE) +# SI & SL content handlers left by Symbian +TARGETDLL2=sislcontenthandlers.dll +# ECOM resource left by Symbian (for SI & SL content handlers) +TARGETRESOURCE2=sislcontenthandlers.r$(LANGUAGE) +# Just in case: remove the ECOM registry - the system will create a new +ECOMREGISTRY=$(EPOCROOT)epoc32\$(PLATFORM)\c\system\data\plugins\ecom.rom.dat +# Remove Symbian push mtm +TARGETMTMDLL=wappushmtmclientserver.dll + +# +# Target directories +# + +ifeq (wins,$(findstring wins, $(PLATFORM))) + TARGETDIRRESOURCE=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z\resource\plugins +else +endif +TARGETDIRDLL=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG) +GENERICTARGETDIRRESOURCE=$(EPOCROOT)epoc32\data\z\resource\plugins +TARGETMTMDIRDLL=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG) + +# +# Remove the files +# + +do_tidy: + if exist "$(TARGETDIRDLL)\$(TARGETDLL1)" del "$(TARGETDIRDLL)\$(TARGETDLL1)" +ifeq (wins,$(findstring wins, $(PLATFORM))) + if exist "$(TARGETDIRRESOURCE)\$(TARGETRESOURCE1)" \ + del "$(TARGETDIRRESOURCE)\$(TARGETRESOURCE1)" +endif + if exist "$(GENERICTARGETDIRRESOURCE)\$(TARGETRESOURCE1)" \ + del "$(GENERICTARGETDIRRESOURCE)\$(TARGETRESOURCE1)" + if exist "$(TARGETDIRDLL)\$(TARGETDLL2)" del "$(TARGETDIRDLL)\$(TARGETDLL2)" +ifeq (wins,$(findstring wins, $(PLATFORM))) + if exist "$(TARGETDIRRESOURCE)\$(TARGETRESOURCE2)" \ + del "$(TARGETDIRRESOURCE)\$(TARGETRESOURCE2)" +endif + if exist "$(GENERICTARGETDIRRESOURCE)\$(TARGETRESOURCE2)" \ + del "$(GENERICTARGETDIRRESOURCE)\$(TARGETRESOURCE2)" +ifeq (wins,$(findstring wins, $(PLATFORM))) + if exist "$(ECOMREGISTRY)" del "$(ECOMREGISTRY)" +endif + if exist "$(TARGETMTMDIRDLL)\$(TARGETMTMDLL)" del "$(TARGETMTMDIRDLL)\$(TARGETMTMDLL)" + +do_nothing: + +# +# The targets invoked by abld +# + +MAKMAKE : do_tidy + +RESOURCE : do_nothing + +SAVESPACE : do_nothing + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : do_nothing + +CLEAN : do_tidy + +RELEASABLES : do_nothing + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/Group/PushMtmPushContentHandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/Group/PushMtmPushContentHandler.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file +* +*/ + +#include +#include + +TARGET PushMtmPushContentHandler.dll +TARGETTYPE PLUGIN + +// UIDs - 2nd UID specifies an ECom dll, +// 3rd UID is unique identifier +// (EUidPushContentHandlerDll in PushContentHandlerDef.hrh). +UID 0x10009D8D 0x101F854C + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../PushContentHandler +START RESOURCE 101F854C.rss +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +TARGET PushMtmPushContentHandler.rsc +END // RESOURCE + +USERINCLUDE ../PushContentHandler +USERINCLUDE ../../Inc +USERINCLUDE ../../MtmUtilInc +USERINCLUDE ../../MtmUiInc + +/* todo: to be removed once push header are updated */ +USERINCLUDE /epoc32/include/push + +APP_LAYER_SYSTEMINCLUDE +OS_LAYER_ESTLIB_SYSTEMINCLUDE +#if defined(__PLATFORM_VERSION_32__) +SYSTEMINCLUDE APP_LAYER_PUBLIC_EXPORT_PATH(push) +SYSTEMINCLUDE APP_LAYER_PUBLIC_EXPORT_PATH(ecom) +#endif + +SOURCEPATH ../PushContentHandler +SOURCE CCOContentHandler.cpp +SOURCE CMultiPartMixedContentHandler.cpp +SOURCE CMultiPartRelAndAltContentHandler.cpp +SOURCE CPushContentHandlerBase.cpp +SOURCE CUnknownContentHandler.cpp +SOURCE CSIContentHandler.cpp +SOURCE CSLContentHandler.cpp +SOURCE PushContentHandlerGroupProxy.cpp +SOURCE PushContentHandlerPanic.cpp +SOURCE PushContentHandlerUtils.cpp +SOURCE PushMtmAutoFetchOperation.cpp +SOURCE PushMtmFetchOperation.cpp +SOURCE PushMtmCacheSupply.cpp +SOURCE PushMtmCacheDataSupplier.cpp +SOURCE si_dict.c +SOURCE sl_dict.c +SOURCE StringResourceReader.cpp + +// Define the following __TEST_LOG_MMP macro if logging is required. +// Uncomment it if you want logging. This macro is used only in the mmp file. +// In the source files use __TEST_LOG__. +//#define __TEST_LOG_MMP + +#if defined __TEST_LOG_MMP +MACRO __TEST_LOG__ +#endif + +LIBRARY apengine.lib + +LIBRARY apgrfx.lib +LIBRARY apmime.lib + +LIBRARY bafl.lib + +#ifdef __SERIES60_PUSH_SP +LIBRARY Bifu.lib +LIBRARY BioDB.lib +#endif // __SERIES60_PUSH_SP + +LIBRARY CharConv.lib + +LIBRARY commdb.lib + +#ifdef __SERIES60_PUSH_SP +LIBRARY commonui.lib +#endif // __SERIES60_PUSH_SP + +LIBRARY ECom.lib +LIBRARY efsrv.lib + +LIBRARY esock.lib + +#ifdef __SERIES60_PUSH_SP +LIBRARY etext.lib +#endif // __SERIES60_PUSH_SP + +LIBRARY euser.lib +#ifdef __TEST_LOG_MMP +DEBUGLIBRARY flogger.lib +#endif + +#ifdef __SERIES60_PUSH_SP +LIBRARY gsmu.lib +#endif // __SERIES60_PUSH_SP + +LIBRARY http.lib +LIBRARY BrowserCache.lib +LIBRARY HttpFilterCommon.lib +LIBRARY inetprotutil.lib + +#ifdef __SERIES60_PUSH_SP +LIBRARY MiscPushMsgUtils.lib +#endif // __SERIES60_PUSH_SP + +LIBRARY msgs.lib +LIBRARY PushMsgEntry.lib +LIBRARY PushMtmUtil.lib +LIBRARY SISLPushMsgUtils.lib + +#ifdef __SERIES60_PUSH_SP +LIBRARY smcm.lib +#endif // __SERIES60_PUSH_SP + +LIBRARY WapPushUtils.lib + +LIBRARY ws32.lib + +LIBRARY cXmlParser.lib +LIBRARY CENTRALREPOSITORY.lib +LIBRARY featmgr.lib diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/Group/PushMtmWhiteListAdapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/Group/PushMtmWhiteListAdapter.mmp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Specification file of White List Adapter plug-in +* +*/ + +#include +#include +#include +#include "../WhiteListAdapterInc/WhiteListAdapterUids.h" + +TARGET PushMtmWhiteListAdapter.dll +TARGETTYPE PLUGIN + +// UIDs - 2nd UID specifies an ECom dll, +// 3rd UID is a unique identifier from WhiteListAdapterDef.h +UID 0x10009D8D KWhiteListAdapterDllUid + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +// RESOURCES + +START RESOURCE ../Data/10008D3E.rss +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif +TARGET PushMtmWhiteListAdapter.rsc +END // RESOURCE + +// INCLUDE DIRECTORIES + +USERINCLUDE ../WhiteListAdapterInc +USERINCLUDE ../../MtmUtilInc + +APP_LAYER_SYSTEMINCLUDE + +// SOURCE FILES + +SOURCEPATH ../WhiteListAdapterSrc +SOURCE WhiteListAdapter.cpp +SOURCE WhiteListAdapterGroupProxy.cpp +SOURCE WhiteListAdapterItem.cpp +SOURCE WhiteListAdapterLogger.cpp +SOURCE WhiteListAdapterPanic.cpp + +// LIBRARIES + +LIBRARY Euser.lib +LIBRARY msgs.lib // for MMsvSessionObserver +LIBRARY ProvisioningEngine.lib // for CWPAdapter & Co. +LIBRARY PushMtmUtil.lib // for Push MTM Settings + +// Define this macro is you wish to enable logging +//#define __TEST_WHITELISTADAPTER_LOG_ENABLED + +#ifdef __TEST_WHITELISTADAPTER_LOG_ENABLED + MACRO __TEST_WHITELISTADAPTER_LOG__ + DEBUGLIBRARY flogger.lib +#endif // __TEST_WHITELISTADAPTER_LOG_ENABLED diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/101F854C.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/101F854C.rss Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Push Content Handlers registration resources. +* +*/ + + + +#include +#include "PushContentHandlerDef.hrh" + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = EUidPushContentHandlerDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = EUidPushContentHandlerBase; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = EUidPushUnknownContentHandler; + version_no = 2; + display_name = ""; + default_data = "*"; + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = EUidPushSIContentHandler; + version_no = 2; + display_name = ""; + default_data = "text/vnd.wap.si||application/vnd.wap.sic"; + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = EUidPushSLContentHandler; + version_no = 2; + display_name = ""; + default_data = "text/vnd.wap.sl||application/vnd.wap.slc"; + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = EUidPushCOContentHandler; + version_no = 2; + display_name = ""; + default_data = "text/vnd.wap.co||application/vnd.wap.coc"; + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = EUidPushMultiPartMixedContentHandler; + version_no = 2; + display_name = ""; + default_data = "application/vnd.wap.multipart.mixed||multipart/mixed"; + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = EUidPushMultiPartRelAndAltContentHandler; + version_no = 2; + display_name = ""; + default_data = "application/vnd.wap.multipart.related||application/vnd.wap.multipart.alternative||multipart/related||multipart/alternative"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CCOContentHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CCOContentHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CCOContentHandler. +* +*/ + + + +// INCLUDE FILES + +#include "CCOContentHandler.h" +//#include "PushMtmUtil.h" +//#include "PushMtmSettings.h" +//#include +//#include + +// CONSTANTS + +#if defined(_DEBUG) +_LIT( KErrPushMsgNull, "NULL CPushMessage" ); +#endif + +_LIT( KReserved, "Reserved" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CCOContentHandler::NewL +// --------------------------------------------------------- +// +CCOContentHandler* CCOContentHandler::NewL() + { + CCOContentHandler* self = new(ELeave) CCOContentHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CCOContentHandler::~CCOContentHandler +// --------------------------------------------------------- +// +CCOContentHandler::~CCOContentHandler() + { + Cancel(); + } + +// --------------------------------------------------------- +// CCOContentHandler::CCOContentHandler +// --------------------------------------------------------- +// +CCOContentHandler::CCOContentHandler() +: CContentHandlerBase() + { + } + +// --------------------------------------------------------- +// CCOContentHandler::ConstructL +// --------------------------------------------------------- +// +void CCOContentHandler::ConstructL() + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// CCOContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CCOContentHandler::HandleMessageL( CPushMessage* aPushMsg, + TRequestStatus& aStatus ) + { + __ASSERT_DEBUG( aPushMsg != NULL, User::Panic(KErrPushMsgNull, KErrNone)); + + iMessage = aPushMsg; + iAcknowledge = ETrue; + SetConfirmationStatus( aStatus ); + + iState = EDone; + IdleComplete(); + } + +// --------------------------------------------------------- +// CCOContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CCOContentHandler::HandleMessageL( CPushMessage* aPushMsg ) + { + __ASSERT_DEBUG( aPushMsg != NULL, User::Panic(KErrPushMsgNull, KErrNone)); + + iAcknowledge = EFalse; + iMessage = aPushMsg; + + iState = EDone; + IdleComplete(); + } + +// --------------------------------------------------------- +// CCOContentHandler::CPushHandlerBase_Reserved1 +// --------------------------------------------------------- +// +void CCOContentHandler::CPushHandlerBase_Reserved1() + { + User::Panic(KReserved, KErrNotSupported); + } + +// --------------------------------------------------------- +// CCOContentHandler::CPushHandlerBase_Reserved1 +// --------------------------------------------------------- +// +void CCOContentHandler::CPushHandlerBase_Reserved2() + { + User::Panic(KReserved, KErrNotSupported); + } + +// --------------------------------------------------------- +// CCOContentHandler::CancelHandleMessage +// --------------------------------------------------------- +// +void CCOContentHandler::CancelHandleMessage() + { + Cancel(); + } + +// --------------------------------------------------------- +// CCOContentHandler::DoCancel +// --------------------------------------------------------- +// +void CCOContentHandler::DoCancel() + { + Complete( KErrCancel ); + } + +// --------------------------------------------------------- +// CCOContentHandler::RunL +// --------------------------------------------------------- +// +void CCOContentHandler::RunL() + { + switch( iState ) + { + case EDone: + { + Complete( KErrNone ); + break; + } + default: + break; + } + } + +// --------------------------------------------------------- +// CCOContentHandler::RunError +// --------------------------------------------------------- +// +TInt CCOContentHandler::RunError( TInt aError ) + { + iState = EDone; + Complete( aError ); + return KErrNone; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CCOContentHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CCOContentHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CCOContentHandler. +* +*/ + + + +#ifndef __CCOCONTENTHANDLER_H__ +#define __CCOCONTENTHANDLER_H__ + +// INCLUDE FILES + +#include "PushContentHandlerDef.hrh" +#include +#include + +// CONSTANTS + +const TUid KUidPushCOContentHandler = { EUidPushCOContentHandler }; +_LIT( KCOContentHandlerData, "text/vnd.wap.co||application/vnd.wap.coc" ); + +// FORWARD DECLARATIONS + +/*class CMsvSession; +class CSLPushMsgEntry; +class CPushMtmUtil; +class CPushMtmSettings;*/ + +// CLASS DECLARATION + +/** +* CCOContentHandler Handles Cache Operation Content +* +* This handler takes ownership of the CO message and processes it +* according to the processing rules +* [WAP Cache Operation version 31-July-2001]. +* Also S60 specific requirements are applied. +* +* NB. Currently all CO push messages are discarded! +*/ +class CCOContentHandler : public CContentHandlerBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed object. + */ + static CCOContentHandler* NewL(); + + /** + * D'tor. + */ + virtual ~CCOContentHandler(); + + private: // Constructors + + /** + * Constructor. + */ + CCOContentHandler(); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + private: // Methods from CPushHandlerBase + + /** + * HandleMessage Async. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * @param aPushMsg CPushMessage to process. + * @param aStatus Request status variable for use in asynchronous + * operations. + * @return None. + */ + void HandleMessageL( CPushMessage* aPushMsg, TRequestStatus& aStatus ); + + /** + * HandleMessage Sync. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * Initial State: Set data members then go to the next state + * @param aPushMsg CPushMessage to process. + */ + void HandleMessageL( CPushMessage* aPushMsg ); + + /** + * Same functionality as DoCancel() + */ + void CancelHandleMessage(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved1(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved2(); + + private: // Methods from CActive + + /** + * Current implementation does nothing. TODO on 2.1. + * @return None. + */ + void DoCancel(); + + /** + * Current implementation does nothing. TODO on 2.1. + * @return None. + */ + void RunL(); + + /** + * Current implementation does nothing. TODO on 2.1. + * @return Error code to scheduler. + */ + TInt RunError( TInt aError ); + + private: // Data + + enum TState + { + EDone + }; + }; + +#endif // __CCOCONTENTHANDLER_H__ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CMultiPartMixedContentHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CMultiPartMixedContentHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CMultiPartMixedContentHandler. +* +*/ + +// INCLUDE FILES + +#include "CMultiPartMixedContentHandler.h" +#include +#include +#include + +// Constants + +_LIT(KReserved, "Reserved"); +#if defined(_DEBUG) +_LIT(KErrPushMsgNull, "NULL CPushMessage"); +#endif + +/** + * Static Factory Construction + * + * @param aFs Reference to a file session + * @param aLibrary Reference to DLL Library Object + * @param aIndex Index number corresponding to the Unknown App Handler Class + * 'EMultiPartMixedContentHandler' + * + * @return fully initialized instance of this class + */ +CMultiPartMixedContentHandler* CMultiPartMixedContentHandler::NewL() + { + CMultiPartMixedContentHandler* self = + new (ELeave) CMultiPartMixedContentHandler; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * Destructor + */ +CMultiPartMixedContentHandler::~CMultiPartMixedContentHandler() + { + Cancel(); + delete iMultiMessage; + iContentHandler = NULL; // Not owned. + } + +/** + * Constructor + * + * @param aFs Reference to a file session + * @param aLibrary Reference to DLL Library Object + * @param aIndex Index number corresponding to the Unknown App Handler Class + * 'EMultiPartMixedContentHandler' + */ +CMultiPartMixedContentHandler::CMultiPartMixedContentHandler() +: CContentHandlerBase() + { + } + +/** + * This will complete initialization of the object + */ +void CMultiPartMixedContentHandler::ConstructL() + { + CActiveScheduler::Add(this); + } + +#ifdef __TEST_MULTIPART_MIX_SUPP + +/** + * Creates a Multipart Binary Iterator that will be used for splitting apart the binary + * mulitpart. + * + * @param aPushMsg A WAP binary multipart.mixed message that will be processed + */ +void CMultiPartMixedContentHandler::LoadMultipartMsgL() + { + __ASSERT_DEBUG( iMessage!= 0 , User::Panic(KErrPushMsgNull,0)); + + TPtrC contentType; + iMessage->GetContentType(contentType); + if (!contentType.FindF(KMultipartText)) + iMultiMessage = CMultipartTextIterator::NewL(*iMessage); + else if (!contentType.FindF(KMultipartBin)) + iMultiMessage = CMultipartBinIterator::NewL(*iMessage); + else + User::Leave(KErrCorrupt); + + iMultiMessage->FirstL(); + iState = EHandlePart; + + IdleComplete(); + } + +/** + * Handles the Message Part returned from the Multipart iterator + * by creating a new handler based on the Content-Type, then dispatches it + * synchronously. + */ +void CMultiPartMixedContentHandler::HandlePartL() + { + CPushMessage* msgPart = iMultiMessage->PartL(); + CleanupStack::PushL(msgPart); + + TPtrC contentType; + msgPart->GetContentType(contentType); + CContentHandlerBase& contentHandler = + PushContentTypeDispatcher::GetHandlerL( contentType, *iLog, *iManager ); + iContentHandler = &contentHandler; + CleanupStack::Pop(msgPart); + + // treat as an acknowledged message always to ensure + // sequential creation of handlers + iContentHandler->HandleMessageL(msgPart, iStatus); + iState = ENextPart; + SetActive(); + } + +/** + * Moves multipart iterator to the next part. If there is none, + * State: EDone will be set to complete this handler + */ +void CMultiPartMixedContentHandler::NextPartL() + { + if (iMultiMessage->NextL()) + iState = EHandlePart; + else + iState = EDone; + + IdleComplete(); + } + +#endif // __TEST_MULTIPART_MIX_SUPP + +/** + * The Asynchronous entry point for this plug-in to handle the CPushMessage. + * + * Since we really didn't start an async event, make it look as though our + * asynchronous request has been completed. + * + * @param aPushMsg A WAP binary multipart.mixed message that will be processed + * @param aStatus The TRequestStatus of the caller indicating that this will + * be used aysnchronously + */ +void CMultiPartMixedContentHandler::HandleMessageL( CPushMessage* aPushMsg, + TRequestStatus& aStatus ) + { + __ASSERT_DEBUG( aPushMsg != NULL, User::Panic(KErrPushMsgNull, KErrNone)); + +#ifdef __TEST_MULTIPART_MIX_SUPP + iAcknowledge = ETrue; + iMessage = aPushMsg; + SetConfirmationStatus(aStatus); + iState = ELoadMsgData; + IdleComplete(); +#else // __TEST_MULTIPART_MIX_SUPP + iAcknowledge = ETrue; + iMessage = aPushMsg; + SetConfirmationStatus(aStatus); + // Drop all multipart/mixed messages. + iState = EDone; + IdleComplete(); +#endif // __TEST_MULTIPART_MIX_SUPP + } + + +/** + * The Synchronous entry point for this plug-in to handle the CPushMessage. + * + * @param aPushMsg A WAP binary multipart.mixed message that will be processed + * @param aStatus The TRequestStatus of the caller indicating that this will be + * used aysnchronously + */ +void CMultiPartMixedContentHandler::HandleMessageL( CPushMessage* aPushMsg ) + { + __ASSERT_DEBUG( aPushMsg != NULL, User::Panic(KErrPushMsgNull, KErrNone)); + +#ifdef __TEST_MULTIPART_MIX_SUPP + iAcknowledge = EFalse; + iMessage = aPushMsg; + iState = ELoadMsgData; + IdleComplete(); +#else // __TEST_MULTIPART_MIX_SUPP + iAcknowledge = EFalse; + iMessage = aPushMsg; + // Drop all multipart messages. + iState = EDone; + IdleComplete(); +#endif // __TEST_MULTIPART_MIX_SUPP + } + +/** + * Cancels Asynronous requests on called handler. + */ +void CMultiPartMixedContentHandler::CancelHandleMessage() + { + Cancel(); + } + +void CMultiPartMixedContentHandler::CPushHandlerBase_Reserved1() + { + User::Panic(KReserved, KErrNotSupported); + } + +void CMultiPartMixedContentHandler::CPushHandlerBase_Reserved2() + { + User::Panic(KReserved, KErrNotSupported); + } + +/** + * Cancels Asynronous requests on caller and completes self. + */ +void CMultiPartMixedContentHandler::DoCancel() + { + if ( iContentHandler ) + { + iContentHandler->CancelHandleMessage(); + } + Complete( KErrCancel ); + } + +/** + * State machine to step through the multipart message until it is done + * + * State EHandlePart: Starts the processing of each part of the multipart + * State ENextPart: Moves the interator to point to the next part of the multipart + * when there are no more parts, EDone will be the next state + * State EDone: Clean up and complete + */ +void CMultiPartMixedContentHandler::RunL() + { + switch(iState) + { + +#ifdef __TEST_MULTIPART_MIX_SUPP + + case ELoadMsgData: + { + LoadMultipartMsgL(); + break; + } + case EHandlePart: + { + HandlePartL(); + break; + } + case ENextPart: + { + NextPartL(); + break; + } + +#endif // __TEST_MULTIPART_MIX_SUPP + + case EDone: + { + Complete(KErrNone); + break; + } + default: + { + break; + } + } + } + +/** + * Clean up + */ +TInt CMultiPartMixedContentHandler::RunError(TInt aError) + { + iState=EDone; + Complete(aError); + return KErrNone; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CMultiPartMixedContentHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CMultiPartMixedContentHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CMultiPartMixedContentHandler. +* +*/ + +#ifndef __CMULTIPARTMIXEDCONTENTHANDLER_H__ +#define __CMULTIPARTMIXEDCONTENTHANDLER_H__ + +// INCLUDE FILES + +#include "PushMtmDef.hrh" +#include "PushContentHandlerDef.hrh" +#include +#include + +// CONSTANTS + +const TUid KUidPushMultiPartMixedContentHandler = { + EUidPushMultiPartMixedContentHandler }; +_LIT(KMultiPartMixedContentHandlerData, + "application/vnd.wap.multipart.mixed||multipart/mixed"); + +// FORWARD DECLARATIONS + +class CMultipartIteratorBase; + +// CLASS DECLARATION + +/** +* The MultiPart/Mixed Content Handler +* +* Takes apart the mulitpart message, creating a new sub message from each +* part, then calls on new Push Handlers to process each sub message. +* +* All multipart/mixed messages are dropped if __TEST_MULTIPART_MIX_SUPP +* is not defined. +*/ +class CMultiPartMixedContentHandler : public CContentHandlerBase + { + public: // Constructors and destructor + + static CMultiPartMixedContentHandler* NewL(); + + virtual ~CMultiPartMixedContentHandler(); + + private: // Constructors + + CMultiPartMixedContentHandler(); + + void ConstructL(); + + private: // New functions + +#ifdef __TEST_MULTIPART_MIX_SUPP + + void LoadMultipartMsgL(); + + void HandlePartL(); + + void NextPartL(); + +#endif // __TEST_MULTIPART_MIX_SUPP + + private: // Methods from CPushHandlerBase + + void HandleMessageL(CPushMessage* aPushMsg, TRequestStatus& aStatus); + + void HandleMessageL(CPushMessage* aPushMsg); + + void CancelHandleMessage(); + + void CPushHandlerBase_Reserved1(); + + void CPushHandlerBase_Reserved2(); + + private: // Methods from CActive + + void DoCancel(); + + void RunL(); + + TInt RunError(TInt aError); + + private: // Attributes + + enum TState + { + ELoadMsgData, + EHandlePart, + ENextPart, + EDone + }; + + CMultipartIteratorBase* iMultiMessage; + + CContentHandlerBase* iContentHandler; + + }; + + +#endif // __CMULTIPARTMIXEDCONTENTHANDLER_H__ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CMultiPartRelAndAltContentHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CMultiPartRelAndAltContentHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,335 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CMultiPartRelAndAltContentHandler. +* +*/ + +// INCLUDE FILES + +#include "CMultiPartRelAndAltContentHandler.h" +#include +#include + +// Constants + +_LIT(KReserved, "Reserved"); + +/** + * Static Factory Construction + * + * version of NewLC which leaves nothing + * on the cleanup stack + */ +CMultiPartRelAndAltContentHandler* CMultiPartRelAndAltContentHandler::NewL() + { + CMultiPartRelAndAltContentHandler* self = new (ELeave) CMultiPartRelAndAltContentHandler; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * Default d'tor + */ +CMultiPartRelAndAltContentHandler::~CMultiPartRelAndAltContentHandler() + { + Cancel(); + delete iMultiMessage; + delete iMsvSession; + } + +/** + * The Multipart Related Content handler + * Index number : ESLContentHandlerIndex + */ +CMultiPartRelAndAltContentHandler::CMultiPartRelAndAltContentHandler() +: CContentHandlerBase(), + iSavedMsgId( KMsvNullIndexEntryId ) + { + } + +/** + * This will complete initialization of the object + */ +void CMultiPartRelAndAltContentHandler::ConstructL() + { + iMsvSession = CMsvSession::OpenSyncL( *this ); + CActiveScheduler::Add(this); + } + +#ifdef __TEST_MULTIPART_REL_SUPP + +/** +* Setup the multipart message. +*/ +void CMultiPartRelAndAltContentHandler::LoadMultiPartMsgL() + { +#ifdef _DEBUG + _LIT(KNullMsg,"NULL CPushMessage"); + __ASSERT_DEBUG( iMessage != 0 , User::Panic(KNullMsg,0)); +#endif + TPtrC contentType; + iMessage->GetContentType(contentType); + if (!contentType.FindF(KMultipartText)) + iMultiMessage = CMultipartTextIterator::NewL(*iMessage); + else if (!contentType.FindF(KMultipartBin)) + iMultiMessage = CMultipartBinIterator::NewL(*iMessage); + else + User::Leave(KErrCorrupt); + iMultiMessage->FirstL(); + IdleComplete(); + } + +/** + * Saves message part to messaging server + */ +void CMultiPartRelAndAltContentHandler::HandlePartL() + { + CPushMessage* msgPart = iMultiMessage->PartL(); + CleanupStack::PushL(msgPart); + + // Create a new Unknown Push Entry to hold the header and body data + CUnknownPushMsgEntry* msgEntry=CUnknownPushMsgEntry::NewL(); + CleanupStack::PushL(msgEntry); + // Get the header + TPtrC8 header; + msgPart->GetHeader(header); + //Get the From field + TPtrC8 from; + if (!msgPart->GetBinaryHeaderField(EHttpFrom,from) && + !msgPart->GetBinaryHeaderField(EHttpXWapInitiatorURI,from) && + !msgPart->GetBinaryHeaderField(EHttpContentLocation,from) ) + { + from.Set(KNullDesC8); + } + // Get the body + TPtrC8 body; + msgPart->GetMessageBody(body); + TPtrC content; + msgPart->GetContentType(content); + + //Set fields of the Unknown Entry + msgEntry->SetHeaderL(header); + msgEntry->SetMessageDataL(body); + msgEntry->SetFromL(from); + //Need this next bit so UI knows what to do with the data in the Push Entry + msgEntry->SetContentTypeL( content ); + + msgEntry->SaveL( *iMsvSession, iSavedMsgId ); + CleanupStack::PopAndDestroy( 2 ); //msgEntry, msgPart + + iState = ENextPart; + IdleComplete(); + + } + +/** + * Move multipart iterator to the next part + */ +void CMultiPartRelAndAltContentHandler::NextPartL() + { + if (iMultiMessage->NextL()) + { + iState = EHandlePart; + } + else + { + iState = EDone; + } + IdleComplete(); + } + +/** + * + */ +void CMultiPartRelAndAltContentHandler::SaveMsgRootL() + { + TPtrC8 msgHeaderPtr; + iMessage->GetHeader(msgHeaderPtr); + CMultiPartPushMsgEntry* msgEntry=CMultiPartPushMsgEntry::NewL(); + CleanupStack::PushL(msgEntry); + msgEntry->SetHeaderL(msgHeaderPtr); //Top level entry + TPtrC contentType; + iMessage->GetContentType(contentType); + msgEntry->SetContentTypeL(contentType); + + iSavedMsgId = msgEntry->SaveL(*iMsvSession, + KMsvGlobalInBoxIndexEntryId); + CleanupStack::PopAndDestroy();//msgEntry + } + +/** + * Loads multipart data and creates multipart head entry in the message + * server index. + * @throw KErrCorrupt - message data is corrupt + * @throw KErrNoMemory - insufficient free memory to complete operations + */ + +void CMultiPartRelAndAltContentHandler::LoadMsgDataL() + { + LoadMultiPartMsgL(); + SaveMsgRootL(); + iState = EHandlePart; + } + +void CMultiPartRelAndAltContentHandler::SetMsgCorruptFlagL() + { + CMsvEntry* msvEntry = iMsvSession->GetEntryL( iSavedMsgId ); + CleanupStack::PushL( msvEntry ); + TMsvEntry entry = msvEntry->Entry(); + // get the iMtmData1 value & zero bits 0-3 then add new status + TInt32 mtmdata1 = ( entry.iMtmData1 & 0xFFFFFFF0 ); + mtmdata1 += CPushMsgEntryBase::EPushMsgStatusCorrupt; + // Now set values for TMsvEntry and update the server entry + entry.iMtmData1 = mtmdata1; + msvEntry->ChangeL( entry ); + + CleanupStack::PopAndDestroy( msvEntry ); + } + +#endif // __TEST_MULTIPART_REL_SUPP + +/** + * Async. Version + */ +void CMultiPartRelAndAltContentHandler::HandleMessageL( CPushMessage* aPushMsg, + TRequestStatus& aStatus ) + { +#ifdef __TEST_MULTIPART_REL_SUPP + iAcknowledge=ETrue; + SetConfirmationStatus(aStatus); + iMessage = aPushMsg; + iState = ELoadMsgData; + IdleComplete(); +#else // __TEST_MULTIPART_REL_SUPP + iAcknowledge=ETrue; + SetConfirmationStatus(aStatus); + iMessage = aPushMsg; + // Drop all multipart messages. + iState = EDone; + IdleComplete(); +#endif // __TEST_MULTIPART_REL_SUPP + } + +/** + * Sync. Version + */ +void CMultiPartRelAndAltContentHandler::HandleMessageL( CPushMessage* aPushMsg ) + { +#ifdef __TEST_MULTIPART_REL_SUPP + iAcknowledge=EFalse; + iMessage = aPushMsg; + iState = ELoadMsgData; + IdleComplete(); +#else // __TEST_MULTIPART_REL_SUPP + iAcknowledge=EFalse; + iMessage = aPushMsg; + // Drop all multipart messages. + iState = EDone; + IdleComplete(); +#endif // __TEST_MULTIPART_REL_SUPP + } + +void CMultiPartRelAndAltContentHandler::CancelHandleMessage() + { + Cancel(); + } + +void CMultiPartRelAndAltContentHandler::CPushHandlerBase_Reserved1() + { + User::Panic(KReserved, KErrNotSupported); + } + +void CMultiPartRelAndAltContentHandler::CPushHandlerBase_Reserved2() + { + User::Panic(KReserved, KErrNotSupported); + } + +void CMultiPartRelAndAltContentHandler::DoCancel() + { + Complete( KErrCancel ); + } + +/** +*RunL handles each part separately +*/ +void CMultiPartRelAndAltContentHandler::RunL() + { + switch(iState) + { + +#ifdef __TEST_MULTIPART_REL_SUPP + + case ELoadMsgData: + { + LoadMsgDataL(); + break; + } + case EHandlePart: + { + HandlePartL(); + break; + } + case ENextPart: + { + NextPartL(); + break; + } + +#endif // __TEST_MULTIPART_REL_SUPP + + case EDone: + { + Complete(KErrNone); + break; + } + default: + { + break; + } + } + } + +/** + * Clean up + */ +TInt CMultiPartRelAndAltContentHandler::RunError(TInt aError) + { + iState=EDone; + +#ifdef __TEST_MULTIPART_REL_SUPP + + if (iSavedMsgId != KMsvNullIndexEntryId) + { + TRAPD(error, SetMsgCorruptFlagL()); + } + +#endif // __TEST_MULTIPART_REL_SUPP + + Complete(aError); + return KErrNone; + } + +// --------------------------------------------------------- +// CMultiPartRelAndAltContentHandler::HandleSessionEventL +// --------------------------------------------------------- +// +void CMultiPartRelAndAltContentHandler::HandleSessionEventL( + TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, + TAny* /*aArg2*/, + TAny* /*aArg3*/ ) + {} + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CMultiPartRelAndAltContentHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CMultiPartRelAndAltContentHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CMultiPartRelAndAltContentHandler. +* +*/ + + + +#ifndef __CMULTIPARTRELANDALTCONTENTHANDLER_H__ +#define __CMULTIPARTRELANDALTCONTENTHANDLER_H__ + +// System includes +// +#include "PushMtmDef.hrh" +#include "PushContentHandlerDef.hrh" +#include +#include +#include +#include + +// Constants +// +const TUid KUidPushMultiPartRelAndAltContentHandler = { + EUidPushMultiPartRelAndAltContentHandler }; + +// Forward class declarations +// +class CMsvSession; +class CMultipartIteratorBase; + +/** +* The MultiPart/Alternative & Multipart/Alternative Content Handler +* +* Saves the whole message in the Message Server, each part getting saved as a child +* entry to the main part. +* +* All multipart/rel+alt messages are dropped if __TEST_MULTIPART_REL_SUPP +* is not defined. +*/ +class CMultiPartRelAndAltContentHandler : public CContentHandlerBase, + public MMsvSessionObserver + { + public: // Methods + + static CMultiPartRelAndAltContentHandler* NewL(); + + virtual ~CMultiPartRelAndAltContentHandler(); + + private: // Constructors + + CMultiPartRelAndAltContentHandler(); + + void ConstructL(); + + private: // New functions + +#ifdef __TEST_MULTIPART_REL_SUPP + + void LoadMultiPartMsgL(); + + void HandlePartL(); + + void NextPartL(); + + void SaveMsgRootL(); + + void LoadMsgDataL(); + + void SetMsgCorruptFlagL(); + +#endif // __TEST_MULTIPART_REL_SUPP + + private: // Methods from CPushHandlerBase + + void HandleMessageL(CPushMessage* aPushMsg, TRequestStatus& aStatus); + + void HandleMessageL(CPushMessage* aPushMsg); + + void CancelHandleMessage(); + + void CPushHandlerBase_Reserved1(); + + void CPushHandlerBase_Reserved2(); + + private: // Methods from CActive + + void DoCancel(); + + void RunL(); + + TInt RunError(TInt aError); + + private: // from MMsvSessionObserver + + void HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, TAny* aArg2, TAny* aArg3); + + private: // Attributes + + enum TState + { + ELoadMsgData, + EHandlePart, + EDone, + ENextPart + }; + + CMsvSession* iMsvSession; ///< Has. + + TMsvId iSavedMsgId; + + CMultipartIteratorBase* iMultiMessage; + }; + +#endif // __CMULTIPARTRELANDALTCONTENTHANDLER_H__ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CPushContentHandlerBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CPushContentHandlerBase.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushContentHandlerBase. +* +*/ + + + +// INCLUDE FILES + +#include "CPushContentHandlerBase.h" +#include "PushMtmUtil.h" +#include "PushMtmSettings.h" +#include "PushInitiatorList.h" +#include "PushInitiator.h" +#include "PushMtmCommands.hrh" +#include "PushMtmLog.h" +#include "PushMtmUiDef.h" +#include "StringResourceReader.h" +#include "PushContentHandlerPanic.h" +#include +#include +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushContentHandlerBase::CPushContentHandlerBase +// --------------------------------------------------------- +// +CPushContentHandlerBase::CPushContentHandlerBase() +: CContentHandlerBase() + { + } + +// --------------------------------------------------------- +// CPushContentHandlerBase::ConstructL +// --------------------------------------------------------- +// +void CPushContentHandlerBase::ConstructL() + { + iMsvSession = CMsvSession::OpenSyncL( *this ); + PUSHLOG_WRITE("CPushContentHandlerBase iMsvSession OK") + iWapPushUtils = CPushMtmUtil::NewL( *iMsvSession ); + PUSHLOG_WRITE("CPushContentHandlerBase iWapPushUtils OK") + iMtmSettings = CPushMtmSettings::NewL(); + PUSHLOG_WRITE("CPushContentHandlerBase iMtmSettings OK") + + // Add resource file reader. + TParse* fileParser = new (ELeave) TParse; + CleanupStack::PushL( fileParser ); + fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); + iStrRscReader = new (ELeave) CStringResourceReader + ( iMsvSession->FileSession(), fileParser->FullName() ); + CleanupStack::PopAndDestroy( fileParser ); // fileParser + fileParser = NULL; + PUSHLOG_WRITE("CPushContentHandlerBase iStrRscReader OK") + + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CPushContentHandlerBase::~CPushContentHandlerBase +// --------------------------------------------------------- +// +CPushContentHandlerBase::~CPushContentHandlerBase() + { + PUSHLOG_ENTERFN("CPushContentHandlerBase::~CPushContentHandlerBase") + + // Call Cancel() in derived classes! + delete iStrRscReader; // Must be deleted before iMsvSession. + delete iMtmSettings; // It has to be deleted before iMsvSession, because + // it uses iMsvSession->FileSession(). + delete iWapPushUtils; + delete iMsvSession; + + PUSHLOG_LEAVEFN("CPushContentHandlerBase::~CPushContentHandlerBase") + } + +// --------------------------------------------------------- +// CPushContentHandlerBase::DoCollectGarbageL +// --------------------------------------------------------- +// +void CPushContentHandlerBase::DoCollectGarbageL() + { + PUSHLOG_ENTERFN("CPushContentHandlerBase::DoCollectGarbageL") + + CClientMtmRegistry* clientReg = CClientMtmRegistry::NewL( *iMsvSession ); + CleanupStack::PushL( clientReg ); + PUSHLOG_WRITE("CPushContentHandlerBase clientReg OK") + CBaseMtm* pushMtm = clientReg->NewMtmL( KUidMtmWapPush ); + CleanupStack::PushL( pushMtm ); + PUSHLOG_WRITE("CPushContentHandlerBase pushMtm OK") + CMsvEntrySelection* dummySel = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( dummySel ); + TBuf8<1> dummyPar; + + pushMtm->InvokeSyncFunctionL( EPushMtmCmdCollectGarbage, + *dummySel, dummyPar ); + + CleanupStack::PopAndDestroy( 3, clientReg ); + // dummySel, pushMtm, clientReg + + PUSHLOG_LEAVEFN("CPushContentHandlerBase::DoCollectGarbageL") + } + +// --------------------------------------------------------- +// CPushContentHandlerBase::FilterPushMsgL +// --------------------------------------------------------- +// +TBool CPushContentHandlerBase::FilterPushMsgL() + { + PUSHLOG_ENTERFN("CPushContentHandlerBase::FilterPushMsgL") + + TBool msgAccepted = ETrue; + + if ( iMtmSettings->ServiceReception() == EFalse ) + { + // Discard message. + msgAccepted = EFalse; + PUSHLOG_WRITE(" ServiceReception OFF") + } + + PUSHLOG_WRITE_FORMAT(" msgAccepted <%d>",msgAccepted) + PUSHLOG_LEAVEFN("CPushContentHandlerBase::FilterPushMsgL") + return msgAccepted; + } + +// --------------------------------------------------------- +// CPushContentHandlerBase::HandleSessionEventL +// --------------------------------------------------------- +// +void CPushContentHandlerBase::HandleSessionEventL + ( + TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, + TAny* /*aArg2*/, + TAny* /*aArg3*/ + ) + { + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CPushContentHandlerBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CPushContentHandlerBase.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushContentHandlerBase. +* +*/ + + + +#ifndef __CPUSHCONTENTHANDLERBASE_H__ +#define __CPUSHCONTENTHANDLERBASE_H__ + + +// INCLUDE FILES + +#include +#include +#include +#include + +// FORWARD DECLARATIONS + +class CMsvSession; +class CPushMtmUtil; +class CPushMtmSettings; +class CStringResourceReader; + +// CLASS DECLARATION + +/** +* CPushContentHandlerBase class stands as a base class for almost all push +* content handlers of the Push MTM. It collects the generic functionality of +* a push content handler, such as garbage collection when receiving new +* service message, supporting CMsvSession, CPushMtmUtil and CPushMtmSettings +* objects. +*/ +class CPushContentHandlerBase : public CContentHandlerBase, + public MMsvSessionObserver + { + protected: // Constructors and destructor + + /** + * Constructor. + */ + CPushContentHandlerBase(); + + /** + * Symbian OS constructor. CActiveScheduler::Add( this ) is called in + * this method!! + */ + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CPushContentHandlerBase(); + + protected: // New functions + + /** + * Do Garbage Collection synchronously. + * @return None. + */ + void DoCollectGarbageL(); + + /** + * Apply Push MTM settings on the message. + * @return ETrue if the message passed the filtering. + */ + TBool FilterPushMsgL(); + + protected: // From MMsvSessionObserver + + /** + * Msv session events are handled by this method. This implementation + * is empty. + * @return None. + */ + void HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3); + + protected: // Data + + CMsvSession* iMsvSession; ///< Session to Message Server. Has. + CPushMtmUtil* iWapPushUtils; ///< Push Utility. Has. + CPushMtmSettings* iMtmSettings; ///< Push Settings. Has. + /// Owned. It uses iMsvSession's RFs! + CStringResourceReader* iStrRscReader; + }; + +#endif // __CPUSHCONTENTHANDLERBASE_H__ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CSIContentHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CSIContentHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1835 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CSIContentHandler. +* +*/ + + + +// INCLUDE FILES + +#include "CSIContentHandler.h" +#include "PushMtmUtil.h" +#include "PushMtmSettings.h" +#include "PushMtmLog.h" +#include "PushMtmUiDef.h" +#include "StringResourceReader.h" +#include "PushContentHandlerPanic.h" +#include "si_dict.h" +#include "PushContentHandlerUtils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// si attributes / elements +_LIT8( KSi, "si" ); +_LIT8( KIndication, "indication" ); +_LIT8( KHrefAttrib, "href" ); +_LIT8( KSiIdAttrib, "si-id" ); +_LIT8( KCreatedAttrib, "created" ); +_LIT8( KExpiresAttrib, "si-expires" ); +_LIT8( KActionAttrib, "action" ); + +// action attribute literals +_LIT8( KDeleteAction, "delete" ); +_LIT8( KSignalNone, "signal-none" ); +_LIT8( KSignalLow, "signal-low" ); +_LIT8( KSignalMedium, "signal-medium" ); +_LIT8( KSignalHigh, "signal-high" ); + +_LIT( KSiTextContentType, "text/vnd.wap.si" ); + +const TInt KValidMaxEncodedDateTimeSize = 7; +const TInt KValidUTCLength = 20; // YYYY-MM-DDTHH:MM:SSZ +const TInt KValidUTCNumericals = 14; +const TInt KValidUTCYearBlockLength = 4; +const TInt KValidUTCOtherBlockLength = 2; +const TUint8 KAsciiZeroCharCode = 0x30; + +const TInt KValidTTimeMonthStart = 4; +const TInt KValidTTimeDayStart = 6; +const TInt KValidTTimeHourStart = 8; +const TInt KValidTTimeMinuteStart = 10; +const TInt KValidTTimeSecondStart = 12; +const TInt KValidTTimeBlockLength = 2; + +const TInt KValidTTimeLength = 14; // YYYYMMDDHHMMSS + +const TInt KNoOfDictArrays = 1; + +_LIT( KCharMinus, "-" ); +_LIT( KCharT, "T" ); +_LIT( KCharColon, ":" ); +_LIT( KCharZ, "Z" ); + +/// Conversion buffer size. +LOCAL_D const TInt KPushConversionBufferSize = 256; +/// Zero width non-breaking space character. +LOCAL_D const TUint16 KPushZeroWidthNbsp = 0xfeff; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CSIContentHandler::NewL +// --------------------------------------------------------- +// +CSIContentHandler* CSIContentHandler::NewL() + { + PUSHLOG_ENTERFN("CSIContentHandler::NewL") + + CSIContentHandler* self = new (ELeave) CSIContentHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PUSHLOG_LEAVEFN("CSIContentHandler::NewL") + return self; + } + +// --------------------------------------------------------- +// CSIContentHandler::~CSIContentHandler +// --------------------------------------------------------- +// +CSIContentHandler::~CSIContentHandler() + { + PUSHLOG_ENTERFN("CSIContentHandler::~CSIContentHandler") + + Cancel(); + delete iHrefBuf; + delete iSiIdBuf; + delete iData; + delete iCharacterSetConverter; + iCharacterSetConverter = NULL; + delete iCharacterSetsAvailable; + iCharacterSetsAvailable = NULL; + + PUSHLOG_LEAVEFN("CSIContentHandler::~CSIContentHandler") + } + +// --------------------------------------------------------- +// CSIContentHandler::CSIContentHandler +// --------------------------------------------------------- +// +CSIContentHandler::CSIContentHandler() +: CPushContentHandlerBase(), + iSavedMsgId( KMsvNullIndexEntryId ), + iPushMsgAction( KErrNotFound ), + iExpiresTime( Time::NullTTime() ), + iCreatedTime( Time::NullTTime() ) + { + } + +// --------------------------------------------------------- +// CSIContentHandler::ConstructL +// --------------------------------------------------------- +// +void CSIContentHandler::ConstructL() + { + PUSHLOG_ENTERFN("CSIContentHandler::ConstructL") + + CPushContentHandlerBase::ConstructL(); + // Added to Active Scheduler. + + PUSHLOG_LEAVEFN("CSIContentHandler::ConstructL") + } + +// --------------------------------------------------------- +// CSIContentHandler::CollectGarbageL +// --------------------------------------------------------- +// +void CSIContentHandler::CollectGarbageL() + { + PUSHLOG_ENTERFN("CSIContentHandler::CollectGarbageL") + + DoCollectGarbageL(); + + //Ready. + iState = EFilteringAndParsing; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSIContentHandler::CollectGarbageL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ParsePushMsgL +// Note that cXML parser dosn't do any validation! +// --------------------------------------------------------- +// +void CSIContentHandler::ParsePushMsgL() + { + PUSHLOG_ENTERFN("CSIContentHandler::ParsePushMsgL") + + TPtrC8 bodyPtr; + iMessage->GetMessageBody( bodyPtr ); + // If there is no body in the message leave with an error + if ( bodyPtr.Size() == 0 ) + { + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: Empty body") + User::Leave( KErrCorrupt ); + } + + // Get content type. It will tell us wheather the msg body is encoded or + // textual. + TPtrC contentType; + iMessage->GetContentType( contentType ); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: HTTP header - Content type <%S>",&contentType); + + /* + TPtrC8 encodingPtr; + TBool encodingFound = iMessage->GetHeaderField + ( EHttpContentEncoding, encodingPtr ); + #ifdef __TEST_LOG__ + TBuf<64> encodingBuf; + encodingBuf.Copy( encodingPtr ); + PUSHLOG_WRITE_FORMAT(" HTTP header - Content encoding <%S>",&encodingBuf); + #endif // __TEST_LOG__ + */ + + // Add SI dictionary. + NW_WBXML_Dictionary_t* dictArray[ KNoOfDictArrays ] = + { (NW_WBXML_Dictionary_t*)&NW_SI_WBXMLDictionary }; + + NW_Status_t stat = NW_STAT_SUCCESS; + + RWbxmlDictionary wbxmlDict; + wbxmlDict.InitializeL( KNoOfDictArrays, dictArray ); + CleanupClosePushL( wbxmlDict ); + + NW_TinyDom_Handle_t domHandle; + NW_Byte* buffer = (NW_Byte*)bodyPtr.Ptr(); + NW_Int32 length = (NW_Int32)bodyPtr.Size(); + // Let's use the content type now. + NW_Bool encoded = ( contentType.CompareF( KSiTextContentType ) == 0 ) ? + NW_FALSE : NW_TRUE; + // SI public identifier. + NW_Uint32 publicID = NW_SI_PublicId; + NW_Bool extTNotStringTable = NW_FALSE; + NW_DOM_NodeType_t type = 0; + /********************************** + * Root of DOM + ***********************************/ + CDocumentTreeOwner* docTreeOwner = new (ELeave) CDocumentTreeOwner; + CleanupStack::PushL( docTreeOwner ); + NW_DOM_DocumentNode_t* domNode = NW_DOM_DocumentNode_BuildTree + ( + &domHandle, + buffer, + length, + encoded, + publicID, + extTNotStringTable + ); + if (!domNode) + { + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: domNode is Null") + } + User::LeaveIfNull( domNode ); + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: domNode is not Null") // to be deleted + // Let domNode be on the Cleanup Stack. + docTreeOwner->SetDocTree( domNode ); + + // It must be a document node. + type = NW_DOM_Node_getNodeType( domNode ); + if ( type != NW_DOM_DOCUMENT_NODE ) + { + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: Not Document node <%d>",type) + User::Leave( KErrArgument ); + } + + // Get character encoding (NW_Uint32) + iCharEncoding = NW_DOM_DocumentNode_getCharacterEncoding( domNode ); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: Doc char encoding <%x>",iCharEncoding) + + /********************************** + * ELEMENT si + ***********************************/ + // Get the first element of the document that must be an si. + // first make sure if there any children in the dom tree, otherwise we will PANIC(in NW_DOM_DocumentNode_getDocumentElement) and crash WatcherMainThread. + TBool domNodeHasChildNodes = EFalse; + domNodeHasChildNodes = NW_DOM_Node_hasChildNodes( domNode ); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: check if Dom tree has node <%d>", domNodeHasChildNodes) + if (!domNodeHasChildNodes) + { + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: No SI element present in the dom tree. Message corrupted.") + User::Leave( KErrCorrupt ); + } + + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: before calling getDocumentElement") + NW_DOM_ElementNode_t* siElement = + NW_DOM_DocumentNode_getDocumentElement( domNode ); + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: after calling getDocumentElement") + if (!siElement) + { + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: siElement is Null") + } + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: siElement is not Null, before leaving") + User::LeaveIfNull( siElement ); + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: siElement is not Null, after leaving if siElement is null") + + type = NW_DOM_Node_getNodeType( siElement ); + + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* name = NW_String_new(); + User::LeaveIfNull( name ); + // Let name be on the Cleanup Stack. + stringOwner->SetString( name ); + stat = NW_DOM_Node_getNodeName( siElement, name ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* nameBuf = NW_String_getStorage( name ); + NW_Uint16 nameLen = NW_String_getCharCount( name, iCharEncoding ); + TPtrC8 namePtr( nameBuf, nameLen ); + + // Now comes the validity check. + if ( type != NW_DOM_ELEMENT_NODE || namePtr.CompareF( KSi ) != 0 ) + { + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: Not si element node <%d>",type) + User::Leave( KErrArgument ); + } + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + + /********************************** + * ELEMENT indication + ***********************************/ + if ( NW_DOM_Node_hasChildNodes( siElement ) ) + { + NW_DOM_Node_t* node = NW_DOM_Node_getFirstChild( siElement ); + if (!node) + { + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: no si child nodes!") + } + User::LeaveIfNull( node ); + + // Find the indication element. + TBool indicationFound = EFalse; + do { + type = NW_DOM_Node_getNodeType( node ); + + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* name = NW_String_new(); + User::LeaveIfNull( name ); + stringOwner->SetString( name ); + stat = NW_DOM_Node_getNodeName( node, name ); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: getNodeName ErrCode: %d", NwxStatusToErrCode( stat )) + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* nameBuf = NW_String_getStorage( name ); + NW_Uint16 nameLen = NW_String_getCharCount( name, + iCharEncoding ); + TPtrC8 namePtr( nameBuf, nameLen ); + + if ( type == NW_DOM_ELEMENT_NODE && + namePtr.CompareF( KIndication ) == 0 ) + { + // We found the indication element. Parse it. + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: indication under si found.") + indicationFound = ETrue; + NW_DOM_ElementNode_t* indicationElement = + REINTERPRET_CAST( NW_DOM_ElementNode_t*, node ); + ParseIndicationL( *indicationElement ); + } + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + + if ( !indicationFound ) + { + // Iterate next. + node = NW_DOM_Node_getNextSibling( node ); + if ( !node ) + { + PUSHLOG_WRITE("CSIContentHandler::ParsePushMsgL: No more sibling.") + break; + } + } + + } while ( !indicationFound ); + } + + // Cleanup. + CleanupStack::PopAndDestroy( 2, &wbxmlDict ); // docTreeOwner, wbxmlDict + + if ( !ActionFlag() ) + { + // default if no action explicitly stated + iPushMsgAction = CSIPushMsgEntry::ESIPushMsgSignalMedium; + SetActionFlag( ETrue ); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParsePushMsgL: Defaulting to ActionFlag: %d",iPushMsgAction) + } + + iState = EProcessing; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSIContentHandler::ParsePushMsgL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ParseIndicationL +// --------------------------------------------------------- +// +void CSIContentHandler::ParseIndicationL( NW_DOM_ElementNode_t& aIndication ) + { + PUSHLOG_ENTERFN("CSIContentHandler::ParseIndicationL") + + NW_Status_t stat = NW_STAT_SUCCESS; + NW_DOM_NodeType_t type = 0; + + if ( NW_DOM_ElementNode_hasAttributes( &aIndication ) ) + { + NW_DOM_AttributeListIterator_t attrIter; + stat = NW_DOM_ElementNode_getAttributeListIterator + ( &aIndication, &attrIter ); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParseIndicationL: getAttribListIter ErrCode: %d", NwxStatusToErrCode( stat )) + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + + NW_DOM_AttributeHandle_t attrHandle; + while ( NW_DOM_AttributeListIterator_getNextAttribute + ( &attrIter, &attrHandle ) == NW_STAT_WBXML_ITERATE_MORE ) + { + ParseIndAttributeL( attrHandle ); + } + } + + /********************************** + * PCDATA of ELEMENT indication + ***********************************/ + if ( NW_DOM_Node_hasChildNodes( &aIndication ) ) + { + NW_DOM_TextNode_t* textNode = + NW_DOM_Node_getFirstChild( &aIndication ); + User::LeaveIfNull( textNode ); + + type = NW_DOM_Node_getNodeType( textNode ); + if ( type != NW_DOM_TEXT_NODE ) + { + PUSHLOG_WRITE_FORMAT("CSIContentHandler::ParseIndicationL: Not text node <%d>",type) + User::Leave( KErrArgument ); + } + + ParseTextL( *textNode ); + } + + PUSHLOG_LEAVEFN("CSIContentHandler::ParseIndicationL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ParseIndAttributeL +// --------------------------------------------------------- +// +void CSIContentHandler::ParseIndAttributeL( NW_DOM_AttributeHandle_t& + aAttrHandle ) + { + PUSHLOG_ENTERFN("CSIContentHandler::ParseIndAttributeL") + + NW_Status_t stat = NW_STAT_SUCCESS; + + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* attrName = NW_String_new(); + User::LeaveIfNull( attrName ); + stringOwner->SetString( attrName ); + + // Get the name of the attribute. + stat = NW_DOM_AttributeHandle_getName( &aAttrHandle, attrName ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* attrNameBuf = NW_String_getStorage( attrName ); + NW_Uint16 attrNameLen = NW_String_getCharCount( attrName, iCharEncoding ); + TPtrC8 attrNamePtr( attrNameBuf, attrNameLen ); + + if ( attrNamePtr.CompareF( KCreatedAttrib ) == 0 ) + { + if ( CreatedFlag() ) + { + PUSHLOG_WRITE(" created redefinition") + User::Leave( KErrCorrupt ); + } + else + { + TBool gotDate = AttributeToTTimeL( aAttrHandle, iCreatedTime ); + SetCreatedFlag( gotDate ); + PUSHLOG_WRITE_FORMAT(" iCreatedTime set %d",gotDate?1:0) + } + } + else if ( attrNamePtr.CompareF( KHrefAttrib ) == 0 ) + { + if ( HrefFlag() ) + { + PUSHLOG_WRITE(" href redefinition") + User::Leave( KErrCorrupt ); + } + else + { + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* val = NW_String_new(); + User::LeaveIfNull( val ); + stringOwner->SetString( val ); + stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val ); + if ( stat != NW_STAT_DOM_NO_STRING_RETURNED ) + { + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* storage = NW_String_getStorage( val ); + NW_Uint16 length = NW_String_getCharCount( val, + iCharEncoding ); + if ( length == 0 ) + { + // Zero length href attribute is considered as missing. + PUSHLOG_WRITE(" Zero length HrefFlag"); + } + else + { + TPtrC8 hrefPtr( storage, length ); + HBufC* tempHrefBuf = HBufC::NewMaxL( length ); + // No leavable after it!!! until... + tempHrefBuf->Des().Copy( hrefPtr ); + iHrefBuf = tempHrefBuf; // ...until here. + SetHrefFlag( ETrue ); + PUSHLOG_WRITE_FORMAT(" HrefFlag set <%S>",iHrefBuf); + } + } + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + } + } + else if ( attrNamePtr.CompareF( KExpiresAttrib ) == 0 ) + { + if ( ExpiresFlag() ) + { + PUSHLOG_WRITE(" expires redefinition") + User::Leave( KErrCorrupt ); + } + else + { + TBool gotDate = AttributeToTTimeL( aAttrHandle, iExpiresTime ); + SetExpiresFlag( gotDate ); + PUSHLOG_WRITE_FORMAT(" iExpiresTime set %d",gotDate?1:0) + } + } + else if ( attrNamePtr.CompareF( KSiIdAttrib ) == 0 ) + { + if ( SiIdFlag() ) + { + PUSHLOG_WRITE(" si-id redefinition") + User::Leave( KErrCorrupt ); + } + else + { + // It is expected to be String. + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* val = NW_String_new(); + User::LeaveIfNull( val ); + stringOwner->SetString( val ); + stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* storage = NW_String_getStorage( val ); + NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding ); + TPtrC8 siidPtr( storage, length ); + + iSiIdBuf = HBufC::NewMaxL( siidPtr.Length() ); + iSiIdBuf->Des().Copy( siidPtr ); + SetSiIdFlag( ETrue ); + PUSHLOG_WRITE_FORMAT(" SiIdFlag set <%S>",iSiIdBuf) + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + } + } + else if ( attrNamePtr.CompareF( KActionAttrib ) == 0 ) + { + if ( ActionFlag() ) + { + PUSHLOG_WRITE(" action redefinition") + User::Leave( KErrCorrupt ); + } + else + { + // It is expected to be String. + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* val = NW_String_new(); + User::LeaveIfNull( val ); + stringOwner->SetString( val ); + stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* storage = NW_String_getStorage( val ); + NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding ); + TPtrC8 actionPtr( storage, length ); + + iPushMsgAction = ConvertActionString( actionPtr ); + SetActionFlag( ETrue ); + PUSHLOG_WRITE_FORMAT(" ActionFlag: %d",iPushMsgAction) + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + } + } + else + { + __ASSERT_DEBUG( EFalse, + ContHandPanic( EPushContHandPanUnexpSiToken ) ); + } + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + + PUSHLOG_LEAVEFN("CSIContentHandler::ParseIndAttributeL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ParseTextL +// --------------------------------------------------------- +// +void CSIContentHandler::ParseTextL( NW_DOM_TextNode_t& aTextNode ) + { + PUSHLOG_ENTERFN("CSIContentHandler::ParseTextL") + + if ( DataFlag() ) + { + PUSHLOG_WRITE(" Data flag already set.") + } + else + { + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* data = NW_String_new(); + User::LeaveIfNull( data ); + stringOwner->SetString( data ); + NW_Status_t stat = NW_STAT_SUCCESS; + stat = NW_DOM_TextNode_getData( &aTextNode, data ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + + HBufC16* ucs2buffer = ConvertToUnicodeL( *data, iCharEncoding ); + // Be careful: ucs2buffer is not on the CleanupStack! + __ASSERT_DEBUG( ucs2buffer != 0, ContHandPanic( EPushContHandPanNullUcs2Buf ) ); + + TPtrC16 ucs2ptrC( *ucs2buffer ); + if ( ucs2ptrC.Length() == 0 ) + { + // Zero length data is considered as nothing. + PUSHLOG_WRITE(" Zero length Data"); + } + else + { + PUSHLOG_WRITE_FORMAT(" Data: <%S>",&ucs2ptrC); + + #ifdef __TEST_LOG__ + // Write out each unicode character identifier + TInt length = ucs2ptrC.Length(); + for (TInt logI=0;logI currChar; + currChar.Copy( ucs2ptrC.Mid( logI, /*aLength*/1 ) ); + PUSHLOG_WRITE_FORMAT2(" 0x%x %S",currChar[0],&currChar); + } + #endif // __TEST_LOG__ + + iData = ucs2buffer; // Ownership transferred. + ucs2buffer = NULL; + SetDataFlag( ETrue ); + } + + CleanupStack::PopAndDestroy( stringOwner ); + } + + PUSHLOG_LEAVEFN("CSIContentHandler::ParseTextL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ConvertToUnicodeL +// --------------------------------------------------------- +// +HBufC16* CSIContentHandler::ConvertToUnicodeL( const TDesC8& aSrc, TUint aCharSetId ) + { + PUSHLOG_ENTERFN("CSIContentHandler::ConvertToUnicodeL"); + + __ASSERT_DEBUG( aCharSetId != 0, ContHandPanic( EPushContHandPanNullCharSetId ) ); + + InitialiseCharacterSetConverterL(); + + HBufC16* ucs2buffer = NULL; // The return value. + TBool resultOnStack = EFalse; + + #ifdef __TEST_LOG__ + // Write out the original 8-bit buffer + TInt origiLength = aSrc.Length(); + for (TInt origiLogI=0;origiLogI currChar; // Only 16-bit buffer can be written out. + currChar.Copy( aSrc.Mid( origiLogI, /*aLength*/1 ) ); + PUSHLOG_WRITE_FORMAT2(" 0x%x %S",currChar[0],&currChar); + } + #endif // __TEST_LOG__ + + // Result + HBufC16* buffer = HBufC16::NewLC( KPushConversionBufferSize ); + PUSHLOG_WRITE(" buffer allocated"); + TPtr16 ptr( buffer->Des() ); + + // Prepare conversion for the given charset ID. + RFs& fs = iMsvSession->FileSession(); + iCharacterSetConverter->PrepareToConvertToOrFromL + ( aCharSetId, *iCharacterSetsAvailable, fs ); + PUSHLOG_WRITE(" PrepareToConvertToOrFromL OK"); + + TInt state = 0; + TInt remaining = iCharacterSetConverter->ConvertToUnicode( ptr, aSrc, state ); + PUSHLOG_WRITE_FORMAT(" remaining: %d",remaining); + while ( remaining >= 0 ) + { + if ( ucs2buffer == NULL ) + { + ucs2buffer = HBufC::NewLC( ptr.Length() ); + resultOnStack = ETrue; + } + else + { + __ASSERT_DEBUG( resultOnStack, + ContHandPanic( EPushContHandPanSiResNotOnStack ) ); + // This may change the address of ucs2buffer so we need to put + // it on the cleanup stack again!! + ucs2buffer = ucs2buffer->ReAllocL + ( ucs2buffer->Length() + ptr.Length() ); + CleanupStack::Pop(); // old ucs2buffer + CleanupStack::PushL( ucs2buffer ); // possibly new copy + PUSHLOG_WRITE(" ucs2buffer reallocated"); + } + TPtr16 ucs2ptr( ucs2buffer->Des() ); + ucs2ptr.Append( ptr ); + if ( remaining > 0 ) + { + // Try to convert all remaining characters. + ptr.Zero(); + remaining = iCharacterSetConverter->ConvertToUnicode + ( ptr, aSrc.Right( remaining ), state ); + PUSHLOG_WRITE_FORMAT(" remaining: %d",remaining); + } + else + { + PUSHLOG_WRITE(" break"); + break; + } + } + + if ( resultOnStack ) + { + CleanupStack::Pop(); // ucs2buffer + resultOnStack = EFalse; + } + + // ucs2buffer is not on the CleanupStack! + + CleanupStack::PopAndDestroy( buffer ); // buffer + + if ( ucs2buffer == NULL ) + { + PUSHLOG_WRITE(" NULL ucs2buffer - allocating an empty buf"); + ucs2buffer = KNullDesC().AllocL(); + } + else + { + // Check if first character is a Zero-width nbsp. + TPtrC16 ucs2ptrC( *ucs2buffer ); + if ( ucs2ptrC.Length() >= 1 && ucs2ptrC[0] == KPushZeroWidthNbsp ) + { + // First character is a Zero-width NBSP. This character is used as + // BOM in some encodings and should not be present at this point. + // But we are tolerant and remove it. + // (Not expecting big-endianness here.) + HBufC16* temp = ucs2buffer; + CleanupStack::PushL( temp ); + ucs2buffer = ucs2ptrC.Mid( 1 ).AllocL(); + CleanupStack::PopAndDestroy( temp ); // temp + PUSHLOG_WRITE(" BOM removed"); + } + else + { + PUSHLOG_WRITE(" No BOM"); + } + } + + + PUSHLOG_LEAVEFN("CSIContentHandler::ConvertToUnicodeL"); + return ucs2buffer; + } + +// --------------------------------------------------------- +// CSIContentHandler::ConvertToUnicodeL +// --------------------------------------------------------- +// +HBufC16* CSIContentHandler::ConvertToUnicodeL + ( NW_String_t& aString, NW_Uint32 aCharEncoding ) + { + PUSHLOG_ENTERFN("CSIContentHandler::ConvertToUnicodeL"); + + /* As cXmlLibrary does, we support only the following charsets: + #define HTTP_iso_10646_ucs_2 0x03E8 + #define HTTP_iso_8859_1 0x04 + #define HTTP_us_ascii 0x03 + #define HTTP_utf_8 0x6A + #define HTTP_utf_16 1015 + */ + TUint id = 0; + if ( aCharEncoding == HTTP_iso_10646_ucs_2 ) + { + id = KCharacterSetIdentifierUcs2; + PUSHLOG_WRITE(" KCharacterSetIdentifierUcs2") + } + else if ( aCharEncoding == HTTP_iso_8859_1 ) + { + id = KCharacterSetIdentifierIso88591; + PUSHLOG_WRITE(" KCharacterSetIdentifierIso88591") + } + else if ( aCharEncoding == HTTP_us_ascii ) + { + id = KCharacterSetIdentifierAscii; + PUSHLOG_WRITE(" KCharacterSetIdentifierAscii") + } + else if ( aCharEncoding == HTTP_utf_8 ) + { + id = KCharacterSetIdentifierUtf8; + PUSHLOG_WRITE(" KCharacterSetIdentifierUtf8") + } + else if ( aCharEncoding == HTTP_utf_16 ) // No such in CharConv.h + { + id = KCharacterSetIdentifierUcs2; + PUSHLOG_WRITE(" KCharacterSetIdentifierUcs2") + } + else + { + id = KCharacterSetIdentifierUtf8; // Defaulting to UTF-8 + PUSHLOG_WRITE(" DEFAULTING to KCharacterSetIdentifierUtf8"); + } + + PUSHLOG_WRITE_FORMAT(" id: 0x%x",id); + __ASSERT_DEBUG( id != 0, ContHandPanic( EPushContHandPanNullCharSetId ) ); + + // Source + PUSHLOG_WRITE_FORMAT(" Storage: 0x%x",NW_String_getStorage(&aString)); + PUSHLOG_WRITE_FORMAT(" Byte count: %d",NW_String_getByteCount(&aString)-1); + + // We will use NW_String_getByteCount(&aString)-1 as size, because + // NW_String_getByteCount(&aString) includes NULL terminator. + const TPtrC8 src( NW_String_getStorage(&aString), + NW_String_getByteCount(&aString)-1 ); + HBufC16* ucs2buffer = ConvertToUnicodeL( src, id ); + + PUSHLOG_LEAVEFN("CSIContentHandler::ConvertToUnicodeL"); + return ucs2buffer; + } + +// --------------------------------------------------------- +// CSIContentHandler::InitialiseCharacterSetConverterL +// --------------------------------------------------------- +// +void CSIContentHandler::InitialiseCharacterSetConverterL() + { + PUSHLOG_ENTERFN("CSIContentHandler::InitialiseCharacterSetConverterL") + + iCharacterSetConverter = CCnvCharacterSetConverter::NewL(); + + RFs& fs = iMsvSession->FileSession(); + iCharacterSetsAvailable = + CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL( fs ); + + PUSHLOG_LEAVEFN("CSIContentHandler::InitialiseCharacterSetConverterL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ConvertActionString +// --------------------------------------------------------- +// +TUint CSIContentHandler::ConvertActionString + ( const TDesC8& aActionString ) const + { + const TInt KMatchFound = 0; + + // set to default signal value (to rid ourselves of build warning) + TUint actionValue = CSIPushMsgEntry::ESIPushMsgSignalMedium; + + if ( aActionString.Compare( KDeleteAction ) == KMatchFound ) + { + actionValue = CSIPushMsgEntry::ESIPushMsgDelete; + } + else if ( aActionString.Compare( KSignalNone ) == KMatchFound ) + { + actionValue = CSIPushMsgEntry::ESIPushMsgSignalNone; + } + else if ( aActionString.Compare( KSignalLow ) == KMatchFound ) + { + actionValue = CSIPushMsgEntry::ESIPushMsgSignalLow; + } + else if ( aActionString.Compare( KSignalMedium ) == KMatchFound ) + { + actionValue = CSIPushMsgEntry::ESIPushMsgSignalMedium; + } + else if ( aActionString.Compare( KSignalHigh ) == KMatchFound ) + { + actionValue = CSIPushMsgEntry::ESIPushMsgSignalHigh; + } + + return actionValue; + } + +// --------------------------------------------------------- +// CSIContentHandler::SetSIPushMsgEntryFieldsL +// --------------------------------------------------------- +// +void CSIContentHandler::SetSIPushMsgEntryFieldsL( CSIPushMsgEntry& + aSIPushMsgEntry ) + { + PUSHLOG_ENTERFN("CSIContentHandler::SetSIPushMsgEntryFieldsL") + + if ( SiIdFlag() || HrefFlag() ) + { + if ( SiIdFlag() && ( HrefFlag() == EFalse ) ) + { + // Message has only si-id but no href. + aSIPushMsgEntry.SetIdL( *iSiIdBuf ); + } + else if ( HrefFlag() && ( SiIdFlag() == EFalse ) ) + { + // If message has no si-id but does have a href, use href as si-id. + aSIPushMsgEntry.SetIdL( *iHrefBuf ); + aSIPushMsgEntry.SetUrlL( *iHrefBuf ); + } + else + { + // Use si-id and href as is. + aSIPushMsgEntry.SetIdL( *iSiIdBuf ); + aSIPushMsgEntry.SetUrlL( *iHrefBuf ); + } + } + + __ASSERT_DEBUG( ActionFlag(), + ContHandPanic( EPushContHandPanUnspecSiAction ) ); + if ( ActionFlag() ) + { + aSIPushMsgEntry.SetAction( iPushMsgAction ); + } + else // default if no action explicitly stated + { + aSIPushMsgEntry.SetAction( CSIPushMsgEntry::ESIPushMsgSignalMedium ); + } + + // uses default null time value if no explicit date set in message + aSIPushMsgEntry.SetCreated( iCreatedTime ); + aSIPushMsgEntry.SetExpires( iExpiresTime ); + + // PCDATA (text) from message + if ( DataFlag() ) + { + aSIPushMsgEntry.SetTextL( *iData ); + } + + TPtrC8 msgHeaderPtr; + iMessage->GetHeader( msgHeaderPtr ); + aSIPushMsgEntry.SetHeaderL( msgHeaderPtr ); + + // Get server address. + TPtrC8 srvAddress; + if ( iMessage->GetServerAddress( srvAddress ) ) + { + aSIPushMsgEntry.SetFromL( srvAddress ); + } + + // First line in Inbox: TMsvEntry::iDetails. + if ( srvAddress.Length() == 0 ) + { + // Read from resource. + HBufC* details = + iStrRscReader->AllocReadResourceLC( R_PUSHMISC_UNK_SENDER ); + aSIPushMsgEntry.SetMsgDetailsL( *details ); + CleanupStack::PopAndDestroy( details ); + } + else + { + // Convert the "From" information to the format required by the UI + // spec and then decode it. + HBufC* details = iWapPushUtils->ConvertDetailsL( srvAddress ); + CleanupStack::PushL( details ); + HBufC* convertedFrom = + CPushMtmUtil::ConvertUriToDisplayFormL( *details ); + CleanupStack::PushL( convertedFrom ); + // + aSIPushMsgEntry.SetMsgDetailsL( *convertedFrom ); + // + CleanupStack::PopAndDestroy( 2, details ); // convertedFrom, details + } + + // Second line in Inbox: TMsvEntry::iDescription. + if ( DataFlag() ) + { + // Display SI message. + aSIPushMsgEntry.SetMsgDescriptionL( *iData ); + } + else + { + // Display URL. + __ASSERT_DEBUG( HrefFlag(), + ContHandPanic( EPushContHandPanUnspecSiHref ) ); + const TPtrC url = aSIPushMsgEntry.Url(); + HBufC* convertedUrl = CPushMtmUtil::ConvertUriToDisplayFormL( url ); + CleanupStack::PushL( convertedUrl ); + // + aSIPushMsgEntry.SetMsgDescriptionL( *convertedUrl ); + // + CleanupStack::PopAndDestroy( convertedUrl ); // convertedUrl + } + + // ******** Push MTM specific processing ********* + + /* + * Unfortunately in CPushMsgEntryBase there is no such functionality + * with which we can reach TMsvEntry as non-const, but we have to + * modify the entry's iMtmData2 member somehow. We can do it + * with either casting or with modifying and saving the entry + * manually after it has been saved by CSIPushMsgEntry. The latter + * solution is more expensive so we choose the first. + */ + TMsvEntry& tEntry = CONST_CAST( TMsvEntry&, aSIPushMsgEntry.Entry() ); + if ( HrefFlag() ) + { + CPushMtmUtil::SetAttrs( tEntry, EPushMtmAttrHasHref ); + } + else + { + CPushMtmUtil::ResetAttrs( tEntry, EPushMtmAttrHasHref ); + } + + // *** Set the entry to unread and new state. *** + + tEntry.SetNew( ETrue ); + tEntry.SetUnread( ETrue ); + + PUSHLOG_LEAVEFN("CSIContentHandler::SetSIPushMsgEntryFieldsL") + } + +// --------------------------------------------------------- +// CSIContentHandler::ProcessingPushMsgEntryL +// --------------------------------------------------------- +// +void CSIContentHandler::ProcessingPushMsgEntryL() + { + PUSHLOG_ENTERFN("CSIContentHandler::ProcessingPushMsgEntryL") + + TBool deletePushMsg( EFalse ); + + __ASSERT_DEBUG( ActionFlag(), + ContHandPanic( EPushContHandPanUnspecSiAction ) ); + + // S60 requirement: if both the href and the message is empty then + // delete the msg. + if ( HrefFlag() == EFalse && DataFlag() == EFalse ) + { + deletePushMsg = ETrue; + } + + // Expiration. + if ( !deletePushMsg && ExpiresFlag() ) + { + TTime today; + today.UniversalTime(); +#ifdef __TEST_LOG__ + _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" ); + _LIT( KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B" ); + TBuf<32> dateHolder; + TBuf<32> timeHolder; + today.FormatL( dateHolder, KDateFormat ); + today.FormatL( timeHolder, KTimeFormat ); + PUSHLOG_WRITE_FORMAT(" now date: <%S>",&dateHolder) + PUSHLOG_WRITE_FORMAT(" now time: <%S>",&timeHolder) + iExpiresTime.FormatL( dateHolder, KDateFormat ); + iExpiresTime.FormatL( timeHolder, KTimeFormat ); + PUSHLOG_WRITE_FORMAT(" exp date: <%S>",&dateHolder) + PUSHLOG_WRITE_FORMAT(" exp time: <%S>",&timeHolder) +#endif // __TEST_LOG__ + // check if message has expiry date before today's date + if ( iExpiresTime < today ) + { + PUSHLOG_WRITE("CSIContentHandler already expired") + deletePushMsg = ETrue; + } + } + + // An SI with the action attribute set to “delete” MUST have an + // explicitly assigned value for si-id. + if ( !deletePushMsg && ActionFlag() ) + { + if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgDelete ) + { + if ( !SiIdFlag() || ( SiIdFlag() && iSiIdBuf->Length() == 0 ) ) + { + deletePushMsg = ETrue; + } + } + } + + // Handling out of order delivery & Replacement. + TMsvId matchingEntryId = KMsvNullIndexEntryId; + + if ( !deletePushMsg && ( SiIdFlag() || HrefFlag() ) && CreatedFlag() ) + { + deletePushMsg = HandleMsgOrderReceptionL( matchingEntryId ); + } + + if ( !deletePushMsg && ActionFlag() ) + { + // SI with action=signal-none must not be presented to the end-user. + // Note. In S60 signal-none behaves the same as delete: the + // message is discarded after processing it! + if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgSignalNone ) + { + deletePushMsg = ETrue; + } + // SI with action=delete must also be discarded. + else if ( iPushMsgAction == CSIPushMsgEntry::ESIPushMsgDelete ) + { + deletePushMsg = ETrue; + } + } + + // Store message if not marked for deletion. + if ( !deletePushMsg ) + { + StoreSIMessageL( matchingEntryId ); + } + else + { + // The new entry must be discarded. + // Delete the corresponding matching entry, too. + if ( matchingEntryId != KMsvNullIndexEntryId ) + { + iWapPushUtils->DeleteEntryL( matchingEntryId ); + } + } + + iState = EDone; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSIContentHandler::ProcessingPushMsgEntryL") + } + +// --------------------------------------------------------- +// CSIContentHandler::StoreSIMessageL +// --------------------------------------------------------- +// +void CSIContentHandler::StoreSIMessageL( TMsvId aMatchingEntryId ) + { + PUSHLOG_ENTERFN("CSIContentHandler::StoreSIMessageL") + + CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL(); + CleanupStack::PushL( siEntry ); + + if ( aMatchingEntryId != KMsvNullIndexEntryId ) + { + PUSHLOG_WRITE("Matching SI found"); + //Delete this old entry + iWapPushUtils->DeleteEntryL( aMatchingEntryId ); + } + + SetSIPushMsgEntryFieldsL( *siEntry ); + iSavedMsgId = siEntry->SaveL( *iMsvSession, KMsvGlobalInBoxIndexEntryId ); + +#ifdef __TEST_LOG__ + _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" ); + _LIT( KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B" ); + TBuf<32> dateHolder; + TBuf<32> timeHolder; + TTime recDateTime = siEntry->ReceivedDate(); + recDateTime.FormatL( dateHolder, KDateFormat ); + recDateTime.FormatL( timeHolder, KTimeFormat ); + PUSHLOG_WRITE_FORMAT(" rec date: <%S>",&dateHolder) + PUSHLOG_WRITE_FORMAT(" rec time: <%S>",&timeHolder) +#endif // __TEST_LOG__ + + CleanupStack::PopAndDestroy( siEntry ); // siEntry + + PUSHLOG_LEAVEFN("CSIContentHandler::StoreSIMessageL") + } + +// --------------------------------------------------------- +// CSIContentHandler::HandleMsgOrderReceptionL +// --------------------------------------------------------- +// +TBool CSIContentHandler::HandleMsgOrderReceptionL( TMsvId& aMatchingEntryId ) + { + PUSHLOG_ENTERFN("CSIContentHandler::HandleMsgOrderReceptionL") + + __ASSERT_DEBUG( ( SiIdFlag() || HrefFlag() ), + ContHandPanic( EPushContHandPanNoSiIdOrHrefAttr ) ); + __ASSERT_DEBUG( CreatedFlag(), + ContHandPanic( EPushContHandPanNoCreatedAttr ) ); + + CMsvEntrySelection* matchingIdList = NULL; + TBool discardPushMsg( EFalse ); + + // Get list of matching stored SI messages. + if ( SiIdFlag() && iSiIdBuf->Length() != 0 ) + { + matchingIdList = iWapPushUtils->FindSiIdLC( *iSiIdBuf ); + } + else // HrefFlag() + { + // Use href as si-id. + matchingIdList = iWapPushUtils->FindSiIdLC( *iHrefBuf ); + } + const TInt matchingListCount( matchingIdList->Count() ); + // Note that the count can be greater than 1. + + PUSHLOG_WRITE_FORMAT("CSIContentHandler Count: %d",matchingListCount) + + if ( 0 < matchingListCount && CreatedFlag() ) + { + CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL(); + CleanupStack::PushL( siEntry ); + + // Delete older stored messages and/or mark current message for + // deletion if same date or older than stored messages + TBool foundOneToBeReplaced = EFalse; + for ( TInt count = 0; count < matchingListCount; ++count ) + { + TMsvId matchingSiMsgEntryId( matchingIdList->At(count) ); + + siEntry->RetrieveL( *iMsvSession, matchingSiMsgEntryId ); + + // Skip date comparisons if creation date not valid - + // SI without created attribute never gets replaced. + TTime existingSiCreatedTime( siEntry->Created() ); + + if ( existingSiCreatedTime == Time::NullTTime() ) + { + // continue; + } + else + { + __ASSERT_DEBUG( !foundOneToBeReplaced, + ContHandPanic( EPushContHandPanTooManySi ) ); + if ( foundOneToBeReplaced ) + { + PUSHLOG_WRITE(" Already found one") + // Only one SI has to be found. + // If the program runs into it, then make a + // garbage collection to ensure consistency and + // remove other messages found. + iWapPushUtils->DeleteEntryL( matchingSiMsgEntryId ); + // After the 'for' only one SI is allowed that has created + // attribute. + } + else + { + foundOneToBeReplaced = ETrue; // A match was found. + // Check if received SI is newer than existing stored Si + // (out of order). + if ( iCreatedTime > existingSiCreatedTime ) + { + PUSHLOG_WRITE(" Replacing...") + // The new SI replaces the existing. + aMatchingEntryId = matchingSiMsgEntryId; + discardPushMsg = EFalse; + } + else if ( iCreatedTime <= existingSiCreatedTime ) + { + PUSHLOG_WRITE(" Discarding...") + // Received SI is older than existing stored Si. + discardPushMsg = ETrue; + } + } + } + } + + CleanupStack::PopAndDestroy( siEntry ); // siEntry + } + + CleanupStack::PopAndDestroy( matchingIdList ); // matchingIdList + + PUSHLOG_LEAVEFN("CSIContentHandler::HandleMsgOrderReceptionL") + return discardPushMsg; + } + +// --------------------------------------------------------- +// CSIContentHandler::ConvertDateTimeL +// --------------------------------------------------------- +// +TBool CSIContentHandler::ConvertDateTimeL( const TDesC& aDateTime, + TTime& aConvertedDate ) const + { + PUSHLOG_ENTERFN("CSIContentHandler::ConvertDateTimeL") + + TTime convertedTime = Time::NullTTime(); + TBool convertedOK = EFalse; + + // check supplied descriptor is the correct length + if ( aDateTime.Length() != KValidUTCLength ) + { + PUSHLOG_WRITE_FORMAT(" invalid UTC length <%d>",aDateTime.Length()) + User::Leave( KErrCorrupt ); + } + else + { + TBuf str = aDateTime; + PUSHLOG_WRITE_FORMAT(" datetime str: <%S>",&str) + if ( !IsValidUTCTime( str ) ) + { + // The UTC time is invalid. + PUSHLOG_WRITE(" invalid UTC time") + User::Leave( KErrCorrupt ); + } + else + { + // Now 'str' is in format YYYYMMDD:HHMMSS + // Adjust UTC time to zero offset TTime. Only month and day + // is effected. + const TInt KFirstMonthChar = KValidTTimeMonthStart; + const TInt KSecondMonthChar = KFirstMonthChar + 1; + const TInt KFirstDayChar = KValidTTimeDayStart; + const TInt KSecondDayChar = KFirstDayChar + 1; + // Month. + // check for special case of month = 10 which becomes 09 + if ( str[KFirstMonthChar] == '1' && str[KSecondMonthChar] == '0' ) + { + str[KFirstMonthChar] = '0'; + str[KSecondMonthChar] = '9'; + } + else + { + // month value is either 11, 12 or less than 10, ie 1 - 9. + // reduce day by one, eg 11 becomes 10, 12 becomes 11, 09 becomes 08 + str[KSecondMonthChar]--; + } + + // Day. + // check for special cases 10, 20, 30 + if ( str[KSecondDayChar] == '0' ) + { + // reduce day by 1, ie 10 becomes 09, 20 becomes 19 ... + str[KSecondDayChar] = '9'; + str[KFirstDayChar]--; + } + else + { + // day value is between 1 and 9 so reduce day by one + // eg 29 becomes 28, 11 bcomes 10, 31 becomes 30 + str[KSecondDayChar]--; + } + + // string is now syntaxically correct, but Set() will return an + // error if it's semantically incorrect. + User::LeaveIfError( convertedTime.Set( str ) ); + convertedOK = ETrue; + } + } + + PUSHLOG_LEAVEFN("CSIContentHandler::ConvertDateTimeL") + aConvertedDate = convertedTime; + return convertedOK; + } + +// --------------------------------------------------------- +// CSIContentHandler::ConvertOpaqueToUtcL +// --------------------------------------------------------- +// +HBufC* CSIContentHandler::ConvertOpaqueToUtcL( const TDesC8& aOpaque ) const + { + PUSHLOG_ENTERFN("CSIContentHandler::ConvertOpaqueToUtcL") + + const TInt opaqueSize = aOpaque.Size(); + if ( KValidMaxEncodedDateTimeSize < opaqueSize ) + { + PUSHLOG_WRITE_FORMAT(" Bad OPAQUE size: <%d>",opaqueSize) + User::Leave( KErrCorrupt ); + } + + HBufC* converted = HBufC::NewMaxLC( KValidUTCLength ); + TPtr convertedPtr = converted->Des(); + convertedPtr.SetLength( 0 ); // Reset. + + // Split up each opaque byte to two bytes. + TUint8 byte( 0x00 ); + TUint8 high( 0x00 ); + TUint8 low( 0x00 ); + TInt i = 0; + for ( i = 0; i < opaqueSize; ++i ) + { + byte = aOpaque[i]; + high = (TUint8)( (byte & 0xF0) >> 4 ); + low = (TUint8)( byte & 0x0F ); + // Check high and low if they are in the range [0-9]. + if ( 9 < high || 9 < low ) + { + PUSHLOG_WRITE_FORMAT2(" Overflow: <%d, %d>",high,low) + User::Leave( KErrOverflow ); + } + convertedPtr.Append( TChar(KAsciiZeroCharCode + high) ); + convertedPtr.Append( TChar(KAsciiZeroCharCode + low) ); + } + + // A valid UTC %Datetime contains 14 numerical characters and 6 + // non-numerical: “1999-04-30T06:40:00Z”. + // So fill the remaining bytes with zeros. + for ( i = convertedPtr.Length(); i < KValidUTCNumericals; ++i ) + { + convertedPtr.Append( TChar('0') ); + } + + // Insert the necessary non-numerical boundary characters. + i = 0; + // Skip year and insert '-'. (Don't forget to increase i with 1 each time!) + i += KValidUTCYearBlockLength; + convertedPtr.Insert( i++, KCharMinus ); + // Skip month and insert '-'. + i += KValidUTCOtherBlockLength; + convertedPtr.Insert( i++, KCharMinus ); + // Skip day and insert 'T'. + i += KValidUTCOtherBlockLength; + convertedPtr.Insert( i++, KCharT ); + // Skip hour and insert ':'. + i += KValidUTCOtherBlockLength; + convertedPtr.Insert( i++, KCharColon ); + // Skip minute and insert ':'. + i += KValidUTCOtherBlockLength; + convertedPtr.Insert( i++, KCharColon ); + // Skip second and insert 'Z'. + i += KValidUTCOtherBlockLength; + convertedPtr.Insert( i++, KCharZ ); + + CleanupStack::Pop( converted ); // converted + PUSHLOG_LEAVEFN("CSIContentHandler::ConvertOpaqueToUtcL") + return converted; + } + +// --------------------------------------------------------- +// CSIContentHandler::IsValidUTCTime +// --------------------------------------------------------- +// +TBool CSIContentHandler::IsValidUTCTime( TDes& aDateTime ) const + { + PUSHLOG_ENTERFN("CSIContentHandler::IsValidUTCTime") + + TBool isValid( ETrue ); // Return value. + + // Now aDateTime has to be in format YYYY-MM-DDTHH:MM:SSZ + + // check supplied descriptor is the correct length + if ( aDateTime.Length() != KValidUTCLength ) + { + PUSHLOG_WRITE_FORMAT(" invalid UTC length <%d>",aDateTime.Length()) + isValid = EFalse; + } + else + { + // strip out formatting characters + TInt formatCharPos = 4; + aDateTime.Delete( formatCharPos, 1 ); + // now move through two characters at a time and remove other chars + // to just leave digits + const TInt KRemainingFormatChars = 5; + TInt i( 0 ); + for ( i = 0; i < KRemainingFormatChars; ++i ) + { + formatCharPos += 2; + aDateTime.Delete( formatCharPos, 1 ); + } + + // Now aDateTime has to be in format YYYYMMDDHHMMSS + + __ASSERT_DEBUG( aDateTime.Length() == KValidTTimeLength, + ContHandPanic( EPushContHandPanBadTTimeLength ) ); + + // now have UTC string stripped of format characters - check remaining + // characters are all digits - YYYYMMDDHHMMSS + TChar ch; + for ( i = 0; i < KValidTTimeLength; ++i ) + { + ch = aDateTime[i]; + if ( ch.IsDigit() == EFalse ) + { + PUSHLOG_WRITE_FORMAT(" not digit <%d>",i) + isValid = EFalse; + } + } + + if ( isValid ) + { + /* + In YYYYMMDDHHMMSS + YYYY = 4 digit year ("0000" ... "9999") + MM = 2 digit month ("01"=January, "02"=February ... "12"=December) + DD = 2 digit day ("01", "02" ... "31") + HH = 2 digit hour, 24-hour timekeeping system ("00" ... "23") + MM = 2 digit minute ("00" ... "59") + SS = 2 digit second ("00" ... "59") + */ + TInt err; + TUint val; + // Do not check year. There are no restrictions. + // Check month. + TLex parser( aDateTime.Mid( KValidTTimeMonthStart, + KValidTTimeBlockLength ) ); + err = parser.Val( val, EDecimal ); + if ( err ) + { + isValid = EFalse; + PUSHLOG_WRITE_FORMAT(" parser err: <%d>",err) + } + else + { + PUSHLOG_WRITE_FORMAT(" month: <%d>",val) + if ( val < 1 || 12 < val ) + { + isValid = EFalse; + } + } + // Check day. + if ( isValid ) + { + parser = aDateTime.Mid( KValidTTimeDayStart, + KValidTTimeBlockLength ); + err = parser.Val( val, EDecimal ); + if ( err ) + { + isValid = EFalse; + PUSHLOG_WRITE_FORMAT(" parser err: <%d>",err) + } + else + { + PUSHLOG_WRITE_FORMAT(" day: <%d>",val) + if ( val < 1 || 31 < val ) + { + isValid = EFalse; + } + } + } + // Check hour. + if ( isValid ) + { + parser = aDateTime.Mid( KValidTTimeHourStart, + KValidTTimeBlockLength ); + err = parser.Val( val, EDecimal ); + if ( err ) + { + isValid = EFalse; + PUSHLOG_WRITE_FORMAT(" parser err: <%d>",err) + } + else + { + PUSHLOG_WRITE_FORMAT(" hour: <%d>",val) + if ( 23 < val ) + { + isValid = EFalse; + } + } + } + // Check minute. + if ( isValid ) + { + parser = aDateTime.Mid( KValidTTimeMinuteStart, + KValidTTimeBlockLength ); + err = parser.Val( val, EDecimal ); + if ( err ) + { + isValid = EFalse; + PUSHLOG_WRITE_FORMAT(" parser err: <%d>",err) + } + else + { + PUSHLOG_WRITE_FORMAT(" min: <%d>",val) + if ( 59 < val ) + { + isValid = EFalse; + } + } + } + // Check second. + if ( isValid ) + { + parser = aDateTime.Mid( KValidTTimeSecondStart, + KValidTTimeBlockLength ); + err = parser.Val( val, EDecimal ); + if ( err ) + { + isValid = EFalse; + PUSHLOG_WRITE_FORMAT(" parser err: <%d>",err) + } + else + { + PUSHLOG_WRITE_FORMAT(" sec: <%d>",val) + if ( 59 < val ) + { + isValid = EFalse; + } + } + } + + // insert colon seperating date from time + const TInt KColonPosition = 8; + aDateTime.Insert( KColonPosition, KCharColon ); + + // Now aDateTime has to be in format YYYYMMDD:HHMMSS + } + } + + PUSHLOG_LEAVEFN("CSIContentHandler::IsValidUTCTime") + return isValid; // aDateTime contains a modified buffer. + } + +// --------------------------------------------------------- +// CSIContentHandler::AttributeToTTimeL +// --------------------------------------------------------- +// +TBool CSIContentHandler::AttributeToTTimeL + ( NW_DOM_AttributeHandle_t& aAttrHandle, + TTime& aConvertedDate ) const + { + PUSHLOG_ENTERFN("CSIContentHandler::AttributeToTTimeL") + + TBool gotDate = EFalse; + NW_Status_t stat = NW_STAT_SUCCESS; + NW_DOM_AttrVal_t attrVal; + + // It is expected to be String or Opaque. + // It may be Opaque, to which we will need a NW_DOM_AttrVal_t structure. + stat = NW_DOM_AttributeHandle_getNextVal( &aAttrHandle, &attrVal ); + + if ( stat != NW_STAT_WBXML_ITERATE_MORE ) + { + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + } + else + { + NW_Uint16 valType = NW_DOM_AttrVal_getType( &attrVal ); + + if ( valType == NW_DOM_ATTR_VAL_STRING ) + { + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* val = NW_String_new(); + User::LeaveIfNull( val ); + stringOwner->SetString( val ); + // + stat = NW_DOM_AttrVal_toString( &attrVal, val, iCharEncoding ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* storage = NW_String_getStorage( val ); + NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding ); + TPtrC8 dataPtr( storage, length ); + HBufC* dataBuf = HBufC::NewMaxLC( dataPtr.Length() ); + dataBuf->Des().Copy( dataPtr ); + gotDate = ConvertDateTimeL( *dataBuf, aConvertedDate ); + + CleanupStack::PopAndDestroy( 2, stringOwner ); // dataBuf, + // stringOwner + } + else if ( valType == NW_DOM_ATTR_VAL_OPAQUE ) + { + NW_Uint32 len = 0; + NW_Byte* data = NW_DOM_AttrVal_getOpaque( &attrVal, &len ); + User::LeaveIfNull( data ); + TPtrC8 dataPtr( data, len ); + + HBufC* dateTime = ConvertOpaqueToUtcL( dataPtr ); + CleanupStack::PushL( dateTime ); + gotDate = ConvertDateTimeL( *dateTime, aConvertedDate ); + CleanupStack::PopAndDestroy( dateTime ); // dateTime + } + else + { + User::Leave( KErrNotSupported ); + } + } + + PUSHLOG_LEAVEFN("CSIContentHandler::AttributeToTTimeL") + return gotDate; // aConvertedDate contains the result. + } + +// --------------------------------------------------------- +// CSIContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CSIContentHandler::HandleMessageL( CPushMessage* aPushMsg, + TRequestStatus& aStatus ) + { + PUSHLOG_ENTERFN("CSIContentHandler::HandleMessageL") + + __ASSERT_DEBUG( aPushMsg != NULL, + ContHandPanic( EPushContHandPanMsgNull ) ); + +#ifdef __TEST_LOG__ + TPtrC8 bodyPtr; + aPushMsg->GetMessageBody( bodyPtr ); + PUSHLOG_HEXDUMP( bodyPtr ) +#endif // __TEST_LOG__ + + iMessage = aPushMsg; + iAcknowledge = ETrue; + SetConfirmationStatus( aStatus ); + + iState = EGarbageCollecting; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSIContentHandler::HandleMessageL") + } + +// --------------------------------------------------------- +// CSIContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CSIContentHandler::HandleMessageL( CPushMessage* aPushMsg ) + { + PUSHLOG_ENTERFN("CSIContentHandler::HandleMessageL") + + __ASSERT_DEBUG( aPushMsg != NULL, + ContHandPanic( EPushContHandPanMsgNull ) ); + +#ifdef __TEST_LOG__ + TPtrC8 bodyPtr; + aPushMsg->GetMessageBody( bodyPtr ); + PUSHLOG_HEXDUMP( bodyPtr ) +#endif // __TEST_LOG__ + + iAcknowledge = EFalse; + iMessage = aPushMsg; + + iState = EGarbageCollecting; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSIContentHandler::HandleMessageL") + } + +// --------------------------------------------------------- +// CSIContentHandler::CancelHandleMessage +// --------------------------------------------------------- +// +void CSIContentHandler::CancelHandleMessage() + { + PUSHLOG_ENTERFN("CSIContentHandler::CancelHandleMessage") + Cancel(); + PUSHLOG_LEAVEFN("CSIContentHandler::CancelHandleMessage") + } + +// --------------------------------------------------------- +// CSIContentHandler::CPushHandlerBase_Reserved1 +// --------------------------------------------------------- +// +void CSIContentHandler::CPushHandlerBase_Reserved1() + { + } + +// --------------------------------------------------------- +// CSIContentHandler::CPushHandlerBase_Reserved2 +// --------------------------------------------------------- +// +void CSIContentHandler::CPushHandlerBase_Reserved2() + { + } + +// --------------------------------------------------------- +// CSIContentHandler::DoCancel +// --------------------------------------------------------- +// +void CSIContentHandler::DoCancel() + { + PUSHLOG_ENTERFN("CSIContentHandler::DoCancel") + Complete( KErrCancel ); + PUSHLOG_LEAVEFN("CSIContentHandler::DoCancel") + } + +// --------------------------------------------------------- +// CSIContentHandler::RunL +// --------------------------------------------------------- +// +void CSIContentHandler::RunL() + { + // Handle errors in RunError(). + PUSHLOG_WRITE_FORMAT("iStatus.Int(): %d",iStatus.Int()) + User::LeaveIfError( iStatus.Int() ); + + // use active state machine routine to manage activites: + switch ( iState ) + { + case EGarbageCollecting: + { + CollectGarbageL(); + break; + } + case EFilteringAndParsing: + { + if ( !FilterPushMsgL() ) + { + // It did not pass the filter. Done. + iState = EDone; + IdleComplete(); + } + else + { + // Continue. + TInt ret = KErrNone; + PUSHLOG_WRITE("CSIContentHandler::RunL : before trapping parsing.") + TRAP(ret, ParsePushMsgL()); + PUSHLOG_WRITE_FORMAT("CSIContentHandler::RunL : after trapping parsing. ret = %d", ret) + if ( ret != KErrNone) + { + PUSHLOG_WRITE("CSIContentHandler::RunL : Parsing failed. discarding message.") + iState = EDone; + IdleComplete(); + } + } + break; + } + case EProcessing: + { + ProcessingPushMsgEntryL(); + break; + } + case EDone: + { + PUSHLOG_WRITE("CSIContentHandler EDone") + Complete( KErrNone ); + break; + } + default: + { + // JIC. + PUSHLOG_WRITE("CSIContentHandler default Done") + Complete( KErrNone ); + break; + } + } + } + +// --------------------------------------------------------- +// CSIContentHandler::RunError +// --------------------------------------------------------- +// +TInt CSIContentHandler::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CSIContentHandler::RunError: %d",aError) + + iState = EDone; + Complete( aError ); + return KErrNone; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CSIContentHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CSIContentHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,436 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CSIContentHandler. +* +*/ + + + +#ifndef __CSICONTENTHANDLER_H__ +#define __CSICONTENTHANDLER_H__ + + +// INCLUDE FILES + +#include "CPushContentHandlerBase.h" +#include "PushContentHandlerDef.hrh" +#include +#include +#include +#include + +// CONSTANTS + +const TUid KUidPushSIContentHandler = { EUidPushSIContentHandler }; +_LIT(KSIContentHandlerData,"text/vnd.wap.si||application/vnd.wap.sic"); + +// FORWARD DECLARATIONS + +class CSIPushMsgEntry; + +// CLASS DECLARATION + +/** +* CSIContentHandler handles Service Indication content +* +* This handler takes ownership of the SI message and processes it +* according to the Reception rules +* [WAP Service Indication version 31-July-2001] +* and either stores the message or deletes it. +* Also S60 specific requirements are applied. +* +* OVERVIEW: +* The main body of this class and its functionality lies within +* HandleMessage (asynchonous). This : +* 1. takes ownership of the push message +* 2. validates the message and generates a parsed document tree +* 3. extracts the message attribute values from document tree +* 4. processes the received message +* 5. finishes +* +* NB: A received message with no creation date will be stored (unless +* its action is set to delete or the expiry condition is met). This +* means that the si-id in the message store will not be unique. +*/ +class CSIContentHandler : public CPushContentHandlerBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed object. + */ + static CSIContentHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CSIContentHandler(); + + private: // Constructors + + /** + * Constructor. + */ + CSIContentHandler(); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + private: // New functions + + /** + * Do Garbage Collection synchronously. + * @return None. + */ + void CollectGarbageL(); + + /** + * Parse the current message. If the SI is wbxml encoded then it is + * decoded first to XML format. Then the message details (attributes) + * are earned from the XML tree. + * @return None. + */ + void ParsePushMsgL(); + + /** + * Parse the indication element. + * @param aIndication The element to be parsed. + * @return None. + */ + void ParseIndicationL( NW_DOM_ElementNode_t& aIndication ); + + /** + * Parse an attribute of the indication element. + * @param aAttrHandle The attribute to be parsed. + * @return None. + */ + void ParseIndAttributeL( NW_DOM_AttributeHandle_t& aAttrHandle ); + + /** + * Parse the text of the indication element. + * @param aTextNode The text node to be parsed. + * @return None. + */ + void ParseTextL( NW_DOM_TextNode_t& aTextNode ); + + + /** + * Converts the given buffer to unicode (UCS-2). + * @param aSrc Source text. + * @param aCharSetId Character set ID. + * @return The UCS-2 unicode buffer. + */ + HBufC16* ConvertToUnicodeL( const TDesC8& aSrc, TUint aCharSetId ); + + /** + * Converts the given buffer to unicode (UCS-2). + * @param aString Source text. + * @param aCharEncoding Character encoding. + * @return The UCS-2 unicode buffer. + */ + HBufC16* ConvertToUnicodeL( NW_String_t& aString, NW_Uint32 aCharEncoding ); + + /** + * Initialise the converter. + * @return None. + */ + void InitialiseCharacterSetConverterL(); + + + /** + * Convert the action string to a representative numeric value to + * facilitate storing the message. + * @param aActionString The attribute value indicating the action level + * eg 'signal-high' + * @return TUint: a value representing the action type. + */ + TUint ConvertActionString( const TDesC8& aActionString ) const; + + /** + * The entry fields are set to the correct values. + * @return None. + */ + void SetSIPushMsgEntryFieldsL( CSIPushMsgEntry& aSIPushMsgEntry ); + + /** + * Do the final processing of the message according to the OMA and S60 + * requirements. + * @return None. + */ + void ProcessingPushMsgEntryL(); + + /** + * Store the new message to Messaging. + * @param aMatchingEntryId ID of the matching SI entry. + * @return None. + */ + void StoreSIMessageL( TMsvId aMatchingEntryId ); + + /** + * Handle message order reception. + * NB: A received message with no creation date will be stored (unless + * its action is set to delete or the expiry condition is met). This + * means that the si-id in the message store will not be unique. + * @param aMatchingEntryId ID of the matching SI entry. + * It is changed only if the function returns EFalse (replace)! + * @return ETrue if the entry has to be discarded. + */ + TBool HandleMsgOrderReceptionL( TMsvId& aMatchingEntryId ); + + // conversion utilities + + /** + * Convert UTC date time into native TTime format. Method can leave. + * @param aDateTime The UTC string representing the date and time. + * @param aConvertedDate Member date variable passed in to accept + * converted UTC date as TTime varaible. + * @return TBool indicates if conversion successful (ETrue) or + * conversion failed (EFalse) + */ + TBool ConvertDateTimeL( const TDesC& aDateTime, + TTime& aConvertedDate ) const; + + /** + * Convert OPAQUE data to UTC date time as specified in SI spec. + * @param aOpaque OPAQUE data. + * @return The UTC time. + */ + HBufC* ConvertOpaqueToUtcL( const TDesC8& aOpaque ) const; + + /** + * Check given UTC time string conforms to expected format: + * YYYY-MM-DDTHH:MM:SSZ and strip out formatting characters + * then validate the remaining characters are all digits. + * If validated then add TTime formating character so final + * string returned will be of the format YYYYMMDD:HHMMSS. + * @param aDateTime UTC string which is validated and returned. + * @return boolean: indicates if given date is valid (ETrue) + * or not (EFalse) + */ + TBool IsValidUTCTime( TDes& aDateTime ) const; + + /** + * Convert OPAQUE or STRING attribute to TTime. + * @param aAttrHandle Handle to the attribute. + * @param aConvertedDate The resulted TTime. + * @return ETrue if the conversion succeeded. + */ + TBool AttributeToTTimeL( NW_DOM_AttributeHandle_t& aAttrHandle, + TTime& aConvertedDate ) const; + + // Attribute flags + + /** + * Flag whether message has an action attribute + * @param aAction boolean to set flag to - + * ETrue for action attrib present + * EFalse for no action attrib. + */ + inline void SetActionFlag( TBool aAction ); + + /** + * Check status of action flag to see if message has an action + * attribute. + * @return TBool ETrue - action attribute present in message + * EFalse - no action attribute. + */ + inline TBool ActionFlag() const; + + /** + * Flag whether message has a created date attribute. + * @param aCreated boolean to set flag to - + * ETrue for si-created attrib present + * EFalse for no si-created attrib + */ + inline void SetCreatedFlag( TBool aCreated ); + + /** + * Check status of created flag to see if message has a si-created + * attribute. + * @return TBool ETrue - si-created attribute present in message + * EFalse - no si-created attribute + */ + inline TBool CreatedFlag() const; + + /** + * Flag whether message has a Href attribute + * @param aHref boolean to set flag to - + * ETrue for Href attrib present + * EFalse for no href attrib + */ + inline void SetHrefFlag( TBool aHref ); + + /** + * Check status of href flag to see if message has an href attribute. + * @return TBool + * ETrue - href attribute present in message + * EFalse - no href attribute + */ + inline TBool HrefFlag() const; + + /** + * Flag whether message has an expiry date attribute (si-expires). + * @param aExpires boolean to set flag to - + * ETrue for si-expires present + * EFalse for no si-expires date + */ + inline void SetExpiresFlag( TBool aExpires ); + + /** + * Check status of flag to see if message has an expiry date attribute. + * @return TBool + * ETrue - si-expires attribute present in message + * EFalse - no si-expires attribute + */ + inline TBool ExpiresFlag() const; + + /** + * Flag whether message has a si-id attribute + * @param aSiId boolean to set flag to - + * ETrue for si-id attrib present + * EFalse for no si-id attrib + */ + inline void SetSiIdFlag( TBool aSiId ); + + /** + * Check status of flag to see if message has an si-id attribute. + * @return TBool + * ETrue - si-id attribute present in message + * EFalse - no si-id attribute + */ + inline TBool SiIdFlag() const; + + /** + * Flag whether message has a Data attribute (text) + * @param aData + * boolean to set flag to - ETrue for data attrib present + * EFalse for no data attrib + */ + inline void SetDataFlag( TBool aData ); + + /** + * Check status of data flag to see if message has any data. + * @return TBool + * ETrue - data attribute present in message + * EFalse - no data attribute + */ + inline TBool DataFlag() const; + + private: // Methods from CPushHandlerBase + + /** + * HandleMessage Async. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * @param aPushMsg CPushMessage to process. + * @param aStatus Request status variable for use in asynchronous + * operations. + * @return None. + */ + void HandleMessageL( CPushMessage* aPushMsg, TRequestStatus& aStatus ); + + /** + * HandleMessage Sync. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * Initial State: Set data members then go to the next state + * @param aPushMsg CPushMessage to process. + */ + void HandleMessageL( CPushMessage* aPushMsg ); + + /** + * Same functionality as DoCancel() + */ + void CancelHandleMessage(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved1(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved2(); + + private: // Methods from CActive + + /** + * Terminates any activity + * @return None. + */ + void DoCancel(); + + /** + * Step through the various representative states for handling a message + * States: + * EGarbageCollecting - Deleting expired SI msgs from messaging + * EFilteringAndParsing - Filter push msg according to Service message + * settings and Parses SI push message (retrieving the + * attributes) + * EProcessing - Processing the current entry. OMA and S60 rules are + * applied, then save or update SI msg in the Msg store + * EDone - Clean up, complete observer + * @return None. + */ + void RunL(); + + /** + * This is invoked when RunL Leaves with an error so clean up and + * return. + * @return Error code to scheduler. + */ + TInt RunError(TInt aError); + + private: // Data + + enum + { + EAction = 0x01, + ECreated = 0x02, + EHref = 0x04, + EExpires = 0x08, + ESiId = 0x10, + EData = 0x20 + }; + + enum TState + { + EGarbageCollecting, + EFilteringAndParsing, + EProcessing, + EDone + }; + + TMsvId iSavedMsgId; ///< ID of the message saved. + TUint32 iAttributes; ///< Attribute indication (set or not). + TInt iPushMsgAction; ///< Action attribute + HBufC* iHrefBuf; ///< Href attribute. Has. + HBufC* iSiIdBuf; ///< Si-id attribute. Has. + TTime iExpiresTime; ///< Expiration attribute. + TTime iCreatedTime; ///< Created attribute. + HBufC* iData; ///< Message text. Has. + + NW_Uint32 iCharEncoding; ///< Char encoding of the current msg. + + // + CCnvCharacterSetConverter* iCharacterSetConverter; ///< Owned. + CArrayFix* iCharacterSetsAvailable; ///< Owned. + }; + +#include "CSIContentHandler.inl" + +#endif // __CSICONTENTHANDLER_H__ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CSIContentHandler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CSIContentHandler.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions. +* +*/ + + + +inline void CSIContentHandler::SetActionFlag(TBool aAction) + { + if ( aAction ) + { + iAttributes |= EAction; + } + else + { + iAttributes &=~ EAction; + } + } + +inline TBool CSIContentHandler::ActionFlag() const + { + return iAttributes & EAction; + } + +inline void CSIContentHandler::SetCreatedFlag( TBool aCreated ) + { + if ( aCreated ) + { + iAttributes |= ECreated; + } + else + { + iAttributes &=~ ECreated; + } + } + +inline TBool CSIContentHandler::CreatedFlag() const + { + return iAttributes & ECreated; + } + +inline void CSIContentHandler::SetHrefFlag( TBool aHref ) + { + if ( aHref ) + { + iAttributes |= EHref; + } + else + { + iAttributes &=~ EHref; + } + } + +inline TBool CSIContentHandler::HrefFlag() const + { + return iAttributes & EHref; + } + +inline void CSIContentHandler::SetExpiresFlag( TBool aExpires ) + { + if ( aExpires ) + { + iAttributes |= EExpires; + } + else + { + iAttributes &=~ EExpires; + } + } + +inline TBool CSIContentHandler::ExpiresFlag() const + { + return iAttributes & EExpires; + } + +inline void CSIContentHandler::SetSiIdFlag( TBool aSiId ) + { + if ( aSiId ) + { + iAttributes |= ESiId; + } + else + { + iAttributes &=~ ESiId; + } + } + +inline TBool CSIContentHandler::SiIdFlag() const + { + return iAttributes & ESiId; + } + +inline void CSIContentHandler::SetDataFlag( TBool aData ) + { + if ( aData ) + { + iAttributes |= EData; + } + else + { + iAttributes &=~ EData; + } + } + +inline TBool CSIContentHandler::DataFlag() const + { + return iAttributes & EData; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CSLContentHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CSLContentHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1221 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CSLContentHandler. +* +*/ + + + +// INCLUDE FILES + +#include "CSLContentHandler.h" +#include "PushMtmUtil.h" +#include "PushMtmSettings.h" +#include "PushAuthenticationUtilities.h" +#include "PushMtmLog.h" +#include "PushContentHandlerPanic.h" +#include "PushMtmAutoFetchOperation.h" +#include "PushMtmUiDef.h" +#include "StringResourceReader.h" +#include "sl_dict.h" +#include "PushContentHandlerUtils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "PushMtmPrivateCRKeys.h" +#include + +// CONSTANTS + +// sl attributes / elements +_LIT8( KSl, "sl" ); +_LIT8( KHref, "href" ); +_LIT8( KAction, "action" ); + +// action attribute literals +_LIT8( KExecHigh,"execute-high" ); +_LIT8( KExecLow, "execute-low" ); +_LIT8( KCache, "cache" ); + +// Text SL MIME type +_LIT( KSlTextContentType, "text/vnd.wap.sl" ); + +// Browser command to fetch an URL. See Browser API Specification! +_LIT( KBrowserCmdFetchUrl, "4 " ); +const TUid KBrowserAppUid = { 0x10008D39 }; + +const TInt KNoOfDictArrays = 1; + +/// Autofetch time delay in seconds. +const TInt KAutofetchDelayInSec = 5; + +// file monitored by browser +_LIT( KPushMtmUrl, "c:\\system\\temp\\PushMtmUrl.txt" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CSLContentHandler::NewL +// --------------------------------------------------------- +// +CSLContentHandler* CSLContentHandler::NewL() + { + CSLContentHandler* self = new (ELeave) CSLContentHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CSLContentHandler::~CSLContentHandler +// --------------------------------------------------------- +// +CSLContentHandler::~CSLContentHandler() + { + PUSHLOG_ENTERFN("CSLContentHandler::~CSLContentHandler") + + Cancel(); + delete iFetchOp; + delete iHrefBuf; + + PUSHLOG_LEAVEFN("CSLContentHandler::~CSLContentHandler") + } + +// --------------------------------------------------------- +// CSLContentHandler::CSLContentHandler +// --------------------------------------------------------- +// +CSLContentHandler::CSLContentHandler() +: CPushContentHandlerBase(), + iSavedMsgId( KMsvNullIndexEntryId ), + iPushMsgAction( KErrNotFound ), + iSaveAsRead( EFalse ) + { + } + +// --------------------------------------------------------- +// CSLContentHandler::ConstructL +// --------------------------------------------------------- +// +void CSLContentHandler::ConstructL() + { + PUSHLOG_ENTERFN("CSLContentHandler::ConstructL") + + CRepository* PushSL = CRepository::NewL( KCRUidPushMtm ); + CleanupStack::PushL( PushSL ); + User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) ); + CleanupStack::PopAndDestroy( PushSL ); + + CPushContentHandlerBase::ConstructL(); + // Added to Active Scheduler. + PUSHLOG_LEAVEFN("CSLContentHandler::ConstructL") + } + +// --------------------------------------------------------- +// CSLContentHandler::CollectGarbageL +// --------------------------------------------------------- +// +void CSLContentHandler::CollectGarbageL() + { + PUSHLOG_ENTERFN("CSLContentHandler::CollectGarbageL") + + DoCollectGarbageL(); + + if(iPushSLEnabled) + iState = EFilteringAndParsing; + else + iState = EDone; + + IdleComplete(); + + PUSHLOG_LEAVEFN("CSLContentHandler::CollectGarbageL") + } + + +// --------------------------------------------------------- +// CSLContentHandler::ParsePushMsgL +// Note that cXML parser dosn't do any validation! +// --------------------------------------------------------- +// +void CSLContentHandler::ParsePushMsgL() + { + PUSHLOG_ENTERFN("CSLContentHandler::ParsePushMsgL") + + TPtrC8 bodyPtr; + iMessage->GetMessageBody( bodyPtr ); + // If there is no body in the message leave with an error + if ( bodyPtr.Size() == 0 ) + { + PUSHLOG_WRITE("CSLContentHandler::ParsePushMsgL: Empty body") + User::Leave( KErrCorrupt ); + } + + TPtrC contentType; + iMessage->GetContentType( contentType ); + PUSHLOG_WRITE_FORMAT(" Content type <%S>",&contentType) + + // Add SL dictionary. + NW_WBXML_Dictionary_t* dictArray[ KNoOfDictArrays ] = + { (NW_WBXML_Dictionary_t*)&NW_SL_WBXMLDictionary }; + + NW_Status_t stat = NW_STAT_SUCCESS; + + RWbxmlDictionary wbxmlDict; + wbxmlDict.InitializeL( KNoOfDictArrays, dictArray ); + CleanupClosePushL( wbxmlDict ); + + NW_TinyDom_Handle_t domHandle; + NW_Byte* buffer = (NW_Byte*)bodyPtr.Ptr(); + NW_Int32 length = (NW_Int32)bodyPtr.Size(); + NW_Bool encoded = ( contentType.CompareF( KSlTextContentType ) == 0 ) ? + NW_FALSE : NW_TRUE; + NW_Uint32 publicID = NW_SL_PublicId; + NW_Bool extTNotStringTable = NW_FALSE; // What is this? + NW_DOM_NodeType_t type = 0; + /********************************** + * Root of DOM + ***********************************/ + CDocumentTreeOwner* docTreeOwner = new (ELeave) CDocumentTreeOwner; + CleanupStack::PushL( docTreeOwner ); + NW_DOM_DocumentNode_t* domNode = NW_DOM_DocumentNode_BuildTree + ( + &domHandle, + buffer, + length, + encoded, + publicID, + extTNotStringTable + ); + if (!domNode) + { + PUSHLOG_WRITE("CSLContentHandler::ParsePushMsgL: domNode is Null") + } + User::LeaveIfNull( domNode ); + docTreeOwner->SetDocTree( domNode ); + + type = NW_DOM_Node_getNodeType( domNode ); + if ( type != NW_DOM_DOCUMENT_NODE ) + { + PUSHLOG_WRITE_FORMAT("CSLContentHandler::ParsePushMsgL: Not Document node <%d>",type) + User::Leave( KErrArgument ); + } + + iCharEncoding = NW_DOM_DocumentNode_getCharacterEncoding( domNode ); + PUSHLOG_WRITE_FORMAT("CSLContentHandler::ParsePushMsgL: Doc char encoding <%x>",iCharEncoding) + + /********************************** + * ELEMENT sl + ***********************************/ + // first make sure if there any children in the dom tree, otherwise we will PANIC(in NW_DOM_DocumentNode_getDocumentElement) and crash WatcherMainThread. + TBool domNodeHasChildNodes = EFalse; + domNodeHasChildNodes = NW_DOM_Node_hasChildNodes( domNode ); + PUSHLOG_WRITE_FORMAT("CSLContentHandler::ParsePushMsgL: check if Dom tree has node <%d>", domNodeHasChildNodes) + if (!domNodeHasChildNodes) + { + PUSHLOG_WRITE("CSLContentHandler::ParsePushMsgL: No SL element present in the dom tree. Message corrupted.") + User::Leave( KErrCorrupt ); + } + + PUSHLOG_WRITE("CSLContentHandler::ParsePushMsgL: before calling getDocumentElement") + NW_DOM_ElementNode_t* slElement = + NW_DOM_DocumentNode_getDocumentElement( domNode ); + if (!slElement) + { + PUSHLOG_WRITE("CSLContentHandler::ParsePushMsgL: slElement is Null") + } + User::LeaveIfNull( slElement ); + + type = NW_DOM_Node_getNodeType( slElement ); + + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* name = NW_String_new(); + User::LeaveIfNull( name ); + stringOwner->SetString( name ); + stat = NW_DOM_Node_getNodeName( slElement, name ); + PUSHLOG_WRITE_FORMAT("CSLContentHandler::ParsePushMsgL: getNodeName ErrCode: %d", NwxStatusToErrCode( stat )) + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* nameBuf = NW_String_getStorage( name ); + NW_Uint16 nameLen = NW_String_getCharCount( name, iCharEncoding ); + TPtrC8 namePtr( nameBuf, nameLen ); + + if ( type != NW_DOM_ELEMENT_NODE || namePtr.CompareF( KSl ) != 0 ) + { + PUSHLOG_WRITE_FORMAT("CSLContentHandler::ParsePushMsgL: Not sl element node <%d>",type) + User::Leave( KErrArgument ); + } + + CleanupStack::PopAndDestroy( stringOwner ); // stringOwner + + /********************************** + * Attributes of ELEMENT sl + ***********************************/ + if ( NW_DOM_ElementNode_hasAttributes( slElement ) ) + { + NW_DOM_AttributeListIterator_t attrIter; + stat = NW_DOM_ElementNode_getAttributeListIterator + ( slElement, &attrIter ); + PUSHLOG_WRITE_FORMAT("CSLContentHandler::ParsePushMsgL: getAttribListIter ErrCode: %d", NwxStatusToErrCode( stat )) + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + + NW_DOM_AttributeHandle_t attrHandle; + while( NW_DOM_AttributeListIterator_getNextAttribute + ( &attrIter, &attrHandle ) == NW_STAT_WBXML_ITERATE_MORE ) + { + ParseSlAttributeL( attrHandle ); + } + } + + // Cleanup. + CleanupStack::PopAndDestroy( 2, &wbxmlDict ); // docTreeOwner, wbxmlDict + + // if 'action' attribute not specified, the value 'execute-low' is used. + if ( !ActionFlag() ) + { + iPushMsgAction = CSLPushMsgEntry::ESLPushMsgExecuteLow; + SetActionFlag( ETrue ); + PUSHLOG_WRITE_FORMAT(" Defaulting to ActionFlag: %d",iPushMsgAction) + } + + iState = EProcessing; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSLContentHandler::ParsePushMsgL") + } + +// --------------------------------------------------------- +// CSLContentHandler::ParseSlAttributeL +// --------------------------------------------------------- +// +void CSLContentHandler::ParseSlAttributeL + ( NW_DOM_AttributeHandle_t& aAttrHandle ) + { + PUSHLOG_ENTERFN("CSLContentHandler::ParseSlAttributeL") + + NW_Status_t stat = NW_STAT_SUCCESS; + + CStringOwner* attrNameOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( attrNameOwner ); + + NW_String_t* attrName = NW_String_new(); + User::LeaveIfNull( attrName ); + attrNameOwner->SetString( attrName ); + + // Get the name of the attribute. + stat = NW_DOM_AttributeHandle_getName( &aAttrHandle, attrName ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* attrNameBuf = NW_String_getStorage( attrName ); + NW_Uint16 attrNameLen = NW_String_getCharCount( attrName, iCharEncoding ); + TPtrC8 attrNamePtr( attrNameBuf, attrNameLen ); + + if ( attrNamePtr.CompareF( KHref ) == 0 ) + { + if ( !HrefFlag() ) + { + HBufC* tempHrefBuf = NULL; + + CStringOwner* valOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( valOwner ); + + NW_String_t* val = NW_String_new(); + User::LeaveIfNull( val ); + valOwner->SetString( val ); + stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val ); + if ( stat != NW_STAT_DOM_NO_STRING_RETURNED ) + { + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* storage = NW_String_getStorage( val ); + NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding ); + TPtrC8 prefixPtr( storage, length ); + tempHrefBuf = HBufC::NewMaxL( length ); + // No leavable after it!!! until... + tempHrefBuf->Des().Copy( prefixPtr ); + } + + CleanupStack::PopAndDestroy( valOwner ); // valOwner + + if ( tempHrefBuf ) + { + if ( tempHrefBuf->Length() == 0 ) + { + // Zero length Href is considered as nothing. + PUSHLOG_WRITE(" Zero length HrefFlag"); + } + else + { + iHrefBuf = tempHrefBuf; // ...until here. + SetHrefFlag( ETrue ); + PUSHLOG_WRITE_FORMAT(" HrefFlag set <%S>",iHrefBuf); + } + } + } + } + else if ( attrNamePtr.CompareF( KAction ) == 0 ) + { + if ( !ActionFlag() ) + { + CStringOwner* stringOwner = new (ELeave) CStringOwner; + CleanupStack::PushL( stringOwner ); + + NW_String_t* val = NW_String_new(); + User::LeaveIfNull( val ); + stringOwner->SetString( val ); + stat = NW_DOM_AttributeHandle_getValue( &aAttrHandle, val ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + NW_Byte* storage = NW_String_getStorage( val ); + NW_Uint16 length = NW_String_getCharCount( val, iCharEncoding ); + TPtrC8 actionPtr( storage, length ); + + iPushMsgAction = ConvertActionString( actionPtr ); + SetActionFlag( ETrue ); + PUSHLOG_WRITE_FORMAT(" ActionFlag: %d",iPushMsgAction) + + CleanupStack::PopAndDestroy( stringOwner ); + } + } + else + { + __ASSERT_DEBUG( EFalse, + ContHandPanic( EPushContHandPanUnexpSlToken ) ); + } + + CleanupStack::PopAndDestroy( attrNameOwner ); // attrNameOwner + + PUSHLOG_LEAVEFN("CSLContentHandler::ParseSlAttributeL") + } + +// --------------------------------------------------------- +// CSLContentHandler::ConvertActionString +// --------------------------------------------------------- +// +TUint CSLContentHandler::ConvertActionString + ( const TDesC8& aActionString ) const + { + const TInt KMatchFound = 0; + + // if 'action' attribute not specified, the value 'execute-low' is used. + TUint actionValue = CSLPushMsgEntry::ESLPushMsgExecuteLow; + + if ( aActionString.Compare( KExecHigh ) == KMatchFound ) + { + actionValue = CSLPushMsgEntry::ESLPushMsgExecuteHigh; + } + else if ( aActionString.Compare( KExecLow ) == KMatchFound ) + { + actionValue = CSLPushMsgEntry::ESLPushMsgExecuteLow; + } + else if ( aActionString.Compare( KCache ) == KMatchFound ) + { + actionValue = CSLPushMsgEntry::ESLPushMsgExecuteCache; + } + + return actionValue; + } + +// --------------------------------------------------------- +// CSLContentHandler::SetSlPushMsgEntryFieldsL +// --------------------------------------------------------- +// +void CSLContentHandler::SetSlPushMsgEntryFieldsL( CSLPushMsgEntry& + aSlPushMsgEntry ) const + { + PUSHLOG_ENTERFN("CSLContentHandler::SetSlPushMsgEntryFieldsL") + + // Set URL and Action fields. + if ( HrefFlag() ) + { + aSlPushMsgEntry.SetUrlL( *iHrefBuf ); + } + + __ASSERT_DEBUG( ActionFlag(), + ContHandPanic( EPushContHandPanUnspecSlAction ) ); + if ( ActionFlag() ) + { + aSlPushMsgEntry.SetAction( iPushMsgAction ); + } + else // if not specified, the value 'execute-low' is used. + { + aSlPushMsgEntry.SetAction( CSLPushMsgEntry::ESLPushMsgExecuteLow ); + } + + // Set all the relevant header fields. + TPtrC8 msgHeaderPtr; + iMessage->GetHeader( msgHeaderPtr ); + aSlPushMsgEntry.SetHeaderL( msgHeaderPtr ); + + // Get server address. + TPtrC8 srvAddress; + if ( iMessage->GetServerAddress( srvAddress ) ) + { + aSlPushMsgEntry.SetFromL( srvAddress ); + } + + // First line in Inbox: TMsvEntry::iDetails. + if ( srvAddress.Length() == 0 ) + { + // Read from resource. + HBufC* details = + iStrRscReader->AllocReadResourceLC( R_PUSHMISC_UNK_SENDER ); + aSlPushMsgEntry.SetMsgDetailsL( *details ); + CleanupStack::PopAndDestroy( details ); + } + else + { + // Convert the "From" information to the format required by the UI + // spec and then decode it. + HBufC* details = iWapPushUtils->ConvertDetailsL( srvAddress ); + CleanupStack::PushL( details ); + HBufC* convertedFrom = + CPushMtmUtil::ConvertUriToDisplayFormL( *details ); + CleanupStack::PushL( convertedFrom ); + // + aSlPushMsgEntry.SetMsgDetailsL( *convertedFrom ); + // + CleanupStack::PopAndDestroy( 2, details ); // convertedFrom, details + } + + // Second line in Inbox: TMsvEntry::iDescription. + // Read from resource. + HBufC* description = + iStrRscReader->AllocReadResourceLC( R_PUSHMISC_INBOX_SERV_MSG ); + aSlPushMsgEntry.SetMsgDescriptionL( *description ); + CleanupStack::PopAndDestroy( description ); + + // ******** Push MTM specific processing ********* + + /* + * Unfortunately in CPushMsgEntryBase there is no such functionality + * with which we can reach TMsvEntry as non-const, but we have to + * modify the entry's iMtmData2 member somehow. We can do it + * with either casting or with modifying and saving the entry + * manually after it has been saved by CSLPushMsgEntry. The latter + * solution is more expensive so we choose the first. + */ + TMsvEntry& tEntry = CONST_CAST( TMsvEntry&, aSlPushMsgEntry.Entry() ); + if ( HrefFlag() ) + { + CPushMtmUtil::SetAttrs( tEntry, EPushMtmAttrHasHref ); + } + else + { + CPushMtmUtil::ResetAttrs( tEntry, EPushMtmAttrHasHref ); + } + + // Indication is required if the entry is saved as 'read' (delete & + // replacement notification). It can happen only in case of SL message. + // Otherwise the flag has to be cleared! + if ( !iSaveAsRead ) + { + // Saving as unread & new. + tEntry.SetNew( ETrue ); + tEntry.SetUnread( ETrue ); + CPushMtmUtil::ResetAttrs( tEntry, EPushMtmReadButContentChanged ); + } + else + { + // Saving as read. + tEntry.SetNew( EFalse ); + tEntry.SetUnread( EFalse ); + CPushMtmUtil::SetAttrs( tEntry, EPushMtmReadButContentChanged ); + } + + PUSHLOG_LEAVEFN("CSLContentHandler::SetSlPushMsgEntryFieldsL") + } + +// --------------------------------------------------------- +// CSLContentHandler::ProcessingPushMsgEntryL +// --------------------------------------------------------- +// +void CSLContentHandler::ProcessingPushMsgEntryL() + { + PUSHLOG_ENTERFN("CSLContentHandler::ProcessingPushMsgEntryL") + + TBool discardPushMsg( EFalse ); + + __ASSERT_DEBUG( ActionFlag(), + ContHandPanic( EPushContHandPanUnspecSlAction ) ); + + // S60 requirement: if the href is empty then delete (discard) the msg. + if ( HrefFlag() == EFalse ) + { + PUSHLOG_WRITE(" No SL Href.") + discardPushMsg = ETrue; + } + else + { + __ASSERT_DEBUG( HrefFlag() && iHrefBuf, + ContHandPanic( EPushContHandPanUnspecSlHref ) ); + + // The message will not be discarded + discardPushMsg = EFalse; + + CMsvEntrySelection* matchingUrlList = iWapPushUtils->FindUrlLC + ( *iHrefBuf, KUidWapPushMsgSL ); + TInt matchingListCount = matchingUrlList->Count(); + PUSHLOG_WRITE_FORMAT(" matchingListCount: %d",matchingListCount) + + // Only one SL is allowed with the same Url, so leave the first and + // delete the others. + if ( 1 < matchingListCount ) + { + for ( TInt count = 1; count < matchingListCount; ++count ) + { + iWapPushUtils->DeleteEntryL( matchingUrlList->At(count) ); + } + matchingListCount = 1; // Only one remains. + } + + if ( 0 < matchingListCount ) + { + // Find msg of the same href and discard it if it has a lower or + // the same action value. + CSLPushMsgEntry* matchingSl = CSLPushMsgEntry::NewL(); + CleanupStack::PushL( matchingSl ); + + const TMsvId matchingId = matchingUrlList->At(0); + matchingSl->RetrieveL( *iMsvSession, matchingId ); + + if ( iPushMsgAction <= matchingSl->Action() ) + { + PUSHLOG_WRITE(" SL: not higher action") + discardPushMsg = ETrue; + } + + CleanupStack::PopAndDestroy( matchingSl ); // matchingSl, + } + + CleanupStack::PopAndDestroy( matchingUrlList ); // matchingUrlList + } + + if ( discardPushMsg ) + { + // Nothing to do. + PUSHLOG_WRITE(" SL discarded.") + iState = EDone; + IdleComplete(); + } + else + { + iState = HandleServiceInvocationL(); + IdleComplete(); + } + + __ASSERT_DEBUG( iSavedMsgId == KMsvNullIndexEntryId, + ContHandPanic( EPushContHandPanSlMsgIdSet ) ); + + PUSHLOG_LEAVEFN("CSLContentHandler::ProcessingPushMsgEntryL") + } + +// --------------------------------------------------------- +// CSLContentHandler::HandleServiceInvocationL +// --------------------------------------------------------- +// +TInt CSLContentHandler::HandleServiceInvocationL() const + { + PUSHLOG_ENTERFN("CSLContentHandler::HandleServiceInvocationL") + + TInt nextState = ESavePushMsgEntry; + + if ( iPushMsgAction == CSLPushMsgEntry::ESLPushMsgExecuteCache ) + { + PUSHLOG_WRITE(" SL cache"); + TBool isAuthenticated = TPushAuthenticationUtil:: + AuthenticateMsgL( *iMtmSettings, *iMessage ); + if ( !isAuthenticated ) + { + PUSHLOG_WRITE(" Not authenticated"); + // The message is placed to Inbox. + nextState = ESavePushMsgEntry; + } + else + { + // Authenticated. Fetch SL-cache. + nextState = EFetching; + } + } + + else if ( iPushMsgAction == CSLPushMsgEntry::ESLPushMsgExecuteLow ) + { + PUSHLOG_WRITE(" SL execute-low") + // It is independent from Automatic/Manual setting and WL + // authentication is not applied. The message is placed to Inbox + // for manual downloading. + nextState = ESavePushMsgEntry; + } + + else // ESLPushMsgExecuteHigh + { + PUSHLOG_WRITE(" SL execute-high"); + // If the settings is Manual or it does not pass the WL authentication + // then it is placed to Inbox for manual downloading. + // If the setting is Automatic and it passes the WL authentication, + // the Browser is started standalone to download the URL without any + // user interaction. + if ( iMtmSettings->ServiceLoadingType() == + CPushMtmSettings::EManual ) + { + PUSHLOG_WRITE(" Manual setting") + // The message is placed to Inbox. + nextState = ESavePushMsgEntry; + } + else // Automatic loading + { + PUSHLOG_WRITE(" Automatic setting"); + // Authenticate the message. + TBool isAuthenticated = TPushAuthenticationUtil:: + AuthenticateMsgL( *iMtmSettings, *iMessage ); + if ( !isAuthenticated ) + { + PUSHLOG_WRITE(" Not authenticated"); + // The message is placed to Inbox. + nextState = ESavePushMsgEntry; + } + else + { + // Authenticated - start downloading. + nextState = EFetching; + } + } + } + + PUSHLOG_LEAVEFN("CSLContentHandler::HandleServiceInvocationL") + return nextState; + } + +// --------------------------------------------------------- +// CSLContentHandler::FetchPushMsgEntryL +// --------------------------------------------------------- +// +void CSLContentHandler::FetchPushMsgEntryL() + { + PUSHLOG_ENTERFN("CSLContentHandler::FetchPushMsgEntryL") + + __ASSERT_DEBUG( iSavedMsgId == KMsvNullIndexEntryId, + ContHandPanic( EPushContHandPanAlreadyInitialized ) ); + __ASSERT_DEBUG( HrefFlag() && iHrefBuf, + ContHandPanic( EPushContHandPanUnspecSlHref ) ); + + /* + * In case of execute-high use the Browser to download the service. + * In case of cache use the fetch operation to download the service + * silently. + */ + + if ( iPushMsgAction == CSLPushMsgEntry::ESLPushMsgExecuteHigh ) + { + PUSHLOG_WRITE(" Start Browser") + // Launch the Browser with the URI, then save the message. + // Trap errors. If Browser's launching fails, then save the + // message as 'unread'. In case of an error, it is not forwarded. + TRAPD( err, StartBrowserL() ); + iState = ESavePushMsgEntry; + // Mark it 'read' after succesfull Browser startup. + iSaveAsRead = err ? EFalse : ETrue; + IdleComplete(); + } + else if ( iPushMsgAction == CSLPushMsgEntry::ESLPushMsgExecuteCache ) + { + // Fetch the service inside the content handler. + iStatus = KRequestPending; + SetActive(); + __ASSERT_DEBUG( !iFetchOp, + ContHandPanic( EPushContHandPanFetchAlreadyInit ) ); + + iFetchOp = CPushMtmAutoFetchOperation::NewL( *iHrefBuf, + KAutofetchDelayInSec, + iStatus ); + iFetchOp->StartL(); + PUSHLOG_WRITE(" Fetch op started") + iState = EFetchCompleted; // Next state. + // Fetch completes it. + } + else + { + __ASSERT_DEBUG( EFalse, + ContHandPanic( EPushContHandPanBadActionValue ) ); + User::Leave( KErrNotSupported ); + } + + PUSHLOG_LEAVEFN("CSLContentHandler::FetchPushMsgEntryL") + } + +// --------------------------------------------------------- +// CSLContentHandler::StartBrowserL +// --------------------------------------------------------- +// +void CSLContentHandler::StartBrowserL() + { + PUSHLOG_ENTERFN("CSLContentHandler::StartBrowserL") + + // Parameters are separated by space + // 1st parameter: type of the further parameters + // 2nd parameter: URL + // + HBufC* param = HBufC::NewLC( KBrowserCmdFetchUrl().Length() + + iHrefBuf->Length() ); + TPtr paramPtr = param->Des(); + paramPtr.Copy( KBrowserCmdFetchUrl ); + paramPtr.Append( *iHrefBuf ); + + RWsSession wsSession; + User::LeaveIfError( wsSession.Connect() ); + CleanupClosePushL( wsSession ); + TApaTaskList taskList( wsSession ); + TApaTask task = taskList.FindApp( KBrowserAppUid ); + + if ( task.Exists() ) + { + PUSHLOG_WRITE("CSLContentHandler Browser::SendMessage") + + RFs rfs; + RFile file; + TPtrC8 param8Ptr; + // 8-bit buffer is required. + HBufC8* param8 = HBufC8::NewLC( param->Length() ); + param8->Des().Copy( *param ); + param8Ptr.Set(param8->Des()); + + // Open the file. + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + + // Replace file if exists or Create file if not exist yet + User::LeaveIfError( file.Replace( rfs, KPushMtmUrl, EFileWrite | EFileShareExclusive ) ); + CleanupClosePushL(file); + + // Write to file + User::LeaveIfError( file.Write( param8Ptr ) ); + + // Clean up. + CleanupStack::PopAndDestroy(/*file*/); + CleanupStack::PopAndDestroy(/*rfs*/); + CleanupStack::PopAndDestroy( /*param8*/ ); + } + else + { + PUSHLOG_WRITE("CSLContentHandler Browser::StartDocument") + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); + CleanupClosePushL( appArcSession ); + TThreadId id; + User::LeaveIfError + ( + appArcSession.StartDocument( *param, KBrowserAppUid, id ) + ); + CleanupStack::PopAndDestroy( &appArcSession ); + } + + CleanupStack::PopAndDestroy( &wsSession ); + CleanupStack::PopAndDestroy( param ); + + PUSHLOG_LEAVEFN("CSLContentHandler::StartBrowserL") + } + +// --------------------------------------------------------- +// CSLContentHandler::FetchCompletedL +// --------------------------------------------------------- +// +void CSLContentHandler::FetchCompletedL() + { + PUSHLOG_ENTERFN("CSLContentHandler::FetchCompletedL") + + __ASSERT_DEBUG( iPushMsgAction == CSLPushMsgEntry::ESLPushMsgExecuteCache, + ContHandPanic( EPushContHandPanBadActionValue ) ); + __ASSERT_DEBUG( iSavedMsgId == KMsvNullIndexEntryId, + ContHandPanic( EPushContHandPanAlreadyInitialized ) ); + __ASSERT_DEBUG( iFetchOp, ContHandPanic( EPushContHandPanNoFetchOp ) ); + + const TInt fetchRes = iStatus.Int(); + PUSHLOG_WRITE_FORMAT(" fetchRes <%d>",fetchRes) + + if ( fetchRes != KErrNone ) + { + // Downloading failed. Save the message. + iState = ESavePushMsgEntry; + } + else + { + // Silent fetching has completed successfully. + // The message should not be saved. + iState = EDone; + } + + // Next state set. Complete. + IdleComplete(); + + PUSHLOG_LEAVEFN("CSLContentHandler::FetchCompletedL") + } + +// --------------------------------------------------------- +// CSLContentHandler::SavePushMsgEntryL +// --------------------------------------------------------- +// +void CSLContentHandler::SavePushMsgEntryL() + { + PUSHLOG_ENTERFN("CSLContentHandler::SavePushMsgEntryL") + + __ASSERT_DEBUG( ActionFlag(), + ContHandPanic( EPushContHandPanUnspecSlAction ) ); + __ASSERT_DEBUG( HrefFlag() && iHrefBuf, + ContHandPanic( EPushContHandPanUnspecSlHref ) ); + __ASSERT_DEBUG( iSavedMsgId == KMsvNullIndexEntryId, + ContHandPanic( EPushContHandPanAlreadyInitialized ) ); + + CMsvEntrySelection* matchingUrlList = iWapPushUtils->FindUrlLC + ( *iHrefBuf, KUidWapPushMsgSL ); + TInt matchingListCount = matchingUrlList->Count(); + PUSHLOG_WRITE_FORMAT(" matchingListCount: %d",matchingListCount) + + // Only one SL is allowed with the same Url, so leave the first and + // delete the others. + __ASSERT_DEBUG( matchingListCount <= 1, + ContHandPanic( EPushContHandPanTooManySl ) ); + if ( 1 < matchingListCount ) + { + for ( TInt count = 1; count < matchingListCount; ++count ) + { + iWapPushUtils->DeleteEntryL( matchingUrlList->At(count) ); + } + matchingListCount = 1; // Only one remains. + } + + TBool saveNewMsg = ETrue; // Save by default. + TMsvId matchingEntryId = KMsvNullIndexEntryId; + + // Apply reception rules. + if ( matchingListCount == 0 ) + { + // Nothing to do. + saveNewMsg = ETrue; + } + else + { + CSLPushMsgEntry* matchingSl = CSLPushMsgEntry::NewL(); + CleanupStack::PushL( matchingSl ); + + matchingEntryId = matchingUrlList->At(0); + matchingSl->RetrieveL( *iMsvSession, matchingEntryId ); + + if ( iPushMsgAction <= matchingSl->Action() ) + { + // Discard the new SL: it does not have higher + // action value as the existing. + PUSHLOG_WRITE(" SL not higher action - discarded") + saveNewMsg = EFalse; + } + else + { + // The new has greater action attribute. + // Update the old SL with the new data. + saveNewMsg = ETrue; + } + + CleanupStack::PopAndDestroy( matchingSl ); // matchingSl + } + + CleanupStack::PopAndDestroy( matchingUrlList ); // matchingUrlList + + // Store message if not marked for deletion. + if ( saveNewMsg ) + { + StoreSLMessageL( matchingEntryId ); + } + + iState = EDone; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSLContentHandler::SavePushMsgEntryL") + } + +// --------------------------------------------------------- +// CSLContentHandler::StoreSLMessageL +// --------------------------------------------------------- +// +void CSLContentHandler::StoreSLMessageL( TMsvId aMatchingEntryId ) + { + PUSHLOG_ENTERFN("CSLContentHandler::StoreSLMessageL") + + CSLPushMsgEntry* slEntry = CSLPushMsgEntry::NewL(); + CleanupStack::PushL( slEntry ); + + if ( aMatchingEntryId == KMsvNullIndexEntryId ) + { + PUSHLOG_WRITE(" No matching SL") + // Save new to Inbox. + SetSlPushMsgEntryFieldsL( *slEntry ); + iSavedMsgId = + slEntry->SaveL( *iMsvSession, KMsvGlobalInBoxIndexEntryId ); + // Set the entry to read and *not* new state depending on iSaveAsRead. + if ( !iSaveAsRead ) + { + // Do nothing SaveL saves it as unread. + } + else + { + // SaveL owerrides the read settings (iEntry.SetUnread(ETrue);) + // that we set in SetSlPushMsgEntryFieldsL, thus the read status + // has to be reset manually here: + iWapPushUtils->MarkServiceUnreadL( iSavedMsgId, EFalse ); + } + } + else + { + PUSHLOG_WRITE(" Matching SL") + slEntry->RetrieveL( *iMsvSession, aMatchingEntryId ); + SetSlPushMsgEntryFieldsL( *slEntry ); + + slEntry->UpdateL( *iMsvSession ); + iSavedMsgId = aMatchingEntryId; + // Note that UpdateL does not change the read/unread status. + + // Move the updated msg back to Inbox. + TMsvId parentId = slEntry->Entry().Parent(); + if ( parentId != KMsvGlobalInBoxIndexEntryId ) + { + PUSHLOG_WRITE(" Moving back to Inbox") + CMsvEntry* cParent = iMsvSession->GetEntryL( parentId ); + CleanupStack::PushL( cParent ); + cParent->MoveL( iSavedMsgId, KMsvGlobalInBoxIndexEntryId ); + CleanupStack::PopAndDestroy( cParent ); // cParent + } + } + +#ifdef __TEST_LOG__ + _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" ); + _LIT( KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B" ); + TBuf<32> dateHolder; + TBuf<32> timeHolder; + TTime recDateTime = slEntry->ReceivedDate(); + recDateTime.FormatL( dateHolder, KDateFormat ); + recDateTime.FormatL( timeHolder, KTimeFormat ); + PUSHLOG_WRITE_FORMAT(" rec date: <%S>",&dateHolder) + PUSHLOG_WRITE_FORMAT(" rec time: <%S>",&timeHolder) +#endif // __TEST_LOG__ + + CleanupStack::PopAndDestroy( slEntry ); // slEntry + + PUSHLOG_LEAVEFN("CSLContentHandler::StoreSLMessageL") + } + + +// --------------------------------------------------------- +// CSLContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CSLContentHandler::HandleMessageL( CPushMessage* aPushMsg, + TRequestStatus& aStatus ) + { + PUSHLOG_ENTERFN("CSLContentHandler::HandleMessageL 2") + + __ASSERT_DEBUG( aPushMsg != NULL, + ContHandPanic( EPushContHandPanMsgNull ) ); + +#ifdef __TEST_LOG__ + TPtrC8 bodyPtr; + aPushMsg->GetMessageBody( bodyPtr ); + PUSHLOG_HEXDUMP( bodyPtr ) +#endif // __TEST_LOG__ + + iMessage = aPushMsg; + iAcknowledge = ETrue; + SetConfirmationStatus( aStatus ); + + iState = EGarbageCollecting; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSLContentHandler::HandleMessageL 2") + } + +// --------------------------------------------------------- +// CSLContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CSLContentHandler::HandleMessageL( CPushMessage* aPushMsg ) + { + PUSHLOG_ENTERFN("CSLContentHandler::HandleMessageL 1") + + __ASSERT_DEBUG( aPushMsg != NULL, + ContHandPanic( EPushContHandPanMsgNull ) ); + +#ifdef __TEST_LOG__ + TPtrC8 bodyPtr; + aPushMsg->GetMessageBody( bodyPtr ); + PUSHLOG_HEXDUMP( bodyPtr ) +#endif // __TEST_LOG__ + + iAcknowledge = EFalse; + iMessage = aPushMsg; + + iState = EGarbageCollecting; + IdleComplete(); + + PUSHLOG_LEAVEFN("CSLContentHandler::HandleMessageL 1") + } + +// --------------------------------------------------------- +// CSLContentHandler::CancelHandleMessage +// --------------------------------------------------------- +// +void CSLContentHandler::CancelHandleMessage() + { + Cancel(); + } + +// --------------------------------------------------------- +// CSLContentHandler::CPushHandlerBase_Reserved1 +// --------------------------------------------------------- +// +void CSLContentHandler::CPushHandlerBase_Reserved1() + { + } + +// --------------------------------------------------------- +// CSLContentHandler::CPushHandlerBase_Reserved1 +// --------------------------------------------------------- +// +void CSLContentHandler::CPushHandlerBase_Reserved2() + { + } + +// --------------------------------------------------------- +// CSLContentHandler::DoCancel +// --------------------------------------------------------- +// +void CSLContentHandler::DoCancel() + { + PUSHLOG_ENTERFN("CSLContentHandler::DoCancel") + // TODO Cancel outstanding requests! + Complete( KErrCancel ); + PUSHLOG_LEAVEFN("CSLContentHandler::DoCancel") + } + +// --------------------------------------------------------- +// CSLContentHandler::RunL +// --------------------------------------------------------- +// +void CSLContentHandler::RunL() + { + PUSHLOG_ENTERFN("CSLContentHandler::RunL") + + // Handle errors in RunError(). + PUSHLOG_WRITE_FORMAT(" iStatus.Int(): %d",iStatus.Int()) + + switch ( iState ) + { + case EGarbageCollecting: + { + CollectGarbageL(); + break; + } + + + case EFilteringAndParsing: + { + if(iPushSLEnabled) + { + if ( !FilterPushMsgL() ) + { + // It did not pass the filter. Done. + iState = EDone; + IdleComplete(); + } + else + { + // Continue. + TInt ret = KErrNone; + PUSHLOG_WRITE("CSLContentHandler::RunL : before trapping parsing.") + TRAP(ret, ParsePushMsgL()); + PUSHLOG_WRITE_FORMAT("CSLContentHandler::RunL : after trapping parsing. ret = %d", ret) + if ( ret != KErrNone) + { + PUSHLOG_WRITE("CSLContentHandler::RunL : Parsing failed. discarding message.") + iState = EDone; + IdleComplete(); + } + } + } + break; + } + + case EProcessing: + { + if(iPushSLEnabled) + ProcessingPushMsgEntryL(); + break; + } + + case EFetching: + { + if(iPushSLEnabled) + FetchPushMsgEntryL(); + break; + } + + case EFetchCompleted: + { + if(iPushSLEnabled) + FetchCompletedL(); + break; + } + + case ESavePushMsgEntry: + { + if(iPushSLEnabled) + SavePushMsgEntryL(); + break; + } + + + case EDone: + { + PUSHLOG_WRITE("CSLContentHandler EDone") + Complete( KErrNone ); + break; + } + default: + { + // JIC. + PUSHLOG_WRITE("CSLContentHandler default EDone") + Complete( KErrNone ); + break; + } + } + + PUSHLOG_LEAVEFN("CSLContentHandler::RunL") + } + +// --------------------------------------------------------- +// CSLContentHandler::RunError +// --------------------------------------------------------- +// +TInt CSLContentHandler::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CSLContentHandler::RunError: %d",aError) + + iState = EDone; + Complete( aError ); + return KErrNone; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CSLContentHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CSLContentHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,303 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CSLContentHandler. +* +*/ + + + +#ifndef __CSLCONTENTHANDLER_H__ +#define __CSLCONTENTHANDLER_H__ + +// INCLUDE FILES + +#include "CPushContentHandlerBase.h" +#include "PushMtmDef.hrh" +#include "PushContentHandlerDef.hrh" +#include +#include +#include + +// CONSTANTS + +const TUid KUidPushSLContentHandler = { EUidPushSLContentHandler }; +_LIT( KSLContentHandlerData, "text/vnd.wap.sl||application/vnd.wap.slc" ); + +// FORWARD DECLARATIONS + +class CSLPushMsgEntry; +class CPushMtmAutoFetchOperation; + +// CLASS DECLARATION + +/** +* CSLContentHandler Handles Service Loading Content +* +* This handler takes ownership of the SL message and processes it +* according to the Reception rules +* [WAP Service Loading version 31-July-2001] +* and either stores the message or deletes it. +* Also S60 specific requirements are applied. +* +* NB. If __SERIES60_PUSH_SL is not defined, then all SL push messages are +* discarded! +*/ +class CSLContentHandler : public CPushContentHandlerBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed object. + */ + static CSLContentHandler* NewL(); + + /** + * D'tor. + */ + virtual ~CSLContentHandler(); + + private: // Constructors + + /** + * Constructor. + */ + CSLContentHandler(); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + private: // New functions + + /** + * Do Garbage Collection synchronously when a new message arrives. + * @return None. + */ + void CollectGarbageL(); + + + /** + * Parse the Push SL message using XML parser. + * If Push Message is an SLC then convert it first to text using + * CWbxmlConverterUtil class. + * @return None. + */ + void ParsePushMsgL(); + + /** + * Parse an attribute of the sl element. + * @param aAttrHandle The attribute to be parsed. + * @return None. + */ + void ParseSlAttributeL( NW_DOM_AttributeHandle_t& aAttrHandle ); + + /** + * Convert the action string to a representative numeric value to + * facilitate storing the message. + * @param aActionString The attribute value indicating the action level + * eg 'execute-high' + * @return TUint: a value representing the action type. + */ + TUint ConvertActionString( const TDesC8& aActionString ) const; + + /** + * Set SL entry fields prior to storing message. + * @param aSlPushMsgEntry Entry represents message format to use when + * storing it. + * @return None. + */ + void SetSlPushMsgEntryFieldsL( CSLPushMsgEntry& aSlPushMsgEntry ) const; + + /** + * Check if the message has to be discarded due to empty Href or + * there is a message with higher acton value. + * @return None. + */ + void ProcessingPushMsgEntryL(); + + /** + * Handle Service invocation: decide what to do next according to + * action value and push settings. + * @return Next state. + */ + TInt HandleServiceInvocationL() const; + + /** + * Download the indicated content. + * In case of execute-high use the Browser to download the service. + * In case of cache use the fetch operation to download the service + * silently. + * @return None. + */ + void FetchPushMsgEntryL(); + + /** + * Start the Browser and instruct it to download the content + * indicated by the Sl's URI. + * @return None. + */ + void StartBrowserL(); + + /** + * Check the result of the SL-cache downloading. If it fails, save the + * message. If it succeeds, discard the message. + * @return None. + */ + void FetchCompletedL(); + + /** + * Apply reception rules and save the push message. + * If a message already exists with the same URL, + * it is saved only if it has a higher action value. + * @return None. + */ + void SavePushMsgEntryL(); + + /** + * Store the new message to Messaging. + * @param aMatchingEntryId ID of the matching SI entry. + * @return None. + */ + void StoreSLMessageL( TMsvId aMatchingEntryId ); + + // Attribute flags + + /** + * Flag whether message has an action attribute + * @param aAction boolean to set flag to - + * ETrue for action attrib present + * EFalse for no action attrib. + */ + inline void SetActionFlag( TBool aAction ); + + /** + * Check status of action flag to see if message has an action + * attribute. + * @return TBool ETrue - action attribute present in message + * EFalse - no action attribute. + */ + inline TBool ActionFlag() const; + + /** + * Flag whether message has a Href attribute + * @param aHref boolean to set flag to - + * ETrue for Href attrib present + * EFalse for no href attrib + */ + inline void SetHrefFlag( TBool aHref ); + + /** + * Check status of href flag to see if message has an href attribute. + * @return TBool + * ETrue - href attribute present in message + * EFalse - no href attribute + */ + inline TBool HrefFlag() const; + + + private: // Methods from CPushHandlerBase + + /** + * HandleMessage Async. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * @param aPushMsg CPushMessage to process. + * @param aStatus Request status variable for use in asynchronous + * operations. + * @return None. + */ + void HandleMessageL(CPushMessage* aPushMsg, TRequestStatus& aStatus); + + /** + * HandleMessage Sync. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * Initial State: Set data members then go to the next state + * @param aPushMsg CPushMessage to process. + */ + void HandleMessageL(CPushMessage* aPushMsg); + + /** + * Same functionality as DoCancel() + */ + void CancelHandleMessage(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved1(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved2(); + + private: // Methods from CActive + + /** + * Terminates any activity. + * @return None. + */ + void DoCancel(); + + /** + * Step through the various representative states for handling a + * message. + * @return None. + */ + void RunL(); + + /** + * This is invoked when RunL Leaves with an error so clean up and + * return. + * @return Error code to scheduler. + */ + TInt RunError( TInt aError ); + + private: // Data + + enum + { + EAction = 0x01, + EHref = 0x02 + }; + + enum TState ///< States of this state machine. + { + EGarbageCollecting, + EFilteringAndParsing, + EProcessing, + EFetching, + EFetchCompleted, + ESavePushMsgEntry, + EDone + }; + + TMsvId iSavedMsgId; ///< ID of the saved message. + TUint32 iAttributes; ///< Attribute indication (set or not). + TInt iPushMsgAction; ///< SL action. + HBufC* iHrefBuf; ///< Href attribute. Has. + + /// Asynchronous fetch operation that downloads the SL-cache. Owned. + CPushMtmAutoFetchOperation* iFetchOp; + + NW_Uint32 iCharEncoding; ///< Char encoding of the current msg. + TBool iSaveAsRead; ///< Mark the message 'read' after saving. + TInt iPushSLEnabled; + }; + +#include "CSLContentHandler.inl" + +#endif // __CSLCONTENTHANDLER_H__ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CSLContentHandler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CSLContentHandler.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline functions. +* +*/ + + + + +inline void CSLContentHandler::SetActionFlag( TBool aAction ) + { + if ( aAction ) + { + iAttributes |= EAction; + } + else + { + iAttributes &=~ EAction; + } + } + +inline TBool CSLContentHandler::ActionFlag() const + { + return iAttributes & EAction; + } + +inline void CSLContentHandler::SetHrefFlag( TBool aHref ) + { + if ( aHref ) + { + iAttributes |= EHref; + } + else + { + iAttributes &=~ EHref; + } + } + +inline TBool CSLContentHandler::HrefFlag() const + { + return iAttributes & EHref; + } + + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CUnknownContentHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CUnknownContentHandler.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,694 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CUnknownContentHandler. +* +*/ + + + +// INCLUDE FILES + +#include "CUnknownContentHandler.h" +#include "PushMtmUtil.h" +#include "PushMtmLog.h" +#include "PushContentHandlerPanic.h" +#include "StringResourceReader.h" +#include +#ifdef __SERIES60_PUSH_SP +#include +#include // BIO Message Database and message query methods +#include // CSmsBuffer class +#include // CSmsMessage class +#include // CSmsHeader class +#include // TSmsUtilities class +#include // CRichText class +#include // KUidBioMessageTypeMtm const +#include +#include +#include +#include +#include +#include // KUidMsvMessageEntry const +#include + +// SMUT Unbranch +#include + +#endif // __SERIES60_PUSH_SP + +// CONSTANTS + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CUnknownContentHandler::NewL +// --------------------------------------------------------- +// +CUnknownContentHandler* CUnknownContentHandler::NewL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::NewL") + + CUnknownContentHandler* self = new (ELeave) CUnknownContentHandler; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::NewL") + return self; + } + +// --------------------------------------------------------- +// CUnknownContentHandler::~CUnknownContentHandler +// --------------------------------------------------------- +// +CUnknownContentHandler::~CUnknownContentHandler() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::~CUnknownContentHandler") + + Cancel(); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::~CUnknownContentHandler") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::CUnknownContentHandler +// --------------------------------------------------------- +// +CUnknownContentHandler::CUnknownContentHandler() +: CPushContentHandlerBase(), + iSavedMsgId( KMsvNullIndexEntryId ) + { + } + +// --------------------------------------------------------- +// CUnknownContentHandler::ConstructL +// --------------------------------------------------------- +// +void CUnknownContentHandler::ConstructL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::ConstructL") + + CPushContentHandlerBase::ConstructL(); + // Added to Active Scheduler. + + PUSHLOG_LEAVEFN("CUnknownContentHandler::ConstructL") + } + + +// --------------------------------------------------------- +// CUnknownContentHandler::CollectGarbageL +// --------------------------------------------------------- +// +void CUnknownContentHandler::CollectGarbageL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::CollectGarbageL") + + DoCollectGarbageL(); + +#ifdef __SERIES60_PUSH_SP + iState = EFilteringAndProcessing; +#else // __SERIES60_PUSH_SP + // Do nothing - message is discarded. + iState = EDone; +#endif // __SERIES60_PUSH_SP + IdleComplete(); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::CollectGarbageL") + } + +#ifdef __SERIES60_PUSH_SP + +// --------------------------------------------------------- +// CUnknownContentHandler::ProcessingPushMsgEntryL +// --------------------------------------------------------- +// +void CUnknownContentHandler::ProcessingPushMsgEntryL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::ProcessingPushMsgEntryL") + + const TBool bioMsg( BioMessageTypeL() ); + if ( bioMsg ) + { + PUSHLOG_WRITE(" BIO message"); + // convert to bio format & save + SaveBioMessageEntryL(); + } + else + { + PUSHLOG_WRITE(" Not BIO message"); + + // Check if the received content is supported. + RApaLsSession apaLs; + User::LeaveIfError( apaLs.Connect() ); + CleanupClosePushL( apaLs ); + + // Try to find out the data type. + TPtrC contentTypePtr; + iMessage->GetContentType( contentTypePtr ); + HBufC8* contentT8 = HBufC8::NewMaxLC( contentTypePtr.Length() ); + contentT8->Des().Copy( contentTypePtr ); + TDataRecognitionResult result; + User::LeaveIfError( apaLs.RecognizeData( KNullDesC(), + *contentT8, + result ) ); + CleanupStack::PopAndDestroy( contentT8 ); // contentT8 + + CDocumentHandler* docHandler = CDocumentHandler::NewLC( NULL ); + TBool supported = docHandler->CanOpenL( result.iDataType ); + + CleanupStack::PopAndDestroy( 2, &apaLs ); // docHandler, apaLs + + // Save only supported msg. + if ( supported ) + { + // create unknown push message entry and save + SaveUnknownPushMsgEntryL(); + } + } + + iState = EDone; + IdleComplete(); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::ProcessingPushMsgEntryL") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::BioMessageTypeL +// --------------------------------------------------------- +// +TBool CUnknownContentHandler::BioMessageTypeL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::BioMessageTypeL") + + // need to create local RFs for BIO otherwise raises exception + RFs localFS; + CleanupClosePushL( localFS ); + User::LeaveIfError( localFS.Connect() ); + CBIODatabase* bioDB = CBIODatabase::NewLC( localFS ); + + TPtrC contentTypePtr; + iMessage->GetContentType( contentTypePtr ); + + iBioMsgUID = KNullUid; + TBool isBio = EFalse; + // IsBioMessageL returns KErrNone if found or KErrNotFound if not found + if ( bioDB->IsBioMessageL( EBioMsgIdIana, + contentTypePtr, + NULL, + iBioMsgUID ) == KErrNone ) + { + isBio = ETrue; + } + + CleanupStack::PopAndDestroy( 2 ); // bioDB, localFS + + PUSHLOG_LEAVEFN("CUnknownContentHandler::BioMessageTypeL") + return isBio; + } + +// --------------------------------------------------------- +// CUnknownContentHandler::SaveBioMessageEntryL +// --------------------------------------------------------- +// +void CUnknownContentHandler::SaveBioMessageEntryL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::SaveBioMessageEntryL") + + // create sms message from CPushMessage and then save message + RFs fileSession; + User::LeaveIfError(fileSession.Connect()); + CleanupClosePushL(fileSession); + CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); + CleanupStack::PushL(smsBuffer); + + CSmsMessage* smsMessage = CSmsMessage::NewL( fileSession, + CSmsPDU::ESmsDeliver, + smsBuffer ); + CleanupStack::PushL( smsMessage ); + + smsMessage->SmsPDU().SetAlphabet( TSmsDataCodingScheme::ESmsAlphabet8Bit ); + + TPtrC8 fieldValue; + + if ( iMessage->GetBinaryHeaderField( EHttpFrom, fieldValue ) || + iMessage->GetBinaryHeaderField( EHttpXWapInitiatorURI, fieldValue ) || + iMessage->GetBinaryHeaderField( EHttpContentLocation, fieldValue ) ) + { + // Convert 8 bit to 16 bit + HBufC* tempAddr = HBufC::NewLC( fieldValue.Length() ); + tempAddr->Des().Copy( fieldValue ); + + smsMessage->SmsPDU().SetToFromAddressL( *tempAddr ); + CleanupStack::PopAndDestroy( tempAddr ); + } + + if ( iMessage->GetMessageBody( fieldValue ) ) + { + HBufC* tempBody = HBufC::NewLC( fieldValue.Length() ); + tempBody->Des().Copy( fieldValue ); + + smsBuffer->InsertL( 0, *tempBody ); + CleanupStack::PopAndDestroy( tempBody ); + } + + CleanupStack::Pop( 2 ); //smsBuffer, smsMessage + + StoreMsgL( smsMessage ); // destroys CSmsMessage (contains smsBuffer) + CleanupStack::PopAndDestroy( &fileSession ); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::SaveBioMessageEntryL") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::StoreMsgL +// --------------------------------------------------------- +// +void CUnknownContentHandler::StoreMsgL( CSmsMessage* aSmsMsg ) + { + PUSHLOG_ENTERFN("CUnknownContentHandler::StoreMsgL") + + CleanupStack::PushL( aSmsMsg ); + + // Create a CSmsHeader based on this message. smsHdr takes ownership of aSmsMsg + CSmsHeader* smsHdr = CSmsHeader::NewL( aSmsMsg ); + CleanupStack::Pop( aSmsMsg ); + CleanupStack::PushL( smsHdr ); + + // get root entry + CMsvEntry* msvEntry = iMsvSession->GetEntryL( KMsvRootIndexEntryId ); + CleanupStack::PushL( msvEntry ); + + // create an invisible blank entry + TMsvEntry entry; + entry.iType = KUidMsvMessageEntry; + entry.SetVisible( EFalse ); + entry.SetInPreparation( ETrue ); + entry.SetReadOnly( EFalse ); + entry.SetUnread( ETrue ); + + TMsvId serviceId = SetBioServiceIdL(); + TBuf description; + +// SMUT Unbranch + CSmsGetDetDescInterface* smsPlugin = CSmsGetDetDescInterface::NewL(); + CleanupStack::PushL( smsPlugin ); + + if ( iBioMsgUID != KNullUid ) + { + // sets entry with values passed in + TSmsUtilities::PopulateMsgEntry( entry, + *aSmsMsg, + serviceId, + KUidBIOMessageTypeMtm ); + entry.iBioType = iBioMsgUID.iUid; + + // Look up and set the description + TInt index; + CBIODatabase* bioDB = CBIODatabase::NewLC( msvEntry->Session().FileSession() ); + bioDB->GetBioIndexWithMsgIDL( iBioMsgUID, index ); + description.Copy( bioDB->BifReader(index).Description() ); + entry.iDescription.Set( description ); + CleanupStack::PopAndDestroy(); // bioDB + } + else + { + // sets entry with values passed in + TSmsUtilities::PopulateMsgEntry( entry, *aSmsMsg, serviceId ); + + // Look up and set the description +// SMUT Unbranch + smsPlugin->GetDescription( *aSmsMsg, description ); + entry.iDescription.Set( description ); + } + + // Set the details + TBuf details; + TInt err = smsPlugin->GetDetails( msvEntry->Session().FileSession(), + *aSmsMsg, + details ); + if ( !err ) + { + entry.iDetails.Set( details ); + } + +// SMUT Unbranch + CleanupStack::PopAndDestroy( smsPlugin ); + + // Store entry in inbox + msvEntry->SetEntryL( KMsvGlobalInBoxIndexEntryId ); + msvEntry->CreateL( entry ); + msvEntry->Session().CleanupEntryPushL( entry.Id() ); + msvEntry->SetEntryL( entry.Id() ); + + // Save the message + CMsvStore* store = msvEntry->EditStoreL(); + CleanupStack::PushL( store ); + + // Save off the CSmsHdr + smsHdr->StoreL( *store ); + + // Save the body + + // Create and fill a CRichText object to save to store.. + CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); + CleanupStack::PushL( paraFormatLayer ); + CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); + CleanupStack::PushL( charFormatLayer ); + CRichText* richText = CRichText::NewL( paraFormatLayer, charFormatLayer ); + CleanupStack::PushL( richText ); + HBufC* bufBody=HBufC::NewLC( aSmsMsg->Buffer().Length() ); + TPtr bufBodyPtr = bufBody->Des(); + aSmsMsg->Buffer().Extract( bufBodyPtr, 0, aSmsMsg->Buffer().Length() ); + richText->InsertL( 0, bufBodyPtr ); + store->StoreBodyTextL( *richText ); + CleanupStack::PopAndDestroy( 4 ); //bufBody, richText, charFormatLayer, paraFormatLayer + + store->CommitL(); + entry.SetReadOnly( ETrue ); + entry.SetVisible( ETrue ); + entry.SetInPreparation( EFalse ); + msvEntry->ChangeL( entry ); + + CleanupStack::PopAndDestroy(); //store + msvEntry->Session().CleanupEntryPop(); //entry + CleanupStack::PopAndDestroy( 2 ); //msvEntry, smsHdr + + PUSHLOG_LEAVEFN("CUnknownContentHandler::StoreMsgL") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::SetBioServiceIdL +// --------------------------------------------------------- +// +TMsvId CUnknownContentHandler::SetBioServiceIdL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::SetBioServiceIdL") + + CMsvEntry* msvEntry = iMsvSession->GetEntryL( KMsvRootIndexEntryId ); + + CleanupStack::PushL( msvEntry ); + + TMsvId serviceId = KMsvNullIndexEntryId; + TRAPD( err, TSmsUtilities::ServiceIdL( *msvEntry, + serviceId, + KUidBIOMessageTypeMtm ) ); + if ( err == KErrNotFound ) + { + serviceId = KMsvLocalServiceIndexEntryId; + err = KErrNone; + } + + CleanupStack::PopAndDestroy(); //msvEntry + User::LeaveIfError( err ); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::SetBioServiceIdL") + return serviceId; + } + +// --------------------------------------------------------- +// CUnknownContentHandler::SaveUnknownPushMsgEntryL +// --------------------------------------------------------- +// +void CUnknownContentHandler::SaveUnknownPushMsgEntryL() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::SaveUnknownPushMsgEntryL") + + CUnknownPushMsgEntry* unknownPushMsgEntry = + CUnknownPushMsgEntry::NewL(); + CleanupStack::PushL( unknownPushMsgEntry ); + + SetUnknownPushMsgEntryFieldsL( *unknownPushMsgEntry ); + + iSavedMsgId = unknownPushMsgEntry->SaveL( *iMsvSession, + KMsvGlobalInBoxIndexEntryId ); + + CleanupStack::PopAndDestroy( unknownPushMsgEntry ); // unknownPushMsgEntry + + PUSHLOG_LEAVEFN("CUnknownContentHandler::SaveUnknownPushMsgEntryL") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::SetUnknownPushMsgEntryFieldsL +// --------------------------------------------------------- +// +void CUnknownContentHandler::SetUnknownPushMsgEntryFieldsL + ( CUnknownPushMsgEntry& aUnknownPushMsgEntry ) + { + PUSHLOG_ENTERFN("CUnknownContentHandler::SetUnknownPushMsgEntryFieldsL") + + // Set all the relevant fields + + // Get server address. + TPtrC8 srvAddress; + if ( iMessage->GetServerAddress( srvAddress ) ) + { + aUnknownPushMsgEntry.SetFromL( srvAddress ); + } + + TPtrC contentTypePtr; + iMessage->GetContentType( contentTypePtr ); + aUnknownPushMsgEntry.SetContentTypeL( contentTypePtr ); + + TPtrC8 msgBodyPtr; + iMessage->GetMessageBody( msgBodyPtr ); + aUnknownPushMsgEntry.SetMessageDataL( msgBodyPtr ); + + // First line in Inbox: TMsvEntry::iDetails. + if ( srvAddress.Length() == 0 ) + { + // Read from resource. + HBufC* details = + iStrRscReader->AllocReadResourceLC( R_PUSHMISC_UNK_SENDER ); + aUnknownPushMsgEntry.SetMsgDetailsL( *details ); + CleanupStack::PopAndDestroy( details ); + } + else + { + // Convert the "From" information to the format required by the UI + // spec and then decode it. + HBufC* details = iWapPushUtils->ConvertDetailsL( srvAddress ); + CleanupStack::PushL( details ); + HBufC* convertedFrom = + CPushMtmUtil::ConvertUriToDisplayFormL( *details ); + CleanupStack::PushL( convertedFrom ); + // + aUnknownPushMsgEntry.SetMsgDetailsL( *convertedFrom ); + // + CleanupStack::PopAndDestroy( 2, details ); // convertedFrom, details + } + + // Second line in Inbox: TMsvEntry::iDescription. + TPtrC8 contentUriPtr; + iMessage->GetBinaryHeaderField( EHttpXWapContentURI, contentUriPtr ); + // Copy the 8-bit descriptor into a unicode one. + HBufC* contentUri = HBufC::NewMaxLC( contentUriPtr.Length() ); + contentUri->Des().Copy( contentUriPtr ); + // Extract file name from X-wap-content-uri. + HBufC* fileName = FileNameFromUriL( *contentUri ); + CleanupStack::PopAndDestroy( contentUri ); // contentUri + CleanupStack::PushL( fileName ); + + if ( fileName->Length() == 0 ) + { + // TODO: Read from resource. + //"Unknown content type" qtn_wap_push_msg_content_not_supported + } + else + { + aUnknownPushMsgEntry.SetMsgDescriptionL( *fileName ); + } + + CleanupStack::PopAndDestroy( fileName ); // fileName + + PUSHLOG_LEAVEFN("CUnknownContentHandler::SetUnknownPushMsgEntryFieldsL") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::FileNameFromUriL +// --------------------------------------------------------- +// +HBufC* CUnknownContentHandler::FileNameFromUriL( const TDesC& aUri ) const + { + TUriParser pars; + User::LeaveIfError( pars.Parse( aUri ) ); + + HBufC* res = NULL; + if ( pars.IsPresent( EUriPath ) ) + { + TPtrC path = pars.Extract( EUriPath ); + // Extract the remaining text after the last slash character. + // If the path contains a file name, then it has to contain + // a slash also, so if there is no slash then it's sure that there + // is no file name in it. + TInt index = path.LocateReverse( TChar('/') ); + if ( index < 0 ) + { + // No file name. + } + else if ( ++index < path.Length() ) // If not at the end... + { + // Last slash found. Extract the text after the slash. + res = path.Mid( index ).AllocL(); + } + } + + if ( !res ) + { + res = KNullDesC().AllocL(); + } + + return res; + } + +#endif // __SERIES60_PUSH_SP + + +// --------------------------------------------------------- +// CUnknownContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CUnknownContentHandler::HandleMessageL( CPushMessage* aPushMsg, + TRequestStatus& aStatus ) + { + PUSHLOG_ENTERFN("CUnknownContentHandler::HandleMessageL") + + __ASSERT_DEBUG( aPushMsg != NULL, + ContHandPanic( EPushContHandPanMsgNull ) ); + + iMessage = aPushMsg; + iAcknowledge = ETrue; + SetConfirmationStatus( aStatus ); + iState = EGarbageCollecting; + IdleComplete(); + } + +// --------------------------------------------------------- +// CUnknownContentHandler::HandleMessageL +// --------------------------------------------------------- +// +void CUnknownContentHandler::HandleMessageL( CPushMessage* aPushMsg ) + { + PUSHLOG_ENTERFN("CUnknownContentHandler::HandleMessageL") + + __ASSERT_DEBUG( aPushMsg != NULL, + ContHandPanic( EPushContHandPanMsgNull ) ); + + iAcknowledge = EFalse; + iMessage = aPushMsg; + iState = EGarbageCollecting; + IdleComplete(); + + PUSHLOG_LEAVEFN("CUnknownContentHandler::HandleMessageL") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::CancelHandleMessage +// --------------------------------------------------------- +// +void CUnknownContentHandler::CancelHandleMessage() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::CancelHandleMessage") + Cancel(); + PUSHLOG_LEAVEFN("CUnknownContentHandler::CancelHandleMessage") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::CPushHandlerBase_Reserved1 +// --------------------------------------------------------- +// +void CUnknownContentHandler::CPushHandlerBase_Reserved1() + { + } + +// --------------------------------------------------------- +// CUnknownContentHandler::CPushHandlerBase_Reserved2 +// --------------------------------------------------------- +// +void CUnknownContentHandler::CPushHandlerBase_Reserved2() + { + } + +// --------------------------------------------------------- +// CUnknownContentHandler::DoCancel +// --------------------------------------------------------- +// +void CUnknownContentHandler::DoCancel() + { + PUSHLOG_ENTERFN("CUnknownContentHandler::DoCancel") + Complete( KErrCancel ); + PUSHLOG_LEAVEFN("CUnknownContentHandler::DoCancel") + } + +// --------------------------------------------------------- +// CUnknownContentHandler::RunL +// --------------------------------------------------------- +// +void CUnknownContentHandler::RunL() + { + // Handle errors in RunError(). + PUSHLOG_WRITE_FORMAT("iStatus.Int(): %d",iStatus.Int()) + User::LeaveIfError( iStatus.Int() ); + + // use active state machine routine to manage activites: + switch ( iState ) + { + case EGarbageCollecting: + { + CollectGarbageL(); + break; + } + +#ifdef __SERIES60_PUSH_SP + + case EFilteringAndProcessing: + { + if ( !FilterPushMsgL() ) + { + // It did not pass the filter. Done. + iState = EDone; + IdleComplete(); + } + else + { + // Continue. + ProcessingPushMsgEntryL(); + } + break; + } + +#endif // __SERIES60_PUSH_SP + + default: + { + PUSHLOG_WRITE("CUnknownContentHandler default EDone") + Complete( KErrNone ); + break; + } + } + } + +// --------------------------------------------------------- +// CUnknownContentHandler::RunError +// --------------------------------------------------------- +// +TInt CUnknownContentHandler::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CUnknownContentHandler::RunError: %d",aError) + + iState = EDone; + Complete( aError ); + return KErrNone; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/CUnknownContentHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/CUnknownContentHandler.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CUnknownContentHandler. +* +*/ + + + +#ifndef __CUNKNOWNCONTENTHANDLER_H__ +#define __CUNKNOWNCONTENTHANDLER_H__ + + +// INCLUDE FILES + +#include "CPushContentHandlerBase.h" +#include "PushContentHandlerDef.hrh" +#include +#include + +// CONSTANTS + +const TUid KUidPushUnknownContentHandler = { EUidPushUnknownContentHandler }; +_LIT( KUnknownContentHandlerData, "*" ); + +// FORWARD DECLARATIONS + +class CSmsMessage; +class CUnknownPushMsgEntry; + +// CLASS DECLARATION + +/** +* CUnknownContentHandler provides the default plugin when the +* specific plugin for a data type cannot be matched. +* +* If the feature flag __SERIES60_PUSH_SP is defined, then all this +* kind of messages are discarded on reception. +*/ +class CUnknownContentHandler : public CPushContentHandlerBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @return The constructed object. + */ + static CUnknownContentHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CUnknownContentHandler(); + + private: // Constructors + + /** + * Constructor. + */ + CUnknownContentHandler(); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + + private: // New functions + + /** + * Do Garbage Collection synchronously. + * @return None. + */ + void CollectGarbageL(); + +#ifdef __SERIES60_PUSH_SP + + /** + * Create/Saving Push Msg Entry in the appropriate message store. + * First query the type of push message to check if it is a known BIO + * message type: + * If it is then + * save Push Message as appropriate BIO message + * else + * save as UnknownPushMsgEntry. + * @return None. + */ + void ProcessingPushMsgEntryL(); + + /** + * Check if the given Push Message, which is now owned by the handler, + * is a BIO Messsage (setting the member variable iBioMsgUID if it is) + * and returning a boolean to indicate success (ETrue) or EFalse otherwise. + * @return TBool + * ETrue - push message is a BIO message + * EFalse - push message is not BIO message + */ + TBool BioMessageTypeL(); + + /** + * Save CPushMessage as the relevant BIO message type. + * Firstly create SMS message and use CPushMessage as + * source to populate SMS. Then save SMS message. + * @return None. + */ + void SaveBioMessageEntryL(); + + /** + * Create CMsvEntry for sms messsage, stores the entry and + * then delete entry once done. + * @param aMessage CSmsMessage which embodies details of CPushMessage. + */ + void StoreMsgL( CSmsMessage* aSmsMsg ); + + /** + * Set the service id for Bio messaging + * @return TMsvId The service id for the message store. + */ + TMsvId SetBioServiceIdL(); + + /** + * Save CPushMessage as a CUnknownPushMsgEntry + * @return None. + */ + void SaveUnknownPushMsgEntryL(); + + /** + * Sets the Unknown Push Message Entry Fields from the data in + * the received CPushMessage: + * @param aUnknownPushMsgEntry CUnknownPushMsgEntry to populate with + * CPushMessage details. + */ + void SetUnknownPushMsgEntryFieldsL( CUnknownPushMsgEntry& + aUnknownPushMsgEntry ); + + /** + * Extract the file name from the URI. + * @param aUri The URI. + * @return The file name part or an empty string. + */ + HBufC* FileNameFromUriL( const TDesC& aUri ) const; + +#endif // __SERIES60_PUSH_SP + + private: // Methods from CPushHandlerBase + + /** + * HandleMessage Async. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * @param aPushMsg CPushMessage to process. + * @param aStatus Request status variable for use in asynchronous + * operations. + * @return None. + */ + void HandleMessageL( CPushMessage* aPushMsg, TRequestStatus& aStatus ); + + /** + * HandleMessage Sync. Version. Takes ownership of Push Message and + * sets self active to continue processing message. + * Initial State: Set data members then go to the next state + * @param aPushMsg CPushMessage to process. + */ + void HandleMessageL( CPushMessage* aPushMsg ); + + /** + * Same functionality as DoCancel() + */ + void CancelHandleMessage(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved1(); + + /** + * Reserved function. + */ + void CPushHandlerBase_Reserved2(); + + private: // Methods from CActive + + /** + * Cancels the handling of the message and revokes the active status + * of the handler + */ + void DoCancel(); + + /** + * Handler States: + * EFilteringAndProcessing - Filter new msg according to Service + * message settings and Convert CPushMessage to a + * format to save and save the message (either as Bio + * msg or UnknownPushMsgEntry) + * EDone - Clean up, complete observer + */ + void RunL(); + + /** + * This is invoked when RunL Leaves with an error. + * Cleans up and returns. + * @param aError Error passed into this function + */ + TInt RunError( TInt aError ); + + private: // Data + + enum TState + { + EGarbageCollecting, + EFilteringAndProcessing, + EDone + }; + + TMsvId iSavedMsgId; ///< ID of the saved message. + TUid iBioMsgUID; ///< BIO msg UID. + }; + +#endif // __CUNKNOWNCONTENTHANDLER_H__ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushContentHandlerDef.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushContentHandlerDef.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Macro definitions and enums for the Push Content Handlers. +* +*/ + + + +#ifndef PUSHCONTENTHANDLERDEF_HRH +#define PUSHCONTENTHANDLERDEF_HRH + + +/// PushContentHandler DLL. +#define EUidPushContentHandlerDll 0x101F854C + +/// Implementation UIDs. +#define EUidPushUnknownContentHandler 0x101F854D +#define EUidPushSIContentHandler 0x101F854E +#define EUidPushSLContentHandler 0x101F854F +#define EUidPushCOContentHandler 0x10008D47 +#define EUidPushMultiPartMixedContentHandler 0x101F8550 +#define EUidPushMultiPartRelAndAltContentHandler 0x101F8551 + +/** PushContentHandler Interface UID (defined by Symbian). +* See CContentHandlerBase.h, KUidPushContentHandlerBase. */ +#define EUidPushContentHandlerBase 0x101F3E5E + + +#endif // PUSHCONTENTHANDLERDEF_HRH + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushContentHandlerGroupProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushContentHandlerGroupProxy.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Proxy definition. +* +*/ + + + +// INCLUDE FILES + +#include "PushContentHandlerDef.hrh" +#include "CUnknownContentHandler.h" +#include "CSIContentHandler.h" +#include "CSLContentHandler.h" +#include "CCOContentHandler.h" +#include "CMultiPartMixedContentHandler.h" +#include "CMultiPartRelAndAltContentHandler.h" +#include +#include + + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( EUidPushUnknownContentHandler, CUnknownContentHandler::NewL ), + IMPLEMENTATION_PROXY_ENTRY( EUidPushSIContentHandler, CSIContentHandler::NewL ), + IMPLEMENTATION_PROXY_ENTRY( EUidPushSLContentHandler, CSLContentHandler::NewL ), + IMPLEMENTATION_PROXY_ENTRY( EUidPushCOContentHandler, CCOContentHandler::NewL ), + IMPLEMENTATION_PROXY_ENTRY( EUidPushMultiPartMixedContentHandler, CMultiPartMixedContentHandler::NewL ), + IMPLEMENTATION_PROXY_ENTRY( EUidPushMultiPartRelAndAltContentHandler, CMultiPartRelAndAltContentHandler::NewL ) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushContentHandlerPanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushContentHandlerPanic.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +// INCLUDE FILES + +#include "PushContentHandlerPanic.h" + +// LOCAL CONSTANTS AND MACROS + +_LIT( KContHandPanicString, "PushContentHandler(MTM)" ); + +// --------------------------------------------------------- +// ContHandPanic +// --------------------------------------------------------- +// +GLDEF_C void ContHandPanic( TPushContentHandlerPanic aReason ) + { + User::Panic( KContHandPanicString, aReason ); + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushContentHandlerPanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushContentHandlerPanic.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +#ifndef PUSHCONTENTHANDLERPANIC_H +#define PUSHCONTENTHANDLERPANIC_H + +// INCLUDE FILES + +#include + +enum TPushContentHandlerPanic + { + EPushContHandPanCommandNotSupported = 1, ///< Not supported command. + EPushContHandPanBadType, ///< Unsupported message type for an operation. + EPushContHandPanFoldersNotSupported, ///< MTM loaded with bad message entry. + EPushContHandPanEmptySelection, ///< Entry selection is empty. + EPushContHandPanNotInitUrl, + EPushContHandPanNoContext, + EPushContHandPanAlreadyInitialized, + EPushContHandPanBadActionValue, + EPushContHandPanBadState, + EPushContHandPanNoFetchOp, + EPushContHandPanBadTransaction, + EPushContHandPanNoSiIdAttr, + EPushContHandPanNoCreatedAttr, + EPushContHandPanNoActionAttr, + EPushContHandPanTooManySi, + EPushContHandPanTooManySl, + EPushContHandPanMsgNull, + EPushContHandPanBadCreatedType, + EPushContHandPanExpiresNotOpaque, + EPushContHandPanHrefNotString, + EPushContHandPanClassTokenReached, + EPushContHandPanUnexpHrefAttrVal, + EPushContHandPanUnexpSiToken, + EPushContHandPanUnexpSlToken, + EPushContHandPanUnspecSiAction, + EPushContHandPanUnspecSlAction, + EPushContHandPanUnexpectedTimeType, + EPushContHandPanBadExpiresType, + EPushContHandPanBadTTimeLength, + EPushContHandPanNoSiIdOrHrefAttr, + EPushContHandPanUnspecSiHref, + EPushContHandPanUnspecSlHref, + EPushContHandPanSlMsgIdSet, + EPushContHandPanSlMsgIdNotSet, + EPushContHandPanFetchAlreadyInit, + EPushContHandPanAutBadState, + EPushContHandPanSiResNotOnStack, + EPushContHandPanNullCharSetId, + EPushContHandPanNullUcs2Buf + }; + +GLREF_C void ContHandPanic( TPushContentHandlerPanic aReason ); + +#endif // PUSHCONTENTHANDLERPANIC_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushContentHandlerUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushContentHandlerUtils.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utilities +* +*/ + + + +// INCLUDE FILES + +#include "PushContentHandlerUtils.h" +#include +#include + +// --------------------------------------------------------- +// NwxStatusToErrCode +// --------------------------------------------------------- +// +TInt NwxStatusToErrCode( NW_Status_t aNwxErrorCode ) + { + TInt ret( KErrGeneral ); + + switch ( aNwxErrorCode ) + { + case NW_STAT_SUCCESS: + { + ret = KErrNone; + break; + } + case NW_STAT_OUT_OF_MEMORY: + { + ret = KErrNoMemory; + break; + } + case NW_STAT_CANCELLED: + case NW_STAT_CONN_CANCELLED: + { + ret = KErrCancel; + break; + } + default: + { + ret = KErrGeneral; + break; + } + } + + return ret; + } + +// --------------------------------------------------------- +// RWbxmlDictionary::InitializeL +// --------------------------------------------------------- +// +void RWbxmlDictionary::InitializeL( NW_Int32 aCount, + NW_WBXML_Dictionary_t* aDictArray[] ) + { + NW_Status_t stat = NW_STAT_SUCCESS; + stat = NW_WBXML_Dictionary_initialize( aCount, aDictArray ); + User::LeaveIfError( NwxStatusToErrCode( stat ) ); + } + +// --------------------------------------------------------- +// RWbxmlDictionary::Close +// --------------------------------------------------------- +// +void RWbxmlDictionary::Close() + { + NW_WBXML_Dictionary_destroy(); + } + +// --------------------------------------------------------- +// CDocumentTreeOwner::CDocumentTreeOwner +// --------------------------------------------------------- +// +CDocumentTreeOwner::CDocumentTreeOwner() +: iDocTree( NULL ) + { + } + +// --------------------------------------------------------- +// CDocumentTreeOwner::CDocumentTreeOwner +// --------------------------------------------------------- +// +CDocumentTreeOwner::CDocumentTreeOwner( NW_DOM_DocumentNode_t* aDocTree ) +: iDocTree( aDocTree ) + { + } + +// --------------------------------------------------------- +// CDocumentTreeOwner::~CDocumentTreeOwner +// --------------------------------------------------------- +// +CDocumentTreeOwner::~CDocumentTreeOwner() + { + if ( iDocTree ) + { + NW_DOM_DocumentNode_Delete( iDocTree ); + } + } + +// --------------------------------------------------------- +// CDocumentTreeOwner::SetDocTree +// --------------------------------------------------------- +// +void CDocumentTreeOwner::SetDocTree( NW_DOM_DocumentNode_t* aDocTree ) + { + iDocTree = aDocTree; + } + +// --------------------------------------------------------- +// CStringOwner::CStringOwner +// --------------------------------------------------------- +// +CStringOwner::CStringOwner() +: iString( NULL ) + { + } + +// --------------------------------------------------------- +// CStringOwner::CStringOwner +// --------------------------------------------------------- +// +CStringOwner::CStringOwner( NW_String_t* aString ) +: iString( aString ) + { + } + +// --------------------------------------------------------- +// CStringOwner::~CStringOwner +// --------------------------------------------------------- +// +CStringOwner::~CStringOwner() + { + if ( iString ) + { + NW_String_delete( iString ); + } + } + +// --------------------------------------------------------- +// CStringOwner::SetString +// --------------------------------------------------------- +// +void CStringOwner::SetString( NW_String_t* aString ) + { + iString = aString; + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushContentHandlerUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushContentHandlerUtils.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utilities +* +*/ + + + +#ifndef PUSHCONTENTHANDLERUTILS_H +#define PUSHCONTENTHANDLERUTILS_H + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include + +/** +* Convert cXML status code to Symbian OS error code. +* @param aNwxErrorCode cXML status. +* @return Symbian OS error code. +*/ +TInt NwxStatusToErrCode( NW_Status_t aNwxErrorCode ); + +/* +* The following tiny classes have been introduced to help putting C-style +* Browser Engine structures to the Cleanup Stack, so that we can implement +* a LEAVE-safe code. +*/ + +/** +* Encapsulate WBXML dictionary initialization. +*/ +class RWbxmlDictionary + { + public: + void InitializeL( NW_Int32 aCount, NW_WBXML_Dictionary_t* aDictArray[] ); + void Close(); + }; + +/** +* Encapsulate a WBXML document tree. +*/ +class CDocumentTreeOwner : public CBase + { + public: + CDocumentTreeOwner(); + CDocumentTreeOwner( NW_DOM_DocumentNode_t* aDocTree ); + ~CDocumentTreeOwner(); + public: + void SetDocTree( NW_DOM_DocumentNode_t* aDocTree ); + private: + NW_DOM_DocumentNode_t* iDocTree; ///< Owned. + }; + +/** +* Encapsulate an NW_String_t. +*/ +class CStringOwner : public CBase + { + public: + CStringOwner(); + CStringOwner( NW_String_t* aString ); + ~CStringOwner(); + public: + void SetString( NW_String_t* aString ); + private: + NW_String_t* iString; ///< Owned. + }; + +#endif // PUSHCONTENTHANDLERUTILS_H + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmAutoFetchOperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmAutoFetchOperation.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,235 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMtmAutoFetchOperation. +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmAutoFetchOperation.h" +#include "PushMtmFetchOperation.h" +#include "PushContentHandlerPanic.h" +#include "PushMtmLog.h" + +// CONSTANTS + +/// Max retry. +LOCAL_D const TInt KMaxTry = 2; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::NewL +// --------------------------------------------------------- +// +CPushMtmAutoFetchOperation* CPushMtmAutoFetchOperation::NewL + ( + const TDesC& aRequestedUrl, + TInt aTimeDelayInSec, + TRequestStatus& aObserverRequestStatus + ) + { + CPushMtmAutoFetchOperation* op = + new (ELeave) CPushMtmAutoFetchOperation + ( aTimeDelayInSec, aObserverRequestStatus ); + CleanupStack::PushL( op ); + op->ConstructL( aRequestedUrl ); + CleanupStack::Pop(); // op + return op; + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::~CPushMtmAutoFetchOperation +// --------------------------------------------------------- +// +CPushMtmAutoFetchOperation::~CPushMtmAutoFetchOperation() + { + Cancel(); + delete iFetchOp; + delete iRequestedUrl; + iTimer.Close(); + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::StartL +// --------------------------------------------------------- +// +void CPushMtmAutoFetchOperation::StartL() + { + PUSHLOG_ENTERFN("CPushMtmAutoFetchOperation::StartL") + + Cancel(); + + iTry = 0; + iState = EFetch; + + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + + PUSHLOG_LEAVEFN("CPushMtmAutoFetchOperation::StartL") + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::CPushMtmAutoFetchOperation +// --------------------------------------------------------- +// +CPushMtmAutoFetchOperation::CPushMtmAutoFetchOperation + + ( + TInt aTimeDelayInSec, + TRequestStatus& aObserverRequestStatus + ) +: CActive( EPriorityStandard ), + iObserver( aObserverRequestStatus ), + iState( EInit ), + iTimeDelayInSec( aTimeDelayInSec ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::ConstructL +// --------------------------------------------------------- +// +void CPushMtmAutoFetchOperation::ConstructL( const TDesC& aRequestedUrl ) + { + PUSHLOG_ENTERFN("CPushMtmAutoFetchOperation::ConstructL") + + iRequestedUrl = HBufC::NewMaxL( aRequestedUrl.Length() ); + iRequestedUrl->Des().Copy( aRequestedUrl ); + + User::LeaveIfError( iTimer.CreateLocal() ); + + PUSHLOG_LEAVEFN("CPushMtmAutoFetchOperation::ConstructL") + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::FetchL +// --------------------------------------------------------- +// +void CPushMtmAutoFetchOperation::FetchL() + { + PUSHLOG_ENTERFN("CPushMtmAutoFetchOperation::FetchL") + + delete iFetchOp; + iFetchOp = NULL; + iStatus = KRequestPending; + SetActive(); + iFetchOp = CPushMtmFetchOperation::NewL( *iRequestedUrl, iStatus ); + PUSHLOG_WRITE(" Fetch op created") + + ++iTry; // Increase indicator. + PUSHLOG_WRITE_FORMAT(" Try: %d",iTry) + iFetchOp->StartL(); + iState = ECheck; // Next state. + PUSHLOG_WRITE(" Fetch op started") + + PUSHLOG_LEAVEFN("CPushMtmAutoFetchOperation::FetchL") + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::DoCancel +// --------------------------------------------------------- +// +void CPushMtmAutoFetchOperation::DoCancel() + { + if ( iFetchOp ) + { + iFetchOp->Cancel(); + } + + iTimer.Cancel(); + + TRequestStatus* status = &iObserver; + User::RequestComplete( status, KErrCancel ); + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::RunL +// --------------------------------------------------------- +// +void CPushMtmAutoFetchOperation::RunL() + { + PUSHLOG_ENTERFN("CPushMtmAutoFetchOperation::RunL") + + __ASSERT_DEBUG( iState != EInit && iState != EDone, + ContHandPanic( EPushContHandPanAutBadState ) ); + + switch ( iState ) + { + case EFetch: + { + PUSHLOG_WRITE(" EFetch") + FetchL(); + break; + } + + case ECheck: + { + PUSHLOG_WRITE_FORMAT2(" ECheck: %d,%d",iStatus.Int(),iTry) + if ( iStatus.Int() != KErrNone && iTry < KMaxTry ) + { + // Wait and Retry. + iTimer.Cancel(); + iStatus = KRequestPending; + SetActive(); + TTimeIntervalMicroSeconds32 delayInMSec = + iTimeDelayInSec * 1000000; + iTimer.After( iStatus, delayInMSec ); + iState = EFetch; + } + else + { + // No error or no more trial allowed. + iState = EDone; + PUSHLOG_WRITE_FORMAT(" SignalObs: %d",iStatus.Int()); + TRequestStatus* status = &iObserver; + User::RequestComplete( status, iStatus.Int() ); + } + break; + } + + default: + { + PUSHLOG_WRITE(" default") + // JIC. + iState = EDone; + TRequestStatus* status = &iObserver; + User::RequestComplete( status, KErrNone ); + break; + } + } + + PUSHLOG_LEAVEFN("CPushMtmAutoFetchOperation::RunL") + } + +// --------------------------------------------------------- +// CPushMtmAutoFetchOperation::RunError +// --------------------------------------------------------- +// +TInt CPushMtmAutoFetchOperation::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CPushMtmAutoFetchOperation::RunError <%d>",aError); + + // Signal the observer that a leave has occured. + TRequestStatus* status = &iObserver; + User::RequestComplete( status, aError ); + + return KErrNone; + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmAutoFetchOperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmAutoFetchOperation.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of PushMtmAutoFetchOperation. +* +*/ + + + +#ifndef PUSHMTMAUTOFETCHOPERATION_H +#define PUSHMTMAUTOFETCHOPERATION_H + +// INCLUDE FILES + +#include + +// FORWARD DECLARATIONS + +class CPushMtmFetchOperation; + +// CLASS DECLARATION + +/** +* Asynchronous fetch operation that runs in silent mode and in addition to the +* services of CPushMtmFetchOperation it retries downloading of the indicated +* service if the first try fails. +*/ +class CPushMtmAutoFetchOperation : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aRequestedUrl The requested URL. + * @param aTimeDelayInSec Time delay between fetches in seconds. + * @param aObserverRequestStatus Completion status. + * @return The constructed client. + */ + static CPushMtmAutoFetchOperation* NewL + ( + const TDesC& aRequestedUrl, + TInt aTimeDelayInSec, + TRequestStatus& aObserverRequestStatus + ); + + /** + * Destructor. + */ + virtual ~CPushMtmAutoFetchOperation(); + + public: // Functions from base classes + + /** + * Start or restart the operation. + */ + void StartL(); + + protected: // Constructors + + /** + * Constructor. + * @param aTimeDelayInSec Time delay between fetches in seconds. + * @param aObserverRequestStatus Completion status. + */ + CPushMtmAutoFetchOperation( TInt aTimeDelayInSec, + TRequestStatus& aObserverRequestStatus ); + + /** + * Second phase constructor. + * @param aRequestedUrl The requested URL. + */ + void ConstructL( const TDesC& aRequestedUrl ); + + protected: // New functions + + /** + * Issue fetching. + */ + void FetchL(); + + protected: // Functions from base classes + + /** + * Cancel fetching. + * @return None. + */ + void DoCancel(); + + /** + * Start fetching and make an entry into the operation mapper. + * @return None. + */ + void RunL(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. + */ + TInt RunError( TInt aError ); + + protected: // Data + + TRequestStatus& iObserver; ///< Observer's status. + HBufC* iRequestedUrl; ///< Request URI or NULL. Owned. + + enum TState ///< State. + { + EInit, ///< Initial state. + EFetch, ///< Fetch. + ECheck, ///< Check the result of the fetching. + EDone ///< Operation done. + }; + + TState iState; ///< Current state of the state machine. + + /// The operation that does downloading. Owned. + CPushMtmFetchOperation* iFetchOp; + RTimer iTimer; ///< Timer for waiting. + TInt iTimeDelayInSec; ///< Time delay between downloadings in seconds. + TInt iTry; ///< How many times we have tried downloading so far? + }; + +#endif // PUSHMTMAUTOFETCHOPERATION_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmCacheDataSupplier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmCacheDataSupplier.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data supplier for responses loaded from cache +* +*/ + + + +// INCLUDE FILES +#include "PushMtmCacheDataSupplier.h" + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS + +// MACROS + +// LOCAL CONSTANTS AND MACROS + +// MODULE DATA STRUCTURES + +// LOCAL FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// ============================= LOCAL FUNCTIONS =============================== + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPushMtmCacheDataSupplier::CPushMtmCacheDataSupplier +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CPushMtmCacheDataSupplier::CPushMtmCacheDataSupplier( + HBufC8* aBody ) + : iBody( aBody ) + { + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheDataSupplier::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CPushMtmCacheDataSupplier* CPushMtmCacheDataSupplier::NewL( + HBufC8* aBody ) + { + CPushMtmCacheDataSupplier* self = new(ELeave) CPushMtmCacheDataSupplier( aBody ); + return self; + } + +// Destructor +CPushMtmCacheDataSupplier::~CPushMtmCacheDataSupplier() + { + ReleaseData(); + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheDataSupplier::GetNextDataPart +// Return the next chunk of response body from the Cache +// ----------------------------------------------------------------------------- +// +TBool CPushMtmCacheDataSupplier::GetNextDataPart( + TPtrC8 &aDataChunk ) + { + aDataChunk.Set( *iBody ); + return ETrue; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmCacheDataSupplier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmCacheDataSupplier.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +/* +* ============================================================================== +* Name : PushMtmCacheDataSupplier.h +* Part of : PushMtm +* Interface : +* Description : +* Version : 3.1 +*/ + + +#ifndef CPUSHMTMCACHEDATASUPPLIER_H +#define CPUSHMTMCACHEDATASUPPLIER_H + +// INCLUDES +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * Data supplier to supply response body if the url is loaded + * from cache + * + * @lib + * @since 3.1 + */ +class CPushMtmCacheDataSupplier : public CBase, public MHTTPDataSupplier + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CPushMtmCacheDataSupplier* NewL( HBufC8* aBody ); + + /** + * Destructor. + */ + virtual ~CPushMtmCacheDataSupplier(); + + public: // from MHTTPDataSupplier + + /** + * From MHTTPDataSupplier. Free the data chunk that was requested. + * @since 2.0 + */ + virtual void ReleaseData() { delete iBody; iBody = NULL;} + + /** + * From MHTTPDataSupplier. It is not possible to know + * the data size, so return KErrNotFound + * @since 2.0 + */ + virtual TInt OverallDataSize () { return KErrNotFound; } + + /** + * From MHTTPDataSupplier. Get the next data part of the response body + * @since 2.0 + */ + virtual TBool GetNextDataPart( TPtrC8& aDataPart ); + + /** + * From MHTTPDataSupplier. Not Supported + * @since 2.0 + */ + virtual TInt Reset() { return KErrNotFound; } + + private: + + /** + * C++ default constructor. + */ + CPushMtmCacheDataSupplier( HBufC8* aBody ); + + private: // Data + + //owned by datasupplier and is destroyed + //when the releasedata function is called + HBufC8* iBody; + }; + +#endif // CPUSHMTMCACHEDATASUPPLIER_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmCacheSupply.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmCacheSupply.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,363 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMtmCacheSupply +* +*/ + + +// INCLUDE FILES +#include "PushMtmCacheSupply.h" +#include "httpcachemanager.h" +#include "PushMtmCacheDataSupplier.h" + +#include +#include +#include +#include + + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS +const TInt KResponseTimeout = 0; + +// MACROS + +// LOCAL CONSTANTS AND MACROS + +// MODULE DATA STRUCTURES + +// LOCAL FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// ============================= LOCAL FUNCTIONS =============================== + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::CPushMtmCacheSupply +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CPushMtmCacheSupply::CPushMtmCacheSupply(MCacheSupplyCallbacks* aCacheSupplyCallbacks ): + // closed by default + iReponseState( THTTPEvent::EClosed ) + { + iCacheEntry.iCacheHandler = NULL; + iCacheEntry.iCacheEntry = NULL; + iCacheSupplyCallbacks = aCacheSupplyCallbacks; + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::ConstructL(CHttpCacheManager* aCacheMgr) + { + iCacheManager = aCacheMgr; + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CPushMtmCacheSupply* CPushMtmCacheSupply::NewL(CHttpCacheManager* aCacheMgr, MCacheSupplyCallbacks* aCacheSupplyCallbacks ) + { + CPushMtmCacheSupply* self = new( ELeave ) CPushMtmCacheSupply( aCacheSupplyCallbacks); + + CleanupStack::PushL( self ); + self->ConstructL(aCacheMgr); + CleanupStack::Pop(); + + return self; + } + +// Destructor +CPushMtmCacheSupply::~CPushMtmCacheSupply() + { + delete iDataSupplier; + CloseRequest(); + if (iResponseTimer) + { + iResponseTimer->Cancel(); + } + delete iResponseTimer; + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::StartRequestL +// +// +// ----------------------------------------------------------------------------- +// +TInt CPushMtmCacheSupply::StartRequestL( ) + { + TInt status; + + status = iCacheManager->RequestL( *(iCacheSupplyCallbacks->Transaction()), + TBrCtlDefs::ECacheModeNormal , iCacheEntry ); + // start a timer that feeds the content to the transaction + if( status == KErrNone ) + { + iClosed = EFalse; + // set response state. start with the http headers. + iReponseState = THTTPEvent::EGotResponseHeaders; + // + iResponseTimer = CPeriodic::NewL( CActive::EPriorityHigh ); + iResponseTimer->Start( KResponseTimeout, KResponseTimeout, TCallBack( &ResponseCallbackL, this ) ); + } + return status; + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::CloseRequest +// +// +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::CloseRequest() + { + if( !iClosed ) + { + iCacheManager->RequestClosed( (iCacheSupplyCallbacks->Transaction()), iCacheEntry ); + iClosed = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::HeadersReceived +// +// +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::HeadersReceivedL() + { + // do not cache content we just sent off + if( iReponseState == THTTPEvent::EClosed ) + { + RHTTPTransaction* trans = iCacheSupplyCallbacks->Transaction(); + iCacheManager->ReceivedResponseHeadersL( *(iCacheSupplyCallbacks->Transaction()), iCacheEntry ); + // + iNotModified = trans->Response().StatusCode() == HTTPStatus::ENotModified; + if( iNotModified ) + { + // change from 304 to 200 -otherwise trans exits with EFailed + trans->Response().SetStatusCode( HTTPStatus::EOk ); + } + } + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::BodyReceivedL +// +// +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::BodyReceivedL() + { + // do not cache content we just sent off + if( iReponseState == THTTPEvent::EClosed ) + { + RHTTPTransaction* trans = iCacheSupplyCallbacks->Transaction(); + MHTTPDataSupplier* supplier = trans->Response().Body(); + // + iCacheManager->ReceivedResponseBodyDataL( *trans, *supplier, iCacheEntry ); + } + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::ResponseComplete +// +// +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::ResponseCompleteL() + { + if( iReponseState == THTTPEvent::EClosed ) + { + RHTTPTransaction* trans = iCacheSupplyCallbacks->Transaction(); + // not modified needs body before response complete + if( iNotModified ) + { + // use cache + // close response first + iCacheManager->ResponseComplete( *trans, iCacheEntry ); + // request the item from cache + if( iCacheManager->RequestL( *trans, TBrCtlDefs::ECacheModeOnlyCache, iCacheEntry ) == KErrNone ) + { + // ser + iReponseState = THTTPEvent::EGotResponseBodyData; + // + SendBodyL(); + CloseRequest(); + } + } + else + { + // normal response complete + iCacheManager->ResponseComplete( *trans, iCacheEntry ); + } + } + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::ResponseCallbackL +// +// +// ----------------------------------------------------------------------------- +// +TInt CPushMtmCacheSupply::ResponseCallbackL( + TAny* aAny ) + { + // + CPushMtmCacheSupply* thisObj = (CPushMtmCacheSupply*)aAny; + thisObj->SupplyResponseL(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::SupplyResponseL +// +// +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::SupplyResponseL() + { + RHTTPTransaction* trans = iCacheSupplyCallbacks->Transaction(); + // + switch( iReponseState ) + { + case THTTPEvent::EGotResponseHeaders: + { + // + iFailed = EFalse; + if( iCacheManager->RequestHeadersL( *trans, iCacheEntry ) == KErrNone ) + { + // + trans->Response().SetStatusCode( HTTPStatus::EOk ); + // + iCacheSupplyCallbacks->HandleEventL( THTTPEvent::EGotResponseHeaders ); + // move to the next state + iReponseState = THTTPEvent::EGotResponseBodyData; + } + else + { + // move to the next state + iFailed = ETrue; + // move to the next state + iReponseState = THTTPEvent::EResponseComplete; + } + break; + } + case THTTPEvent::EGotResponseBodyData: + { + // + SendBodyL(); + // move to the next state + iReponseState = THTTPEvent::EResponseComplete; + break; + } + case THTTPEvent::EResponseComplete: + { + iCacheSupplyCallbacks->HandleEventL( THTTPEvent::EResponseComplete ); + // move to the next state + iReponseState = !iFailed ? THTTPEvent::ESucceeded : THTTPEvent::EFailed; + break; + } + case THTTPEvent::ESucceeded: + { + // move to the next state + iReponseState = THTTPEvent::EClosed; + // cancel timer + iResponseTimer->Cancel(); + // + iCacheSupplyCallbacks->HandleEventL( THTTPEvent::ESucceeded ); + // this obj is destroyed at this point + break; + } + case THTTPEvent::EFailed: + { + // move to the next state + iReponseState = THTTPEvent::EClosed; + // cancel timer + iResponseTimer->Cancel(); + // + iCacheSupplyCallbacks->HandleEventL( THTTPEvent::EFailed ); + // this obj is destroyed at this point + break; + } + default: + { + // + } + } + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::SendBodyL +// +// +// ----------------------------------------------------------------------------- +// +void CPushMtmCacheSupply::SendBodyL() + { + RHTTPTransaction* trans = iCacheSupplyCallbacks->Transaction(); + // + TBool lastChunk; + // currently it is always the last chunk + HBufC8* body = iCacheManager->RequestNextChunkL( *trans, lastChunk, iCacheEntry ); + if( body ) + { + CleanupStack::PushL( body ); + // create datasupplier and attach it to the transaction + if( !iDataSupplier ) + iDataSupplier = CPushMtmCacheDataSupplier::NewL( body ); + trans->Response().SetBody( *iDataSupplier ); + CleanupStack::Pop(); // body + // + iCacheSupplyCallbacks->HandleEventL( THTTPEvent::EGotResponseBodyData ); + } + else + { + // move to the next state + iFailed = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::PauseSupply +// ----------------------------------------------------------------------------- +void CPushMtmCacheSupply::PauseSupply() + { + if( iResponseTimer && iResponseTimer->IsActive() ) + iResponseTimer->Cancel(); + } + +// ----------------------------------------------------------------------------- +// CPushMtmCacheSupply::ResumeSupply +// ----------------------------------------------------------------------------- +void CPushMtmCacheSupply::ResumeSupply() + { + if( iResponseTimer && !iResponseTimer->IsActive() ) + iResponseTimer->Start( KResponseTimeout, KResponseTimeout, TCallBack( &ResponseCallbackL, this ) ); + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmCacheSupply.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmCacheSupply.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of CPushMtmCacheSupply +* +*/ + + +#ifndef CPUSHMTMCACHESUPPLY_H +#define CPUSHMTMCACHESUPPLY_H + +// INCLUDES +#include +#include +#include "httpcachemanager.h" + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CHttpTransaction; +class CPeriodic; +class CPushMtmCacheDataSupplier; + +// CLASS DECLARATION + + + +class MCacheSupplyCallbacks + { + public: + virtual RHTTPTransaction* Transaction() = 0; + virtual void HandleEventL(THTTPEvent aEvent) = 0; + }; + + +/** +* This class handles http transactions. +* @lib PushMtmContentHandler +* @since 3.1 +*/ +class CPushMtmCacheSupply : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param + * @param + * @param + * @return Http cache object. + */ + static CPushMtmCacheSupply* NewL( CHttpCacheManager* aCacheMgr, MCacheSupplyCallbacks* aCacheSupplyCallbacks ); + + /** + * Destructor. + */ + virtual ~CPushMtmCacheSupply(); + + public: // new functions + + /** + * + * @since 3.1 + * @param + * @return + */ + TInt StartRequestL( ); + + /** + * + * @since 3.1 + * @param + * @return + */ + void CloseRequest(); + + /** + * + * @since 3.1 + * @param + * @return + */ + void HeadersReceivedL(); + + /** + * + * @since 3.1 + * @param + * @return + */ + void BodyReceivedL(); + + /** + * + * @since 3.1 + * @param + * @return + */ + void ResponseCompleteL(); + + /** + * + * @since 3.1 + * @param + * @return + */ + TInt ResponseState() const { return iReponseState;} + + /** + * + * @since 3.1 + * @param + * @return + */ + TBool IsSupplying() { return iResponseTimer!=0; } + + /** + * + * @since 3.1 + * @param + * @return + */ + void PauseSupply(); + + /** + * + * @since 3.1 + * @param + * @return + */ + void ResumeSupply(); + + private: + + /** + * Construct. + * @param + * @param + * @parem + * @return + */ + CPushMtmCacheSupply( MCacheSupplyCallbacks* aCacheSupplyCallbacks ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(CHttpCacheManager* aCacheMgr); + + private: // + + /** + * Callback for async response + * @since 3.1 + * @param aAny this pinter + * @return TInt KErrNone + */ + static TInt ResponseCallbackL( TAny* aAny ); + + /** + * + * @since 3.1 + * @param + * @return + */ + void SupplyResponseL(); + + /** + * + * @since 3.1 + * @param + * @return + */ + void SendBodyL(); + + private: // Data + + // + CHttpCacheManager* iCacheManager; // not owned + // + TInt iReponseState; + // + CPeriodic* iResponseTimer; // owned + // + TBool iFailed; + // + TBool iNotModified; + // + THttpCacheEntry iCacheEntry; + // ETrue if the cache object is closed + TBool iClosed; + + CPushMtmCacheDataSupplier* iDataSupplier; + MCacheSupplyCallbacks* iCacheSupplyCallbacks; + }; + +#endif // CPUSHMTMCACHESUPPLY_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmFetchOperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmFetchOperation.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,1043 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushMtmFetchOperation. +* +*/ + + + +// INCLUDE FILES + +#include "PushMtmFetchOperation.h" +#include "PushContentHandlerPanic.h" +#include "PushMtmLog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "PushMtmPrivateCRKeys.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// ================= MACROS ======================= + +#ifdef _DEBUG + /// Guard "debug-only" argument name with this (expands to argument). + #define DEBUG_ONLY( argName ) argName +#else /* not defined _DEBUG */ + /// Guard "debug-only" argument name with this (expands to nothing). + #define DEBUG_ONLY( argName ) +#endif /* def _DEBUG */ + +// ================= LOCAL CONSTANTS ======================= + +_LIT8( KHttpProtString, "HTTP/TCP" ); +_LIT8( KUserAgent, "Push MTM" ); + +/// Base HTTP error code. See Extended Error Handling UI Specification! +LOCAL_C const TInt KPushMtmHttpErrorBase = -25000; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmFetchOperation::NewL +// --------------------------------------------------------- +// +CPushMtmFetchOperation* CPushMtmFetchOperation::NewL + ( + const TDesC& aRequestedUrl, + TRequestStatus& aObserverRequestStatus + ) + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::NewL") + + CPushMtmFetchOperation* op = + new (ELeave) CPushMtmFetchOperation( aObserverRequestStatus ); + CleanupStack::PushL( op ); + op->ConstructL( aRequestedUrl ); + CleanupStack::Pop( op ); // op + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::NewL") + return op; + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::~CPushMtmFetchOperation +// --------------------------------------------------------- +// +CPushMtmFetchOperation::~CPushMtmFetchOperation() + { + Cancel(); + delete ( iCacheMgr ); + delete iCacheSupply; + iHttpTrans.Close(); + iHttpSess.Close(); + iConn.Close(); + iSockServ.Close(); + delete iRequestedUrl; + delete iSourceUri; + delete iBody; + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::StartL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::StartL() + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::StartL") + + Cancel(); + + iResult = KErrNone; + iState = EInit; + + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::StartL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::CPushMtmFetchOperation +// --------------------------------------------------------- +// +CPushMtmFetchOperation::CPushMtmFetchOperation + ( TRequestStatus& aObserverRequestStatus ) +: CActive( EPriorityStandard ), + iObserver( aObserverRequestStatus ), + iState( EInit ), + iResult( KErrNone ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::ConstructL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::ConstructL( const TDesC& aRequestedUrl ) + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::ConstructL") + + iRequestedUrl = HBufC8::NewMaxL( aRequestedUrl.Length() ); + iRequestedUrl->Des().Copy( aRequestedUrl ); + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::ConstructL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::GetDefaultInetAccessPointL +// --------------------------------------------------------- +// +TBool CPushMtmFetchOperation::GetDefaultInetAccessPointL + ( TUint32& aIapId ) const + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::GetDefaultInetAccessPointL") + + // Try to find the default AP. + // The Browser may stores the default AP in the shared data. + CRepository* repository = CRepository::NewL( KCRUidBrowser ); + CleanupStack::PushL( repository ); + + TInt wapApId; + User::LeaveIfError + ( repository->Get( KBrowserDefaultAccessPoint, wapApId ) ); + TUint32 wapApId32( wapApId ); + TUint32 iapId32( 0 ); + + CleanupStack::PopAndDestroy( repository ); + repository = 0; + + CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); + CleanupStack::PushL( commsDb ); + CApDataHandler* apDataHandler = CApDataHandler::NewLC( *commsDb ); + CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); + TRAPD( err, apDataHandler->AccessPointDataL( wapApId32, *apItem ) ); + CApUtils* apUtils = CApUtils::NewLC( *commsDb ); + + TBool wapApFound( EFalse ); + TBool iapFound( EFalse ); + + PUSHLOG_WRITE_FORMAT(" err: <%d>",err) + if ( err == KErrNone ) + { + wapApFound = ETrue; + } + else // err != KErrNone + { + // The first valid access point has to be selected if exists + CApSelect* apSelect = CApSelect::NewLC + ( + *commsDb, + KEApIspTypeAll, + EApBearerTypeAll, + KEApSortNameAscending + ); + if ( apSelect->MoveToFirst() ) + { + wapApFound = ETrue; + wapApId32 = apSelect->Uid(); + } + CleanupStack::PopAndDestroy( apSelect ); // apSelect + } + + if ( wapApFound ) + { + // Get the IAP ID from the WAP AP ID. +#ifndef __SERIES60_WSP + iapId32 = 0; + TRAPD( errTransl, iapId32 = apUtils->IapIdFromWapIdL( wapApId32 ) ); + PUSHLOG_WRITE_FORMAT(" IapIdFromWapIdL errTransl: <%d>",errTransl) + if ( errTransl == KErrNone ) + { + iapFound = ETrue; + } +#else + iapId32 = wapApId32; + iapFound = ETrue; +#endif // __SERIES60_WSP + } + + CleanupStack::PopAndDestroy( 4 ); // apUtils, apItem, + // apDataHandler, commsDb + + if ( iapFound ) + { + aIapId = iapId32; + } + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::GetDefaultInetAccessPointL") + return iapFound; + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::InitializeL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::InitializeL() + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::InitializeL") + + User::LeaveIfError( iSockServ.Connect() ); + PUSHLOG_WRITE("CPushMtmFetchOperation iSockServ.Connect() OK") + User::LeaveIfError( iConn.Open( iSockServ ) ); + PUSHLOG_WRITE("CPushMtmFetchOperation iConn.Open() OK") + + // Open the HTTP session. + iHttpSess.OpenL( KHttpProtString ); + PUSHLOG_WRITE("CPushMtmFetchOperation iHttpSess.OpenL OK") + + // Set our Socket Server handle and Connection as session properties. + iHttpSess.ConnectionInfo().SetPropertyL + ( + StringF( HTTP::EHttpSocketServ ), + THTTPHdrVal( iSockServ.Handle() ) + ); + PUSHLOG_WRITE("CPushMtmFetchOperation EHttpSocketServ set") + iHttpSess.ConnectionInfo().SetPropertyL + ( + StringF( HTTP::EHttpSocketConnection ), + THTTPHdrVal( REINTERPRET_CAST( TInt, &iConn ) ) + ); + PUSHLOG_WRITE("CPushMtmFetchOperation EHttpSocketConnection set") + + // Open different string tables to the session. These are required + // by the Accept Header Filter. + iHttpSess.StringPool().OpenL( HttpFilterCommonStringsExt::GetTable() ); + PUSHLOG_WRITE("CPushMtmFetchOperation table 1 opened"); + iHttpSess.StringPool().OpenL( HttpFilterCommonStringsExt::GetLanguageTable() ); + PUSHLOG_WRITE("CPushMtmFetchOperation table 2 opened"); + + // Install the very same set of filters that BrowserEngine installs. + // The following filters must not be installed: + // - Authentication Filter, because the fetch operation and the push mtm + // subsystem does not support credentials. + // - Conn Handler Filter, because the fetch operation let it to the HTTP + // core framework to create connection - it just sets the acces point. + + // Install UAProf filter. + CHttpUAProfFilterInterface::InstallFilterL( iHttpSess ); + PUSHLOG_WRITE(" UAProf installed") + + // Install cookie filter. + CHttpCookieFilter::InstallFilterL( iHttpSess ); + PUSHLOG_WRITE(" Cookie filter installed") + + // Create cache manager + FeatureManager::InitializeLibL(); + iCacheMgr = CHttpCacheManager::NewL(); + PUSHLOG_WRITE(" Cache Manager installed") + + // Install Accept Header Filter. + CHttpFilterAcceptHeaderInterface::InstallFilterL( iHttpSess ); + PUSHLOG_WRITE(" Accept Header Filter installed") + + // Install IOP Filter. + CHttpFilterIopInterface::InstallFilterL( iHttpSess, iopOptionHostHeader ); + PUSHLOG_WRITE(" IOP Filter installed") + + // Install Deflate Filter. + CHttpDeflateFilter::InstallFilterL( iHttpSess ); + PUSHLOG_WRITE(" Deflate Filter installed"); + + TUint32 defIapId( 0 ); + TBool defIapIdFound = EFalse; + TCommDbConnPref commPrefs; +#ifndef __WINS__ + // Use Browser default AP & comms db: + defIapIdFound = GetDefaultInetAccessPointL( defIapId ); + PUSHLOG_WRITE_FORMAT(" defIapIdFound: <%d>",(TInt)defIapIdFound) + PUSHLOG_WRITE_FORMAT(" defIapId: <%d>",defIapId) + commPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); + if ( defIapIdFound ) + { + commPrefs.SetIapId( defIapId ); + } +#else // __WINS__ + // Prompt the user to select access point + commPrefs.SetDialogPreference( ECommDbDialogPrefPrompt ); +#endif // __WINS__ + + iState = EStartRequest; + + iStatus = KRequestPending; + SetActive(); + iConn.Start( commPrefs, iStatus ); + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::InitializeL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::StartRequestL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::StartRequestL() + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::StartRequestL") + + // Create the transaction. + CreateTransactionL(); + + CheckCacheL(); + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::StartRequestL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::CheckCacheL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::CheckCacheL() + + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::CheckCacheL") + iCacheSupply = CPushMtmCacheSupply::NewL(iCacheMgr, this); + TInt ret = iCacheSupply->StartRequestL(); + iStatus = KRequestPending; + SetActive(); + if (ret != KErrNone) // Not in cache + { + iState = ERequest; + iCachedResponse = ETrue; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone); + } + else + { + iState = EDone; + iCachedResponse = EFalse; + } + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::CheckCacheL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::RequestL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::RequestL() + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::RequestL") + + iState = EDone; + + iStatus = KRequestPending; + SetActive(); + SubmitTransactionL(); + // Do not call InvokeRun(). Let MHFRunL to handle the request. + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::RequestL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::Done +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::Done() + { + PUSHLOG_WRITE_FORMAT("CPushMtmFetchOperation::Done iResult: <%d>",iResult); + + delete iRequestedUrl; + iRequestedUrl = NULL; + + // Notify parent. + TRequestStatus* status = &iObserver; + User::RequestComplete( status, iResult ); +// iState = EInit; + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::CreateTransactionL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::CreateTransactionL() + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::CreateTransactionL") + + __ASSERT_DEBUG( iRequestedUrl, + ContHandPanic( EPushContHandPanNotInitUrl ) ); + + // Create the transaction. + TUriParser8 uri; + User::LeaveIfError( uri.Parse( *iRequestedUrl ) ); + iHttpTrans = + iHttpSess.OpenTransactionL( uri, *this, StringF( HTTP::EGET ) ); + PUSHLOG_WRITE("CPushMtmFetchOperation OpenTransactionL OK") + + // Set request headers. + RHTTPHeaders hdr = iHttpTrans.Request().GetHeaderCollection(); + SetHeaderL( hdr, HTTP::EUserAgent, KUserAgent ); + SetHeaderL( hdr, HTTP::EAccept, HTTP::EAnyAny ); + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::CreateTransactionL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::SubmitTransactionL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::SubmitTransactionL() + { + iHttpTrans.SubmitL(); + PUSHLOG_WRITE("CPushMtmFetchOperation iHttpTrans.SubmitL OK") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::HandleResponseHeadersL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::HandleResponseHeadersL( RHTTPResponse aResponse ) + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::HandleResponseHeadersL") + + TInt httpCode = aResponse.StatusCode(); + PUSHLOG_WRITE_FORMAT(" HttpStatus: %d",httpCode) + +#ifdef __TEST_LOG__ + LogHeadersL( aResponse.GetHeaderCollection() ); +#endif // __TEST_LOG__ + + if ( HTTPStatus::IsSuccessful( httpCode ) && + ( httpCode != HTTPStatus::ENoContent ) ) + { + // Successful GET. + PUSHLOG_WRITE(" Successful GET") + // Get content type. + iDataType = TDataType + ( GetContentTypeL( aResponse.GetHeaderCollection() ) ); + // Get source URI. + HBufC8* buf = GetSourceUriL( iHttpTrans ).AllocL(); + PUSHLOG_WRITE(" Source URI got") + delete iSourceUri; + iSourceUri = buf; + // No error: + iResult = KErrNone; + } + else + { + // See Extended Error Handling UI Specification! + iResult = KPushMtmHttpErrorBase - httpCode; + PUSHLOG_WRITE_FORMAT(" iResult: <%d>",iResult) + } + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::HandleResponseHeadersL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::VersionRetryL +// --------------------------------------------------------- +// +TBool CPushMtmFetchOperation::VersionRetryL() + { + TBool retryDone( EFalse ); + + // Check what http version we are using. + THTTPHdrVal val; + TBool exists = iHttpSess.ConnectionInfo().Property + ( + StringF( HTTP::EHTTPVersion ), + val + ); + if ( exists && TInt( val ) == HTTP::EHttp11 ) + { + // Currently using HTTP/1.1. Cancel transaction and resubmit it using + // HTTP/1.0. + iHttpTrans.Cancel(); + iHttpSess.ConnectionInfo().SetPropertyL + ( + StringF( HTTP::EHTTPVersion ), + THTTPHdrVal( StringF( HTTP::EHttp10 ) ) + ); + SubmitTransactionL(); + retryDone = ETrue; + } + + return retryDone; + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::AppendResponse +// --------------------------------------------------------- +// +TInt CPushMtmFetchOperation::AppendResponse( const TDesC8& aDataChunk ) + { + TInt err( KErrNone ); + HBufC8* newBodyBuf = NULL; + + if ( !iBody ) + { + // iBody does not exist yet; allocate buffer for the first data chunk. + newBodyBuf = HBufC8::New( aDataChunk.Length() ); + } + else + { + const TInt needed( iBody->Des().Length() + aDataChunk.Length() ); + if ( iBody->Des().MaxLength() < needed ) + { + // iBody exists, but small. + newBodyBuf = iBody->ReAlloc( needed ); + iBody = NULL; // ReAlloc deleted it! + } + else + { + // iBody exists and the new chunk fits into it. + } + } + + if ( newBodyBuf ) + { + __ASSERT_DEBUG( iBody == NULL, + ContHandPanic( EPushContHandPanAlreadyInitialized ) ); + delete iBody; // Not necessary, JIC. + iBody = newBodyBuf; + } + else + { + if (aDataChunk.Length() > 0) + { + err = KErrNoMemory; + } + } + + if ( !err ) + { + iBody->Des().Append( aDataChunk ); + } + + return err; + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::SetHeaderL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::SetHeaderL( RHTTPHeaders aHeaders, + HTTP::TStrings aHdrField, + const TDesC8& aHdrValue ) + { + RStringF valStr = iHttpSess.StringPool().OpenFStringL( aHdrValue ); + CleanupClosePushL( valStr ); + SetHeaderL( aHeaders, aHdrField, valStr ); + CleanupStack::PopAndDestroy(); // close valStr + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::SetHeaderL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::SetHeaderL( RHTTPHeaders aHeaders, + HTTP::TStrings aHdrField, + HTTP::TStrings aHdrValue ) + { + SetHeaderL( aHeaders, aHdrField, StringF( aHdrValue ) ); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::SetHeaderL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::SetHeaderL( RHTTPHeaders aHeaders, + HTTP::TStrings aHdrField, + const RStringF aHdrValue ) + { + THTTPHdrVal val( aHdrValue ); + aHeaders.SetFieldL( StringF( aHdrField ), val ); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::GetContentTypeL +// --------------------------------------------------------- +// +const TDesC8& CPushMtmFetchOperation::GetContentTypeL( RHTTPHeaders aHeaders ) + { + THTTPHdrVal hdrVal; + User::LeaveIfError + ( aHeaders.GetField( StringF( HTTP::EContentType ), 0, hdrVal ) ); + if ( hdrVal.Type() != THTTPHdrVal::KStrFVal ) + { + User::Leave( KErrArgument ); + } + return hdrVal.StrF().DesC(); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::GetSourceUriL +// --------------------------------------------------------- +// +const TDesC8& CPushMtmFetchOperation::GetSourceUriL + ( RHTTPTransaction aTransaction ) + { + // TODO if redirected URI exists, how do we get it? + // For the moment request URI is used. + return aTransaction.Request().URI().UriDes(); + } + + +// --------------------------------------------------------- +// CPushMtmFetchOperation::LogHeadersL +// --------------------------------------------------------- +// +#ifndef __TEST_LOG__ + +void CPushMtmFetchOperation::LogHeadersL( RHTTPHeaders /*aHeaders*/ ) + { + } + +#else // #ifdef __TEST_LOG__ + +void CPushMtmFetchOperation::LogHeadersL( RHTTPHeaders aHeaders ) + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::LogHeadersL") + + _LIT( KDateFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S.%C%:3" ); + + PUSHLOG_WRITE("Headers:"); + + RStringPool strP = iHttpTrans.Session().StringPool(); + THTTPHdrFieldIter it = aHeaders.Fields(); + + while ( !it.AtEnd() ) + { + RStringTokenF fieldName = it(); + RStringF fieldNameStr = strP.StringF( fieldName ); + THTTPHdrVal fieldVal; + if ( aHeaders.GetField( fieldNameStr, 0, fieldVal ) == KErrNone ) + { + const TInt KMaxLogStrLen = 64; + TPtrC8 fieldName8 = fieldNameStr.DesC(); + TInt fieldNameLen = fieldName8.Length(); + fieldNameLen = ( KMaxLogStrLen < fieldNameLen ) ? + KMaxLogStrLen : fieldNameLen; + fieldName8.Set( fieldName8.Mid( 0, fieldNameLen ) ); + HBufC* fieldNameHBufC = HBufC::NewMaxLC( fieldName8.Length() ); + TPtr fieldName = fieldNameHBufC->Des(); + fieldName.Copy( fieldName8 ); + + switch ( fieldVal.Type() ) + { + case THTTPHdrVal::KTIntVal: + { + PUSHLOG_WRITE_FORMAT2 + (" <%S> (%d)",&fieldName,fieldVal.Int()) + break; + } + + case THTTPHdrVal::KStrFVal: + { + RStringF fieldValStr = strP.StringF( fieldVal.StrF() ); + TPtrC8 fieldVal8 = fieldValStr.DesC(); + // Truncate if too long. + TInt fieldValLen = fieldVal8.Length(); + fieldNameLen = ( KMaxLogStrLen < fieldValLen ) ? + KMaxLogStrLen : fieldValLen; + fieldVal8.Set( fieldVal8.Mid( 0, fieldValLen ) ); + // Truncate end. + HBufC* fieldValHBufC = HBufC::NewMaxLC( fieldVal8.Length() ); + TPtr fieldVal = fieldValHBufC->Des(); + fieldVal.Copy( fieldVal8 ); + PUSHLOG_WRITE_FORMAT2 + (" <%S> (%S)",&fieldName,&fieldVal) + CleanupStack::PopAndDestroy( fieldValHBufC ); + // fieldValHBufC + break; + } + + case THTTPHdrVal::KStrVal: + { + RString fieldValStr = strP.String( fieldVal.Str() ); + TPtrC8 fieldVal8 = fieldValStr.DesC(); + // Truncate if too long. + TInt fieldValLen = fieldVal8.Length(); + fieldNameLen = ( KMaxLogStrLen < fieldValLen ) ? + KMaxLogStrLen : fieldValLen; + fieldVal8.Set( fieldVal8.Mid( 0, fieldValLen ) ); + // Truncate end. + HBufC* fieldValHBufC = HBufC::NewMaxLC( fieldVal8.Length() ); + TPtr fieldVal = fieldValHBufC->Des(); + fieldVal.Copy( fieldVal8 ); + PUSHLOG_WRITE_FORMAT2 + (" <%S> (%S)",&fieldName,&fieldVal) + CleanupStack::PopAndDestroy( fieldValHBufC ); + // fieldValHBufC + break; + } + + case THTTPHdrVal::KDateVal: + { + TDateTime date = fieldVal.DateTime(); + TBuf<40> dateTimeString; + TTime t( date ); + TRAP_IGNORE( t.FormatL( dateTimeString, KDateFormat ) ); + PUSHLOG_WRITE_FORMAT2 + (" <%S> (%S)",&fieldName,&dateTimeString) + break; + } + + default: + { + PUSHLOG_WRITE_FORMAT2 + (" <%S> unrecognised value type (%d)", + &fieldName,fieldVal.Type()) + break; + } + } + + // Display realm for WWW-Authenticate header. + RStringF wwwAuth = strP.StringF + ( HTTP::EWWWAuthenticate, RHTTPSession::GetTable() ); + if ( fieldNameStr == wwwAuth ) + { + PUSHLOG_WRITE(" fieldNameStr == wwwAuth") + // check the auth scheme is 'basic' + RStringF basic = strP.StringF + ( HTTP::EBasic, RHTTPSession::GetTable() ); + RStringF realm = strP.StringF + ( HTTP::ERealm, RHTTPSession::GetTable() ); + THTTPHdrVal realmVal; + if ( ( fieldVal.StrF() == basic ) && + ( !aHeaders.GetParam( wwwAuth, realm, realmVal ) ) ) + { + RStringF realmValStr = strP.StringF( realmVal.StrF() ); + PUSHLOG_WRITE_FORMAT(" Realm <%S>",&realmValStr); + } + } + + CleanupStack::PopAndDestroy( fieldNameHBufC ); // fieldNameHBufC + } + ++it; + } + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::LogHeadersL") + } + +#endif // __TEST_LOG__ + +// --------------------------------------------------------- +// CPushMtmFetchOperation::DoCancel +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::DoCancel() + { + switch ( iState ) + { + /*case EStartConnect: + { + // Complete ourselves - nothing is outstanding. + TRequestStatus* ownStatus = &iStatus; + User::RequestComplete( ownStatus, KErrCancel ); + break; + }*/ + + /*case EConnect: + { + //__ASSERT_DEBUG( iConn, ContHandPanic( ECodInternal ) ); + //iConn->Cancel(); // This will complete our status. + break; + }*/ + + case EStartRequest: + case ECheckCache: + case ERequest: + { + delete iCacheSupply; + iCacheSupply = NULL; + + iHttpTrans.Close(); + // Now the transaction has been closed. Closing it does not + // complete our status, so we do it manually. + TRequestStatus* status = &iStatus; + SetActive(); + User::RequestComplete( status, iResult ); + break; + } + + case EInit: + default: + { + // No requests should be outstanding in these states. + //ContHandPanic( ECodInternal ); + break; + } + } + + iResult = KErrCancel; + Done(); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::RunL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::RunL() + { + PUSHLOG_WRITE_FORMAT("CPushMtmFetchOperation::RunL status = %d", iState); + // Handle errors in RunError(). + User::LeaveIfError( iStatus.Int() ); + + switch ( iState ) + { + case EInit: + { + InitializeL(); + break; + } + + case EStartRequest: + { + StartRequestL(); + break; + } + + case ERequest: + { + RequestL(); + break; + } + + case EDone: + { + Done(); + break; + } + + default: + { + // JIC. + Done(); + break; + } + } + PUSHLOG_WRITE_FORMAT("CPushMtmFetchOperation::RunL moving to status = %d", iState); + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::RunError +// --------------------------------------------------------- +// +TInt CPushMtmFetchOperation::RunError( TInt aError ) + { + PUSHLOG_WRITE_FORMAT("CPushMtmFetchOperation::RunError <%d>",aError) + + iResult = aError; + delete iCacheSupply; + iCacheSupply = NULL; + iHttpTrans.Close(); + Done(); + + return KErrNone; + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::MHFRunL +// --------------------------------------------------------- +// +void CPushMtmFetchOperation::MHFRunL + ( + RHTTPTransaction DEBUG_ONLY( aTransaction ), + const THTTPEvent& aEvent + ) + { + PUSHLOG_ENTERFN("CPushMtmFetchOperation::MHFRunL") + __ASSERT_DEBUG( aTransaction == iHttpTrans, + ContHandPanic( EPushContHandPanBadTransaction ) ); + switch ( aEvent.iStatus ) + { + case THTTPEvent::EGotResponseHeaders: + { + PUSHLOG_WRITE(" EGotResponseHeaders") + // pass headers to the cache first + TRAP_IGNORE( iCacheSupply->HeadersReceivedL() ); + // Now we know that the request was processed by the server. + HandleResponseHeadersL( iHttpTrans.Response() ); + break; + } + + case THTTPEvent::EGotResponseBodyData: + { + PUSHLOG_WRITE(" EGotResponseBodyData") + // pass chunk to the cache first + TRAP_IGNORE( iCacheSupply->BodyReceivedL() ); + // Get body data and save it. + TInt err( KErrNone ); + MHTTPDataSupplier* body = iHttpTrans.Response().Body(); + if ( !body ) + { + PUSHLOG_WRITE(" NULL body") + } + else + { + TPtrC8 bodyPtr; + // Caution: no leaving between body->GetNextDataPart and + // body->ReleaseData calls! Data must always be released. +#ifdef __TEST_LOG__ + TBool isLast = body->GetNextDataPart( bodyPtr ); // No leave... + PUSHLOG_WRITE_FORMAT(" last? (%d)",(isLast?1:0)) +#else // ifndef __TEST_LOG__ + (void)body->GetNextDataPart( bodyPtr ); // No leave... +#endif // __TEST_LOG__ + //if ( iHttpTrans.Request().Method() == StringF( HTTP::EGET ) ) + err = AppendResponse( bodyPtr ); + body->ReleaseData(); // ...until here. + PUSHLOG_WRITE_FORMAT(" err: (%d)",err) + User::LeaveIfError( err ); + } + break; + } + + case THTTPEvent::EResponseComplete: + { + // do not mix it up with the ESucceeded + // The transaction's response is complete. An incoming event. + TRAP_IGNORE( iCacheSupply->ResponseCompleteL() ); + break; + } + + case THTTPEvent::ERequestComplete: + { + // request is all set + iCacheSupply->CloseRequest(); + break; + } + + case THTTPEvent::EFailed: + { + PUSHLOG_WRITE(" EFailed") + // Safety code: we should already have an error code. + if ( iResult == KErrNone ) + { + iResult = KErrGeneral; + } + // TODO. Fall through. + } + + case THTTPEvent::ESucceeded: + { + PUSHLOG_WRITE(" ESucceeded") + delete iCacheSupply; + iCacheSupply = NULL; + iHttpTrans.Close(); + // Transaction is finished, invoke RunL now. + TRequestStatus* status = &iStatus; + if (!IsActive()) + { + SetActive(); + } + User::RequestComplete( status, iResult ); + break; + } + + case THTTPEvent::ERedirectedPermanently: + { + PUSHLOG_WRITE(" ERedirectedPermanently") + // Do nothing just continue. + break; + } + + default: + { + PUSHLOG_WRITE(" default case") + // Handle errors in MHFRunError. + User::LeaveIfError( aEvent.iStatus ); + break; + } + } + + PUSHLOG_LEAVEFN("CPushMtmFetchOperation::MHFRunL") + } + +// --------------------------------------------------------- +// CPushMtmFetchOperation::MHFRunError +// --------------------------------------------------------- +// +TInt CPushMtmFetchOperation::MHFRunError + ( + TInt aError, + RHTTPTransaction DEBUG_ONLY( aTransaction ), + const THTTPEvent& /*aEvent*/ + ) + { + __ASSERT_DEBUG( aTransaction == iHttpTrans, + ContHandPanic( EPushContHandPanBadTransaction ) ); + iResult = aError; + iCacheSupply->CloseRequest(); + iHttpTrans.Close(); + + // Transaction is finished, invoke RunL now. + // iResult contains the (error) code. + if ( !IsActive() ) + { + SetActive(); + } + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + + return KErrNone; + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmFetchOperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmFetchOperation.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,309 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushMtmFetchOperation. +* +*/ + + + +#ifndef PUSHMTMFETCHOPERATION_H +#define PUSHMTMFETCHOPERATION_H + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include "httpcachemanager.h" +#include "PushMtmCacheSupply.h" + +// FORWARD DECLARATIONS + +class CMsvEntry; + +// CLASS DECLARATION + +/** +* Asynchronous fetch operation that downloads the service indicated by an SL +* pushed service message. +* +* The operation can run in silent mode without requiring any user intervention. +*/ +class CPushMtmFetchOperation : public CActive, + public MHTTPTransactionCallback, + public MCacheSupplyCallbacks + { + public: // Constructors and destructor + + /** + * Two-phased constructor. Leaves on failure. + * @param aRequestedUrl The requested URL. + * @param aObserverRequestStatus Observer's status. + * @return The constructed operation. + */ + static CPushMtmFetchOperation* NewL + ( + const TDesC& aRequestedUrl, + TRequestStatus& aObserverRequestStatus + ); + + /** + * Destructor. + */ + virtual ~CPushMtmFetchOperation(); + + public: // Functions from base classes + + /** + * Start or restart the operation. + */ + void StartL(); + + RHTTPTransaction* Transaction(){ return &iHttpTrans; } + void HandleEventL(THTTPEvent aEvent) { MHFRunL(iHttpTrans, aEvent); } + + protected: // Constructors + + /** + * Constructor. + * @param aObserverRequestStatus Observer's status. + */ + CPushMtmFetchOperation( TRequestStatus& aObserverRequestStatus ); + + /** + * Second phase constructor. + * @param aRequestedUrl The requested URL. + * @return None. + */ + void ConstructL( const TDesC& aRequestedUrl ); + + protected: // New functions + + /** + * Get the ID of the defauld internet access point set in the Browser + * Preferences that is used for connection creation. + * @param aIapId The ID of the access point, if found. The value of + * this variable is not changed if no default ap can be found. + * @return Indicate if default ap could be found. + */ + TBool GetDefaultInetAccessPointL( TUint32& aIapId ) const; + + protected: // state machine parts + + /** + * Initiate connecting. + */ + void InitializeL(); + + /** + * StartRequestL + */ + void StartRequestL(); + + /** + * CheckCacheL + */ + void CheckCacheL(); + + /** + * Initiate connecting. + */ + void RequestL(); + + /** + * Clean up and notify parent. + */ + void Done(); + + /** + * Create transaction, set request headers (and body for POST request). + */ + void CreateTransactionL(); + + /** + * Submit the transaction (make the HTTP request). + */ + void SubmitTransactionL(); + + /** + * Handle response from server. + * @param aResponse Response from server. + */ + void HandleResponseHeadersL( RHTTPResponse aResponse ); + + /** + * HTTP Version Not Supported. Resubmit transaction using HTTP/1.0. + * @return ETrue if transaction was resubmitted, EFalse if not (i.e + * we already use HTTP/1.0). + */ + TBool VersionRetryL(); + + /** + * Append a new chunk of response data to the reponse buffer. + * @return KErrNone or KErrNoMemory. + */ + TInt AppendResponse( const TDesC8& aDataChunk ); + + protected: // helpers + + /** + * Helper function to set a header. + * @param aHeaders Set the header to this header set. + * @param aHdrField Header field name. + * @param aHdrValue Header value. + */ + void SetHeaderL + ( + RHTTPHeaders aHeaders, + HTTP::TStrings aHdrField, + const TDesC8& aHdrValue + ); + + /** + * Helper function to set a header. + * @param aHeaders Set the header to this header set. + * @param aHdrField Header field name. + * @param aHdrValue Header value. + */ + void SetHeaderL + ( + RHTTPHeaders aHeaders, + HTTP::TStrings aHdrField, + HTTP::TStrings aHdrValue + ); + + /** + * Helper function to set a header. + * @param aHeaders Set the header to this header set. + * @param aHdrField Header field name. + * @param aHdrValue Header value. + */ + void SetHeaderL + ( + RHTTPHeaders aHeaders, + HTTP::TStrings aHdrField, + const RStringF aHdrValue + ); + + /** + * Helper function to get the Content-Type header value. + * @param aHeaders HTTP header set. + * @return Content-Type header value. + */ + const TDesC8& GetContentTypeL( RHTTPHeaders aHeaders ); + + /** + * Helper function to get the source URI of a transaction. + * @param aTransaction Transaction. + * @return Source URI. + */ + const TDesC8& GetSourceUriL( RHTTPTransaction aTransaction ); + + /** + * Get a shared string from the session stringpool. + * @param aId Id of string. + * @return Shared string from HTTP string table. No need to close. + */ + inline RStringF StringF( HTTP::TStrings aId ); + + protected: // debug utilities + + /** + * In debug build, log headers. In release build, do nothing. + * @param aHeaders Headers to log. + */ + void LogHeadersL( RHTTPHeaders aHeaders ); + + protected: // Functions from base classes + + /** + * Cancel fetching. + * @return None. + */ + void DoCancel(); + + /** + * Start fetching and make an entry into the operation mapper. + * @return None. + */ + void RunL(); + + /** + * Leave handler protocol implementation: it is called when + * RunL leaves. + */ + TInt RunError( TInt aError ); + + protected: // from MHTTPTransactionCallback + + /** + * Handle transaction event. + * @param aTransaction The transaction that the event has occurred on. + * @param aEvent The event that has occurred. + */ + void MHFRunL( RHTTPTransaction aTransaction, + const THTTPEvent& aEvent ); + + /** + * Handle errors occured in MHFRunL(). + * @param aError The leave code that RunL left with. + * @param aTransaction The transaction that was being processed. + * @param aEvent The Event that was being processed. + * @return KErrNone. + */ + TInt MHFRunError( TInt aError, + RHTTPTransaction aTransaction, + const THTTPEvent& aEvent ); + + protected: // Data + + TRequestStatus& iObserver; ///< Observer's status. + HBufC8* iRequestedUrl; ///< Request URI or NULL. Owned. + + enum TState ///< State. + { + EInit, ///< Initial state. + EStartRequest, ///< Create HTTP session & request + ECheckCache, ///< Check if content is in cache + ERequest, ///< HTTP request. + EDone + }; + + TState iState; ///< Current state. + TInt iResult; ///< Resulting error code. + + RSocketServ iSockServ; ///< Socket Server session handle. + RConnection iConn; ///< Connection handle. + + CHttpCacheManager* iCacheMgr;///< Cache Manager. Owned. + + RHTTPSession iHttpSess; ///< HTTP session. Owned. + RHTTPTransaction iHttpTrans;///< Transaction. Owned. + + HBufC8* iSourceUri; ///< Source URI. Owned. + HBufC8* iBody; ///< Response body. Owned. + TDataType iDataType; ///< Data type. + THttpCacheEntry iCacheEntry;///< Holds the cache entry + CPushMtmCacheSupply* iCacheSupply; + TBool iCachedResponse; + }; + +#include "PushMtmFetchOperation.inl" + +#endif // PUSHMTMFETCHOPERATION_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/PushMtmFetchOperation.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/PushMtmFetchOperation.inl Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline method definitions of class CPushMtmFetchOperation. +* +*/ + + + +#ifndef PUSHMTMFETCHOPERATION_INL +#define PUSHMTMFETCHOPERATION_INL + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushMtmFetchOperation::StringF +// --------------------------------------------------------- +// +RStringF CPushMtmFetchOperation::StringF( HTTP::TStrings aId ) + { + return iHttpSess.StringPool().StringF( aId, RHTTPSession::GetTable() ); + } + +#endif /* def PUSHMTMFETCHOPERATION_INL */ + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/StringResourceReader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/StringResourceReader.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of CStringResourceReader +* +* +*/ + + +// INCLUDE FILES + +#include "StringResourceReader.h" +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CStringResourceReader::CStringResourceReader +// --------------------------------------------------------- +// +CStringResourceReader::CStringResourceReader + ( RFs& aFs, const TDesC& aRscFileWithPathAndDrive ) +: CBase(), iFs( aFs ), iInitialized( EFalse ) + { + iRscFileName.Copy( aRscFileWithPathAndDrive ); + } + +// --------------------------------------------------------- +// CStringResourceReader::~CStringResourceReader +// --------------------------------------------------------- +// +CStringResourceReader::~CStringResourceReader() + { + iResourceFile.Close(); + } + +// --------------------------------------------------------- +// CStringResourceReader::AllocReadResourceL +// --------------------------------------------------------- +// +HBufC* CStringResourceReader::AllocReadResourceL( TInt aResId ) + { + InitializeL(); + // + HBufC8* buf8 = iResourceFile.AllocReadLC( aResId ); +#ifdef _UNICODE + const TPtrC buf( (const TUint16*)buf8->Ptr(), buf8->Size()/2 ); +#else + const TPtrC buf( buf8->Ptr(), buf8->Size() ); +#endif + HBufC* retBuf = buf.AllocL(); + CleanupStack::PopAndDestroy( buf8 ); + + return retBuf; + } + +// --------------------------------------------------------- +// CStringResourceReader::AllocReadResourceLC +// --------------------------------------------------------- +// +HBufC* CStringResourceReader::AllocReadResourceLC( TInt aResId ) + { + HBufC* temp = AllocReadResourceL( aResId ); + CleanupStack::PushL( temp ); + return temp; + } + +// --------------------------------------------------------- +// CStringResourceReader::InitializeL +// --------------------------------------------------------- +// +void CStringResourceReader::InitializeL() + { + if ( !iInitialized ) + { + TFileName resourceFileName( iRscFileName ); + BaflUtils::NearestLanguageFile( iFs, resourceFileName ); + iResourceFile.OpenL( iFs, resourceFileName ); + iResourceFile.ConfirmSignatureL( iResourceFile.SignatureL() ); + iInitialized = ETrue; + } + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/StringResourceReader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/StringResourceReader.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of CStringResourceReader. +* +* +*/ + + +#ifndef STRINGRESOURCEREADER_H +#define STRINGRESOURCEREADER_H + +// INCLUDE FILES + +#include +#include +#include + +// FORWARD DECLARATIONS + +class RFs; + +// CLASS DECLARATION + +/** +* Utility class that helps reading string resources without CONE. +* Not intended for derivation. +*/ +class CStringResourceReader : public CBase + { + public: // Constructors and destructor + + CStringResourceReader( RFs& aFs, const TDesC& aRscFileWithPathAndDrive ); + + ~CStringResourceReader(); + + public: // New functions + + /** + * Return a given string from resource. + * @param aResId Resource ID. + * @return See above. + */ + HBufC* AllocReadResourceL( TInt aResId ); + HBufC* AllocReadResourceLC( TInt aResId ); + + private: // New functions + + void InitializeL(); + + private: // Data members + + RFs& iFs; ///< File server session. + TBuf<64> iRscFileName; + RResourceFile iResourceFile; + TBool iInitialized; + }; + +#endif // STRINGRESOURCEREADER_H + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/si_dict.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/si_dict.c Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +/* + * Dictionary = SI + * Public id = 5 + * Doc Type = -//WAPFORUM//DTD SI 1.0//EN + */ + +#include "si_dict.h" + + +static const NW_Ucs2 NW_SI_ElementTag_si[] = {'s','i','\0'}; +static const NW_Ucs2 NW_SI_ElementTag_indication[] = {'i','n','d','i','c','a','t','i','o','n','\0'}; +static const NW_Ucs2 NW_SI_ElementTag_info[] = {'i','n','f','o','\0'}; +static const NW_Ucs2 NW_SI_ElementTag_item[] = {'i','t','e','m','\0'}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +/* + * tag entries - sorted by token + */ +static const +NW_WBXML_DictEntry_t NW_SI_tag_token_0[4] = { + {0x05, (NW_String_UCS2Buff_t *) NW_SI_ElementTag_si}, + {0x06, (NW_String_UCS2Buff_t *) NW_SI_ElementTag_indication}, + {0x07, (NW_String_UCS2Buff_t *) NW_SI_ElementTag_info}, + {0x08, (NW_String_UCS2Buff_t *) NW_SI_ElementTag_item} +}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +/* + * tag entries - sorted by name + */ +static const +NW_Byte NW_SI_tag_name_0[4] = { + 1, + 2, + 3, + 0, +}; + +static const NW_Ucs2 NW_SI_AttributeTag_action_signal_none[] = {'a','c','t','i','o','n','=','s','i','g','n','a','l','-','n','o','n','e','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_action_signal_low[] = {'a','c','t','i','o','n','=','s','i','g','n','a','l','-','l','o','w','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_action_signal_medium[] = {'a','c','t','i','o','n','=','s','i','g','n','a','l','-','m','e','d','i','u','m','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_action_signal_high[] = {'a','c','t','i','o','n','=','s','i','g','n','a','l','-','h','i','g','h','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_action_delete[] = {'a','c','t','i','o','n','=','d','e','l','e','t','e','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_created[] = {'c','r','e','a','t','e','d','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_href[] = {'h','r','e','f','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_href_http___[] = {'h','r','e','f','=','h','t','t','p',':','/','/','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_href_http___www_[] = {'h','r','e','f','=','h','t','t','p',':','/','/','w','w','w','.','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_href_https___[] = {'h','r','e','f','=','h','t','t','p','s',':','/','/','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_href_https___www_[] = {'h','r','e','f','=','h','t','t','p','s',':','/','/','w','w','w','.','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_si_expires[] = {'s','i','-','e','x','p','i','r','e','s','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_si_id[] = {'s','i','-','i','d','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_class[] = {'c','l','a','s','s','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag_action[] = {'a','c','t','i','o','n','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag__com_[] = {'.','c','o','m','/','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag__edu_[] = {'.','e','d','u','/','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag__net_[] = {'.','n','e','t','/','\0'}; +static const NW_Ucs2 NW_SI_AttributeTag__org_[] = {'.','o','r','g','/','\0'}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +/* + * attribute entries - sorted by token + */ +static const +NW_WBXML_DictEntry_t NW_SI_attribute_token_0[19] = { + {0x05, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_action_signal_none}, + {0x06, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_action_signal_low}, + {0x07, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_action_signal_medium}, + {0x08, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_action_signal_high}, + {0x09, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_action_delete}, + {0x0a, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_created}, + {0x0b, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_href}, + {0x0c, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_href_http___}, + {0x0d, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_href_http___www_}, + {0x0e, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_href_https___}, + {0x0f, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_href_https___www_}, + {0x10, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_si_expires}, + {0x11, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_si_id}, + {0x12, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_class}, + {0x13, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag_action}, + {0x85, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag__com_}, + {0x86, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag__edu_}, + {0x87, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag__net_}, + {0x88, (NW_String_UCS2Buff_t *) NW_SI_AttributeTag__org_} +}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +/* + * attribute entries - sorted by name + */ +static const +NW_Byte NW_SI_attribute_name_0[19] = { + 15, + 16, + 17, + 18, + 14, + 4, + 3, + 1, + 2, + 0, + 13, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, +}; + +/* + * Tag codepage table + */ +static const +NW_WBXML_Codepage_t NW_SI_tag_codepages[1] = { + {4, (NW_WBXML_DictEntry_t*)&NW_SI_tag_token_0[0], (NW_Byte *)&NW_SI_tag_name_0[0]}, +}; + +/* + * Attribute codepage table + */ +static const +NW_WBXML_Codepage_t NW_SI_attribute_codepages[1] = { + {19, (NW_WBXML_DictEntry_t*)&NW_SI_attribute_token_0[0], (NW_Byte *)&NW_SI_attribute_name_0[0]}, +}; + +static const NW_Ucs2 NW_SI_docType[] = {'-','/','/','W','A','P','F','O','R','U','M','/','/','D','T','D',' ','S','I',' ','1','.','0','/','/','E','N','\0'}; + +/* + * Dictionary + */ +const NW_WBXML_Dictionary_t NW_SI_WBXMLDictionary = { + NW_SI_PublicId, + (NW_Ucs2 *)NW_SI_docType, + 1, (NW_WBXML_Codepage_t*)&NW_SI_tag_codepages[0], + 1, (NW_WBXML_Codepage_t*)&NW_SI_attribute_codepages[0], +}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/si_dict.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/si_dict.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +#ifndef HEADER_GUARD_si_dict_h +#define HEADER_GUARD_si_dict_h + + +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#define NW_SI_PublicId 5 + +typedef enum NW_SI_ElementToken_0_e{ + NW_SI_ElementToken_si = 0x0005, + NW_SI_ElementToken_indication = 0x0006, + NW_SI_ElementToken_info = 0x0007, + NW_SI_ElementToken_item = 0x0008 +}NW_SI_ElementToken_0_t; + + +typedef enum NW_SI_AttributeToken_0_e{ + NW_SI_AttributeToken_action_signal_none = 0x0005, + NW_SI_AttributeToken_action_signal_low = 0x0006, + NW_SI_AttributeToken_action_signal_medium = 0x0007, + NW_SI_AttributeToken_action_signal_high = 0x0008, + NW_SI_AttributeToken_action_delete = 0x0009, + NW_SI_AttributeToken_created = 0x000a, + NW_SI_AttributeToken_href = 0x000b, + NW_SI_AttributeToken_href_http___ = 0x000c, + NW_SI_AttributeToken_href_http___www_ = 0x000d, + NW_SI_AttributeToken_href_https___ = 0x000e, + NW_SI_AttributeToken_href_https___www_ = 0x000f, + NW_SI_AttributeToken_si_expires = 0x0010, + NW_SI_AttributeToken_si_id = 0x0011, + NW_SI_AttributeToken_class = 0x0012, + NW_SI_AttributeToken_action = 0x0013, + NW_SI_AttributeToken__com_ = 0x0085, + NW_SI_AttributeToken__edu_ = 0x0086, + NW_SI_AttributeToken__net_ = 0x0087, + NW_SI_AttributeToken__org_ = 0x0088 +}NW_SI_AttributeToken_0_t; + +extern const NW_WBXML_Dictionary_t NW_SI_WBXMLDictionary; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Fri Sep 26 19:53:43 2003 +** (coordinated universal time) +** +** Command line: dict_creator si.dict si_dict.c si_dict.h +*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/sl_dict.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/sl_dict.c Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +/* + * Dictionary = SL + * Public id = 6 + * Doc Type = -//WAPFORUM//DTD SL 1.0//EN + */ + +#include "sl_dict.h" + + +static const NW_Ucs2 NW_SL_ElementTag_sl[] = {'s','l','\0'}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +/* + * tag entries - sorted by token + */ +static const +NW_WBXML_DictEntry_t NW_SL_tag_token_0[1] = { + {0x05, (NW_String_UCS2Buff_t *) NW_SL_ElementTag_sl} +}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +/* + * tag entries - sorted by name + */ +static const +NW_Byte NW_SL_tag_name_0[1] = { + 0, +}; + +static const NW_Ucs2 NW_SL_AttributeTag_action_execute_low[] = {'a','c','t','i','o','n','=','e','x','e','c','u','t','e','-','l','o','w','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_action_execute_high[] = {'a','c','t','i','o','n','=','e','x','e','c','u','t','e','-','h','i','g','h','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_action_cache[] = {'a','c','t','i','o','n','=','c','a','c','h','e','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_href[] = {'h','r','e','f','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_href_http___[] = {'h','r','e','f','=','h','t','t','p',':','/','/','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_href_http___www_[] = {'h','r','e','f','=','h','t','t','p',':','/','/','w','w','w','.','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_href_https___[] = {'h','r','e','f','=','h','t','t','p','s',':','/','/','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_href_https___www_[] = {'h','r','e','f','=','h','t','t','p','s',':','/','/','w','w','w','.','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag_action[] = {'a','c','t','i','o','n','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag__com_[] = {'.','c','o','m','/','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag__edu_[] = {'.','e','d','u','/','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag__net_[] = {'.','n','e','t','/','\0'}; +static const NW_Ucs2 NW_SL_AttributeTag__org_[] = {'.','o','r','g','/','\0'}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +/* + * attribute entries - sorted by token + */ +static const +NW_WBXML_DictEntry_t NW_SL_attribute_token_0[13] = { + {0x05, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_action_execute_low}, + {0x06, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_action_execute_high}, + {0x07, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_action_cache}, + {0x08, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_href}, + {0x09, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_href_http___}, + {0x0a, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_href_http___www_}, + {0x0b, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_href_https___}, + {0x0c, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_href_https___www_}, + {0x0d, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag_action}, + {0x85, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag__com_}, + {0x86, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag__edu_}, + {0x87, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag__net_}, + {0x88, (NW_String_UCS2Buff_t *) NW_SL_AttributeTag__org_} +}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +/* + * attribute entries - sorted by name + */ +static const +NW_Byte NW_SL_attribute_name_0[13] = { + 9, + 10, + 11, + 12, + 8, + 2, + 1, + 0, + 3, + 4, + 5, + 6, + 7, +}; + +/* + * Tag codepage table + */ +static const +NW_WBXML_Codepage_t NW_SL_tag_codepages[1] = { + {1, (NW_WBXML_DictEntry_t*)&NW_SL_tag_token_0[0], (NW_Byte *)&NW_SL_tag_name_0[0]}, +}; + +/* + * Attribute codepage table + */ +static const +NW_WBXML_Codepage_t NW_SL_attribute_codepages[1] = { + {13, (NW_WBXML_DictEntry_t*)&NW_SL_attribute_token_0[0], (NW_Byte *)&NW_SL_attribute_name_0[0]}, +}; + +static const NW_Ucs2 NW_SL_docType[] = {'-','/','/','W','A','P','F','O','R','U','M','/','/','D','T','D',' ','S','L',' ','1','.','0','/','/','E','N','\0'}; + +/* + * Dictionary + */ +const NW_WBXML_Dictionary_t NW_SL_WBXMLDictionary = { + NW_SL_PublicId, + (NW_Ucs2 *)NW_SL_docType, + 1, (NW_WBXML_Codepage_t*)&NW_SL_tag_codepages[0], + 1, (NW_WBXML_Codepage_t*)&NW_SL_attribute_codepages[0], +}; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/PushContentHandler/sl_dict.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/PushContentHandler/sl_dict.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +#ifndef HEADER_GUARD_sl_dict_h +#define HEADER_GUARD_sl_dict_h + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#define NW_SL_PublicId 6 + +typedef enum NW_SL_ElementToken_0_e{ + NW_SL_ElementToken_sl = 0x0005 +}NW_SL_ElementToken_0_t; + + +typedef enum NW_SL_AttributeToken_0_e{ + NW_SL_AttributeToken_action_execute_low = 0x0005, + NW_SL_AttributeToken_action_execute_high = 0x0006, + NW_SL_AttributeToken_action_cache = 0x0007, + NW_SL_AttributeToken_href = 0x0008, + NW_SL_AttributeToken_href_http___ = 0x0009, + NW_SL_AttributeToken_href_http___www_ = 0x000a, + NW_SL_AttributeToken_href_https___ = 0x000b, + NW_SL_AttributeToken_href_https___www_ = 0x000c, + NW_SL_AttributeToken_action = 0x000d, + NW_SL_AttributeToken__com_ = 0x0085, + NW_SL_AttributeToken__edu_ = 0x0086, + NW_SL_AttributeToken__net_ = 0x0087, + NW_SL_AttributeToken__org_ = 0x0088 +}NW_SL_AttributeToken_0_t; + +extern const NW_WBXML_Dictionary_t NW_SL_WBXMLDictionary; + +/* +** WARNING +** +** DO NOT EDIT - THIS CODE IS AUTOMATICALLY GENERATED +** FROM A DATA FILE BY THE DICTIONARY CREATION PROGRAM +** +** This file generated on Tue Sep 30 14:30:25 2003 +** (coordinated universal time) +** +** Command line: dict_creator sl.dict sl_dict.c sl_dict.h +*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapter.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Handles white list settings in provisioning. +* +*/ + + +#ifndef WHITELISTADAPTER_H +#define WHITELISTADAPTER_H + +// INCLUDE FILES + // User includes +#include "WhiteListAdapterDef.h" + // System includes +#include +#include +#include + +// FORWARD DECLARATIONS + +class CPushMtmSettings; +class CWPCharacteristic; +class CWPParameter; +class MWPPairVisitor; +class TWhiteListAdapterItem; + +// CLASS DECLARATION + +/** +* An ECOM adapter plug-in. It is responsible for maintaining data in a +* WAP Provisioning pushed message : we get appropriate physical proxy +* addresses from the message and store them in Push MTM settings. It is the +* Push Content Handler that will use these addresses to filter out +* unauthorized pushed SL messages. +* Note : although an adapter should always be prepared for displaying the +* processed and stored settings in the appropriate format, the stored items +* in this specific adapter will _never_ be displayed. Thus, ItemCount, +* SummaryTitle and SummaryText methods have been written considering this +* approach. +*/ +class CWhiteListAdapter : public CWPAdapter, + public MMsvSessionObserver, + public MWPContextExtension + { + public : // construction, destruction + /** + * Two-phased constructor. + */ + static CWhiteListAdapter* NewL(); + + /** + * Destructor. + */ + ~CWhiteListAdapter(); + + public : // from CWPAdapter + + /** + * Check the number of settings items. + * @see CWPAdapter + */ + /*virtual*/ TInt ItemCount() const; + + /** + * Returns the title of the nth summary line. + * @see CWPAdapter + */ + /*virtual*/ const TDesC16& SummaryTitle( TInt aIndex ) const; + + /** + * Returns the text of the nth summary line. + * @see CWPAdapter + */ + /*virtual*/ const TDesC16& SummaryText( TInt aIndex ) const; + + /** + * Saves one setting handled by the adapter. + * @see CWPAdapter + */ + /*virtual*/ void SaveL( TInt aItem ); + + /** + * Returns ETrue if the adapter can set the settings as default. + * @see CWPAdapter + */ + /*virtual*/ TBool CanSetAsDefault( TInt aItem ) const; + + /** + * Adapter sets the settings as default. + * @see CWPAdapter + */ + /*virtual*/ void SetAsDefaultL( TInt aItem ); + + /** + * Calls the pair visitor for each detail line of an item. + * @see CWPAdapter + */ + /*virtual*/ TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); + + /** + * Returns a pointer to a context extension. + * @param aExtension + * Contains a pointer to MWPContextExtension if supported. + * @return KErrNotSupported if not supported, KErrNone otherwise + */ + /*virtual*/ TInt ContextExtension( MWPContextExtension*& aExtension ); + + public: // From MWPVisitor (inheritance is through CWPAdapter) + + /** + * Called for each characteristic found. + * @see MWPVisitor + */ + /*virtual*/ void VisitL( CWPCharacteristic& aCharacteristic ); + + /** + * Called for each parameter found. + * @see MWPVisitor + */ + /*virtual*/ void VisitL( CWPParameter& aParameter ); + + /** + * Called for each link to a logical proxy or access point. + * @see MWPVisitor + */ + /*virtual*/ void VisitLinkL( CWPCharacteristic& aCharacteristic ); + + public : // from MMsvSessionObserver + /** + * Indicates an event has occurred. + * @see MMsvSessionObserver + */ + /*virtual*/ void HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3 ); + + private : // construction + /** + * Constructor. + */ + CWhiteListAdapter(); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + private : // internal new methods + /** + * This method is for interpreting a string as push support. + * If the value of the string is '1', then push is enabled, + * if it's equal to '0', then push is disabled, otherwise the proxy + * does not care of push. + * @param aPushSupport String to be processed. + * @return TPushSupport enumeration value. + */ + TPushSupport ResolvePushSupport( const TDesC& aPushSupport ); + + private: // From MWPContextExtension + + /** + * Returns the data used for saving. + * @param aIndex The index of the data + * @return The data. Ownership is transferred. + */ + const TDesC8& SaveDataL( TInt aIndex ) const; + + /** + * Deletes a saved item. + * @param aSaveData The data used for saving + */ + void DeleteL( const TDesC8& aSaveData ); + + /** + * Returns the UID of the adapter. + * @return UID + */ + TUint32 Uid() const; + + private : // data members + + RPointerArray iItems; ///< Physical proxies + + /** + * These items are parts of the current logical proxy and have not + * been added to the final item array (i.e. iItems array), because + * further processing is needed. + */ + RPointerArray iItemsToBeAdded; + + TPushSupport iLogicalProxyPushSupport; + + TBool iPhysicalProxyIsVisited; ///< In order to differentiate + ///< if we are visiting a + ///< ph. or a log. proxy + + TWhiteListAdapterItem* iCurrentItem; ///< Current physical proxy. + ///< Has. + + CMsvSession* iMsvSession; ///< Session to the Message + ///< Server. Has. + CPushMtmSettings* iPushMtmSettings; ///< Push MTM Settings object. + ///< Has. + }; + +#endif // WHITELISTADAPTER_H + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterDef.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Common constants for the White List Adapter plug-in. +* +*/ + + + +#ifndef WHITELISTADAPTERDEF_H +#define WHITELISTADAPTERDEF_H + +// DATA TYPES + +enum TPushSupport + { + EPushEnabled, ///< Explicitly set to enabled + EPushDisabled, ///< Explicitly set to disabled + EPushDontCare ///< Has not been set + }; + +#endif // WHITELISTADAPTERDEF_H + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterItem.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Class the represents a physical proxy (in context of WAP Provisioning). +* +*/ + + +#ifndef WHITELISTADAPTERITEM_H +#define WHITELISTADAPTERITEM_H + +// INCLUDE FILES + + // User includes +#include "PushInitiator.h" +#include "WhiteListAdapterDef.h" + // System includes +#include + +// CLASS DECLARATION + +/** +* This class encapsulates a proxy item found in a WAP Provisioning document. +* It is designed for describing a particular White List address. +*/ +class TWhiteListAdapterItem + { + public : // construction, destruction + /** + * Default constructor. + */ + TWhiteListAdapterItem(); + + public : // getter/setter methods + /** + * Use this method to get the address. + * @return The stored proxy address. + */ + const TDesC& Address() const; + + /** + * Use this method to get the address type. + * @return The type of the stored proxy address. + */ + CPushInitiator::TAddrType AddressType() const; + + /** + * Tells the ID of the item. + * @return Item ID. + */ + TUint32 Id() const; + + /** + * Tells the ID of the item in a buffer. + * @return Item ID in a buffer. + */ + const TDesC8& IdBuf() const; + + /** + * Tells the push support. + * @return Push support. + */ + TPushSupport PushSupport() const; + + /** + * Sets the address. + * @param aAddress The proxy address to be set. + */ + void SetAddress( const TDesC& aAddress ); + + /** + * Sets the address type. + * @param aAddressType The proxy address type to be set. + */ + void SetAddressType( const TDesC& aAddressType ); + + /** + * Sets the ID of the item. + * @param aID The ID. + */ + void SetId( TUint32 aId ); + + /** + * Sets the physical proxy ID. + * @param aProxyId The physical proxy identifier to be set. + */ + void SetProxyId( const TDesC& aProxyId ); + + /** + * Sets whether or not the proxy address is push enabled. + * @param aPushEnabled If the value is 1, then push is enabled, + * otherwise (i.e. when the value is 0) the push is disabled. + */ + void SetPushSupport( TPushSupport aPushSupport ); + + public : // other public methods + + /** + * Tells whether the freshly initialized adapter item contains + * information about a valid proxy address. The proxy address is + * invalid if either it is not type of the correct address type + * or the proxy server is not push enabled. + * @return ETrue if the proxy address is valid, EFalse otherwise. + */ + TBool Valid() const; + + private : // data members + + TPtrC iAddress; ///< Physical proxy gateway address + + CPushInitiator::TAddrType iAddressType; + + /// ID of the item after it has been added to MTM Settings. + TUint32 iId; + /// ID of the item packaged into a buffer pointer. + TPckgC iIdBufPtr; + + TPtrC iProxyId; ///< Proxy identifier (or name) + + TPushSupport iPushSupport; + }; + +#endif // WHITELISTADAPTERITEM_H + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterLogger.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Logging macros for White List Adapter. +* +* +*/ + + +#ifndef WHITELISTADAPTER_LOGGER_H +#define WHITELISTADAPTER_LOGGER_H + +// INCLUDES + +#include +#include +#include + +// TYPES + +enum TWhiteListAdapterLogMask ///< Log mask bits. + { + ELogOff = 0x00000000, ///< Don't log. + ELogBasic = 0x00000001, ///< Log only basic activities. + ELogDetailed = 0x00000002, ///< Detailed activities use this mask. + ELogAll = 0xFFFFFFFF ///< Log all. + }; + +// MACROS + +// Determines what to log. Construct this from TWhiteListAdapterLogMask values. +#define WHITELISTADAPTER_LOG_MASK ELogAll +/// Determines log detail (0==basic level). +#define WHITELISTADAPTER_LOG_LEVEL 5 + +// CLASS DECLARATION + +/** +* Logger class. +*/ +class WhiteListAdapterLogger + { + public: // new methods + + /** + * Write formatted log. + * @param aMask Log mask. + * @param aLevel Log level. + * @param aFmt Format string. + */ + static void Write + ( TInt32 aMask, TInt aLevel, TRefByValue aFmt, ... ); + + /** + * Write formatted log. + * @param aMask Log mask. + * @param aLevel Log level. + * @param aFmt Format string. + * @param aList Variable argument list. + */ + static void Write + ( + TInt32 aMask, + TInt aLevel, + TRefByValue aFmt, + VA_LIST& aList + ); + + /** + * Write formatted log. + * @param aMask Log mask. + * @param aLevel Log level. + * @param aFmt Format string. + */ + static void Write + ( TInt32 aMask, TInt aLevel, TRefByValue aFmt, ... ); + + /** + * Write formatted log. + * @param aMask Log mask. + * @param aLevel Log level. + * @param aFmt Format string. + * @param aList Variable argument list. + */ + static void Write + ( + TInt32 aMask, + TInt aLevel, + TRefByValue aFmt, + VA_LIST& aList + ); + + /** + * Write hex dump. + * @param aMask Log mask. + * @param aLevel Log level. + * @param aHeader Header string. + * @param aMargin Margin. + * @param aPtr Data. + * @param aLen Data length. + */ + static void HexDump + ( + TInt32 aMask, + TInt aLevel, + const TText* aHeader, + const TText* aMargin, + const TUint8* aPtr, + TInt aLen + ); + }; + +#ifdef __TEST_WHITELISTADAPTER_LOG__ + + /// Write formatted to log. + #define CLOG( body ) WhiteListAdapterLogger::Write body + /// Write hex dump. + #define CDUMP( body ) WhiteListAdapterLogger::HexDump body + /// Guard "log-only" argument name with this (expands to argument). + #define LOG_ONLY( argName ) argName + +#else /* not defined __TEST_WHITELISTADAPTER_LOG__ */ + + /// Do nothing (log disabled). + #define CLOG( body ) + /// Do nothing (log disabled). + #define CDUMP( body ) + /// Guard "log-only" argument name with this (expands to nothing). + #define LOG_ONLY( argName ) + + +#endif /* def __TEST_WHITELISTADAPTER_LOG__ */ + +#endif /* def WHITELISTADAPTER_LOGGER_H */ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterPanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterPanic.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Panic handling for white list management. +* +*/ + + +#ifndef WHITELISTADAPTERPANIC_H +#define WHITELISTADAPTERPANIC_H + +// INCLUDE FILES + // System includes +#include + +// DATA TYPES + +enum TWhiteListAdapterPanics + { + ENoItemsToBeDisplayed, ///< A UI control tries to display items + EArrayIndexOutOfBounds, ///< Self-explanatory + ENullProxy ///< Physicial proxy cannot be found + }; + +// FUNCTION PROTOTYPES + +/** +* Panic handling in White List Adapter module. It's role is centralizing +* panics. +* @param aPanic Panic code, defined in THermesProtocolPanic. +*/ +void Panic( TInt aPanic ); + + +#endif // WHITELISTADAPTERPANIC_H + +// End of file \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterUids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterInc/WhiteListAdapterUids.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: UID definitions for the White List Adapter plug-in. +* +*/ + + + +#ifndef WHITELISTADAPTERUIDS_H +#define WHITELISTADAPTERUIDS_H + +// ================= UIDs ====================== + +/// DLL UID +#define KWhiteListAdapterDllUid 0x10008D3E + +// ECOM DLL implementation UID - White List Adapter +#define KWhiteListAdapterImplementationUid 0x101F85EF + +// ECOM DLL interface UID +#define KProvisioningAdapterInterfaceUid 0x101F84D5 + +#endif // WHITELISTADAPTERUIDS_H + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapter.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,522 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Handles white list settings in provisioning. +* +*/ + + +// INCLUDE FILES + + // User includes +#include "PushInitiator.h" +#include "PushInitiatorList.h" +#include "PushMtmSettings.h" +#include "WhiteListAdapter.h" +#include "WhiteListAdapterDef.h" +#include "WhiteListAdapterItem.h" +#include "WhiteListAdapterLogger.h" +#include "WhiteListAdapterPanic.h" +#include "WhiteListAdapterUids.h" + // System includes +#include +#include + +// CONSTANTS + +// 'Push enabled' flag settings +const TInt KPushEnabledFlagLength = 1; +const TUint16 KPushEnabledFlagTrue = '1'; +const TUint16 KPushEnabledFlagFalse = '0'; + +// Granularity value for dynamic arrays +const TInt KDynamicArrayGranularity = 3; + +// ================= MEMBER FUNCTIONS ====================== + +// --------------------------------------------------------- +// CWhiteListAdapter::CWhiteListAdapter +// --------------------------------------------------------- +// +CWhiteListAdapter::CWhiteListAdapter() : CWPAdapter(), +iItems( KDynamicArrayGranularity ), +iItemsToBeAdded( KDynamicArrayGranularity ), +iLogicalProxyPushSupport( EPushDontCare ), iPhysicalProxyIsVisited( EFalse ) + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter c'tor" ) ) ); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::ConstructL +// --------------------------------------------------------- +// +void CWhiteListAdapter::ConstructL() + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "-> WhiteListAdapter::ConstructL" ) ) ); + + iMsvSession = CMsvSession::OpenSyncL( *this ); + iPushMtmSettings = CPushMtmSettings::NewL(); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "<- WhiteListAdapter::ConstructL" ) ) ); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::NewL +// --------------------------------------------------------- +// +CWhiteListAdapter* CWhiteListAdapter::NewL() + { + CWhiteListAdapter* self = new (ELeave) CWhiteListAdapter; + + CleanupStack::PushL( self ); + + self->ConstructL(); + + CleanupStack::Pop(); // self + + return self; + } + +// --------------------------------------------------------- +// CWhiteListAdapter::~CWhiteListAdapter +// --------------------------------------------------------- +// +CWhiteListAdapter::~CWhiteListAdapter() + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "-> WhiteListAdapter d'tor" ) ) ); + + delete iCurrentItem; + + delete iPushMtmSettings; // It has to be deleted before iMsvSession, + // because it uses iMsvSession->FileSession(). + delete iMsvSession; + + CLOG( ( ELogDetailed, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter d'tor, iItemsToBeAdded.Count:%d" ), + iItemsToBeAdded.Count() ) ); + iItemsToBeAdded.ResetAndDestroy(); + iItemsToBeAdded.Close(); + + CLOG( ( ELogDetailed, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter d'tor, iItems.Count:%d" ), iItems.Count() ) ); + iItems.ResetAndDestroy(); + iItems.Close(); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "<- WhiteListAdapter d'tor" ) ) ); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::ItemCount +// --------------------------------------------------------- +// +TInt CWhiteListAdapter::ItemCount() const + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::ItemCount %d" ), iItems.Count() ) ); + + return iItems.Count(); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::SummaryTitle +// --------------------------------------------------------- +// +const TDesC16& CWhiteListAdapter::SummaryTitle( TInt /*aIndex*/ ) const + { + // As WL text will never be shown, we simply return an empty string here. + return KNullDesC16(); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::SummaryText +// --------------------------------------------------------- +// +const TDesC16& CWhiteListAdapter::SummaryText( TInt /*aIndex*/ ) const + { + // As WL text will never be shown, we simply return an empty string here. + return KNullDesC16(); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::SaveL +// --------------------------------------------------------- +// +void CWhiteListAdapter::SaveL( TInt aItem ) + { + __ASSERT_DEBUG( 0 <= aItem && aItem < iItems.Count(), + Panic( EArrayIndexOutOfBounds ) ); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "-> WhiteListAdapter::SaveL %d" ), aItem ) ); + + CPushInitiator* pi = new (ELeave) CPushInitiator; + CleanupStack::PushL( pi ); + pi->SetAddressL( iItems[aItem]->Address(), + iItems[aItem]->AddressType() ); + + TUint32 entryId = iPushMtmSettings->PushInitiatorList().AddL( pi ); + CleanupStack::Pop( pi ); // pi, ownership taken over + // Save the ID of the added entry: + iItems[aItem]->SetId( entryId ); + + iPushMtmSettings->SaveL(); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "<- WhiteListAdapter::SaveL" ) ) ); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::CanSetAsDefault +// --------------------------------------------------------- +// +TBool CWhiteListAdapter::CanSetAsDefault( TInt /*aItem*/ ) const + { + return EFalse; + } + +// --------------------------------------------------------- +// CWhiteListAdapter::SetAsDefaultL +// --------------------------------------------------------- +// +void CWhiteListAdapter::SetAsDefaultL( TInt /*aItem*/ ) + { + } + +// --------------------------------------------------------- +// CWhiteListAdapter::DetailsL +// --------------------------------------------------------- +// +TInt CWhiteListAdapter::DetailsL( TInt /*aItem*/, + MWPPairVisitor& /*aVisitor*/ ) + { + return KErrNotSupported; + } + +// --------------------------------------------------------- +// CWhiteListAdapter::ContextExtension +// --------------------------------------------------------- +// +TInt CWhiteListAdapter::ContextExtension( MWPContextExtension*& aExtension ) + { + aExtension = this; + return KErrNone; + } + +// --------------------------------------------------------- +// CWhiteListAdapter::VisitL +// --------------------------------------------------------- +// +void CWhiteListAdapter::VisitL( CWPCharacteristic& aCharacteristic ) + { + if ( aCharacteristic.Type() == KWPPxLogical ) + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "-> WhiteListAdapter::VisitL PXLOGICAL" ) ) ); + + aCharacteristic.AcceptL( *this ); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL PXLOGICAL visited, push support is %d" ), + iLogicalProxyPushSupport ) ); + + // iItemsToBeAdded contains physical proxies whose push support + // is either PushEnabled or PushDontCare (i.e. PushDisabled proxies + // are not present in this array). + if ( iLogicalProxyPushSupport == EPushEnabled ) + { + // Knowing that the logical proxy's push support is PushEnabled, + // we have to add each element of the above-mentioned array. + for ( TInt i = 0; i < iItemsToBeAdded.Count(); i++ ) + { + // If addition fails, then we delete the item. Otherwise, + // the ownership has been taken over by iItems array. + if ( iItems.Append( iItemsToBeAdded[i] ) != KErrNone ) + { + delete iItemsToBeAdded[i]; + } + } + } + else + { + // We're here : logical proxy's push support is either PushDontCare + // or PushDisabled. In this case we have to add only those elements + // in the array whose push support is PushEnabled. This is because + // physical proxy's push support definition is stronger than the + // logical proxy's definition. + for ( TInt i = 0; i < iItemsToBeAdded.Count(); i++ ) + { + TWhiteListAdapterItem* item = iItemsToBeAdded[i]; + if ( item->PushSupport() == EPushEnabled ) + { + // If addition fails, then we delete the item. Otherwise, + // the ownership has been taken over by iItems array. + if ( iItems.Append( item ) != KErrNone ) + { + delete item; + } + } + else + { + delete item; + } + } + } + + // There is only one thing we need to do here : reset the array. + // At this point, each element in the array is invalid : if the + // element happened to be valid, then the other array (iItems) + // took over the ownership. Otherwise (i.e. the element was + // invalid), the element got deleted manually. + // Thus, we can safely reset the array. + iItemsToBeAdded.Reset(); + + iLogicalProxyPushSupport = EPushDontCare; + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "<- WhiteListAdapter::VisitL PXLOGICAL" ) ) ); + } + else if ( aCharacteristic.Type() == KWPPxPhysical ) + { + // This deletion is for safety's sake : if one of the leaving methods + // in this section (below) has left, then it may happen that this + // method is called again and iCurrentItem is not NULL. If it is the + // case, we can avoid having an orphaned memory area by deleting the + // current item before allocating a new one. + // However, in most cases iCurrentItem will be NULL. + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "-> WhiteListAdapter::VisitL PXPHYSICAL" ) ) ); + + delete iCurrentItem; + iCurrentItem = NULL; + iCurrentItem = new (ELeave) TWhiteListAdapterItem(); + + iPhysicalProxyIsVisited = ETrue; + + aCharacteristic.AcceptL( *this ); + + iPhysicalProxyIsVisited = EFalse; + + if ( iCurrentItem->Valid() ) + { + User::LeaveIfError( iItemsToBeAdded.Append( iCurrentItem ) ); + iCurrentItem = NULL; // Ownership transferred. + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL PXPHYSICAL valid & added" ) ) ); + } + else + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL PXPHYSICAL invalid" ) ) ); + // invalid physical proxy (at least from our point of view) + delete iCurrentItem; + iCurrentItem = NULL; + } + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "<- WhiteListAdapter::VisitL PXPHYSICAL" ) ) ); + } + } + +// --------------------------------------------------------- +// CWhiteListAdapter::VisitL +// --------------------------------------------------------- +// +void CWhiteListAdapter::VisitL( CWPParameter& aParameter ) + { + switch ( aParameter.ID() ) + { + case EWPParameterPhysicalProxyID : + { + __ASSERT_DEBUG( iCurrentItem, Panic( ENullProxy ) ); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL PhysicalProxyID" ) ) ); + + if ( iCurrentItem ) + { + iCurrentItem->SetProxyId( aParameter.Value() ); + } + + break; + } + case EWPParameterPxAddr : + { + __ASSERT_DEBUG( iCurrentItem, Panic( ENullProxy ) ); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL PxAddr" ) ) ); + + if ( iCurrentItem ) + { + iCurrentItem->SetAddress( aParameter.Value() ); + } + + break; + } + case EWPParameterPxAddrType : + { + __ASSERT_DEBUG( iCurrentItem, Panic( ENullProxy ) ); + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL PxAddrType" ) ) ); + + if ( iCurrentItem ) + { + iCurrentItem->SetAddressType( aParameter.Value() ); + } + + break; + } + case EWPParameterPushEnabled : + { + if ( iCurrentItem ) + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL Physical PushEnabled" ) ) ); + + // it is a physical proxy + iCurrentItem->SetPushSupport + ( ResolvePushSupport( aParameter.Value() ) ); + } + else + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::VisitL Logical PushEnabled" ) ) ); + + // it is a logical proxy + iLogicalProxyPushSupport = + ResolvePushSupport( aParameter.Value() ); + } + + break; + } + default : + break; + } + } + +// --------------------------------------------------------- +// CWhiteListAdapter::VisitLinkL +// --------------------------------------------------------- +// +void CWhiteListAdapter::VisitLinkL( CWPCharacteristic& /*aCharacteristic*/ ) + { + } + +// --------------------------------------------------------- +// CWhiteListAdapter::HandleSessionEventL +// --------------------------------------------------------- +// +void CWhiteListAdapter::HandleSessionEventL( TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, + TAny* /*aArg2*/, + TAny* /*aArg3*/ ) + { + } + +// --------------------------------------------------------- +// CWhiteListAdapter::ResolvePushSupport +// --------------------------------------------------------- +// +TPushSupport CWhiteListAdapter::ResolvePushSupport( const TDesC& aPushSupport ) + { + TPushSupport support = EPushDontCare; + + if ( aPushSupport.Length() == KPushEnabledFlagLength ) + { + if ( aPushSupport[0] == KPushEnabledFlagTrue ) + { + support = EPushEnabled; + } + else if ( aPushSupport[0] == KPushEnabledFlagFalse ) + { + support = EPushDisabled; + } + } + + return support; + } + +// --------------------------------------------------------- +// CWhiteListAdapter::SaveDataL +// --------------------------------------------------------- +// +const TDesC8& CWhiteListAdapter::SaveDataL( TInt aIndex ) const + { + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::SaveDataL %d %d %d" ), + iItems.Count(), aIndex, iItems[aIndex]->Id() ) ); + return ( iItems[aIndex]->IdBuf() ); + } + +// --------------------------------------------------------- +// CWhiteListAdapter::DeleteL +// --------------------------------------------------------- +// +void CWhiteListAdapter::DeleteL( const TDesC8& aSaveData ) + { + // Copy source into a package buffer: + TPckgBuf entryIdBuf; + entryIdBuf.Copy( aSaveData ); + // Extract the entry ID: + TUint32 entryId( entryIdBuf() ); + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::DeleteL ID %d" ), entryId ) ); + + // Now entryId holds the ID - we can remove it from WL: + CPushInitiatorList& whiteList = iPushMtmSettings->PushInitiatorList(); + // Find the index of the Initiator with the given ID. + TInt index( KErrNotFound ); + // As the entries are unique in WL by the ID, it's enough + // to continue the loop until first hit. + const TInt count( whiteList.Count() ); + for ( TInt i = 0; i < count; ++i ) + { + const CPushInitiator& initiator = whiteList.At(i); + if ( initiator.EntryID() == entryId ) + { + index = i; + // Found: + break; + } + } + + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::DeleteL index %d" ), index ) ); + if ( index != KErrNotFound ) + { + whiteList.Delete( index ); + // Commit changes. + iPushMtmSettings->SaveL(); + CLOG( ( ELogBasic, WHITELISTADAPTER_LOG_LEVEL, + _L( "WhiteListAdapter::DeleteL Saved..." ) ) ); + } + } + +// --------------------------------------------------------- +// CWhiteListAdapter::Uid +// --------------------------------------------------------- +// +TUint32 CWhiteListAdapter::Uid() const + { + return (TUint32)KWhiteListAdapterImplementationUid; + } + +// End of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterGroupProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterGroupProxy.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Table of plugins for ECom +* +*/ + + + +// INCLUDE FILES + // System includes +#include +#include + + // User includes +#include "WhiteListAdapter.h" +#include "WhiteListAdapterUids.h" + +// CONSTANTS + +const TImplementationProxy KImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KWhiteListAdapterImplementationUid, CWhiteListAdapter::NewL ) + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + + return KImplementationTable; + } + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterItem.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Handles white list settings in provisioning. +* +*/ + + +// INCLUDE FILES + // User includes +#include "WhiteListAdapterItem.h" + +// CONSTANTS + +_LIT( KIPv4AddressType, "IPV4" ); +_LIT( KIPv6AddressType, "IPV6" ); +_LIT( KE164AddressType, "E164" ); +_LIT( KAlphanumericAddressType, "ALPHA" ); + +// ================= MEMBER FUNCTIONS ====================== + +// --------------------------------------------------------- +// TWhiteListAdapterItem::TWhiteListAdapterItem +// --------------------------------------------------------- +// +TWhiteListAdapterItem::TWhiteListAdapterItem() +: iAddress( KNullDesC ), + iAddressType( CPushInitiator::ETypeE164 ), + iId( 0 ), + iIdBufPtr( iId ), + iProxyId( KNullDesC ), + iPushSupport( EPushDontCare ) + { + iAddressType = CPushInitiator::ETypeIpv4; + iPushSupport = EPushDontCare; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::Address +// --------------------------------------------------------- +// +const TDesC& TWhiteListAdapterItem::Address() const + { + return iAddress; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::AddressType +// --------------------------------------------------------- +// +CPushInitiator::TAddrType TWhiteListAdapterItem::AddressType() const + { + return iAddressType; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::Id +// --------------------------------------------------------- +// +TUint32 TWhiteListAdapterItem::Id() const + { + return iId; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::IdBuf +// --------------------------------------------------------- +// +const TDesC8& TWhiteListAdapterItem::IdBuf() const + { + return iIdBufPtr; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::PushSupport +// --------------------------------------------------------- +// +TPushSupport TWhiteListAdapterItem::PushSupport() const + { + return iPushSupport; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::SetAddress +// --------------------------------------------------------- +// +void TWhiteListAdapterItem::SetAddress( const TDesC& aAddress ) + { + iAddress.Set( aAddress ); + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::SetAddressType +// --------------------------------------------------------- +// +void TWhiteListAdapterItem::SetAddressType( const TDesC& aAddressType ) + { + if ( !aAddressType.Compare( KIPv4AddressType ) ) + { + iAddressType = CPushInitiator::ETypeIpv4; + } + else if ( !aAddressType.Compare( KIPv6AddressType ) ) + { + iAddressType = CPushInitiator::ETypeIpv6; + } + else if ( !aAddressType.Compare( KE164AddressType ) ) + { + iAddressType = CPushInitiator::ETypeE164; + } + else if ( !aAddressType.Compare( KAlphanumericAddressType ) ) + { + iAddressType = CPushInitiator::ETypeAlpha; + } + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::SetId +// --------------------------------------------------------- +// +void TWhiteListAdapterItem::SetId( TUint32 aId ) + { + iId = aId; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::SetProxyId +// --------------------------------------------------------- +// +void TWhiteListAdapterItem::SetProxyId( const TDesC& aProxyId ) + { + iProxyId.Set( aProxyId ); + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::SetPushSupport +// --------------------------------------------------------- +// +void TWhiteListAdapterItem::SetPushSupport( TPushSupport aPushSupport ) + { + iPushSupport = aPushSupport; + } + +// --------------------------------------------------------- +// TWhiteListAdapterItem::Valid +// --------------------------------------------------------- +// +TBool TWhiteListAdapterItem::Valid() const + { + TBool valid = EFalse; + + // TODO : checking IP address/phone number validity (MsgBioUtils?) + + if ( ( iPushSupport == EPushEnabled || iPushSupport == EPushDontCare ) && + ( iAddressType == CPushInitiator::ETypeE164 ) && + ( 0 < iAddress.Length() ) ) + { + valid = ETrue; + } + + return valid; + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterLogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterLogger.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of class WhiteListAdapterLogger. +* +* +*/ + + +#ifdef __TEST_WHITELISTADAPTER_LOG__ + +// INCLUDE FILES + // System includes +#include + + // User includes +#include "WhiteListAdapterLogger.h" + +// ================= CONSTANTS ======================= + +/// White List Adapter logging directory. +_LIT( KWhiteListAdapterLogDir, "WLA" ); +/// White List Adapter log file name. +_LIT( KWhiteListAdapterLogFile, "Log.txt" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// WhiteListAdapterLogger::Write() +// --------------------------------------------------------- +// +void WhiteListAdapterLogger::Write +( TInt32 aMask, TInt aLevel, TRefByValue aFmt, ... ) + { + if( ( aMask & WHITELISTADAPTER_LOG_MASK ) && + ( aLevel <= WHITELISTADAPTER_LOG_LEVEL ) ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat + ( + KWhiteListAdapterLogDir, + KWhiteListAdapterLogFile, + EFileLoggingModeAppend, + aFmt, + list + ); + VA_END( list ); + } + } + +// --------------------------------------------------------- +// WhiteListAdapterLogger::Write() +// --------------------------------------------------------- +// +void WhiteListAdapterLogger::Write +( TInt32 aMask, TInt aLevel, TRefByValue aFmt, VA_LIST& aList ) + { + if( ( aMask & WHITELISTADAPTER_LOG_MASK ) && + ( aLevel <= WHITELISTADAPTER_LOG_LEVEL ) ) + { + RFileLogger::WriteFormat + ( + KWhiteListAdapterLogDir, + KWhiteListAdapterLogFile, + EFileLoggingModeAppend, + aFmt, + aList + ); + } + } + +// --------------------------------------------------------- +// WhiteListAdapterLogger::Write() +// --------------------------------------------------------- +// +void WhiteListAdapterLogger::Write +( TInt32 aMask, TInt aLevel, TRefByValue aFmt, ... ) + { + if( ( aMask & WHITELISTADAPTER_LOG_MASK ) && + ( aLevel <= WHITELISTADAPTER_LOG_LEVEL ) ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat + ( + KWhiteListAdapterLogDir, + KWhiteListAdapterLogFile, + EFileLoggingModeAppend, + aFmt, + list + ); + VA_END( list ); + } + } + +// --------------------------------------------------------- +// WhiteListAdapterLogger::Write() +// --------------------------------------------------------- +// +void WhiteListAdapterLogger::Write +( TInt32 aMask, TInt aLevel, TRefByValue aFmt, VA_LIST& aList ) + { + if( ( aMask & WHITELISTADAPTER_LOG_MASK ) && + ( aLevel <= WHITELISTADAPTER_LOG_LEVEL ) ) + { + RFileLogger::WriteFormat + ( + KWhiteListAdapterLogDir, + KWhiteListAdapterLogFile, + EFileLoggingModeAppend, + aFmt, + aList + ); + } + } + +// --------------------------------------------------------- +// WhiteListAdapterLogger::HexDump() +// --------------------------------------------------------- +// +void WhiteListAdapterLogger::HexDump + ( + TInt32 aMask, + TInt aLevel, + const TText* aHeader, + const TText* aMargin, + const TUint8* aPtr, + TInt aLen + ) + { + if( ( aMask & WHITELISTADAPTER_LOG_MASK ) && + ( aLevel <= WHITELISTADAPTER_LOG_LEVEL ) ) + { + RFileLogger::HexDump + ( + KWhiteListAdapterLogDir, + KWhiteListAdapterLogFile, + EFileLoggingModeAppend, + aHeader, + aMargin, + aPtr, + aLen + ); + } + } + +#endif // __TEST_WHITELISTADAPTER_LOG__ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterPanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Plugins/WhiteListAdapterSrc/WhiteListAdapterPanic.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Panic handling for white list management. +* +*/ + + +// INCLUDE FILES + // System includes +#include + + // User includes +#include "WhiteListAdapterPanic.h" + +// CONSTANTS + +_LIT( KWhiteListAdapterPanicString, "WhiteListAdapter" ); + +// External function(s) + +void Panic( TInt aPanic ) + { + User::Panic( KWhiteListAdapterPanicString, aPanic ); + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Rom/PushMtm.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Rom/PushMtm.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __PUSHMTM_IBY__ +#define __PUSHMTM_IBY__ + + +file=ABI_DIR\BUILD_DIR\PushMtmCliSrv.dll SHARED_LIB_DIR\PushMtmCliSrv.dll +file=ABI_DIR\BUILD_DIR\PushMtmUi.dll SHARED_LIB_DIR\PushMtmUi.dll +file=ABI_DIR\BUILD_DIR\PushMtmUtil.dll SHARED_LIB_DIR\PushMtmUtil.dll + +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR, PushMtm) + +S60_APP_EXE(PushViewer) +//This component doesn't have icon S60_APP_AIF_ICONS(PushViewer) +S60_UPGRADABLE_APP_REG_RSC(PushViewer) + +ECOM_PLUGIN(PushMtmPushContentHandler.dll,101F854C.rsc) +#ifdef __PUSH_WHITELIST +ECOM_PLUGIN(PushMtmWhiteListAdapter.dll,10008D3E.rsc) +#endif // __PUSH_WHITELIST + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Rom/PushMtmResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Rom/PushMtmResources.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __PUSHMTM_RESOURCES_IBY__ +#define __PUSHMTM_RESOURCES_IBY__ + +//Resource file(s) for PushMtm (PushMtm.iby) +data=DATAZ_\MTM_INFO_FILE_DIR\PushRegistry.rsc MTM_INFO_FILE_DIR\PushRegistry.rsc +data=DATAZ_\MTM_RESOURCE_DIR\PushMtmUi.rsc MTM_RESOURCE_DIR\PushMtmUi.rsc +data=DATAZ_\APP_RESOURCE_DIR\PushViewer.rsc APP_RESOURCE_DIR\PushViewer.rsc + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Rom/S60SiSlWapPush.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Rom/S60SiSlWapPush.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __S60SISLWAPPUSH_IBY__ +#define __S60SISLWAPPUSH_IBY__ + +REM This iby file puts Symbian components to ROM. It replaces sislwappush.iby. +REM It does not put some components to ROM, that are put by sislwappush.iby. + +file=ABI_DIR\BUILD_DIR\sislpushmsgutils.dll System\Libs\sislpushmsgutils.dll + +data=ZRESOURCE\wappush\si.dtd RESOURCE\wappush\si.dtd +data=ZRESOURCE\wappush\sl.dtd RESOURCE\wappush\sl.dtd +data=ZRESOURCE\wappush\si10.tok RESOURCE\wappush\si10.tok +data=ZRESOURCE\wappush\sl10.tok RESOURCE\wappush\sl10.tok + +#endif // __S60SISLWAPPUSH_IBY__ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/Rom/wappush.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/Rom/wappush.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __WAPPUSH_IBY__ +#define __WAPPUSH_IBY__ + +REM This iby file puts Symbian components to ROM. +REM It replaces Symbian wappush.iby. + +#include +#include + +file=ABI_DIR\BUILD_DIR\wappushutils.dll System\Libs\wappushutils.dll +ECOM_PLUGIN(pushapphandler.dll,101f3e5b.rsc) +ECOM_PLUGIN(pushsecurity.dll,101f3e57.rsc) +#ifdef __WATCHER_API_V2__ +ECOM_PLUGIN(pushwatcher.dll, 10009145.rsc) +#else +file=ABI_DIR\BUILD_DIR\pushwatcher.dll System\Libs\watchers\pushwatcher.dll +#endif // __WATCHER_API_V2__ +file=ABI_DIR\BUILD_DIR\pushmsgentry.dll System\Libs\pushmsgentry.dll + +#endif // __WAPPUSH_IBY__ diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewer.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewer.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: hrh file. Enums and defines. +* +*/ + + + +#ifndef PUSHVIEWER_HRH +#define PUSHVIEWER_HRH + +#include +#include +#include +#include + + +enum TPushViewerCommand + { + // Application specific command ids. + // + EPushViewerCmdLoadService = 1, // The value 0 doesn't work, because it is EEikCmdCanceled. + EPushViewerCmdDelete, + EPushViewerCmdMessageInfo, + EPushViewerCmdPreviousMessage, + EPushViewerCmdNextMessage, + // + // Ui framework defined command ids. + // + EPushViewerCmdOptions = EAknSoftkeyOptions,// = 3000 +#ifdef __SERIES60_HELP + EPushViewerCmdHelp = EAknCmdHelp, // = 4003 +#endif //__SERIES60_HELP + EPushViewerCmdBack = EAknSoftkeyBack, // = 3001 + EPushViewerCmdExit = EEikCmdExit, // = 0x100. Use in HandleCommanL. + EPushViewerCmdAknExit = EAknCmdExit // = 4011. Use in resources. + }; + +enum TPushViewerControl + { + EPushViewerCntrlTab, + EMyMsgComponentIdBody = EMsgComponentIdFirstFreeEditorSpecificId + }; + + +#endif // PUSHVIEWER_HRH + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewerApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewerApp.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of CPushViewerApplication. +* +*/ + + + +#ifndef PUSHVIEWERAPP_H +#define PUSHVIEWERAPP_H + +// INCLUDES + +#include + +// FORWARD DECLARATION + +class CApaAppServer; + +// CLASS DECLARATION + +/** +* Push Viewer application +*/ +class CPushViewerApplication : public CAknApplication + { + private: // Functions from base classes + + /** + * From CApaApplication. + */ + TUid AppDllUid() const; + + /** + * From CEikApplication. + */ + CApaDocument* CreateDocumentL(); + + /* + * From CEikApplication. + */ + void NewAppServerL( CApaAppServer*& aAppServer ); + }; + +#endif // PUSHVIEWERAPP_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewerAppServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewerAppServer.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PushViewerAppServer_H +#define PushViewerAppServer_H + +// INCLUDES +#include +#include + + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class CPushViewerAppServer : public CAknAppServer + { + public: // Constructors and destructor + + CPushViewerAppServer(); + + public: // from CAknAppServer + + CApaAppServiceBase* CreateServiceL( TUid aServiceType ) const; + + protected: // from CPolicyServer + + virtual TCustomResult CustomFailureActionL( const RMessage2& aMsg, + TInt aAction, + const TSecurityInfo& aMissing ); + }; + +#endif // PushViewerAppServer_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewerDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewerDef.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic definition file. Internal usage only. +* +*/ + + + +#ifndef PUSHVIEWERDEF_H +#define PUSHVIEWERDEF_H + +// INCLUDE FILES + +#include "PushMtmDef.hrh" + +// CONSTANTS + +/// Push Viewer application UID. +LOCAL_D const TUid KUidPushViewerApp = { EUidPushViewerApp }; +/// WML Browser releates figures. +LOCAL_D const TUid KUidWmlBrowserApp = { 0x10008D39 }; +/// Other applications. +LOCAL_D const TUid KUidNotepadApp = { 0x1000599d }; +/// Bitmap file. +_LIT( KPushViewerMbm, "z:\\resource\\PushViewer.mbm"); + +#endif // PUSHVIEWERDEF_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewerDoc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewerDoc.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CPushViewerDocument +* +*/ + + + +#ifndef PUSHVIEWERDOC_H +#define PUSHVIEWERDOC_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** +* Push Viewer application's document. +*/ +class CPushViewerDocument : public CMsgEditorDocument + { + public: // Constructors and destructor + + static CPushViewerDocument* NewL( CEikApplication& aApp ); + + public: // New functions + + /** + * Issue EPushMtmCmdLoadService to MTM UI. + * @return None. + */ + void IssueLoadServiceL(); + + /** + * Issue KMtmUiFunctionMessageInfo to MTM UI. + * @return None. + */ + void IssueMessageInfoL(); + + private: // Constructors and destructor + + CPushViewerDocument( CEikApplication& aApp ); + + private: // Functions from base classes + + /** + * From CEikDocument. + */ + CEikAppUi* CreateAppUiL(); + + /** + * From CMsgEditorDocument + */ + TMsvId DefaultMsgFolder() const; + + /** + * From CMsgEditorDocument + */ + TMsvId DefaultMsgService() const; + + /** + * From CMsgEditorDocument + */ + TMsvId CreateNewL( TMsvId aService, TMsvId aFolder ); + + /** + * From CMsgEditorDocument + */ + void EntryChangedL(); + }; + +#endif // PUSHVIEWERDOC_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewerMsgEdAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewerMsgEdAppUi.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application Ui declaration. +* +*/ + + + +#ifndef PUSHVIEWERMSGEDAPPUI_H +#define PUSHVIEWERMSGEDAPPUI_H + +// INCLUDES + +#include +#include + +// FORWARD DECLARATIONS + +class CMsgEditorView; +class CPushMsgEntryBase; +class CPushViewerDocument; + +// CLASS DECLARATION + +/** +* Push Viewer application's UI that creates a MsgEditor-based view. +* This application uses a message server entry as a "model" or "context". +*/ +class CPushViewerMsgEdAppUi : public CMsgEditorAppUi + { + public: // Constructors and destructor + + /** + * Constructor. + */ + CPushViewerMsgEdAppUi(); + + /** + * Destructor. + */ + virtual ~CPushViewerMsgEdAppUi(); + + public: // New functions + + /** + * Return the model of the application that is a push message entry. + * @return The base class for all push entries. + */ + CPushMsgEntryBase& Model() const; + + private: // Constructors + + /** + * Constructor. + * @return None. + */ + void ConstructL(); + + private: // New functions + + /** + * Return the document of the application. + * @return The doc. + */ + CPushViewerDocument& PushDoc() const; + + /** + * Call CMsgEditorAppUi::UpdateNaviPaneL() with the right images. + * @return None. + */ + void UpdateNaviPaneL(); + + /** + * Construct the view and make it visible. + * @return None. + */ + void ConstructViewL(); + + /** + * Chect the expiration state of the context. It is SI specific. + * In case of other push messages it returns EFalse. + * @return ETrue or EFalse. + */ + TBool IsExpired(); + + /** + * Show information note and terminate the application. + */ + void NotifyAndExitL( TInt aResId ); + + /** + * Construct the two body text: one holds the message, + * the other holds the href. The order depends on the + * length of the message text. + * @param aBodyControl1 The first body control. + * @param aBodyControl2 The second body control. + * @return Index of the Href control or KErrNotFound if no href in the msg. + */ + TInt ConstructBodyTextL( CMsgBodyControl& aBodyControl1, + CMsgBodyControl& aBodyControl2 ) const; + + private: // Functions from base classes + + /** + * Terminate the application with this method. + * @return None. + */ + void DoMsgSaveExitL(); + + /** + * Construct the context, update the navi pane and construct the view. + * @return None. + */ + void LaunchViewL(); + + /** + * This method is called when the context is changed. + * @return None. + */ + void HandleEntryChangeL(); + + /** + * This method is called when the context is deleted. + * @return None. + */ + void HandleEntryDeletedL(); + + /** + * We handle the Left/Right arrow here. Other event keys are + * handled by the view. + * @return EKeyWasConsumed. + */ + TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * Dynamically initialize the menu takin into consideration + * the current context. + * @return None. + */ + void DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ); + + /** + * It's just an empty implementation. + * @return None. + */ + void GetHelpContextForControl( TCoeHelpContext& aContext ) const; + +#ifdef __SERIES60_HELP + /** + * Get help context from the appui. + * @return Context. + */ + CArrayFix* HelpContextL() const; +#endif // __SERIES60_HELP + + /** + * Handle commands. + * @return None. + */ + void HandleCommandL( TInt aCommand ); + + private: // Data members + + CPushMsgEntryBase* iContext; ///< Message wrapper. Owned. + CMsgEditorView* iView; ///< MsgEditor style view. Owned. + }; + +#endif // PUSHVIEWERMSGEDAPPUI_H + +// End of File diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerInc/PushViewerPanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerInc/PushViewerPanic.h Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +#ifndef PUSHVIEWERPANIC_H +#define PUSHVIEWERPANIC_H + +// INCLUDE FILES + +#include + +enum TPushViewerPanic + { + EPushViewerPanCommandNotSupported = 1, ///< Not supported command. + EPushViewerPanBadType = 2, ///< Unsupported message type for an operation. + EPushViewerPanFoldersNotSupported = 3, ///< MTM loaded with bad message entry. + EPushViewerPanEmptySelection = 4, ///< Entry selection is empty. + EPushViewerPanBadItemType = 5, + EPushViewerPanNotInitialized = 6, + EPushViewerPanListBoxTooLarge = 7, + EPushViewerPanNull = 8, + EPushViewerPanIllegalArgument = 9, + EPushViewerPanBadPushType = 10, + EPushViewerPanBadMtmType = 11, + EPushViewerPanNotEmptyRichText = 12, + EPushViewerPanBadParaCount = 13, + EPushViewerPanSlEmptyHref = 14 + }; + +GLREF_C void ViewerPanic( TPushViewerPanic aReason ); + +#endif // PUSHVIEWERPANIC_H diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerSrc/PushViewerApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerSrc/PushViewerApp.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application class declaration. +* +*/ + + + +// INCLUDE FILES + +#include "PushViewerApp.h" +#include "PushViewerDoc.h" +#include "PushViewerDef.h" +#include "PushViewerAppServer.h" +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushViewerApplication::AppDllUid +// --------------------------------------------------------- +// +TUid CPushViewerApplication::AppDllUid() const + { + return KUidPushViewerApp; + } + +// --------------------------------------------------------- +// CPushViewerApplication::CreateDocumentL +// --------------------------------------------------------- +// +CApaDocument* CPushViewerApplication::CreateDocumentL() + { + return CPushViewerDocument::NewL( *this ); + } + +// --------------------------------------------------------- +// CPushViewerApplication::NewAppServerL +// --------------------------------------------------------- +// +void CPushViewerApplication::NewAppServerL + ( CApaAppServer*& aAppServer ) + { + aAppServer = new (ELeave) CPushViewerAppServer; + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +LOCAL_C CApaApplication* NewApplication() + { + return new CPushViewerApplication; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerSrc/PushViewerAppServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerSrc/PushViewerAppServer.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "PushViewerAppServer.h" +#include +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPushViewerAppServer::CreateServiceL +// ----------------------------------------------------------------------------- +// +CApaAppServiceBase* +CPushViewerAppServer::CreateServiceL( TUid aServiceType ) const + { + if ( aServiceType == TUid::Uid( KMuiuMsgEditorServiceUid ) ) + { + return new (ELeave) CMuiuMsgEditorServiceSession; + } + else + { + return CAknAppServer::CreateServiceL( aServiceType ); + } + } + +// ----------------------------------------------------------------------------- +// CPushViewerAppServer::CPushViewerAppServer +// ----------------------------------------------------------------------------- +// +CPushViewerAppServer::CPushViewerAppServer( ) + { + } + +// ----------------------------------------------------------------------------- +// CPushViewerAppServer::CustomFailureActionL +// ----------------------------------------------------------------------------- +// +CPolicyServer::TCustomResult +CPushViewerAppServer::CustomFailureActionL( const RMessage2& /*aMsg*/, + TInt /*aAction*/, + const TSecurityInfo& /*aMissing*/ ) + { + CPolicyServer::TCustomResult res( CPolicyServer::EPass ); + return res; + } + +// End of File + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerSrc/PushViewerDoc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerSrc/PushViewerDoc.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CPushViewerDocument. +* +*/ + + + +// INCLUDE FILES + +#include "PushViewerDoc.h" +#include +#include "PushViewerMsgEdAppUi.h" +#include "PushMtmCommands.hrh" +#include "PushMtmDef.h" +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushViewerDocument::NewL +// --------------------------------------------------------- +// +CPushViewerDocument* CPushViewerDocument::NewL( CEikApplication& aApp ) + { + CPushViewerDocument* doc = new (ELeave) CPushViewerDocument( aApp ); + CleanupStack::PushL( doc ); + doc->ConstructL(); + CleanupStack::Pop(); + return doc; + } + +// --------------------------------------------------------- +// CPushViewerDocument::IssueLoadServiceL +// --------------------------------------------------------- +// +void CPushViewerDocument::IssueLoadServiceL() + { + CMsvSingleOpWatcher* opWatcher = CMsvSingleOpWatcher::NewLC( *this ); + + TBuf8<1> dummyPar; + CMsvEntrySelection* dummySel = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( dummySel ); + + CMsvOperation* operation = MtmUi().InvokeAsyncFunctionL + ( EPushMtmCmdLoadService, + *dummySel, + opWatcher->iStatus, + dummyPar ); + + CleanupStack::PopAndDestroy( dummySel ); // dummySel + + // Observe the operation. + AddSingleOperationL( operation, opWatcher ); + CleanupStack::Pop( opWatcher ); // opWatcher + } + +// --------------------------------------------------------- +// CPushViewerDocument::IssueMessageInfoL +// --------------------------------------------------------- +// +void CPushViewerDocument::IssueMessageInfoL() + { + CMsvSingleOpWatcher* opWatcher = CMsvSingleOpWatcher::NewLC( *this ); + + TMessageInfoParam par; + par.iDontShowNotification = ETrue; + TMessageInfoParamBuf parBuf( par ); + + CMsvEntrySelection* dummySel = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL( dummySel ); + + CMsvOperation* operation = MtmUi().InvokeAsyncFunctionL + ( KMtmUiFunctionMessageInfo, + *dummySel, + opWatcher->iStatus, + parBuf ); + CleanupStack::PopAndDestroy( dummySel ); // dummySel + + // See MsgEditorDocument.cpp about the usage of the following + // method. + AddSingleOperationL( operation, opWatcher ); + CleanupStack::Pop( opWatcher ); // opWatcher + } + +// --------------------------------------------------------- +// CPushViewerDocument::CPushViewerDocument +// --------------------------------------------------------- +// +CPushViewerDocument::CPushViewerDocument( CEikApplication& aApp ) +: CMsgEditorDocument( aApp ) + { + } + +// --------------------------------------------------------- +// CPushViewerDocument::CreateAppUiL +// --------------------------------------------------------- +// +CEikAppUi* CPushViewerDocument::CreateAppUiL() + { + // Create a MsgEditor based view. + return new (ELeave) CPushViewerMsgEdAppUi; + } + +// --------------------------------------------------------- +// CPushViewerDocument::DefaultMsgFolder +// --------------------------------------------------------- +// +TMsvId CPushViewerDocument::DefaultMsgFolder() const + { + return KMsvDraftEntryIdValue; + } + +// --------------------------------------------------------- +// CPushViewerDocument::DefaultMsgService +// --------------------------------------------------------- +// +TMsvId CPushViewerDocument::DefaultMsgService() const + { + return KMsvLocalServiceIndexEntryId; + } + +// --------------------------------------------------------- +// CPushViewerDocument::CreateNewL +// --------------------------------------------------------- +// +TMsvId CPushViewerDocument::CreateNewL( TMsvId /*aService*/, + TMsvId /*aFolder*/ ) + { + return 0; + } + +// --------------------------------------------------------- +// CPushViewerDocument::EntryChangedL +// --------------------------------------------------------- +// +void CPushViewerDocument::EntryChangedL() + { + } + +// End of file. diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerSrc/PushViewerMsgEdAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerSrc/PushViewerMsgEdAppUi.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,677 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application Ui member definitions. +* +*/ + + + +// INCLUDE FILES + +#include "PushViewerMsgEdAppUi.h" +#include "PushViewerDoc.h" +#include "PushViewerDef.h" +#include "PushViewerPanic.h" +#include "PushMtmUtil.h" +#include "PushViewer.hrh" +#include "PushMtmLog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __SERIES60_HELP +// Context-Sensitve Help File +#include +#include +#endif // __SERIES60_HELP + +#include "eikon.hrh" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::CPushViewerMsgEdAppUi +// --------------------------------------------------------- +// +CPushViewerMsgEdAppUi::CPushViewerMsgEdAppUi() + { + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi +// --------------------------------------------------------- +// +CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi() + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi") + delete iView; + iView = NULL; + delete iContext; + iContext = NULL; + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::~CPushViewerMsgEdAppUi") + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::ConstructL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::ConstructL() + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::ConstructL") + + CMsgEditorAppUi::ConstructL(); + + if ( !iEikonEnv->StartedAsServerApp( ) ) + { + // If the app was not started as server app, + // we can call PrepareLaunchL + Document()->PrepareToLaunchL( this ); + } + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::ConstructL") + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::ConstructBodyTextL +// --------------------------------------------------------- +// +TInt CPushViewerMsgEdAppUi::ConstructBodyTextL + ( CMsgBodyControl& aBodyControl1, CMsgBodyControl& aBodyControl2 ) const + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::ConstructBodyTextL"); + + HBufC* staticText = iEikonEnv->AllocReadResourceLC + ( R_PUSHVIEWER_MAINPANE_TEXT ); + + TPtrC renderedTextPtr( *staticText ); // Static text by default. + TPtrC renderedHrefPtr( KNullDesC ); + + if ( Model().PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, &Model() ); + + const TPtrC text = si->Text(); + if ( text.Length() ) + { + renderedTextPtr.Set( text ); + } + else + { + renderedTextPtr.Set( *staticText ); + } + + const TPtrC url = si->Url(); + if ( url.Length() ) + { + renderedHrefPtr.Set( url ); + } + } + else if ( Model().PushMsgType() == KUidWapPushMsgSL.iUid ) + { + CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, &Model() ); + + const TPtrC url = sl->Url(); + if ( url.Length() ) + { + renderedHrefPtr.Set( url ); + } + } + else + { + User::Leave( KErrNotSupported ); + } + + // The message goes to the first body control by default, but + // if it does not fit into one screen, then first comes the href. + + aBodyControl1.InsertTextL( renderedTextPtr ); + + CMsgBodyControl* controlContainingTheUrl = NULL; + TInt indexOfHrefControl = KErrNotFound; + + // Add the href + if ( renderedHrefPtr.Length() == 0 ) + { + // No href. + controlContainingTheUrl = NULL; + iAvkonAppUi->Cba()->SetCommandSetL( R_PUSHVIEWER_SOFTKEYS ); + iAvkonAppUi->Cba()->DrawNow(); + } + else + { + aBodyControl2.InsertTextL( renderedHrefPtr ); + controlContainingTheUrl = &aBodyControl2; + indexOfHrefControl = 1; // Zero based. + } + + aBodyControl1.SetPlainTextMode( ETrue ); + aBodyControl2.SetPlainTextMode( ETrue ); + + // Switch on URL highlighting. We use FindItem for it - + // otherwise Find Item has no other role! + if ( controlContainingTheUrl != NULL ) + { + if ( controlContainingTheUrl->ItemFinder() ) + { + controlContainingTheUrl-> + ItemFinder()->SetFindModeL( CItemFinder::EUrlAddress ); + controlContainingTheUrl-> + SetupAutomaticFindAfterFocusChangeL( ETrue ); + } + controlContainingTheUrl->Editor().SetAlignment( EAknEditorAlignCenter ); + } + + CleanupStack::PopAndDestroy( staticText ); // staticText + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::ConstructBodyTextL"); + return indexOfHrefControl; + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::ConstructViewL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::ConstructViewL() + { + CMsgEditorView* newView = CMsgEditorView::NewL + ( *this, CMsgEditorView::EMsgReadOnly ); + delete iView; + iView = newView; + + // Let two body controls: one for the message text and one for the Href + + // There is already one by default - get a pointer to it. + CMsgBodyControl* bodyControl1 = REINTERPRET_CAST( CMsgBodyControl*, + iView->ControlById( EMsgComponentIdBody ) ); + + // Create the second: + CMsgBodyControl* bodyControl2 = CMsgBodyControl::NewL( iView ); + CleanupStack::PushL( bodyControl2 ); + iView->AddControlL( bodyControl2, + /*aControlId*/EMyMsgComponentIdBody, + /*aIndex*/1, + /*aFormComponent*/EMsgBody ); + CleanupStack::Pop( bodyControl2 ); // bodyControl2 + + TInt indexOfHrefControl = ConstructBodyTextL( *bodyControl1, *bodyControl2 ); + + // Construct the view. + TInt controlIdForFocus = indexOfHrefControl==1?EMyMsgComponentIdBody:EMsgComponentIdBody; + iView->ExecuteL( ClientRect(), controlIdForFocus ); + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::HandleKeyEventL +// --------------------------------------------------------- +// +TKeyResponse CPushViewerMsgEdAppUi::HandleKeyEventL + ( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + PUSHLOG_WRITE_FORMAT + ("CPushViewerMsgEdAppUi::HandleKeyEventL <%d>",aKeyEvent.iCode) + // Check for iView and iContext objects are created before Handle + if ( (NULL == iView) || (NULL == iContext) ) + { + return (EKeyWasConsumed); + } + + if ( aType == EEventKey ) + { + switch ( aKeyEvent.iCode ) + { + + case EKeyDevice3: + { + // Selection key pressed. Behave as "Load service" if there is + // service to download. + const TMsvEntry& context = Model().Entry(); + if ( CPushMtmUtil::Attrs( context ) & EPushMtmAttrHasHref ) + { + HandleCommandL( EPushViewerCmdLoadService ); + } + break; + } + + case EKeyLeftUpArrow: // Northwest + case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyLeftArrow: // West + case EKeyLeftDownArrow: // Southwest + case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge + { + HandleCommandL( EPushViewerCmdPreviousMessage ); + break; + } + + case EKeyRightUpArrow: // Northeast + case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge + case EKeyRightArrow: // East + case EKeyRightDownArrow: // Southeast + case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge + { + HandleCommandL( EPushViewerCmdNextMessage ); + break; + } + + case EKeyBackspace : + { + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if ( dlg->ExecuteLD + ( R_PUSHVIEWER_ENTRY_DELETE_CONFIRM ) == EAknSoftkeyYes ) + { + DeleteAndExitL(); + } + break; + } + + default: + { + iView->OfferKeyEventL( aKeyEvent, aType ); + break; + } + + } + } + + return EKeyWasConsumed; + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::DynInitMenuPaneL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::DynInitMenuPaneL( TInt aMenuId, + CEikMenuPane* aMenuPane ) + { + if ( aMenuId == R_PUSHVIEWER_OPTIONS_MENU_PANE ) + { + // Remove EPushViewerCmdLoadService if the current message + // does not contain URL. + CPushMsgEntryBase& modelBase = Model(); + if ( Model().PushMsgType() == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry& si = (CSIPushMsgEntry&)modelBase; + if ( !si.Url().Length() ) + { + aMenuPane->DeleteMenuItem( EPushViewerCmdLoadService ); + Cba()->SetCommandSetL( R_PUSHVIEWER_SOFTKEYS ); + } + } + else if ( Model().PushMsgType() == KUidWapPushMsgSL.iUid ) + { + CSLPushMsgEntry& sl = (CSLPushMsgEntry&)modelBase; + __ASSERT_DEBUG( sl.Url().Length() != 0, + ViewerPanic( EPushViewerPanSlEmptyHref ) ); + if ( !sl.Url().Length() ) + { + aMenuPane->DeleteMenuItem( EPushViewerCmdLoadService ); + Cba()->SetCommandSetL( R_PUSHVIEWER_SOFTKEYS ); + } + } + } + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::Model +// --------------------------------------------------------- +// +CPushMsgEntryBase& CPushViewerMsgEdAppUi::Model() const + { + PUSHLOG_WRITE_FORMAT("CPushViewerMsgEdAppUi::Model <%x>",iContext) + return *iContext; + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::PushDoc +// --------------------------------------------------------- +// +CPushViewerDocument& CPushViewerMsgEdAppUi::PushDoc() const + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::PushDoc") + return REINTERPRET_CAST( CPushViewerDocument&, *Document() ); + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::PushDoc") + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::UpdateNaviPaneL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::UpdateNaviPaneL() + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::UpdateNaviPaneL") + + CEikImage* image = new (ELeave) CEikImage; + CleanupStack::PushL( image ); + + // Read image from resource. + // + TResourceReader reader; + iCoeEnv->CreateResourceReaderLC( reader, R_PUSHVIEWER_NAVI_IMAGE ); + image->ConstructFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader + + CMsgEditorAppUi::UpdateNaviPaneL( image->Bitmap(), image->Mask() ); + image->SetPictureOwnedExternally( ETrue ); + + CleanupStack::PopAndDestroy(); // image + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::UpdateNaviPaneL") + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::IsExpired +// --------------------------------------------------------- +// +TBool CPushViewerMsgEdAppUi::IsExpired() + { + TBool ret( EFalse ); + + if ( Document()->Entry().iBioType == KUidWapPushMsgSI.iUid ) + { + CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, iContext ); + // Check expiration if expiration time was set. + if ( si->Expires() != Time::NullTTime() ) + { + TTime today; + today.UniversalTime(); + if ( si->Expires() < today ) + { + ret = ETrue; + } + } + } + + return ret; + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::DoMsgSaveExitL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::DoMsgSaveExitL() + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::DoMsgSaveExitL"); + + Exit( EAknSoftkeyBack ); + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::DoMsgSaveExitL") + }; + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::NotifyAndExitL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::NotifyAndExitL( TInt aResId ) + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::NotifyAndExitL"); + + HBufC* noteText = iCoeEnv->AllocReadResourceLC( aResId ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); + note->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); // noteText + + // Close the application. + if ( !IsAppShutterRunning() ) + { + PUSHLOG_WRITE(" RunAppShutter") + RunAppShutter(); + } + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::NotifyAndExitL"); + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::LaunchViewL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::LaunchViewL() + { + __ASSERT_ALWAYS( Document()->Entry().iMtm == KUidMtmWapPush, + ViewerPanic( EPushViewerPanBadMtmType ) ); + + // Construct model. + CPushMsgEntryBase* newContext = NULL; + const TInt32 bioType( Document()->Entry().iBioType ); + + if ( bioType == KUidWapPushMsgSI.iUid ) + { + newContext = CSIPushMsgEntry::NewL(); + } + else if ( bioType == KUidWapPushMsgSL.iUid ) + { + newContext = CSLPushMsgEntry::NewL(); + } + else if ( bioType == KUidWapPushMsgMultiPart.iUid ) + { +#ifdef __TEST_MULTIPART_SUPP + newContext = CMultiPartPushMsgEntry::NewL(); +#else // __TEST_MULTIPART_SUPP + User::Leave( KErrNotSupported ); +#endif // __TEST_MULTIPART_SUPP + } + else + { + __ASSERT_DEBUG( EFalse, ViewerPanic( EPushViewerPanBadPushType ) ); + User::Leave( KErrNotSupported ); + } + + CleanupStack::PushL( newContext ); + newContext->RetrieveL( Document()->Session(), Document()->Entry().Id() ); + delete iContext; + iContext = NULL; + iContext = newContext; + CleanupStack::Pop( newContext ); // newContext + + // Construct view. + UpdateNaviPaneL(); + ConstructViewL(); + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::HandleEntryChangeL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::HandleEntryChangeL() + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::HandleEntryChangeL"); + + + // We have to act only in case of such changes where the content + // of the message changes, not only the unread/read flag. + // The content handlers and the Push subsystem behave so that + // the content is changed only when the entry becomes 'unread', + // except one case where the CH changes the content, but the + // message becomes 'read' (SL-execute-high). In this case + // a flag indicates that the content was changed. + + // Get an up-to-date entry and check the necessary flags: + TMsvEntry tEntry; + TMsvId service; + TMsvId entryId = Document()->Entry().Id(); + CMsvSession& msvSession = Document()->Session(); + User::LeaveIfError( msvSession.GetEntry( entryId, service, tEntry ) ); + TBool isChangeToUnread = tEntry.Unread(); + TBool contentChangedFlagSet = + CPushMtmUtil::Attrs( tEntry ) & EPushMtmReadButContentChanged; + + if ( !isChangeToUnread && !contentChangedFlagSet ) + { + // Nothing to do. Somebody just set it as read. + PUSHLOG_WRITE(" Content not changed"); + } + else + { + // Show note about the message changes & close the application. + NotifyAndExitL( R_PUSHVIEWER_INFO_REPLACED ); + } + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::HandleEntryChangeL") + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::HandleEntryDeletedL +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::HandleEntryDeletedL() + { + PUSHLOG_ENTERFN("CPushViewerMsgEdAppUi::HandleEntryDeletedL"); + // Check for iView and iContext objects are created before Handle + if ( (NULL == iView) || (NULL == iContext)) + { + return; + } + // Show note about the message deletion & close the application. + NotifyAndExitL( R_PUSHVIEWER_INFO_DELETED ); + + PUSHLOG_LEAVEFN("CPushViewerMsgEdAppUi::HandleEntryDeletedL") + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::GetHelpContextForControl +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::GetHelpContextForControl + ( TCoeHelpContext& /*aContext*/ ) const + { + } + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::HandleCommandL +// See DynInitMenuPaneL() to see which commands are valid +// on a given type of item. +// --------------------------------------------------------- +// +void CPushViewerMsgEdAppUi::HandleCommandL( TInt aCommand ) + { + PUSHLOG_WRITE_FORMAT("CPushViewerMsgEdAppUi::HandleCommandL <%d>",aCommand) + // Check for iView and iContext objects are created before Handle + if ( (NULL == iView) || (NULL == iContext)) + { + return; + } + switch ( aCommand ) + { + case EPushViewerCmdLoadService: + { + if ( IsExpired() ) + { + // The entry is expired. + HBufC* value = + iCoeEnv->AllocReadResourceLC( R_PUSHVIEWER_EXPIRED_NOTE ); + CAknInformationNote* note = + new (ELeave) CAknInformationNote( ETrue ); + note->ExecuteLD( *value ); + CleanupStack::PopAndDestroy( value ); // value + + // Delete the expired message and exit. + DeleteAndExitL(); + } + else + { + PushDoc().IssueLoadServiceL(); + } + break; + } + + case EPushViewerCmdDelete: + { + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if ( dlg->ExecuteLD + ( R_PUSHVIEWER_ENTRY_DELETE_CONFIRM ) == EAknSoftkeyYes ) + { + DeleteAndExitL(); + } + break; + } + + case EPushViewerCmdMessageInfo: + { + PushDoc().IssueMessageInfoL(); + break; + } + + case EPushViewerCmdPreviousMessage: + { + if ( IsNextMessageAvailableL( EFalse ) ) + { + NextMessageL( EFalse ); + } + break; + } + + case EPushViewerCmdNextMessage: + { + if ( IsNextMessageAvailableL( ETrue ) ) + { + NextMessageL( ETrue ); + } + break; + } + +#ifdef __SERIES60_HELP + + case EPushViewerCmdHelp: + { + HlpLauncher::LaunchHelpApplicationL + ( iEikonEnv->WsSession(), AppHelpContextL() ); + break; + } + +#endif //__SERIES60_HELP + + case EPushViewerCmdBack: + case EPushViewerCmdExit: + { + DoMsgSaveExitL(); + break; + } + + default: + { + break; + } + } + } + +#ifdef __SERIES60_HELP + +// --------------------------------------------------------- +// CPushViewerMsgEdAppUi::HelpContextL +// --------------------------------------------------------- +// +CArrayFix* CPushViewerMsgEdAppUi::HelpContextL() const + { + CArrayFix* contexts = new (ELeave) CArrayFixFlat( 1 ); + CleanupStack::PushL( contexts ); + TCoeHelpContext help( TUid::Uid( EUidPushViewerApp ), KWPUSH_HLP_VIEWER ); + contexts->AppendL( help ); + CleanupStack::Pop(); // contexts + return contexts; + } + +#endif // __SERIES60_HELP + +// End of file. + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/ViewerSrc/PushViewerPanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/ViewerSrc/PushViewerPanic.cpp Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic utility +* +*/ + + + +// INCLUDE FILES + +#include "PushViewerPanic.h" + + +_LIT( KViewerPanicString, "PushViewer" ); + +GLDEF_C void ViewerPanic( TPushViewerPanic aReason ) + { + User::Panic( KViewerPanicString, aReason ); + } diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/bwinscw/PUSHMTMCLISRVU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/bwinscw/PUSHMTMCLISRVU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?NewL@CPushMtmClient@@SAPAV1@AAVCRegisteredMtmDll@@AAVCMsvSession@@@Z @ 1 NONAME ; class CPushMtmClient * CPushMtmClient::NewL(class CRegisteredMtmDll &, class CMsvSession &) + ?NewL@CPushMtmServer@@SAPAV1@AAVCRegisteredMtmDll@@PAVCMsvServerEntry@@@Z @ 2 NONAME ; class CPushMtmServer * CPushMtmServer::NewL(class CRegisteredMtmDll &, class CMsvServerEntry *) + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/bwinscw/PUSHMTMUIU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/bwinscw/PUSHMTMUIU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?NewL@CPushMtmUi@@SAPAV1@AAVCBaseMtm@@AAVCRegisteredMtmDll@@@Z @ 1 NONAME ; class CPushMtmUi * CPushMtmUi::NewL(class CBaseMtm &, class CRegisteredMtmDll &) + ?NewL@CPushMtmUiData@@SAPAV1@AAVCRegisteredMtmDll@@@Z @ 2 NONAME ; class CPushMtmUiData * CPushMtmUiData::NewL(class CRegisteredMtmDll &) + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/bwinscw/PUSHMTMUTILU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/bwinscw/PUSHMTMUTILU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,68 @@ +EXPORTS + ??0CPushAsyncOpRunner@@IAE@AAVCMsvSession@@JAAVTRequestStatus@@@Z @ 1 NONAME ; CPushAsyncOpRunner::CPushAsyncOpRunner(class CMsvSession &, long, class TRequestStatus &) + ??0CPushInitiator@@QAE@XZ @ 2 NONAME ; CPushInitiator::CPushInitiator(void) + ??0CPushMtmOperation@@IAE@AAVCMsvSession@@JAAVTRequestStatus@@@Z @ 3 NONAME ; CPushMtmOperation::CPushMtmOperation(class CMsvSession &, long, class TRequestStatus &) + ??1CPushAsyncOpRunner@@MAE@XZ @ 4 NONAME ; CPushAsyncOpRunner::~CPushAsyncOpRunner(void) + ??1CPushInitiator@@UAE@XZ @ 5 NONAME ; CPushInitiator::~CPushInitiator(void) + ??1CPushInitiatorList@@UAE@XZ @ 6 NONAME ; CPushInitiatorList::~CPushInitiatorList(void) + ??1CPushMtmOperation@@UAE@XZ @ 7 NONAME ; CPushMtmOperation::~CPushMtmOperation(void) + ??1CPushMtmSettings@@UAE@XZ @ 8 NONAME ; CPushMtmSettings::~CPushMtmSettings(void) + ??1CPushMtmUtil@@UAE@XZ @ 9 NONAME ; CPushMtmUtil::~CPushMtmUtil(void) + ??8CPushInitiatorList@@QBEHABV0@@Z @ 10 NONAME ; int CPushInitiatorList::operator==(class CPushInitiatorList const &) const + ??9CPushInitiatorList@@QBEHABV0@@Z @ 11 NONAME ; int CPushInitiatorList::operator!=(class CPushInitiatorList const &) const + ?AddL@CPushInitiatorList@@QAEKABVCPushInitiator@@@Z @ 12 NONAME ; unsigned long CPushInitiatorList::AddL(class CPushInitiator const &) + ?AddL@CPushInitiatorList@@QAEKPAVCPushInitiator@@@Z @ 13 NONAME ; unsigned long CPushInitiatorList::AddL(class CPushInitiator *) + ?At@CPushInitiatorList@@QBEAAVCPushInitiator@@H@Z @ 14 NONAME ; class CPushInitiator & CPushInitiatorList::At(int) const + ?Attrs@CPushMtmUtil@@SAKABVTMsvEntry@@@Z @ 15 NONAME ; unsigned long CPushMtmUtil::Attrs(class TMsvEntry const &) + ?AuthenticateMsgL@TPushAuthenticationUtil@@SAHABVCPushMtmSettings@@ABVCPushMessage@@@Z @ 16 NONAME ; int TPushAuthenticationUtil::AuthenticateMsgL(class CPushMtmSettings const &, class CPushMessage const &) + ?AuthenticateMsgL@TPushAuthenticationUtil@@SAHABVCPushMtmSettings@@ABVCPushMsgEntryBase@@@Z @ 17 NONAME ; int TPushAuthenticationUtil::AuthenticateMsgL(class CPushMtmSettings const &, class CPushMsgEntryBase const &) + ?CancelObserveEntryEvent@CPushMtmOperation@@IAEXXZ @ 18 NONAME ; void CPushMtmOperation::CancelObserveEntryEvent(void) + ?ConvertDetailsL@CPushMtmUtil@@QBEPAVHBufC16@@ABVTDesC8@@@Z @ 19 NONAME ; class HBufC16 * CPushMtmUtil::ConvertDetailsL(class TDesC8 const &) const + ?ConvertUriToDisplayFormL@CPushMtmUtil@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 20 NONAME ; class HBufC16 * CPushMtmUtil::ConvertUriToDisplayFormL(class TDesC16 const &) + ?Count@CPushInitiatorList@@QBEHXZ @ 21 NONAME ; int CPushInitiatorList::Count(void) const + ?Delete@CPushInitiatorList@@QAEXH@Z @ 22 NONAME ; void CPushInitiatorList::Delete(int) + ?DeleteEntryL@CPushMtmUtil@@QAEXJ@Z @ 23 NONAME ; void CPushMtmUtil::DeleteEntryL(long) + ?DeleteOperation@CPushAsyncOpRunner@@IAEXXZ @ 24 NONAME ; void CPushAsyncOpRunner::DeleteOperation(void) + ?DoCancel@CPushAsyncOpRunner@@MAEXXZ @ 25 NONAME ; void CPushAsyncOpRunner::DoCancel(void) + ?DoCancel@CPushMtmOperation@@MAEXXZ @ 26 NONAME ; void CPushMtmOperation::DoCancel(void) + ?Find@CPushInitiatorList@@QBEHABVCPushInitiator@@AAH@Z @ 27 NONAME ; int CPushInitiatorList::Find(class CPushInitiator const &, int &) const + ?FindMessagesL@CPushMtmUtil@@QAEPAVCMsvEntrySelection@@ABV2@VTUid@@@Z @ 28 NONAME ; class CMsvEntrySelection * CPushMtmUtil::FindMessagesL(class CMsvEntrySelection const &, class TUid) + ?FindMessagesL@CPushMtmUtil@@QAEPAVCMsvEntrySelection@@JVTUid@@H@Z @ 29 NONAME ; class CMsvEntrySelection * CPushMtmUtil::FindMessagesL(long, class TUid, int) + ?FindMessagesL@CPushMtmUtil@@QAEPAVCMsvEntrySelection@@VTUid@@@Z @ 30 NONAME ; class CMsvEntrySelection * CPushMtmUtil::FindMessagesL(class TUid) + ?FindPushFoldersL@CPushMtmUtil@@QAEPAVCMsvEntrySelection@@XZ @ 31 NONAME ; class CMsvEntrySelection * CPushMtmUtil::FindPushFoldersL(void) + ?FindSiIdLC@CPushMtmUtil@@QAEPAVCMsvEntrySelection@@ABVTDesC16@@@Z @ 32 NONAME ; class CMsvEntrySelection * CPushMtmUtil::FindSiIdLC(class TDesC16 const &) + ?FindUrlLC@CPushMtmUtil@@QAEPAVCMsvEntrySelection@@ABVTDesC16@@VTUid@@@Z @ 33 NONAME ; class CMsvEntrySelection * CPushMtmUtil::FindUrlLC(class TDesC16 const &, class TUid) + ?HandleEntryEventL@CPushMtmOperation@@MAEXW4TMsvEntryEvent@MMsvEntryObserver@@PAX11@Z @ 34 NONAME ; void CPushMtmOperation::HandleEntryEventL(enum MMsvEntryObserver::TMsvEntryEvent, void *, void *, void *) + ?InvokeRun@CPushMtmOperation@@IAEXXZ @ 35 NONAME ; void CPushMtmOperation::InvokeRun(void) + ?LoadL@CPushMtmSettings@@QAEXXZ @ 36 NONAME ; void CPushMtmSettings::LoadL(void) + ?MarkServiceUnreadL@CPushMtmUtil@@QAEXJH@Z @ 37 NONAME ; void CPushMtmUtil::MarkServiceUnreadL(long, int) + ?NewL@CPushInitiatorList@@SAPAV1@XZ @ 38 NONAME ; class CPushInitiatorList * CPushInitiatorList::NewL(void) + ?NewL@CPushMtmSettings@@SAPAV1@XZ @ 39 NONAME ; class CPushMtmSettings * CPushMtmSettings::NewL(void) + ?NewL@CPushMtmUtil@@SAPAV1@AAVCMsvSession@@@Z @ 40 NONAME ; class CPushMtmUtil * CPushMtmUtil::NewL(class CMsvSession &) + ?NewLC@CPushMtmSettings@@SAPAV1@XZ @ 41 NONAME ; class CPushMtmSettings * CPushMtmSettings::NewLC(void) + ?ObserveEntryEventL@CPushMtmOperation@@IAEXXZ @ 42 NONAME ; void CPushMtmOperation::ObserveEntryEventL(void) + ?OnRunLActionL@CPushAsyncOpRunner@@MAEHAAH@Z @ 43 NONAME ; int CPushAsyncOpRunner::OnRunLActionL(int &) + ?OnStartupL@CPushAsyncOpRunner@@MAEHAAH@Z @ 44 NONAME ; int CPushAsyncOpRunner::OnStartupL(int &) + ?Operation@CPushAsyncOpRunner@@IAEAAVCMsvOperation@@XZ @ 45 NONAME ; class CMsvOperation & CPushAsyncOpRunner::Operation(void) + ?ProgressL@CPushAsyncOpRunner@@UAEABVTDesC8@@XZ @ 46 NONAME ; class TDesC8 const & CPushAsyncOpRunner::ProgressL(void) + ?ProgressL@CPushMtmOperation@@UAEABVTDesC8@@XZ @ 47 NONAME ; class TDesC8 const & CPushMtmOperation::ProgressL(void) + ?PushInitiatorList@CPushMtmSettings@@QBEAAVCPushInitiatorList@@XZ @ 48 NONAME ; class CPushInitiatorList & CPushMtmSettings::PushInitiatorList(void) const + ?ResetAndDestroy@CPushInitiatorList@@QAEXXZ @ 49 NONAME ; void CPushInitiatorList::ResetAndDestroy(void) + ?ResetAttrs@CPushMtmUtil@@SAXAAVTMsvEntry@@K@Z @ 50 NONAME ; void CPushMtmUtil::ResetAttrs(class TMsvEntry &, unsigned long) + ?RestoreFactorySettingsL@CPushMtmSettings@@QAEXXZ @ 51 NONAME ; void CPushMtmSettings::RestoreFactorySettingsL(void) + ?RunError@CPushAsyncOpRunner@@MAEHH@Z @ 52 NONAME ; int CPushAsyncOpRunner::RunError(int) + ?RunError@CPushMtmOperation@@MAEHH@Z @ 53 NONAME ; int CPushMtmOperation::RunError(int) + ?RunL@CPushAsyncOpRunner@@MAEXXZ @ 54 NONAME ; void CPushAsyncOpRunner::RunL(void) + ?RunL@CPushMtmOperation@@MAEXXZ @ 55 NONAME ; void CPushMtmOperation::RunL(void) + ?SaveL@CPushMtmSettings@@QAEXH@Z @ 56 NONAME ; void CPushMtmSettings::SaveL(int) + ?ServiceLoadingType@CPushMtmSettings@@QBE?AW4TServiceLoading@1@XZ @ 57 NONAME ; enum CPushMtmSettings::TServiceLoading CPushMtmSettings::ServiceLoadingType(void) const + ?ServiceReception@CPushMtmSettings@@QBEHXZ @ 58 NONAME ; int CPushMtmSettings::ServiceReception(void) const + ?SetAddressL@CPushInitiator@@QAEXABVTDesC16@@W4TAddrType@1@@Z @ 59 NONAME ; void CPushInitiator::SetAddressL(class TDesC16 const &, enum CPushInitiator::TAddrType) + ?SetAttrs@CPushMtmUtil@@SAXAAVTMsvEntry@@K@Z @ 60 NONAME ; void CPushMtmUtil::SetAttrs(class TMsvEntry &, unsigned long) + ?SetOperation@CPushAsyncOpRunner@@IAEXPAVCMsvOperation@@@Z @ 61 NONAME ; void CPushAsyncOpRunner::SetOperation(class CMsvOperation *) + ?SetServiceLoadingType@CPushMtmSettings@@QAEXW4TServiceLoading@1@@Z @ 62 NONAME ; void CPushMtmSettings::SetServiceLoadingType(enum CPushMtmSettings::TServiceLoading) + ?SetServiceReception@CPushMtmSettings@@QAEXH@Z @ 63 NONAME ; void CPushMtmSettings::SetServiceReception(int) + ?SignalObserver@CPushMtmOperation@@IAEXH@Z @ 64 NONAME ; void CPushMtmOperation::SignalObserver(int) + ?StartL@CPushAsyncOpRunner@@UAEXXZ @ 65 NONAME ; void CPushAsyncOpRunner::StartL(void) + ?StartL@CPushMtmOperation@@UAEXXZ @ 66 NONAME ; void CPushMtmOperation::StartL(void) + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/cenrep/keys_pushmtm.xls Binary file pushmtm/cenrep/keys_pushmtm.xls has changed diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/conf/pushmtm.confml Binary file pushmtm/conf/pushmtm.confml has changed diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/conf/pushmtm_10008D42.crml Binary file pushmtm/conf/pushmtm_10008D42.crml has changed diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/eabi/PUSHMTMCLISRVU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/eabi/PUSHMTMCLISRVU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,10 @@ +EXPORTS + _ZN14CPushMtmClient4NewLER17CRegisteredMtmDllR11CMsvSession @ 1 NONAME + _ZN14CPushMtmServer4NewLER17CRegisteredMtmDllP15CMsvServerEntry @ 2 NONAME + _ZTI14CPushMtmClient @ 3 NONAME ; ## + _ZTI14CPushMtmServer @ 4 NONAME ; ## + _ZTI19CPushMtmGcOperation @ 5 NONAME ; ## + _ZTV14CPushMtmClient @ 6 NONAME ; ## + _ZTV14CPushMtmServer @ 7 NONAME ; ## + _ZTV19CPushMtmGcOperation @ 8 NONAME ; ## + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/eabi/PUSHMTMUIU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/eabi/PUSHMTMUIU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,20 @@ +EXPORTS + _ZN10CPushMtmUi4NewLER8CBaseMtmR17CRegisteredMtmDll @ 1 NONAME + _ZN14CPushMtmUiData4NewLER17CRegisteredMtmDll @ 2 NONAME + _ZTI10CPushMtmUi @ 3 NONAME ; ## + _ZTI14CPushMtmUiData @ 4 NONAME ; ## + _ZTI18CPushLoadServiceOp @ 5 NONAME ; ## + _ZTI18CPushMessageInfoOp @ 6 NONAME ; ## + _ZTI18CPushViewMessageOp @ 7 NONAME ; ## + _ZTI19CPushMtmUiOperation @ 8 NONAME ; ## + _ZTI19CPushSettingsDialog @ 9 NONAME ; ## + _ZTI22CPushMessageInfoDialog @ 10 NONAME ; ## + _ZTV10CPushMtmUi @ 11 NONAME ; ## + _ZTV14CPushMtmUiData @ 12 NONAME ; ## + _ZTV18CPushLoadServiceOp @ 13 NONAME ; ## + _ZTV18CPushMessageInfoOp @ 14 NONAME ; ## + _ZTV18CPushViewMessageOp @ 15 NONAME ; ## + _ZTV19CPushMtmUiOperation @ 16 NONAME ; ## + _ZTV19CPushSettingsDialog @ 17 NONAME ; ## + _ZTV22CPushMessageInfoDialog @ 18 NONAME ; ## + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/eabi/PUSHMTMUTILU_EKA2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/eabi/PUSHMTMUTILU_EKA2U.def Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,98 @@ +EXPORTS + _ZN12CPushMtmUtil10FindSiIdLCERK7TDesC16 @ 1 NONAME + _ZN12CPushMtmUtil10ResetAttrsER9TMsvEntrym @ 2 NONAME + _ZN12CPushMtmUtil12DeleteEntryLEl @ 3 NONAME + _ZN12CPushMtmUtil13FindMessagesLE4TUid @ 4 NONAME + _ZN12CPushMtmUtil13FindMessagesLERK18CMsvEntrySelection4TUid @ 5 NONAME + _ZN12CPushMtmUtil13FindMessagesLEl4TUidi @ 6 NONAME + _ZN12CPushMtmUtil16FindPushFoldersLEv @ 7 NONAME + _ZN12CPushMtmUtil18MarkServiceUnreadLEli @ 8 NONAME + _ZN12CPushMtmUtil24ConvertUriToDisplayFormLERK7TDesC16 @ 9 NONAME + _ZN12CPushMtmUtil4NewLER11CMsvSession @ 10 NONAME + _ZN12CPushMtmUtil5AttrsERK9TMsvEntry @ 11 NONAME + _ZN12CPushMtmUtil8SetAttrsER9TMsvEntrym @ 12 NONAME + _ZN12CPushMtmUtil9FindUrlLCERK7TDesC164TUid @ 13 NONAME + _ZN12CPushMtmUtilD0Ev @ 14 NONAME + _ZN12CPushMtmUtilD1Ev @ 15 NONAME + _ZN12CPushMtmUtilD2Ev @ 16 NONAME + _ZN14CPushInitiator11SetAddressLERK7TDesC16NS_9TAddrTypeE @ 17 NONAME + _ZN14CPushInitiatorC1Ev @ 18 NONAME + _ZN14CPushInitiatorC2Ev @ 19 NONAME + _ZN14CPushInitiatorD0Ev @ 20 NONAME + _ZN14CPushInitiatorD1Ev @ 21 NONAME + _ZN14CPushInitiatorD2Ev @ 22 NONAME + _ZN16CPushMtmSettings19SetServiceReceptionEi @ 23 NONAME + _ZN16CPushMtmSettings21SetServiceLoadingTypeENS_15TServiceLoadingE @ 24 NONAME + _ZN16CPushMtmSettings23RestoreFactorySettingsLEv @ 25 NONAME + _ZN16CPushMtmSettings4NewLEv @ 26 NONAME + _ZN16CPushMtmSettings5LoadLEv @ 27 NONAME + _ZN16CPushMtmSettings5NewLCEv @ 28 NONAME + _ZN16CPushMtmSettings5SaveLEi @ 29 NONAME + _ZN16CPushMtmSettingsD0Ev @ 30 NONAME + _ZN16CPushMtmSettingsD1Ev @ 31 NONAME + _ZN16CPushMtmSettingsD2Ev @ 32 NONAME + _ZN17CPushMtmOperation14SignalObserverEi @ 33 NONAME + _ZN17CPushMtmOperation17HandleEntryEventLEN17MMsvEntryObserver14TMsvEntryEventEPvS2_S2_ @ 34 NONAME + _ZN17CPushMtmOperation18ObserveEntryEventLEv @ 35 NONAME + _ZN17CPushMtmOperation23CancelObserveEntryEventEv @ 36 NONAME + _ZN17CPushMtmOperation4RunLEv @ 37 NONAME + _ZN17CPushMtmOperation6StartLEv @ 38 NONAME + _ZN17CPushMtmOperation8DoCancelEv @ 39 NONAME + _ZN17CPushMtmOperation8RunErrorEi @ 40 NONAME + _ZN17CPushMtmOperation9InvokeRunEv @ 41 NONAME + _ZN17CPushMtmOperation9ProgressLEv @ 42 NONAME + _ZN17CPushMtmOperationC1ER11CMsvSessionlR14TRequestStatus @ 43 NONAME + _ZN17CPushMtmOperationC2ER11CMsvSessionlR14TRequestStatus @ 44 NONAME + _ZN17CPushMtmOperationD0Ev @ 45 NONAME + _ZN17CPushMtmOperationD1Ev @ 46 NONAME + _ZN17CPushMtmOperationD2Ev @ 47 NONAME + _ZN18CPushAsyncOpRunner10OnStartupLERi @ 48 NONAME + _ZN18CPushAsyncOpRunner12SetOperationEP13CMsvOperation @ 49 NONAME + _ZN18CPushAsyncOpRunner13OnRunLActionLERi @ 50 NONAME + _ZN18CPushAsyncOpRunner15DeleteOperationEv @ 51 NONAME + _ZN18CPushAsyncOpRunner4RunLEv @ 52 NONAME + _ZN18CPushAsyncOpRunner6StartLEv @ 53 NONAME + _ZN18CPushAsyncOpRunner8DoCancelEv @ 54 NONAME + _ZN18CPushAsyncOpRunner8RunErrorEi @ 55 NONAME + _ZN18CPushAsyncOpRunner9OperationEv @ 56 NONAME + _ZN18CPushAsyncOpRunner9ProgressLEv @ 57 NONAME + _ZN18CPushAsyncOpRunnerC1ER11CMsvSessionlR14TRequestStatus @ 58 NONAME + _ZN18CPushAsyncOpRunnerC2ER11CMsvSessionlR14TRequestStatus @ 59 NONAME + _ZN18CPushAsyncOpRunnerD0Ev @ 60 NONAME + _ZN18CPushAsyncOpRunnerD1Ev @ 61 NONAME + _ZN18CPushAsyncOpRunnerD2Ev @ 62 NONAME + _ZN18CPushInitiatorList15ResetAndDestroyEv @ 63 NONAME + _ZN18CPushInitiatorList4AddLEP14CPushInitiator @ 64 NONAME + _ZN18CPushInitiatorList4AddLERK14CPushInitiator @ 65 NONAME + _ZN18CPushInitiatorList4NewLEv @ 66 NONAME + _ZN18CPushInitiatorList6DeleteEi @ 67 NONAME + _ZN18CPushInitiatorListD0Ev @ 68 NONAME + _ZN18CPushInitiatorListD1Ev @ 69 NONAME + _ZN18CPushInitiatorListD2Ev @ 70 NONAME + _ZN23TPushAuthenticationUtil16AuthenticateMsgLERK16CPushMtmSettingsRK12CPushMessage @ 71 NONAME + _ZN23TPushAuthenticationUtil16AuthenticateMsgLERK16CPushMtmSettingsRK17CPushMsgEntryBase @ 72 NONAME + _ZNK12CPushMtmUtil15ConvertDetailsLERK6TDesC8 @ 73 NONAME + _ZNK16CPushMtmSettings16ServiceReceptionEv @ 74 NONAME + _ZNK16CPushMtmSettings17PushInitiatorListEv @ 75 NONAME + _ZNK16CPushMtmSettings18ServiceLoadingTypeEv @ 76 NONAME + _ZNK18CPushInitiatorList2AtEi @ 77 NONAME + _ZNK18CPushInitiatorList4FindERK14CPushInitiatorRi @ 78 NONAME + _ZNK18CPushInitiatorList5CountEv @ 79 NONAME + _ZNK18CPushInitiatorListeqERKS_ @ 80 NONAME + _ZNK18CPushInitiatorListneERKS_ @ 81 NONAME + _ZTI12CPushMtmUtil @ 82 NONAME ; ## + _ZTI14CPushInitiator @ 83 NONAME ; ## + _ZTI16CPushMtmSettings @ 84 NONAME ; ## + _ZTI17CPushMtmOperation @ 85 NONAME ; ## + _ZTI18CPushAsyncOpRunner @ 86 NONAME ; ## + _ZTI18CPushInitiatorList @ 87 NONAME ; ## + _ZTI19CWhiteListConverter @ 88 NONAME ; ## + _ZTV12CPushMtmUtil @ 89 NONAME ; ## + _ZTV14CPushInitiator @ 90 NONAME ; ## + _ZTV16CPushMtmSettings @ 91 NONAME ; ## + _ZTV17CPushMtmOperation @ 92 NONAME ; ## + _ZTV18CPushAsyncOpRunner @ 93 NONAME ; ## + _ZTV18CPushInitiatorList @ 94 NONAME ; ## + _ZTV19CWhiteListConverter @ 95 NONAME ; ## + _ZThn48_N17CPushMtmOperation17HandleEntryEventLEN17MMsvEntryObserver14TMsvEntryEventEPvS2_S2_ @ 96 NONAME ; ## + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/help/data/xhtml.zip Binary file pushmtm/help/data/xhtml.zip has changed diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/help/group/bld.inf Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* Export help related files. +* +*/ + +#include +#include "../../../../../mw/web/web_plat/browser_platform_api/inc/browser_platform_variant.hrh" + +#if !defined(__PLATFORM_VERSION_32__) && !defined(__PLATFORM_VERSION_5250__) && !defined(__PLATFORM_VERSION_S60_50__) + +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/wpush.hlp.hrh APP_LAYER_PLATFORM_EXPORT_PATH(csxhelp/wpush.hlp.hrh) +../rom/pushmtmhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(pushmtmhelps_variant.iby) + +#endif diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/help/inc/wpush.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/help/inc/wpush.hlp.hrh Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,15 @@ +// +// wpush.hlp.hrh +// + +// +// File generated by CSXHelp Utilities on 2009-04-17 +// + +#ifndef __WPUSH_HLP_HRH__ +#define __WPUSH_HLP_HRH__ + +_LIT(KWPUSH_HLP_SETTINGS, "WPUSH_HLP_SETTINGS"); // +_LIT(KWPUSH_HLP_VIEWER, "WPUSH_HLP_VIEWER"); // + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/help/rom/pushmtmhelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/help/rom/pushmtmhelps_variant.iby Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for PushMtmHelps +* +*/ + +#ifndef __PUSHMTMHELPS_VARIANT_IBY__ +#define __PUSHMTMHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) && defined(__PUSHMTM_USED) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D3C\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D3C\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D3C\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D3C\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D3C\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D3C\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10008D3C\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10008D3C\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/loc/PushMtmUi.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/loc/PushMtmUi.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is a localisation file. +* +*/ + + + +// LOCALISATION STRINGS + +// d: Command in options list in Mce. +// d: Opens Message info dialog +// d: Visible when one message selected. +// l: list_single_pane_t1_cp2 +// +#define qtn_mce_info "Message info" + +// d: Command in options list in Mce. +// d: View a message +// l: list_single_pane_t1_cp2 +// +#define qtn_mce_open_to_brow "View Service" + +// d: Command in options list in Mce. +// d: Load a message +// l: list_single_pane_t1_cp2 +// +#define qtn_mce_fetch "Load Service" + +// d: Item in settings list in Mce. +// l: list_double_pane_t1 +// +#define qtn_mce_settings_push "Service message" + +//============================================================================= +// +// Push Settings Dialog related resources +// +//============================================================================= + +// d:Title +// l:title_pane_t2/opt9 +// +#define qtn_mce_title_settings_push "Service Settings" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_mce_settings_change "Change" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_mce_settings_delete "Delete" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_mce_settings_exit "Exit" + +// d:Setting item title +// l:list_setting_pane_t1 +// +#define qtn_mce_settings_push_recept "Service reception" + +// d:Setting item text +// l:list_set_graphic_pane_t1 +// +#define qtn_wml_push_setting_recep_on "On" + +// d:Setting item text +// l:list_set_graphic_pane_t1 +// +#define qtn_wml_push_setting_recep_off "Off" + +// d:Setting item title +// l:list_setting_pane_t1 +// +#define qtn_mce_settings_push_loading "Download messages" + +// d:Setting item text +// l:list_set_graphic_pane_t1 +// +#define qtn_wml_push_setting_load_autom "Automatically" + +// d:Setting item text +// l:list_set_graphic_pane_t1 +// +#define qtn_wml_push_setting_load_man "Manually" + +// d:Setting confirmation query +// l:popup_note_window +// +#define qtn_wml_push_sttng_autom_conf_q "Messages will be downloaded automatically when connection is active. Continue?" + +//============================================================================= +// +// Push Message Info Dialog related resources +// +//============================================================================= + +// d:Title of the Message info window +// l:heading_pane_t1 +// +#define qtn_wml_push_title_msginfo "Message info" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_from "From" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_url "Address" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_body "Message" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_type "Type" + +// d:Message type in Message info. +// d:Note that Message info dialog will wrap it! +// d:The string can be whatever long! +// l:list_single_heading_pane_t1_cp2 +// +#define qtn_wml_push_msgnfo_type_srv_msg "Service message" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msg_content_type "Content type" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_created "Created" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_expires "Expires" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_size "Size" + +// d:Heading item text +// l:list_single_heading_pane_t2 +// +#define qtn_wml_push_msginfo_rcvd "Received" + +//============================================================================= +// +// Push Load Service related resources +// +//============================================================================= + +// d:Setting confirmation query +// l:popup_note_image_window +// +#define qtn_wml_push_note_msg_expired "The service is no longer available - this message will be deleted." + +// d:Automatic fetching is on and not authenticated SL execute-high is opened. +// l:popup_note_window +// +#define qtn_service_inbox_sl_not_trusted "The message came from an untrusted source. Download it anyway?" + +// d:SL Cache is not authenticated and is opened. +// l:popup_note_window +// +#define qtn_service_inbox_sl_cache_not_trusted "The message came from an untrusted source and will be downloaded to cache. Download it anyway?" + +//============================================================================= +// +// Misc +// +//============================================================================= + +// d:First line of the Inbox list item +// l:list_double_graphic_pane_t1 +// +#define qtn_mce_push_inbox_sender_unkw "Unknown" + +// d:Second line of the Inbox list item +// l:list_double_graphic_pane_t2 +// +#define qtn_mce_push_inbox_message "Service message" + +// d:Message type in Messages/Settings +// l:list_single_pane_t1_cp2 +// +#define qtn_mce_settings_type_srv_msg "Service message" + +//============================================================================= +// +// Service reception +// +//============================================================================= + +// d:Shown in CAknInformationNote +// l:popup_note_window +// +#define qtn_service_inbox_updating_message_received "There are newer service message available, message will be replaced." + diff -r 6385c4c93049 -r 8e6fa1719340 pushmtm/loc/PushViewer.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pushmtm/loc/PushViewer.loc Wed Sep 01 12:31:04 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is a localisation file. +* +*/ + + + +// LOCALISATION STRINGS + +// d:Application title +// l:title_pane_t2/opt9 +// +#define qtn_wml_push_title_viewer "Service Message" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_mce_inbox_open "Open" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_mce_inbox_fetch "Load service" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_wml_push_cmd_delete "Delete" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_wml_push_cmd_info "Message info" + +// d:Menu item +// l:list_single_pane_t1_cp2 +// +#define qtn_wml_push_cmd_exit "Exit" + +// d:List item text +// l:list_double2_large_graphic_pane +// +#define qtn_wml_push_w_not_loaded "Content not loaded" + +// d:List item text +// l:list_double_large_graphic_pane_t1_cp2 +// +#define qtn_wml_push_w_attach "Content" + +// d:List item text +// l:list_double_large_graphic_pane_t1_cp2 +// +#define qtn_wap_push_w_wml_page "Wml page" + +// d:List item text +// l:list_double2_large_graphic_pane +// +#define qtn_mail_lds1_size "Size: %N kB" + +// d: Header of the Simple text viewer +// l: heading_pane_t1 +// +#define qtn_wml_push_txt_pop_heading "Message:" + +// d:Delete confirmation query +// l:popup_note_image_window +// +#define qtn_wml_push_view_query_del "Delete message?" + +// d:Shown on the main pane of PushViewer +// l:msg_body_pane_t1 +// +#define qtn_service_inbox_push_viewer_view_text "Download service message content by selecting Options - Download." + +// End of File