# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1265062647 -7200 # Node ID d6fe6244b863a6e957fd584e29ff65432e51ba73 Revision: 201003 Kit: 201005 diff -r 000000000000 -r d6fe6244b863 creator/data/creator.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/data/creator.rss Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,2324 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 MATT + +#include +#include +#include +#include +#include +#include + + + +#include "creator.hrh" +#include +#include + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_creator_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +// --------------------------------------------------------- +// +// r_creator_menubar +// Menubar for Creator +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_creator_menubar + { + titles = + { + MENU_TITLE {menu_pane = r_creator_menu;} + }; + } + + +// --------------------------------------------------------- +// +// r_creator_menu +// Menu for "Options" +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_creator_menu + { + items = + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + MENU_ITEM + { + command = ECmdCreateFromFile; + txt = "Run script"; + }, +#endif + + MENU_ITEM + { + command = ECmdCreateCalendarEntries; + cascade = r_creator_agendaentries_submenu; + txt = "Calendar"; + }, + + MENU_ITEM + { + command = ECmdCreateBrowserEntries; + cascade = r_creator_browserentries_submenu; + txt = "Browser"; + }, + + MENU_ITEM + { + command = ECmdCreateFileEntries; + cascade = r_creator_fileentries_submenu; + txt = "Files"; + }, + + MENU_ITEM + { + command = ECmdCreateLogEntries; + cascade = r_creator_logentries_submenu; + txt = "Logs"; + }, + + MENU_ITEM + { + command = ECmdCreateMessagingEntries; + cascade = r_creator_messagingentries_submenu; + txt = "Messaging"; + }, + + MENU_ITEM + { + command = ECmdCreateMiscEntries; + cascade = r_creator_miscentries_submenu; + txt = "Misc"; + }, + + MENU_ITEM + { + command = ECmdCreatePhoneBookEntries; + cascade = r_creator_phonebookentries_submenu; + txt = "Phonebook"; + }, + + MENU_ITEM + { + command = ECmdDeleteEntries; + cascade = r_creator_deleteentries_submenu; + txt = "Delete"; + }, + + MENU_ITEM + { + command = ECmdSelectRandomDataFile; + txt = "Select random data file"; + }, + + MENU_ITEM + { + command = ECmdAboutCreator; + txt = "About Creator"; + }, + + MENU_ITEM + { + command = EAknSoftkeyExit; + txt = "Exit"; + } + }; + } + + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_agendaentries_submenu + { + items = + { + MENU_ITEM + { + command = ECmdCreateCalendarEntryAppointments; + txt = "Appointments"; + }, + MENU_ITEM + { + command = ECmdCreateCalendarEntryEvents; + txt = "Events"; + }, + MENU_ITEM + { + command = ECmdCreateCalendarEntryAnniversaries; + txt = "Anniversaries"; + }, + MENU_ITEM + { + command = ECmdCreateCalendarEntryToDos; + txt = "Todos"; + }, + MENU_ITEM + { + command = ECmdCreateCalendarEntryReminders; + txt = "Reminders"; + } + }; + } + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_browserentries_submenu + { + items = + { + MENU_ITEM + { + command = ECmdCreateBrowserBookmarkEntries; + txt = "Bookmarks"; + }, + MENU_ITEM + { + command = ECmdCreateBrowserBookmarkFolderEntries; + txt = "Bookmark folders"; + }, + MENU_ITEM + { + command = ECmdCreateBrowserSavedPageEntries; + txt = "Saved pages"; + }, + MENU_ITEM + { + command = ECmdCreateBrowserSavedPageFolderEntries; + txt = "Saved page folders"; + } + }; + } + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_fileentries_submenu + { + items = + { + MENU_ITEM + { + command = ECmdCreateFileEntryEmptyFolder; + txt = "Empty folder"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryJPEG_25kB; + txt = "JPEG 25kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryJPEG_200kB; + txt = "JPEG 200kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryJPEG_500kB; + txt = "JPEG 500kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryPNG_15kB; + txt = "PNG 15kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryGIF_2kB; + txt = "GIF 2kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryBMP_25kB; + txt = "BMP 25kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryJP2_65kB; + txt = "JP2 65kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntrySVG_15kB; + txt = "SVG 15kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryTIF_25kB; + txt = "TIF 25kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryRNG_1kB; + txt = "RNG 1kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryMIDI_10kB; + txt = "MIDI 10kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryWAV_20kB; + txt = "WAVE 20kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryAMR_20kB; + txt = "AMR 20kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryXLS_15kB; + txt = "Excel 15kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryDOC_20kB; + txt = "Word 20kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryPPT_40kB; + txt = "PowerPoint 40kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryTXT_10kB; + txt = "Text 10kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryTXT_70kB; + txt = "Text 70kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryHTML_20kB; + txt = "HTML 20kB"; + }, + /*MENU_ITEM + { + command = ECmdCreateFileEntryDeck_1kB; + txt = "Savedeck 1kB"; + },*/ + MENU_ITEM + { + command = ECmdCreateFileEntryMXMF_40kB; + txt = "MXMF 40kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryRAM_1kB; + txt = "RAM 1kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryJAD_1kB; + txt = "JAD 1kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryJAR_10kB; + txt = "JAR 10kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryVCF_1kB; + txt = "VCF 1kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryVCS_1kB; + txt = "VCS 1kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntrySISX_10kB; + txt = "SISX 10kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntry3GPP_70kB; + txt = "3GPP 70kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryMP3_250kB; + txt = "MP3 250kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryAAC_100kB; + txt = "AAC 100kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntrySWF_15kB; + txt = "SWF 15kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryMP4_200kB; + txt = "MP4 200kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryRM_95kB; + txt = "RM 95kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryWMA_50kB; + txt = "WMA 50kB"; + }, + MENU_ITEM + { + command = ECmdCreateFileEntryWMV_200kB; + txt = "WMV 200kB"; + } + }; + } + + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_logentries_submenu + { + items = + { + MENU_ITEM + { + command = ECmdCreateLogEntryMissedCalls; + txt = "Missed calls"; + }, + MENU_ITEM + { + command = ECmdCreateLogEntryReceivedCalls; + txt = "Received calls"; + }, + MENU_ITEM + { + command = ECmdCreateLogEntryDialledNumbers; + txt = "Dialled numbers"; + } + }; + } + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_messagingentries_submenu + { + items = + { +/* + MENU_ITEM + { + command = ECmdCreateMessagingEntryCBSTopics; + txt = "CBS topics"; + }, + MENU_ITEM + { + command = ECmdCreateMessagingEntryDocumentsFolders; + txt = "Documents folders"; + }, + MENU_ITEM + { + command = ECmdCreateMessagingEntrySMSMessageCenters; + txt = "SMS Message Centers"; + }, +*/ + MENU_ITEM + { + command = ECmdCreateMessagingEntryMailboxes; + txt = "Mailboxes"; + }, + MENU_ITEM + { + command = ECmdCreateMessagingEntryMessages; + txt = "Messages"; + } +/* + , + MENU_ITEM + { + command = ECmdCreateMessagingEntryTemplates; + txt = "Templates"; + } +*/ + }; + } + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_miscentries_submenu + { + items = + { + #if defined (__SERIES60_30__) || defined(__SERIES60_31__) + MENU_ITEM + { + command = ECmdCreateMiscEntryAccessPoints; + txt = "Access Points"; + }, + + #else + MENU_ITEM + { + command = ECmdCreateMiscEntryAccessPoints; + txt = "Connection Methods"; + }, + + #endif + +/* + MENU_ITEM + { + command = ECmdCreateMiscEntryAppMenuFolders; + txt = "App menu folders"; + }, +*/ + #ifdef __PRESENCE + MENU_ITEM + { + command = ECmdCreateMiscEntryIMPSServers; + txt = "IMPS servers"; + }, + #endif + + MENU_ITEM + { + command = ECmdCreateMiscEntryNotes; + txt = "Notes"; + } + + +/* + , + MENU_ITEM + { + command = ECmdCreateMiscEntrySyncSettings; + txt = "Sync settings"; + } +*/ + , + MENU_ITEM + { + command = ECmdCreateMiscEntryLandmarks; + txt = "Landmarks"; + } + }; + } + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_phonebookentries_submenu + { + items = + { + MENU_ITEM + { + command = ECmdCreatePhoneBookEntryContacts; + txt = "Contacts"; + }, + MENU_ITEM + { + command = ECmdCreatePhoneBookEntryGroups; + txt = "Groups"; + } +/* + , + MENU_ITEM + { + command = ECmdCreatePhoneBookEntrySubscribedContacts; + txt = "Subscribed contacts"; + } +*/ + }; + } + +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_creator_deleteentries_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteAllEntries; + cascade = r_creator_deleteall_submenu; + txt = "All items"; + }, + MENU_ITEM + { + command = ECmdDeleteCalendarEntries; + cascade = r_creator_deletecalendar_submenu; + txt = "Calendar entries"; + }, + MENU_ITEM + { + command = ECmdDeleteBrowserBookmarks; + cascade = r_creator_deletebookmarks_submenu; + txt = "Br bookmarks"; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorBrowserBookmarkFolders; + cascade = r_creator_deletebookmarkfolders_submenu; + txt = "Br bookmark folders"; + }, + MENU_ITEM + { + command = ECmdDeleteBrowserSavedPages; + cascade = r_creator_deletesavedpages_submenu; + txt = "Br saved pages"; + }, + MENU_ITEM + { + command = ECmdDeleteBrowserSavedPageFolders; + cascade = r_creator_deletesavedpagefolders_submenu; + txt = "Br saved page folders"; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorFiles; + cascade = r_creator_deletefiles_submenu; + txt = "Files"; + }, + MENU_ITEM + { + command = ECmdDeleteLogs; + cascade = r_creator_deletelogs_submenu; + txt = "Logs"; + }, + MENU_ITEM + { + command = ECmdDeleteMessages; + cascade = r_creator_deletemessages_submenu; + txt = "Messages"; + }, + MENU_ITEM + { + command = ECmdDeleteIAPs; // ECmdDeleteMiscEntryAccessPoints + cascade = r_creator_deleteiaps_submenu; +#if defined (__SERIES60_30__) || defined(__SERIES60_31__) + txt = "Access Points"; +#else + txt = "Connection methods"; +#endif + }, + MENU_ITEM + { + command = ECmdDeleteIMPSs; + cascade = r_creator_deleteimps_submenu; + txt = "IMPS servers"; + }, + MENU_ITEM + { + command = ECmdDeleteNotes; + cascade = r_creator_deletenotes_submenu; + txt = "Notes"; + }, + MENU_ITEM + { + command = ECmdDeleteLandmarks; + cascade = r_creator_deletelandmarks_submenu; + txt = "Landmarks"; + }, + MENU_ITEM + { + command = ECmdDeleteContacts; + cascade = r_creator_deletecontacts_submenu; + txt = "Contacts"; + }, + MENU_ITEM + { + command = ECmdDeleteContactGroups; + cascade = r_creator_deletecontactgroups_submenu; + txt = "Contact groups"; + } + + /* + MENU_ITEM + { + command = ECmdDeleteMiscEntryAccessPoints; + txt = "All Connection Methods"; + } + */ + }; + } + +#define string_creator_deletemenu_all "All" +#define string_creator_deletemenu_by_creator "By Creator" + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deleteall_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteAllEntries; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteAllCreatorEntries; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletecalendar_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteCalendarEntries; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorCalendarEntries; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletebookmarks_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteBrowserBookmarks; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorBrowserBookmarks; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletebookmarkfolders_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteBrowserBookmarkFolders; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorBrowserBookmarkFolders; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletesavedpages_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteBrowserSavedPages; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorBrowserSavedPages; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletesavedpagefolders_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteBrowserSavedPageFolders; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorBrowserSavedPageFolders; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletefiles_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteCreatorFiles; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletelogs_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteLogs; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorLogs; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletemailboxes_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteMailboxes; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorMailboxes; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletemessages_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteMessages; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorMessages; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deleteiaps_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteIAPs; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorIAPs; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deleteimps_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteIMPSs; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorIMPSs; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletenotes_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteNotes; + txt = string_creator_deletemenu_all; + } + // By Creator not supported because + // note id is not available via Notepad API + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletelandmarks_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteLandmarks; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorLandmarks; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletecontacts_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteContacts; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorContacts; + txt = string_creator_deletemenu_by_creator; + } + }; + } + +// --------------------------------------------------------- +RESOURCE MENU_PANE r_creator_deletecontactgroups_submenu + { + items = + { + MENU_ITEM + { + command = ECmdDeleteContactGroups; + txt = string_creator_deletemenu_all; + }, + MENU_ITEM + { + command = ECmdDeleteCreatorContactGroups; + txt = string_creator_deletemenu_by_creator; + } + }; + } + + +// --------------------------------------------------------- +// +// r_creator_about_dialog +// About dialog - show version and copyright info etc. +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_creator_about_dialog +{ + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About Creator"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + message = "Version 5.3.5 - 30th October 2009. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; + }; + } + }; +} + + +// --------------------------------------------------------- +// +// r_entry_query +// Dialog to query the amount of entries to create +// +// --------------------------------------------------------- +// + + +RESOURCE DIALOG r_entry_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = ENumberLayout; + label = "Insert label to ExecuteLD"; + control = AVKON_INTEGER_EDWIN + { + min = 0; + max = 9999; + }; + }; + } + }; + } + + +// --------------------------------------------------------- +// +// r_start_date_query +// Dialog to query a start date +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_start_date_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = EDateLayout; + label = "Start date of creation period"; + control = DATE_EDITOR + { + minDate = DATE + { + year = 1900; + }; + maxDate = DATE + { + year = 3000; + }; + flags = 0; + }; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_end_date_query +// Dialog to query a start date +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_end_date_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = EDateLayout; + label = "End date of creation period"; + control = DATE_EDITOR + { + minDate = DATE + { + year = 1900; + }; + maxDate = DATE + { + year = 3000; + }; + flags = 0; + }; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_contact_creation_type_query +// Dialog to query a contact creation type +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_contact_creation_type_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_contact_creation_type_query_array; + }; + heading = "Fields in contact"; + }; + } + }; + } + +RESOURCE ARRAY r_contact_creation_type_query_array + { + items = + { + LBUF {txt = "Default fields"; }, + LBUF {txt = "Define..."; } + }; + } + + +// --------------------------------------------------------- +// +// r_message_type_query +// Dialog to query a message type +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_message_type_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_message_type_query_array; + }; + heading = "Message type"; + }; + } + }; + } + +RESOURCE ARRAY r_message_type_query_array + { + items = + { + LBUF {txt = "SMS"; }, + LBUF {txt = "MMS"; }, + LBUF {txt = "AMS"; }, + LBUF {txt = "Email"; }, + LBUF {txt = "Smart Message"; }, + LBUF {txt = "IR Message"; }, + LBUF {txt = "BT Message"; } + }; + } + +// --------------------------------------------------------- +// +// r_folder_type_query +// Dialog to query a message type +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_folder_type_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_folder_type_query_array; + }; + heading = "Folder type"; + }; + } + }; + } + +RESOURCE ARRAY r_folder_type_query_array + { + items = + { + LBUF {txt = "Inbox"; }, + LBUF {txt = "Drafts"; }, + LBUF {txt = "Outbox"; }, + LBUF {txt = "Sent"; } + }; + } + +// --------------------------------------------------------- +// +// r_folder_type_with_mailbox_query +// Dialog to query a message type +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_folder_type_with_mailbox_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_folder_type_with_mailbox_query_array; + }; + heading = "Folder type"; + }; + } + }; + } +RESOURCE ARRAY r_folder_type_with_mailbox_query_array + { + items = + { + LBUF {txt = "Inbox"; }, + LBUF {txt = "Drafts"; }, + LBUF {txt = "Outbox"; }, + LBUF {txt = "Sent"; }, + LBUF {txt = "Mailbox..."; } + }; + } + +// --------------------------------------------------------- +// +// r_app_selection_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_mailbox_selection_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + }; + heading = "Choose mailbox:"; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_unread_type_query +// Dialog to query whether to create the message unread or not +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_unread_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_unread_query_array; + }; + heading = "Message status"; + }; + } + }; + } + +RESOURCE ARRAY r_unread_query_array + { + items = + { + LBUF {txt = "Read"; }, + LBUF {txt = "New"; } + }; + } + +// --------------------------------------------------------- +// +// r_attachment_single_selection_query +// r_attachment_multi_selection_query +// Dialogs to query attachments +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_attachment_single_selection_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_attachment_query_array; + }; + heading = "Choose attachment:"; + }; + } + }; + } + +RESOURCE DIALOG r_ams_attachment_single_selection_query +{ +flags = EGeneralQueryFlags; +buttons = R_AVKON_SOFTKEYS_OK_CANCEL; +items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_ams_attachment_query_array; + }; + heading = "Choose attachment:"; + }; + } + }; +} + + +RESOURCE DIALOG r_attachment_multi_selection_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSingleGraphicPopupMenuListBox; + listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST + { + array_id = r_attachment_multiselection_query_array; + }; + heading = "Choose attachments:"; + }; + } + }; + } + + +RESOURCE ARRAY r_attachment_query_array + { + items = + { + LBUF {txt = "JPEG 25kB"; }, + LBUF {txt = "JPEG 300kB"; }, + LBUF {txt = "JPEG 500kB"; }, + LBUF {txt = "PNG 15kB"; }, + LBUF {txt = "GIF 2kB"; }, + LBUF {txt = "RNG 1kB"; }, + LBUF {txt = "MIDI 10kB"; }, + LBUF {txt = "WAVE 20kB"; }, + LBUF {txt = "AMR 20kB"; }, + LBUF {txt = "Excel 15kB"; }, + LBUF {txt = "Word 20kB"; }, + LBUF {txt = "PowerPoint 40kB"; }, + LBUF {txt = "Text 10kB"; }, + LBUF {txt = "Text 70kB"; }, + LBUF {txt = "3GPP 70kB"; }, + LBUF {txt = "MP3 250kB"; }, + LBUF {txt = "AAC 100kB"; }, + LBUF {txt = "RM 95kB"; } + }; + } + +RESOURCE ARRAY r_ams_attachment_query_array + { + items = + { + LBUF {txt = "AMR 20kB"; } + }; + } + +RESOURCE ARRAY r_attachment_multiselection_query_array + { + items = + { + LBUF {txt = "1\tNone"; }, + LBUF {txt = "1\tJPEG 25kB"; }, + LBUF {txt = "1\tJPEG 200kB"; }, + LBUF {txt = "1\tJPEG 500kB"; }, + LBUF {txt = "1\tPNG 15kB"; }, + LBUF {txt = "1\tGIF 2kB"; }, + LBUF {txt = "1\tRNG 1kB"; }, + LBUF {txt = "1\tMIDI 10kB"; }, + LBUF {txt = "1\tWAVE 20kB"; }, + LBUF {txt = "1\tAMR 20kB"; }, + LBUF {txt = "1\tExcel 15kB"; }, + LBUF {txt = "1\tWord 20kB"; }, + LBUF {txt = "1\tPowerPoint 40kB"; }, + LBUF {txt = "1\tText 10kB"; }, + LBUF {txt = "1\tText 70kB"; }, + LBUF {txt = "1\t3GPP 70kB"; }, + LBUF {txt = "1\tMP3 250kB"; }, + LBUF {txt = "1\tAAC 100kB"; }, + LBUF {txt = "1\tRM 95kB"; }, + LBUF {txt = "1\tBMP 25kB"; }, + LBUF {txt = "1\tHTML 20kB"; }, + LBUF {txt = "1\tJAD 1kB"; }, + LBUF {txt = "1\tJAR 10kB"; }, + LBUF {txt = "1\tJP2 65kB"; }, + LBUF {txt = "1\tMP4 200kB"; }, + LBUF {txt = "1\tMXMF 40kB"; }, + LBUF {txt = "1\tRAM 1kB"; }, + LBUF {txt = "1\tSVG 15kB"; }, + LBUF {txt = "1\tSWF 15kB"; }, + LBUF {txt = "1\tTIF 25kB"; }, + LBUF {txt = "1\tVCF 1kB"; }, + LBUF {txt = "1\tVCS 1kB"; }, + LBUF {txt = "1\tSISX 10kB"; } + }; + } + +// --------------------------------------------------------- +// +// r_group_creation_type_query +// Dialog to query a group creation type +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_group_creation_type_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_group_creation_type_query_array; + }; + heading = "Fields in contact"; + }; + } + }; + } + +RESOURCE ARRAY r_group_creation_type_query_array + { + items = + { + LBUF {txt = "Random"; }, + LBUF {txt = "Define..."; } + }; + } + +// --------------------------------------------------------- +// +// r_directory_query +// Dialog to query the directory from the user +// +// --------------------------------------------------------- +// + + +RESOURCE DIALOG r_directory_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = EDataLayout; + label = "Specify the directory"; + control = EDWIN + { + }; + }; + } + }; + } + + +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_progress_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = EProgressNote; + control= AVKON_NOTE + { + layout = EProgressLayout; + imagefile = AVKON_ICON_FILE; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + }; + } + }; + } + +// --------------------------------------------------------- + +RESOURCE ARRAY r_data_firstnames + { + items= + { + LBUF { txt="John"; }, + LBUF { txt="Francis"; }, + LBUF { txt="Andrew"; }, + LBUF { txt="Lawrence"; }, + LBUF { txt="Gregory"; }, + LBUF { txt="Fulke"; }, + LBUF { txt="Thomas"; }, + LBUF { txt="Nicholas"; }, + LBUF { txt="Hakle"; }, + LBUF { txt="Roger"; }, + LBUF { txt="Nathaniel"; }, + LBUF { txt="Luke"; }, + LBUF { txt="William"; }, + LBUF { txt="Ralph"; }, + LBUF { txt="Leonar"; }, + LBUF { txt="Daniel"; }, + LBUF { txt="Aban"; }, + LBUF { txt="Mathias"; }, + LBUF { txt="Robert"; }, + LBUF { txt="Christopher"; }, + LBUF { txt="Martin"; }, + LBUF { txt="Michael"; }, + LBUF { txt="Barnaby"; }, + LBUF { txt="Tobias"; }, + LBUF { txt="Richard"; }, + LBUF { txt="Anthony"; }, + LBUF { txt="Simon"; }, + LBUF { txt="Samuel"; }, + LBUF { txt="Geoffrey"; }, + LBUF { txt="Isaac"; }, + LBUF { txt="Henry"; }, + LBUF { txt="Matthew"; }, + LBUF { txt="Peter"; }, + LBUF { txt="Allen"; }, + LBUF { txt="Reynold"; }, + LBUF { txt="Jerome"; }, + LBUF { txt="Elizabeth"; }, + LBUF { txt="Catherine"; }, + LBUF { txt="Frances"; }, + LBUF { txt="Cecily"; }, + LBUF { txt="Millicent"; }, + LBUF { txt="Audrey"; }, + LBUF { txt="Joan"; }, + LBUF { txt="Elinor"; }, + LBUF { txt="Joyce"; }, + LBUF { txt="Frideswide"; }, + LBUF { txt="Rose"; }, + LBUF { txt="Helen"; }, + LBUF { txt="Margaret"; }, + LBUF { txt="Isabel"; }, + LBUF { txt="Bridget"; }, + LBUF { txt="Grace"; }, + LBUF { txt="Thomasin"; }, + LBUF { txt="Janet"; }, + LBUF { txt="Agnes"; }, + LBUF { txt="Dorothy"; }, + LBUF { txt="Christian"; }, + LBUF { txt="Amy"; }, + LBUF { txt="Fortune"; }, + LBUF { txt="Sybil"; }, + LBUF { txt="Alice"; }, + LBUF { txt="Margery"; }, + LBUF { txt="Edith"; }, + LBUF { txt="Barbara"; }, + LBUF { txt="Gillian"; }, + LBUF { txt="Ursula"; } + }; + } + +RESOURCE ARRAY r_data_surnames + { + items= + { + LBUF { txt="Lux"; }, + LBUF { txt="Mandot"; }, + LBUF { txt="Mansfield"; }, + LBUF { txt="Mayberry"; }, + LBUF { txt="McCarrel"; }, + LBUF { txt="McDaniel"; }, + LBUF { txt="Mefford"; }, + LBUF { txt="Metcalf"; }, + LBUF { txt="Metchell"; }, + LBUF { txt="Moller"; }, + LBUF { txt="Margan"; }, + LBUF { txt="Keaney"; }, + LBUF { txt="Kenyon"; }, + LBUF { txt="Kesler"; }, + LBUF { txt="Kinman"; }, + LBUF { txt="Kreinert"; }, + LBUF { txt="Kummerlin"; }, + LBUF { txt="Lamgley"; }, + LBUF { txt="Leas"; }, + LBUF { txt="Leighton"; }, + LBUF { txt="Lillie"; }, + LBUF { txt="Hilms"; }, + LBUF { txt="Holt"; }, + LBUF { txt="Hosier"; }, + LBUF { txt="Howard"; }, + LBUF { txt="Hypes"; }, + LBUF { txt="Jacmor"; }, + LBUF { txt="Behnson"; }, + LBUF { txt="Kammer"; }, + LBUF { txt="Patts"; }, + LBUF { txt="West"; }, + LBUF { txt="Wilbar"; }, + LBUF { txt="Witsan"; }, + LBUF { txt="Gillams"; }, + LBUF { txt="Good"; }, + LBUF { txt="Wreght"; }, + LBUF { txt="Worthley"; }, + LBUF { txt="Adams"; }, + LBUF { txt="Allen"; }, + LBUF { txt="Ansley"; }, + LBUF { txt="Ayries"; }, + LBUF { txt="Bartlett"; }, + LBUF { txt="Barton"; }, + LBUF { txt="Payne"; }, + LBUF { txt="Pintard"; }, + LBUF { txt="Prence"; }, + LBUF { txt="Richards"; }, + LBUF { txt="Dillman"; }, + LBUF { txt="Dory"; }, + LBUF { txt="Edgards"; }, + LBUF { txt="Engell"; }, + LBUF { txt="Farprington"; }, + LBUF { txt="Fisher"; }, + LBUF { txt="Foed"; }, + LBUF { txt="Burges"; }, + LBUF { txt="Childwall"; }, + LBUF { txt="Smith"; }, + LBUF { txt="Sipon"; }, + LBUF { txt="Simmons"; }, + LBUF { txt="Stewert"; }, + LBUF { txt="Stiles"; }, + LBUF { txt="Stratton"; }, + LBUF { txt="Dennis"; }, + LBUF { txt="Talmot"; } + }; + } + +RESOURCE ARRAY r_data_companies + { + items= + { + LBUF { txt="CDP"; }, + LBUF { txt="Exbox"; }, + LBUF { txt="Munro"; }, + LBUF { txt="Majaka"; }, + LBUF { txt="Bitzumi"; }, + LBUF { txt="Melroy"; }, + LBUF { txt="Matal"; }, + LBUF { txt="Japponi"; }, + LBUF { txt="Siwaka"; }, + LBUF { txt="Keiku"; }, + LBUF { txt="Naamate"; }, + LBUF { txt="Remonti"; }, + LBUF { txt="Melleva"; }, + LBUF { txt="WEX"; }, + LBUF { txt="Chataz"; }, + LBUF { txt="Ponly"; }, + LBUF { txt="Alriva"; }, + LBUF { txt="Giate"; }, + LBUF { txt="Kesso"; }, + LBUF { txt="Nyssa"; }, + LBUF { txt="Peger"; }, + LBUF { txt="Metrio"; }, + LBUF { txt="Mitchitatchi"; }, + LBUF { txt="Neppari"; }, + LBUF { txt="Amcuila"; }, + LBUF { txt="Muipitsu"; }, + LBUF { txt="Redex"; }, + LBUF { txt="Maariz"; }, + LBUF { txt="Swerck"; }, + LBUF { txt="Makiac"; }, + LBUF { txt="Dumpia"; }, + LBUF { txt="Worldmom"; }, + LBUF { txt="Renfaul"; }, + LBUF { txt="Kmartissori"; }, + LBUF { txt="Findo"; }, + LBUF { txt="Samsanc"; }, + LBUF { txt="Dellervo"; }, + LBUF { txt="Manrel"; }, + LBUF { txt="WSMRL"; }, + LBUF { txt="Eripox"; }, + LBUF { txt="Abiturien"; }, + LBUF { txt="Vesus"; }, + LBUF { txt="MI4"; }, + LBUF { txt="Overhiba"; }, + LBUF { txt="Tridune"; }, + LBUF { txt="Kyomcera"; }, + LBUF { txt="Praston"; }, + LBUF { txt="Gapmis"; }, + LBUF { txt="WPPDCD"; } + }; + } + +RESOURCE ARRAY r_data_addresses + { + items= + { + LBUF { txt="Barnes Street"; }, + LBUF { txt="Barnes Place"; }, + LBUF { txt="Eastman Street"; }, + LBUF { txt="West Park"; }, + LBUF { txt="South Park"; }, + LBUF { txt="Park Avenue"; }, + LBUF { txt="Richards Court"; }, + LBUF { txt="Pukershire Avenue"; }, + LBUF { txt="Ellis Avenue"; }, + LBUF { txt="East Mountain"; }, + LBUF { txt="Chestnut Hill"; }, + LBUF { txt="Plains Road"; }, + LBUF { txt="Fremont Street"; }, + LBUF { txt="Heritage Court"; }, + LBUF { txt="Highland Avenue Extension"; }, + LBUF { txt="Maple Heights"; }, + LBUF { txt="McKenzie Avenue"; }, + LBUF { txt="McKenzie Lane"; }, + LBUF { txt="West Terrace Street"; }, + LBUF { txt="Windsor Avenue"; }, + LBUF { txt="Windsor Road"; }, + LBUF { txt="Mechanic Street Extension"; }, + LBUF { txt="Granite Place"; }, + LBUF { txt="Meadow Street"; }, + LBUF { txt="Sugar River"; } + }; + } + +RESOURCE ARRAY r_data_cities + { + items= + { + LBUF { txt="Kuopio"; }, + LBUF { txt="Los Angeles"; }, + LBUF { txt="Lappeenranta"; }, + LBUF { txt="London"; }, + LBUF { txt="Bangkok"; }, + LBUF { txt="St. Michel"; }, + LBUF { txt="St. Petersburg"; }, + LBUF { txt="Tokyo"; }, + LBUF { txt="Helsinki"; }, + LBUF { txt="Trondheim"; }, + LBUF { txt="Nairobi"; }, + LBUF { txt="Havana"; } + }; + } + +RESOURCE ARRAY r_data_countries + { + items= + { + LBUF { txt="Finland"; }, + LBUF { txt="Cuba"; }, + LBUF { txt="United States of America"; }, + LBUF { txt="Thailand"; }, + LBUF { txt="Sweden"; }, + LBUF { txt="Russia"; }, + LBUF { txt="Japan"; }, + LBUF { txt="Norway"; }, + LBUF { txt="Kenya"; } + }; + } + +RESOURCE ARRAY r_data_postcodes + { + items= + { + LBUF { txt="00310"; }, + LBUF { txt="FI-70100"; }, + LBUF { txt="99002"; }, + LBUF { txt="11233"; } + }; + } + +RESOURCE ARRAY r_data_states + { + items= + { + LBUF { txt="California state"; }, + LBUF { txt="Alaska state"; }, + LBUF { txt="Florida state"; } + }; + } + +RESOURCE ARRAY r_data_poboxes + { + items= + { + LBUF { txt="P.O BOX 5532"; }, + LBUF { txt="P.O BOX 701"; }, + LBUF { txt="99"; }, + LBUF { txt="1133"; }, + LBUF { txt="P.O. BOX 113322"; }, + LBUF { txt="112"; } + }; + } + +RESOURCE ARRAY r_data_prefixes + { + items= + { + LBUF { txt="Ms."; }, + LBUF { txt="Mrs."; }, + LBUF { txt="Mr."; }, + LBUF { txt="Dr."; } + + }; + } + +RESOURCE ARRAY r_data_suffixes + { + items= + { + LBUF { txt="Jr."; }, + LBUF { txt="Sr."; } + }; + } + +RESOURCE ARRAY r_data_jobtitles + { + items= + { + LBUF { txt="Doctor"; }, + LBUF { txt="SW Engineer"; }, + LBUF { txt="Administrative Assistant"; }, + LBUF { txt="Bookkeeper"; }, + LBUF { txt="Credit Controller"; }, + LBUF { txt="Data Entry Operator"; }, + LBUF { txt="Payroll Officer"; }, + LBUF { txt="Receptionist"; }, + LBUF { txt="Trainee"; }, + LBUF { txt="Accounts Clerk"; }, + LBUF { txt="Administrator"; }, + LBUF { txt="Taxation Assistant"; }, + LBUF { txt="Financial Director"; }, + LBUF { txt="Bank Manager"; }, + LBUF { txt="Mobile Lending"; }, + LBUF { txt="Overseas Transactions"; }, + LBUF { txt="Restructuring"; }, + LBUF { txt="Business Analyst"; }, + LBUF { txt="Call Centre Manager"; }, + LBUF { txt="Administration"; }, + LBUF { txt="Manager"; }, + LBUF { txt="Student"; }, + LBUF { txt="Mail Sorter"; }, + LBUF { txt="Mayor"; }, + LBUF { txt="Account Servicing"; }, + LBUF { txt="Management"; }, + LBUF { txt="Media Consultant"; }, + LBUF { txt="Newsagent"; }, + LBUF { txt="Librarian"; }, + LBUF { txt="Creative Director"; }, + LBUF { txt="Announcer"; }, + LBUF { txt="Copywriter"; }, + LBUF { txt="Presenter"; }, + LBUF { txt="Promotions Manager"; }, + LBUF { txt="Advertising Sales Representative"; }, + LBUF { txt="Editor"; }, + LBUF { txt="Marketing, Sales & Publicity"; }, + LBUF { txt="Publisher"; }, + LBUF { txt="Gallery Assistant"; }, + LBUF { txt="Photographer"; }, + LBUF { txt="Storyboard Artist"; }, + LBUF { txt="Events Manager"; }, + LBUF { txt="Cameraman"; }, + LBUF { txt="Technician"; }, + LBUF { txt="Producer"; } + }; + } + +RESOURCE ARRAY r_data_phonenumbers + { + items= + { + LBUF { txt="0307834387"; }, + LBUF { txt="0230328732"; }, + LBUF { txt="0430365562"; }, + LBUF { txt="0530328732"; }, + LBUF { txt="0433032865"; }, + LBUF { txt="0542306532"; }, + LBUF { txt="0342303777"; }, + LBUF { txt="0250235603"; }, + LBUF { txt="0492303652"; }, + LBUF { txt="0542303286"; }, + LBUF { txt="0543656546"; }, + LBUF { txt="0545545454"; }, + LBUF { txt="0543444454"; }, + LBUF { txt="0776463255"; }, + LBUF { txt="0432443343"; }, + LBUF { txt="0243334344"; }, + LBUF { txt="0544543443"; }, + LBUF { txt="0231343243"; }, + LBUF { txt="0213443434"; }, + LBUF { txt="0143234476"; }, + LBUF { txt="0785434444"; }, + LBUF { txt="0454445345"; }, + LBUF { txt="0342443433"; }, + LBUF { txt="0432434454"; }, + LBUF { txt="0455454454"; }, + LBUF { txt="0656565655"; }, + LBUF { txt="0343434443"; }, + LBUF { txt="0565645455"; }, + LBUF { txt="0343243243"; }, + LBUF { txt="0565466565"; }, + LBUF { txt="0465565655"; }, + LBUF { txt="0435445454"; }, + LBUF { txt="+35854553456"; }, + LBUF { txt="+35878453486"; }, + LBUF { txt="+35876653456"; }, + LBUF { txt="+35834435486"; }, + LBUF { txt="+35876766466"; }, + LBUF { txt="+4465665456"; }, + LBUF { txt="+4432434334"; }, + LBUF { txt="+4488776776"; }, + LBUF { txt="+4465655656"; }, + LBUF { txt="+4443433434"; }, + LBUF { txt="+4465656565"; }, + LBUF { txt="+4454454354"; } + }; + } + +RESOURCE ARRAY r_data_groupnames + { + items= + { + LBUF { txt="Nice guys"; }, + LBUF { txt="Repairs"; }, + LBUF { txt="Office works"; }, + LBUF { txt="The buddies"; }, + LBUF { txt="Football team"; }, + LBUF { txt="Gold club"; }, + LBUF { txt="Silver club"; }, + LBUF { txt="Bronze club"; }, + LBUF { txt="Best buddies"; }, + LBUF { txt="Rockers"; }, + LBUF { txt="Science group"; } + }; + } + +RESOURCE ARRAY r_data_meetingreasons + { + items= + { + LBUF { txt="Security issues"; }, + LBUF { txt="Team meeting"; }, + LBUF { txt="Discussion about"; }, + LBUF { txt="Work plans"; }, + LBUF { txt="Meeting with the professor"; }, + LBUF { txt="Meeting with the boss"; }, + LBUF { txt="Work issues"; }, + LBUF { txt="New workers"; } + }; + } + +RESOURCE ARRAY r_data_meetingplaces + { + items= + { + LBUF { txt="Room"; }, + LBUF { txt="Home"; }, + LBUF { txt="Auditorium"; }, + LBUF { txt="Company"; } + }; + } + +RESOURCE ARRAY r_data_landmark_names + { + items= + { + LBUF { txt="Good place to fish";}, + LBUF { txt="Uncle over board";}, + LBUF { txt="Best food ever!";}, + LBUF { txt="Nice beach";}, + LBUF { txt="Good hamburgers";}, + LBUF { txt="Nice view";}, + LBUF { txt="John's home";}, + LBUF { txt="Carage";}, + LBUF { txt="Gas station";}, + LBUF { txt="Food store";}, + LBUF { txt="Car wash";}, + LBUF { txt="Summer cottage";}, + LBUF { txt="My home";}, + LBUF { txt="Bank";}, + LBUF { txt="Hospital";}, + LBUF { txt="Ice hall";}, + LBUF { txt="Work place";} + }; + } + +RESOURCE ARRAY r_data_landmark_descriptions + { + items= + { + LBUF { txt="The salmons were really big here!";}, + LBUF { txt="Delicious strawberries sold here. Must visit again sometime!";}, + LBUF { txt="Place looks really nice.";}, + LBUF { txt="This is my favorite place";}, + LBUF { txt="Words are not enough to describe this landmark";}, + LBUF { txt="What a shocking place to visit! Remember to bring camera next time :-)";} + }; + } + +RESOURCE ARRAY r_data_memos + { + items= + { + LBUF { txt="No work today!"; }, + LBUF { txt="Movies tonight"; }, + LBUF { txt="Ship new binaries"; }, + LBUF { txt="New works"; }, + LBUF { txt="Exam"; }, + LBUF { txt="Community service"; }, + LBUF { txt="Volunteer work"; }, + LBUF { txt="Don't forget the dinner at the restaurant"; }, + LBUF { txt="Go the bank"; }, + LBUF { txt="Go to the store"; }, + LBUF { txt="Buy goods"; }, + LBUF { txt="Buy food"; }, + LBUF { txt="Buy new pair of socks"; }, + LBUF { txt="Buy vegetables"; }, + LBUF { txt="Buy fruits"; }, + LBUF { txt="Umbrella"; }, + LBUF { txt="New shoes"; }, + LBUF { txt="New suit"; }, + LBUF { txt="Buy flowers"; }, + LBUF { txt="School day"; } + }; + } +RESOURCE ARRAY r_data_anniversaries + { + items= + { + LBUF { txt="birthday"; }, + LBUF { txt="anniversary"; } + }; + } + +RESOURCE ARRAY r_data_todos + { + items= + { + LBUF { txt="Watch for gum on my shoe"; }, + LBUF { txt="Watch my step in the hall"; }, + LBUF { txt="Always think big"; }, + LBUF { txt="Don't ever think small"; }, + LBUF { txt="Keep pedaling my bike"; }, + LBUF { txt="Watch for bees in my pop"; }, + LBUF { txt="Keep moving forward"; }, + LBUF { txt="Don't ever stop"; }, + LBUF { txt="Keep my sled underneath me"; }, + LBUF { txt="Keep my stick on the ice"; }, + LBUF { txt="Don't swim in a whirlpool"; }, + LBUF { txt="Don't look for a fight"; }, + LBUF { txt="Don't spit in the wind"; }, + LBUF { txt="Just do what is right"; }, + LBUF { txt="Go out in the world"; }, + LBUF { txt="Enjoy a warm rain"; }, + LBUF { txt="Don't worship TV"; }, + LBUF { txt="Keep my oars in the water"; }, + LBUF { txt="Point my boat right downstream"; }, + LBUF { txt="Face head on my problems"; }, + LBUF { txt="Change underwear daily"; }, + LBUF { txt="Believe myself first"; }, + LBUF { txt="Go out and have fun"; }, + LBUF { txt="Turn the cards one by one"; }, + LBUF { txt="Get out and do something"; } + }; + } + +RESOURCE ARRAY r_data_reminders + { + items= + { + LBUF { txt="Remeber to fix car"; }, + LBUF { txt="Remeber to eat vegetables"; }, + LBUF { txt="Remeber to go shopping"; }, + LBUF { txt="Remeber to buy boxes for moving"; }, + LBUF { txt="Remeber to fix bike"; }, + LBUF { txt="Remeber to buy christmast presents"; }, + LBUF { txt="Remeber to send flowers to grandmother"; }, + LBUF { txt="Remeber to talk with son"; }, + LBUF { txt="Remeber to cut hedge"; }, + LBUF { txt="Remeber to bumper potatoes"; }, + LBUF { txt="Remeber to harvest corn field"; }, + LBUF { txt="Remeber to sleep enaugh"; }, + LBUF { txt="Remeber to wash teeths ewery morning"; }, + LBUF { txt="Remeber to get sleep early"; }, + LBUF { txt="Remeber to give some wather to flowers"; }, + LBUF { txt="Remeber to wax snowboard"; }, + LBUF { txt="Remeber to wax skiis"; }, + LBUF { txt="Remeber to wax cross country skiis"; }, + LBUF { txt="Remeber to call mother"; }, + LBUF { txt="Remeber to call father"; }, + LBUF { txt="Remeber to call brother"; }, + LBUF { txt="Remeber to call sister"; }, + LBUF { txt="Remeber to call daughter"; }, + LBUF { txt="Remeber to call son"; }, + LBUF { txt="Remeber to rent villa"; } + }; + } + +RESOURCE ARRAY r_data_messagesubjects + { + items= + { + LBUF { txt="Whaaasssaaap!!??"; }, + LBUF { txt="Hello"; }, + LBUF { txt="How are you doing?"; }, + LBUF { txt="You will win the battle, GUARANTEED!"; }, + LBUF { txt="Why pay more for something if you don't have to?"; }, + LBUF { txt="You can afford health care now"; }, + LBUF { txt="Re: *Buddy* *Lists*!!~ (it's soooo cool)!!~"; }, + LBUF { txt="Weedmon say: call, we be open 7 days, mon"; }, + LBUF { txt="Want her to look better?"; }, + LBUF { txt="Good Morning andyw, how are you?"; }, + LBUF { txt="Happy Assumption"; }, + LBUF { txt="There is NO Risk involved"; }, + LBUF { txt="Free Bottle Offer!"; }, + LBUF { txt="Introduction on MDSL"; }, + LBUF { txt="Theres Help out there for you"; }, + LBUF { txt="hello there - check this out"; }, + LBUF { txt="Darling"; }, + LBUF { txt="It doesn't have to be that way"; }, + LBUF { txt="Webmaster, Free health insurance quotes!"; }, + LBUF { txt="Join us at the OSGi 2003 World Congress"; }, + LBUF { txt="Put your subject line here"; }, + LBUF { txt="You are not protected"; }, + LBUF { txt="Please try again"; }, + LBUF { txt="you didn't reply my email ? why ? ???"; }, + LBUF { txt="A very funny game"; }, + LBUF { txt="Meeting notice"; }, + LBUF { txt="Opportunities"; } + }; + } + +RESOURCE ARRAY r_data_messagetexts + { + items= + { + LBUF { txt="The contents of these pages are copyrighted. Any rights not expressly granted herein are reserved. The use of this site is permitted to private use."; }, + LBUF { txt="Reproduction, transfer, distribution or storage of part or all of the contents in any form without the prior written permission is prohibited."; }, + LBUF { txt="We consents to you browsing the pages on your computer or printing copies of extracts from these pages for your personal use only."; }, + LBUF { txt="If you place an order for a product, request a service or submit content to this site, we may need to contact you for additional information."; }, + LBUF { txt="The use of press releases and other documents classified as public is permitted in public communications if the source for the information has been stated."; }, + LBUF { txt="For your easy accessibility we may include links to sites on the Internet that are owned or operated by third parties."; }, + LBUF { txt="You also agree that we have no control over the content of that site and cannot assume any responsibility for material by such third-party sites."; }, + LBUF { txt="In addition, a link to a such site does not imply that we endorses the site or the products or services referenced in such third party site."; }, + LBUF { txt="In order to respond to your questions or manage interactive customer programs, it may be necessary to ask for personal information."; }, + LBUF { txt="We may use this information to respond to your requests, or to contact you via mail, e-mail or phone to inform you of new products."; }, + LBUF { txt="If you place an order for a product, request a service or submit content to this site, we may need to contact you for additional information."; } + }; + } + + +// --------------------------------------------------------- +// +// New framework: +// Secure platform and scalable UI changes +// +// --------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_creator_localisable_app_info + { + short_caption = "Creator"; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = "Creator"; + + number_of_icons = 1; + + // Note for ROM-based apps it is recommended to add the drive letter + // icon_file = "z:"APP_BITMAP_DIR"\\myapp_aif.mif"; + icon_file = APP_BITMAP_DIR"\\creator_aif.mif"; + }; + } + +RESOURCE DIALOG r_yes_no_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE DIALOG r_encryption_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtListQueryControl; + id = EListQueryControl; + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = LISTBOX + { + flags = EAknListBoxSelectionList; + height = 3; + width = 3; + }; + heading = "Encryption"; + }; + } + }; + } diff -r 000000000000 -r d6fe6244b863 creator/data/creator_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/data/creator_reg.rss Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,35 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +#include + + +UID2 KUidAppRegistrationResourceFile +UID3 0x20011383 + + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "Creator"; + localisable_resource_file = APP_RESOURCE_DIR"\\Creator"; + localisable_resource_id = R_CREATOR_LOCALISABLE_APP_INFO; + group_name = "RnD Tools"; + } diff -r 000000000000 -r d6fe6244b863 creator/files/3GPP-70kB.dat Binary file creator/files/3GPP-70kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/AAC-100kB.dat Binary file creator/files/AAC-100kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/AMR-20kB.dat Binary file creator/files/AMR-20kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/BMP-25kB.dat Binary file creator/files/BMP-25kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/DOC-20kB.dat Binary file creator/files/DOC-20kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/Deck-1kB.dat Binary file creator/files/Deck-1kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/GIF-2kB.dat Binary file creator/files/GIF-2kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/HTML-20kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/HTML-20kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,378 @@ + +
+My HTML page +
+ +

My HTML page

+ +
  • item 1
  • +
  • item 2
  • +
  • item 3
  • +
  • item 4
  • + +

    + COPYRIGHT LICENSE +

    + + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS + +

    + +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + +

    + COPYRIGHT LICENSE +

    + NOKIA CORPORATION END-USER SOFTWARE AGREEMENT FOR + CARBIDE.C++ AND ASSOCIATED ON-DEVICE APPLICATIONS +

    +This Software Agreement ("Agreement") is between You (either an +individual or an entity), the End User, and Nokia Corporation +("Nokia"). The Agreement authorizes You to use the Software specified +in Clause 1 below, which may be stored on a CD-ROM, sent to You by +electronic mail, or downloaded from Nokia's Web pages or Servers or +from other sources under the terms and conditions set forth below. +This is an agreement on end-user rights and not an agreement for sale. +Nokia continues to own the copy of the Software and the physical media +contained in the sales package and any other copy that You are +authorized to make pursuant to this Agreement. + +Read this Agreement carefully before installing, downloading, or using +the Software. By clicking on the "I Accept" button while installing, +downloading, and/or using the Software, You agree to the terms and +conditions of this Agreement. If You do not agree to all of the terms +and conditions of this Agreement, promptly click the "Decline" or +"I Do Not Accept" button, cancel the installation or downloading, or +destroy or return the Software and accompanying documentation to +Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU +HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS +TERMS AND CONDITIONS. + +

    + + + + \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/files/JAD-1kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/JAD-1kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,7 @@ +MIDlet-1: HelloWorld, , helloworld.HelloWorld +MIDlet-Icon: \HelloWorld.png +MIDlet-Jar-Size: 6817 +MIDlet-Jar-URL: HelloWorld.jar +MIDlet-Name: HelloWorld +MIDlet-Vendor: My Vendor +MIDlet-Version: 1.0 diff -r 000000000000 -r d6fe6244b863 creator/files/JAR-10kB.dat Binary file creator/files/JAR-10kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/JP2-65kB.dat Binary file creator/files/JP2-65kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/JPEG-200kB.dat Binary file creator/files/JPEG-200kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/JPEG-25kB.dat Binary file creator/files/JPEG-25kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/JPEG-500kB.dat Binary file creator/files/JPEG-500kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/MIDI-10kB.dat Binary file creator/files/MIDI-10kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/MP3-250kB.dat Binary file creator/files/MP3-250kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/MP4-200kB.dat Binary file creator/files/MP4-200kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/MXMF-40kB.dat Binary file creator/files/MXMF-40kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/PNG-15kB.dat Binary file creator/files/PNG-15kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/PPT-40kB.dat Binary file creator/files/PPT-40kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/RAM-1kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/RAM-1kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1 @@ +rtsp://nokia.com \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/files/RM-95kB.dat Binary file creator/files/RM-95kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/RNG-1kB.dat Binary file creator/files/RNG-1kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/SISX-10kB.dat Binary file creator/files/SISX-10kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/SVG-15kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/SVG-15kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/files/SWF-15kB.dat Binary file creator/files/SWF-15kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/TIF-25kB.dat Binary file creator/files/TIF-25kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/TXT-10kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/TXT-10kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,19 @@ +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/files/TXT-70kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/TXT-70kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,147 @@ +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing.Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... TestiTesting... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing..ing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Te. Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... + + +Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... ng... .. \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/files/VCF-1kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/VCF-1kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,17 @@ +BEGIN:VCARD +VERSION:2.1 +N:Smith;John +FN:John Smith +ORG:Firm +TITLE:Boss +NOTE;ENCODING=QUOTED-PRINTABLE:Liirum larum.=0D=0A +TEL;WORK;VOICE:132456798 +TEL;HOME;VOICE:654654987 +TEL;CELL;VOICE:0400654987654 +TEL;WORK;FAX:2321654987987 +ADR;WORK:;;Firmstreet 1;New City;Sawo;00000;Finland +LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Firmstreet 1=0D=0ANew City, Sawo 00000=0D=0AFinland +URL;WORK:http://www.nokia.com +EMAIL;PREF;INTERNET:John.Smith@firm.com +REV:20080306T115812Z +END:VCARD diff -r 000000000000 -r d6fe6244b863 creator/files/VCS-1kB.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/files/VCS-1kB.dat Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,15 @@ +BEGIN:VCALENDAR +PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN +VERSION:1.0 +BEGIN:VEVENT +DTSTART:20080306T060000Z +DTEND:20080306T070000Z +LOCATION;ENCODING=QUOTED-PRINTABLE:Meeting room +UID:040000008200E00074C5B7101A82E00800000000000CEF7E917FC8010000000000000000100 + 000008AA6A7A7250C0A4E97153769E69DD064 +DESCRIPTION;ENCODING=QUOTED-PRINTABLE:Remember to bring laptop and document= +ation=0D=0A +SUMMARY;ENCODING=QUOTED-PRINTABLE:Meeting with BOSS +PRIORITY:3 +END:VEVENT +END:VCALENDAR diff -r 000000000000 -r d6fe6244b863 creator/files/WAV-20kB.dat Binary file creator/files/WAV-20kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/WMA-50kB.dat Binary file creator/files/WMA-50kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/WMV-200kB.dat Binary file creator/files/WMV-200kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/files/XLS-15kB.dat Binary file creator/files/XLS-15kB.dat has changed diff -r 000000000000 -r d6fe6244b863 creator/group/ReleaseNotes_Creator.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/group/ReleaseNotes_Creator.txt Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,206 @@ +=============================================================================== + +RELEASE NOTES - CREATOR v5.3.5 +RELEASED 30th October 2009 + +SUPPORTS S60 3.0+ + +=============================================================================== + +Product Description: +==================== +The Creator tool can be used to create different kinds of data into a device. +It's useful for testing that the device works correctly when there are +large amounts of data saved. + +Main Features: +============== +- Creating appointment, event, anniversary, todo, and reminder entries +- Creating bookmark, bookmark folder, saved page, and saved page folder + entries +- Creating different kinds of predefined file formats with or without DRM +- Creating missed call, received call, and dialed number entries +- Creating SMS, MMS, AMS, Email, Smart, Infrared and Bluetooth messages +- Creating mailbox entries +- Creating connection method, IMPS server, landmark and note entries +- Creating contact and contact group entries +- Entries can be created on the UI or by using scripts +- Entries can be deleted with the UI + +=============================================================================== + +What's New in v5.3.5 +==================== +- Fix: Creator crashes when creating 2000 contact entries. +- Fix: Creator cannot create 1000 SMS messages + +=============================================================================== + +Installation Notes: +=================== +Creator is typically preinstalled on ROM. If not, it can be added to the +ROM with the .iby file. Alternatively, a .sis file can be found under the sis- +directory, but the user needs to sign it with their own developer certificate. +In Nokia R&D environment, you can use directly the R&D-signed .sis file under +the internal\sis directory. + +When signing with own developer certificate, the following capabilities are +needed: + ReadDeviceData + WriteDeviceData + AllFiles + SwEvent + NetworkServices + LocalServices + ReadUserData + WriteUserData + Location + UserEnvironment + +=============================================================================== + +System Requirements: +==================== +Basic Requirements: +- Any S60 3.x device, 5.x device or emulator environment + +=============================================================================== + +Compatibility Issues: +===================== +Since version 5.0.0, the old .creator script files are no longer supported, +therefore you should use the new .creatorxml format instead. However, the script +support is not available for S60 3.0 and 3.1 releases. + +When Creator has been compiled against 3.0 or 3.1, it will use the old +phonebook and accesspoint APIs. With 3.2 and newer, new virtual phonebook and +connection method APIs are used. + +=============================================================================== + +Known Issues: +============= +- Generated browser saved pages cannot be opened in the browser. Currently no + workaround available. +- Logs: element is not saved into database. Event time is always + creation time of the event. S60 feature. +- Deleting Notes created only with Creator is not supported +- Deleting mailboxes is not supported +- Deleting entries without using Creator may cause Creator to delete incorrect + entries when using Delete -> ... -> By Creator -command + +=============================================================================== + +Version History: +================ + +Version 5.3.4 - 12th October 2009 +--------------------------------- +- Fix: Cannot create SMS messages in inbox with Creator +- Fix: Softkeys are not visible immediately when progress bar is shown + +Version 5.3.3 - 26th August 2009 +-------------------------------- +- Fix: Creator crashes when using scripts to create calendar appointments, + which have existing contacts as attendees. +- Fix: Destinations cannot be opened after deleting connection methods with + Creator. + +Version 5.3.2 - 17th April 2009 +------------------------------- +- Fix: Creator crashes after phonebook operation + +Version 5.3.1 - 20th February 2009 +---------------------------------- +- Fix: Unable to create a phonebook group with more than 15 members + +Version 5.3.0 - 13th February 2009 +---------------------------------- +- Change: XML Schema is now available for validating Creator scripts +- Change: Creator now deletes files created by Creator when selecting + Options -> Delete -> All +- Fix: Creator crashes when creating RNG file +- Fix: Creator crashes when creating large amount of files +- Fix: Actual MIDI and 3GPP filenames are different from names described in + Creator UI +- Fix: Text type attachment are not displayed correctly with generated messages + +Version 5.2.2 - 12th December 2008 +---------------------------------- +- Change: Generated file data changed + +Version 5.2.1 - 14th November 2008 +---------------------------------- +- Fix: VCS and VCF type attachments does not work with MMS in Creator scripts +- Fix: DRM accumulated element in Creator script mixes up starttime and + endtime values +- Fix: Deleting Browser Bookmark folders -> By Creator deletes all bookmark + folders when it should delete only those created with Creator + +Version 5.2.0 - 31st October 2008 +--------------------------------- +- Feature: Deleting entries +- Feature: Support for creating WMA and WMV files + +Version 5.1.1 - 3rd October 2008 +-------------------------------- +- Fix: Creator creates messages with invalid recepients which causes Messages + application to crash +- Fix: Creator crashes when pressing cancel while creating phonebook entries +- Feature: Script support for DRM protected files +- Feature: "incvalueforeachcopy" attribute introduced for increasing phone + numbers in scripts + +Version 5.1.0 - 19th September 2008 +----------------------------------- +- Feature: DRM protected files can be now generated +- Fix: Message read status does not get generated correctly from script +- Change: Legacy version removed + +Version 5.0.4 - 8th August 2008 +------------------------------- +- Feature: Random string can be now specified via an external XML file if not + wanting to use the defaults provided by the tool +- Fix: Crash when creating new landmark entries + +Version 5.0.3 - 2nd June 2008 +----------------------------- +- Feature: Scripts can be now executed directly via commandline +- Fix: With some combinations of parameters, connection method generation could + fail + +Version 5.0.2 - 14th May 2008 +----------------------------- +- Fix: Error handling in calendar entry recurrency rule improved +- Fix: Context check for script's fields could fail + +Version 5.0.1 - 5th May 2008 +---------------------------- +- Fix: Calendar entry creation may crash due to incorrect status field +- Fix: Saved deck entry creation may crash due to invalid path + +Version 5.0.0 - 21st April 2008 +------------------------------- +- Feature: Uses Virtual Phonebook API for S60 3.2 or newer +- Feature: Uses Connection Method API for S60 3.2 or newer +- Feature: Creation of Landmarks +- Feature: Completely new XML based script-format supporting all features +- Change: Agenda API replaced with Calendar Interim API + +Version 4.9.0 - 1st April 2008 +------------------------------ +- Change: Modified to support coexisting with Creator 5.0.0 + +Version 4.8.1 - 19th March 2008 +--------------------------------- +- Fix: Contact groups were created incorrectly + +=============================================================================== +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 "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". + diff -r 000000000000 -r d6fe6244b863 creator/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/group/backup_registration.xml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/group/bld.inf Tue Feb 02 00:17:27 2010 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies 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 + +PRJ_EXPORTS +../group/backup_registration.xml Z:/private/20011383/backup_registration.xml +../files/3GPP-70kB.dat Z:/private/20011383/3GPP-70kB.3gpp +../files/AAC-100kB.dat Z:/private/20011383/AAC-100kB.aac +../files/AMR-20kB.dat Z:/private/20011383/AMR-20kB.amr +../files/BMP-25kB.dat Z:/private/20011383/BMP-25kB.bmp +../files/Deck-1kB.dat Z:/private/20011383/Deck-1kB.saveddeck +../files/DOC-20kB.dat Z:/private/20011383/DOC-20kB.doc +../files/GIF-2kB.dat Z:/private/20011383/GIF-2kB.gif +../files/HTML-20kB.dat Z:/private/20011383/HTML-20kB.html +../files/JAD-1kB.dat Z:/private/20011383/JAD-1kB.jad +../files/JAR-10kB.dat Z:/private/20011383/JAR-10kB.jar +../files/JP2-65kB.dat Z:/private/20011383/JP2-65kB.jp2 +../files/JPEG-200kB.dat Z:/private/20011383/JPEG-200kB.jpg +../files/JPEG-25kB.dat Z:/private/20011383/JPEG-25kB.jpg +../files/JPEG-500kB.dat Z:/private/20011383/JPEG-500kB.jpg +../files/MIDI-10kB.dat Z:/private/20011383/MIDI-10kB.mid +../files/MP3-250kB.dat Z:/private/20011383/MP3-250kB.mp3 +../files/MP4-200kB.dat Z:/private/20011383/MP4-200kB.mp4 +../files/MXMF-40kB.dat Z:/private/20011383/MXMF-40kB.mxmf +../files/PNG-15kB.dat Z:/private/20011383/PNG-15kB.png +../files/PPT-40kB.dat Z:/private/20011383/PPT-40kB.ppt +../files/RAM-1kB.dat Z:/private/20011383/RAM-1kB.ram +../files/RM-95kB.dat Z:/private/20011383/RM-95kB.rm +../files/RNG-1kB.dat Z:/private/20011383/RNG-1kB.rng +../files/SVG-15kB.dat Z:/private/20011383/SVG-15kB.svg +../files/SWF-15kB.dat Z:/private/20011383/SWF-15kB.swf +../files/TIF-25kB.dat Z:/private/20011383/TIF-25kB.tif +../files/TXT-10kB.dat Z:/private/20011383/TXT-10kB.txt +../files/TXT-70kB.dat Z:/private/20011383/TXT-70kB.txt +../files/VCF-1kB.dat Z:/private/20011383/VCF-1kB.vcf +../files/VCS-1kB.dat Z:/private/20011383/VCS-1kB.vcs +../files/WAV-20kB.dat Z:/private/20011383/WAV-20kB.wav +../files/XLS-15kB.dat Z:/private/20011383/XLS-15kB.xls +../files/SISX-10kB.dat Z:/private/20011383/SISX-10kB.sisx +../files/WMA-50kB.dat Z:/private/20011383/WMA-50kB.wma +../files/WMV-200kB.dat Z:/private/20011383/WMV-200kB.wmv + +../scripts/creator.xsd +/tools/s60rndtools/creator/creator.xsd +../scripts/browserEx.creatorxml +/tools/s60rndtools/creator/browserEx.creatorxml +../scripts/calendarEx.creatorxml +/tools/s60rndtools/creator/calendarEx.creatorxml +../scripts/connectionmethodEx.creatorxml +/tools/s60rndtools/creator/connectionmethodEx.creatorxml +../scripts/contactEx.creatorxml +/tools/s60rndtools/creator/contactEx.creatorxml +../scripts/filesEx.creatorxml +/tools/s60rndtools/creator/filesEx.creatorxml +../scripts/impsEx.creatorxml +/tools/s60rndtools/creator/impsEx.creatorxml +../scripts/landmarkEx.creatorxml +/tools/s60rndtools/creator/landmarkEx.creatorxml +../scripts/logEx.creatorxml +/tools/s60rndtools/creator/logEx.creatorxml +../scripts/mailboxEx.creatorxml +/tools/s60rndtools/creator/mailboxEx.creatorxml +../scripts/messagesEx.creatorxml +/tools/s60rndtools/creator/messagesEx.creatorxml +../scripts/notepadEx.creatorxml +/tools/s60rndtools/creator/notepadEx.creatorxml + +#ifdef CORE_IBY_EXPORT_PATH + ../rom/creator.iby CORE_IBY_EXPORT_PATH(tools,creator.iby) +#endif + + +PRJ_MMPFILES +#if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__S60_32__) + gnumakefile creator_icons_aif.mk + + #ifdef MARM + gnumakefile creator_stub_sis.mk + #endif +#endif + +creator.mmp + + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + PRJ_EXTENSIONS + START EXTENSION s60/mifconv + OPTION TARGETFILE creator_aif.mif + OPTION SOURCEDIR ../icons + OPTION SOURCES -c8,8 qgn_menu_creator + END + + #ifdef MARM + START EXTENSION app-services/buildstubsis + OPTION SRCDIR ../sis + OPTION SISNAME Creator_stub + END + #endif +#endif diff -r 000000000000 -r d6fe6244b863 creator/group/creator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/group/creator.mmp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,158 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 + + +TARGET creator.exe +TARGETTYPE exe +EPOCSTACKSIZE 0x5000 +EPOCHEAPSIZE 0x10000 0x2000000 // Min 64Kb, Max 32Mb + +UID 0x100039CE 0x20011383 + +VENDORID VID_DEFAULT +CAPABILITY CAP_APPLICATION AllFiles + +SMPSAFE + +LANG SC + + +START RESOURCE ../data/creator.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END + +START RESOURCE ../data/creator_reg.rss +DEPENDS creator.rsg +TARGETPATH /private/10003a3f/apps +END + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc +SOURCEPATH ../src + + +SOURCE creator.cpp +SOURCE creator_app.cpp +SOURCE creator_document.cpp +SOURCE creator_appui.cpp +SOURCE creator_container.cpp +SOURCE creator_model.cpp +SOURCE creator_factory.cpp +SOURCE creator_scriptentry.cpp +SOURCE creator_scriptparser.cpp +SOURCE creator_scriptelementfactory.cpp +SOURCE creator_scriptelement.cpp +SOURCE creator_calendar.cpp +SOURCE creator_calendarelement.cpp +SOURCE creator_message.cpp +SOURCE creator_messageelement.cpp +SOURCE creator_note.cpp +SOURCE creator_noteelement.cpp +SOURCE creator_log.cpp +SOURCE creator_logelement.cpp +SOURCE creator_file.cpp +SOURCE creator_fileelement.cpp +SOURCE creator_browser.cpp +SOURCE creator_browserelement.cpp +SOURCE creator_imps.cpp +SOURCE creator_impselement.cpp +SOURCE creator_mailbox.cpp +SOURCE creator_mailboxelement.cpp +SOURCE creator_landmark.cpp +SOURCE creator_landmarkelement.cpp +SOURCE creator_phonebookbase.cpp +SOURCE creator_contactelement.cpp +SOURCE creator_contactsetcache.cpp +SOURCE creator_connectionmethodelement.cpp +SOURCE creator_randomdataparser.cpp + +#if defined (__SERIES60_30__) || defined(__SERIES60_31__) + SOURCE creator_phonebook.cpp + SOURCE creator_accesspoint.cpp +#else + SOURCE creator_virtualphonebook.cpp + SOURCE creator_connectionmethod.cpp +#endif + + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY aknnotify.lib +LIBRARY estor.lib +LIBRARY cntmodel.lib +LIBRARY favouritesengine.lib +LIBRARY msgs.lib +LIBRARY logwrap.lib +LIBRARY logcli.lib +LIBRARY efsrv.lib +LIBRARY gsmu.lib +LIBRARY imcm.lib +LIBRARY npdlib.lib +LIBRARY bafl.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY commdb.lib +LIBRARY muiu.lib +LIBRARY etext.lib +LIBRARY commonengine.lib +LIBRARY commonui.lib +LIBRARY platformenv.lib +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY obexmtmutil.lib +LIBRARY smcm.lib +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY flogger.lib +LIBRARY etel.lib +LIBRARY etelmm.lib +LIBRARY xmlframework.lib +LIBRARY charconv.lib +LIBRARY senutils.lib +LIBRARY calinterimapi.lib +LIBRARY eposlandmarks.lib +LIBRARY lbs.lib +LIBRARY ecom.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +LIBRARY drmrights.lib +LIBRARY edbms.lib +LIBRARY imageconversion.lib +LIBRARY fbscli.lib +LIBRARY bitmaptransforms.lib + +#if defined (__SERIES60_30__) || defined(__SERIES60_31__) + LIBRARY apengine.lib + LIBRARY pbkeng.lib +#else + LIBRARY cmmanager.lib + LIBRARY cmmanagerdatabase.lib + LIBRARY vpbkeng.lib + LIBRARY pbk2presentation.lib +#endif + +#ifdef __PRESENCE + LIBRARY wvsapsettingsstore.lib +#endif diff -r 000000000000 -r d6fe6244b863 creator/group/creator_icons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/group/creator_icons_aif.mk Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,54 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies 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 +ICONTARGETFILENAME=$(TARGETDIR)\creator_aif.mif + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : ..\icons\qgn_menu_creator.svg + mifconv $(ICONTARGETFILENAME) \ + /c8,8 ..\icons\qgn_menu_creator.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r d6fe6244b863 creator/group/creator_stub_sis.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/group/creator_stub_sis.mk Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,56 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install + +SISNAME=Creator_stub +PKGNAME=Creator_stub + +$(TARGETDIR) : + @perl -S emkdir.pl "$(TARGETDIR)" + +do_nothing : + rem do_nothing + +SISFILE=$(TARGETDIR)\$(SISNAME).sis + +$(SISFILE) : ..\sis\$(PKGNAME).pkg + makesis -s $? $@ + + + +MAKMAKE : do_nothing + +RESOURCE : do_nothing + +SAVESPACE : do_nothing + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : $(TARGETDIR) $(SISFILE) + +CLEAN : + @if exist $(SISFILE) erase $(SISFILE) + +RELEASABLES : + @echo $(SISFILE) diff -r 000000000000 -r d6fe6244b863 creator/icons/qgn_menu_creator.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/icons/qgn_menu_creator.svg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/inc/creator.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator.hrh Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,177 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_HRH__ +#define __CREATOR_HRH__ + + +enum TCreatorIds + { + ECmdCreateFromFile=1, + + ECmdCreateCalendarEntries, + ECmdCreateCalendarEntryAppointments, + ECmdCreateCalendarEntryEvents, + ECmdCreateCalendarEntryAnniversaries, + ECmdCreateCalendarEntryToDos, + ECmdCreateCalendarEntryReminders, + + ECmdCreateBrowserEntries, + ECmdCreateBrowserBookmarkEntries, + ECmdCreateBrowserBookmarkFolderEntries, + ECmdCreateBrowserSavedPageEntries, + ECmdCreateBrowserSavedPageFolderEntries, + + ECmdCreateFileEntries, + ECmdCreateFileEntryEmptyFolder, + + ECmdCreateFileEntry3GPP_70kB, + ECmdCreateFileEntryAAC_100kB, + ECmdCreateFileEntryAMR_20kB, + ECmdCreateFileEntryBMP_25kB, + ECmdCreateFileEntryDeck_1kB, + ECmdCreateFileEntryDOC_20kB, + ECmdCreateFileEntryGIF_2kB, + ECmdCreateFileEntryHTML_20kB, + ECmdCreateFileEntryJAD_1kB, + ECmdCreateFileEntryJAR_10kB, + ECmdCreateFileEntryJP2_65kB, + ECmdCreateFileEntryJPEG_200kB, + ECmdCreateFileEntryJPEG_25kB, + ECmdCreateFileEntryJPEG_500kB, + ECmdCreateFileEntryMIDI_10kB, + ECmdCreateFileEntryMP3_250kB, + ECmdCreateFileEntryMP4_200kB, + ECmdCreateFileEntryMXMF_40kB, + ECmdCreateFileEntryPNG_15kB, + ECmdCreateFileEntryPPT_40kB, + ECmdCreateFileEntryRAM_1kB, + ECmdCreateFileEntryRM_95kB, + ECmdCreateFileEntryRNG_1kB, + ECmdCreateFileEntrySVG_15kB, + ECmdCreateFileEntrySWF_15kB, + ECmdCreateFileEntryTIF_25kB, + ECmdCreateFileEntryTXT_10kB, + ECmdCreateFileEntryTXT_70kB, + ECmdCreateFileEntryVCF_1kB, + ECmdCreateFileEntryVCS_1kB, + ECmdCreateFileEntryWAV_20kB, + ECmdCreateFileEntryXLS_15kB, + ECmdCreateFileEntrySISX_10kB, + ECmdCreateFileEntryWMA_50kB, + ECmdCreateFileEntryWMV_200kB, + + ECmdCreateLogEntries, + ECmdCreateLogEntryMissedCalls, + ECmdCreateLogEntryReceivedCalls, + ECmdCreateLogEntryDialledNumbers, + + ECmdCreateMessagingEntries, + ECmdCreateMessagingEntryCBSTopics, + ECmdCreateMessagingEntryDocumentsFolders, + ECmdCreateMessagingEntrySMSMessageCenters, + ECmdCreateMessagingEntryMailboxes, + ECmdCreateMessagingEntryMessages, + ECmdCreateMessagingEntryMessagesViaScript, + ECmdCreateMessagingEntryTemplates, + + ECmdCreateRandomEntrySMSInbox, + ECmdCreateRandomEntrySMSDrafts, + ECmdCreateRandomEntrySMSOutbox, + ECmdCreateRandomEntrySMSSent, + ECmdCreateRandomEntryMMSInbox, + ECmdCreateRandomEntryMMSDrafts, + ECmdCreateRandomEntryMMSOutbox, + ECmdCreateRandomEntryMMSSent, + ECmdCreateRandomEntryAMSInbox, + ECmdCreateRandomEntryAMSDrafts, + ECmdCreateRandomEntryAMSOutbox, + ECmdCreateRandomEntryAMSSent, + ECmdCreateRandomEntryEmailInbox, + ECmdCreateRandomEntryEmailDrafts, + ECmdCreateRandomEntryEmailOutbox, + ECmdCreateRandomEntryEmailSent, + ECmdCreateRandomEntryBIOInbox, + ECmdCreateRandomEntryBIODrafts, + ECmdCreateRandomEntryBIOOutbox, + ECmdCreateRandomEntryBIOSent, + ECmdCreateRandomEntryIRInbox, + ECmdCreateRandomEntryIRDrafts, + ECmdCreateRandomEntryIROutbox, + ECmdCreateRandomEntryIRSent, + ECmdCreateRandomEntryBTInbox, + ECmdCreateRandomEntryBTDrafts, + ECmdCreateRandomEntryBTOutbox, + ECmdCreateRandomEntryBTSent, + + ECmdCreateMiscEntries, + ECmdCreateMiscEntryAccessPoints, + ECmdCreateMiscEntryAppMenuFolders, + ECmdCreateMiscEntryIMPSServers, + ECmdCreateMiscEntryNotes, + ECmdCreateMiscEntrySyncSettings, + ECmdCreateMiscEntryLandmarks, + + ECmdCreatePhoneBookEntries, + ECmdCreatePhoneBookEntryContacts, + ECmdCreatePhoneBookEntryGroups, + ECmdCreatePhoneBookEntrySubscribedContacts, + + ECmdDeleteEntries, + ECmdDeleteAllEntries, + ECmdDeleteAllCreatorEntries, + ECmdDeleteContacts, + ECmdDeleteCreatorContacts, + ECmdDeleteContactGroups, + ECmdDeleteCreatorContactGroups, + ECmdDeleteCalendarEntries, + ECmdDeleteCreatorCalendarEntries, + ECmdDeleteBrowserBookmarks, + ECmdDeleteCreatorBrowserBookmarks, + ECmdDeleteBrowserBookmarkFolders, + ECmdDeleteCreatorBrowserBookmarkFolders, + ECmdDeleteBrowserSavedPages, + ECmdDeleteCreatorBrowserSavedPages, + ECmdDeleteBrowserSavedPageFolders, + ECmdDeleteCreatorBrowserSavedPageFolders, + ECmdDeleteCreatorFiles, + ECmdDeleteLogs, + ECmdDeleteCreatorLogs, + ECmdDeleteMessages, + ECmdDeleteCreatorMessages, + ECmdDeleteMailboxes, + ECmdDeleteCreatorMailboxes, + ECmdDeleteIAPs, + ECmdDeleteCreatorIAPs, + ECmdDeleteIMPSs, + ECmdDeleteCreatorIMPSs, + ECmdDeleteNotes, + // ECmdDeleteCreatorNotes, not supported + ECmdDeleteLandmarks, + ECmdDeleteCreatorLandmarks, + + ECmdAboutCreator, + + ECmdSelectRandomDataFile, + + EProgressNote + + }; + +#endif // __CREATOR_HRH__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator.pan Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_PAN__ +#define __CREATOR_PAN__ + + +/** Creator application panic codes */ +enum TCreatorPanics + { + ECreatorBasicUi = 1 + // add further panics here + }; + +#endif // __CREATOR_PAN__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_accesspoint.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_accesspoint.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,125 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORACCESSPOINTS_H__ +#define __CREATORACCESSPOINTS_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" +#include "creator_connectionmethodbase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class CCreatorEngine; +class CAccessPointsParameters; + + + +class CCreatorAccessPoints : public CCreatorConnectionSettingsBase, public MMsvSessionObserver + { +public: + static CCreatorAccessPoints* NewL(CCreatorEngine* aEngine); + static CCreatorAccessPoints* NewLC(CCreatorEngine* aEngine); + ~CCreatorAccessPoints(); + +private: + CCreatorAccessPoints(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + + TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters); + TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse ); + + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +private: + CCommsDatabase* iCommsDb; + CApDataHandler* iApDataHandler; + CApUtils* iApUtils; + CAccessPointsParameters* iParameters; + RArray iEntryIds; // TUint32 CApDataHandler::CreateFromDataL + +public: + }; + + +class CAccessPointsParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iConnectionName; // connection name + TApBearerType iBearerType; // bearer type + HBufC* iWapStartPage; // WAP start page + TUint32 iWapWspOption; // connection type + HBufC* iGprsAcessPointName; // access point name + HBufC* iIspLoginName; // username + TBool iSecureAuthentication; // password authentication + HBufC* iIspLoginPass; // password + TBool iPromptPassword; // prompt password + HBufC* iWapGatewayAddress; // WAP gateway address + HBufC* iIspIPAddr; // phone IP + HBufC* iIspIPNameServer1; // primary name server + HBufC* iIspIPNameServer2; // secondary name server + HBufC* iIspDefaultTelNumber; // datacall number + TUint32 iIspBearerCallTypeIsdn; // datacall type + TUint32 iIspBearerSpeed; // max connection speed + HBufC* iProxyServerAddress; // proxy address + TUint32 iProxyPortNumber; // proxy number + + void SetRandomCMNameL(CCreatorEngine& aEngine); + void SetRandomLoginNameL(CCreatorEngine& aEngine); + void SetRandomLoginPassL(CCreatorEngine& aEngine); + void SetRandomSecureAuthenticationL(CCreatorEngine& aEngine); + void SetRandomPromptPasswordL(CCreatorEngine& aEngine); + void SetRandomProxyAddressL(CCreatorEngine& aEngine); + void SetRandomProxyPortL(CCreatorEngine& aEngine); + void SetRandomStartPageL(CCreatorEngine& aEngine); + void SetRandomIPAddressL(CCreatorEngine& aEngine); + void SetRandomIP4NameServer1L(CCreatorEngine& aEngine); + void SetRandomIP4NameServer2L(CCreatorEngine& aEngine); + void SetRandomTelephoneNumberL(CCreatorEngine& aEngine); + void SetRandomBearerTypeIsdnL(CCreatorEngine& aEngine); + void SetRandomBearerSpeedL(CCreatorEngine& aEngine); + void SetRandomWapWspOptionL(CCreatorEngine& aEngine); + void SetRandomGatewayAddressL(CCreatorEngine& aEngine); + + +public: + CAccessPointsParameters(); + ~CAccessPointsParameters(); + }; + + + +#endif // __CREATORACCESSPOINTS_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_app.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,56 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_APPLICATION_H__ +#define __CREATOR_APPLICATION_H__ + +#include + +static const TUid KUidCreatorApp = {0x20011383}; + +/*! + @class CCreatorApplication + + @discussion An instance of CCreatorApplication is the application part of the AVKON + application framework for the Creator example application + */ +class CCreatorApplication : public CAknApplication + { +public: // from CApaApplication + +/*! + @function AppDllUid + + @discussion Returns the application DLL UID value + @result the UID of this Application/Dll + */ + TUid AppDllUid() const; + +protected: // from CEikApplication +/*! + @function CreateDocumentL + + @discussion Create a CApaDocument object and return a pointer to it + @result a pointer to the created document + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // __CREATOR_APPLICATION_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_appui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_appui.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,134 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_APPUI_H__ +#define __CREATOR_APPUI_H__ + +#include "creator_model.h" +#include +#include +#include + + +class CCoeEnv; +class CCreatorEngine; + +class CCreatorAppView; + + + +/*! + @class CCreatorAppUi + + @discussion An instance of class CCreatorAppUi is the UserInterface part of the AVKON + application framework for the Creator example application + */ +class CCreatorAppUi : public CAknAppUi, public MBeating + { +public: +/*! + @function ConstructL + + @discussion Perform the second phase construction of a CCreatorAppUi object + this needs to be public due to the way the framework constructs the AppUi + */ + void ConstructL(); + +/*! + @function CCreatorAppUi + + @discussion Perform the first phase of two phase construction. + This needs to be public due to the way the framework constructs the AppUi + */ + CCreatorAppUi(); + + +/*! + @function ~CCreatorAppUi + + @discussion Destroy the object and release all memory objects + */ + ~CCreatorAppUi(); + + +public: // from CEikAppUi +/*! + @function HandleCommandL + + @discussion Handle user menu selections + @param aCommand the enumerated code for the option selected + */ + void HandleCommandL(TInt aCommand); + + + +public: // from MEikMenuPaneObserver + + /*! + @function DynInitMenuPaneL + + @discussion Initialise a menu pane before it is displayed + @param aMenuId id of menu + @param aMenuPane handle for menu pane + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + // callback from engine when the commands from the script file have been executed + void RunScriptDone(); + + // from MBeating + void Beat(); + void Synchronize(); + +private: + void Tick(); + +protected: + CEikonEnv* iEnv; + + +//private: +public: + CCreatorAppView* iAppView; + CCreatorEngine* iEngine; + + + +public: + +private: + HBufC* iCommandLineScriptName; + HBufC* iCommandLineRandomDataFileName; + CHeartbeat* iTimer; + enum TTimerMode + { + ETimerModeNone, + ETimerModeStartScript, + ETimerModeExitAppUi + }; + TTimerMode iMode; + TInt iTickCount; + }; + + + + + +#endif // __CREATOR_APPUI_H__ + diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_browser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_browser.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,106 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORBROWSER_H__ +#define __CREATORBROWSER_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" + +#include +#include +#include +#include + + + +class CCreatorEngine; +class CBrowserParameters; + + +class CCreatorBrowser : public CBase, public MCreatorModuleBase + { +public: + static CCreatorBrowser* NewL(CCreatorEngine* aEngine); + static CCreatorBrowser* NewLC(CCreatorEngine* aEngine); + ~CCreatorBrowser(); + +private: + CCreatorBrowser(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + TInt CreateBookmarkEntryL(CBrowserParameters *aParameters); + TInt CreateBookmarkFolderEntryL(CBrowserParameters *aParameters); + TInt CreateSavedDeckEntryL(CBrowserParameters *aParameters); + TInt CreateSavedDeckFolderEntryL(CBrowserParameters *aParameters); + + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + + void DeleteAllBookmarksL(); + void DeleteAllBookmarksCreatedByCreatorL(); + void DeleteAllBookmarkFoldersL(); + void DeleteAllBookmarkFoldersCreatedByCreatorL(); + void DeleteAllSavedPagesL(); + void DeleteAllSavedPagesCreatedByCreatorL(); + void DeleteAllSavedPageFoldersL(); + void DeleteAllSavedPageFoldersCreatedByCreatorL(); + +private: + void DeleteAllItemsL( const TDesC& aDbName, CFavouritesItem::TType aTypeFilter, TBool aOnlyCreatedWithCreator, RArray& aEntryIds, const TUid aDictUid ); + + + +private: + CBrowserParameters* iParameters; + RArray iBmEntryIds; + RArray iBmFEntryIds; + RArray iSpEntryIds; + RArray iSpFEntryIds; +public: + }; + + +class CBrowserParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iBookmarkName; + HBufC* iBookmarkAddress; + TFavouritesWapAp iBookmarkAccessPoint; + HBufC* iBookmarkUsername; + HBufC* iBookmarkPassword; + + HBufC* iBookmarkFolderName; + + HBufC* iSavedDeckLinkName; + HBufC* iSavedDeckLocalAddress; + + HBufC* iSavedDeckFolderName; + +public: + CBrowserParameters(); + ~CBrowserParameters(); + }; + + + +#endif // __CREATORBROWSER_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_browserelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_browserelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORBROWSERELEMENT_H_ +#define CREATORBROWSERELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatorbrowser +{ +_LIT(KBookmark, "bookmark"); +_LIT(KBookmarkFolder, "bookmarkfolder"); +_LIT(KSavedPage, "savedpage"); +_LIT(KSavedPageFolder, "savedpagefolder"); + +_LIT(KName, "name"); +_LIT(KPath, "path"); +_LIT(KUsername, "username"); +_LIT(KPassword, "password"); +_LIT(KUrl, "url"); +} + +class CCreatorBrowserElement : public CCreatorScriptElement +{ +public: + static CCreatorBrowserElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorBrowserElement(CCreatorEngine* aEngine); + TInt GetBrowserCommandL() const; +}; +#endif /*CREATORBROWSERELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_calendar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_calendar.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,235 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORCALENDARINTERIM_H__ +#define __CREATORCALENDARINTERIM_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" +#include "creator_calendarbase.h" + +#include +#include + +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#include +#include +class CVPbkContactManager; +#endif + +class CCreatorEngine; +class CCalenderInterimParameters; +class CAsyncWaiter; + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack, +public MVPbkSingleContactOperationObserver, public MVPbkContactStoreListObserver, public MVPbkContactFindObserver +#else +class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack +#endif + { +public: + static CCreatorInterimCalendar* NewL(CCreatorEngine* aEngine); + static CCreatorInterimCalendar* NewLC(CCreatorEngine* aEngine); + ~CCreatorInterimCalendar(); + +private: + CCreatorInterimCalendar(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + void AddRepeatingRuleL(const TCalTime& aStartTime, CCalEntry& aCalEntry, CCalenderInterimParameters* parameters=0); + void SetRandomAlarmL(CCalEntry& aCalEntry); + void SetAlarmL(CCalEntry& aCalEntry, CCalenderInterimParameters* params); + void AddAttendeesL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters=0); + void SetPhoneOwnerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy ); + void SetOrganizerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy); + void SetOrganizerL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters ); + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + + TInt CreateAppointmentEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateEventEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateAnniversaryEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateTodoEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateReminderEntryL(CCreatorModuleBaseParameters *aParameters); + + void GenerateRandomId(TDes8& aText); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +public: +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + // From MVPbkSingleContactOperationObserver: + virtual void VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& aOperation, + MVPbkStoreContact* aContact ); + + virtual void VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& aOperation, + TInt aError ); + + // From MVPbkContactStoreListObserver + virtual void OpenComplete(); + virtual void StoreReady(MVPbkContactStore&); + virtual void StoreUnavailable(MVPbkContactStore&, TInt); + virtual void HandleStoreEventL(MVPbkContactStore&, TVPbkContactStoreEvent); + + // From MVPbkContactFindObserver + virtual void FindCompleteL( MVPbkContactLinkArray* aResults ); + virtual void FindFailed( TInt aError ); + void HandleSingleContactResultL(); +#endif + +private: + + CCalenderInterimParameters* iParameters; + TTime iRandomModeStartTime; + TTime iRandomModeEndTime; + TInt iNumberRepeatingEntries; + TInt iNumberOfAttendees; + CCalEntryView* iCalEntryView; + CCalSession* iCalSession; + TBool iSetAlarm; + CDesCArrayFlat* iSoundFileArray; + CAsyncWaiter* iWaiter; + HBufC* iTmpCN; + HBufC* iTmpEmail; + RArray iEntryIds; // TCalLocalUid ( == TUint32 ) CCalEntry::LocalUidL + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + CVPbkContactManager* iContactManager; + MVPbkContactLinkArray* iExistingContacts; + MVPbkStoreContact* iTempContact; +#endif +public: + + //Observer implementation for MCalProgressCallBack + void Progress(TInt aPercentageCompleted); + + void Completed(TInt aError); + + TBool NotifyProgress(); + + }; + +class CCreatorCalenderAttendee : public CBase +{ +public: + virtual ~CCreatorCalenderAttendee(); + static CCreatorCalenderAttendee* NewL(); + void SetCommonNameL(const TDesC& aName); + void SetEmailAddressL(const TDesC& aEmail); + void SetRole(CCalAttendee::TCalRole aRole); + void SetStatus(CCalAttendee::TCalStatus); + + const TDesC& CommonName() const; + const TDesC& EmailAddress() const; + CCalAttendee::TCalRole Role() const; + CCalAttendee::TCalStatus Status() const; + +private: + CCreatorCalenderAttendee(); + TPtrC iDummy; + HBufC* iCommonName; + HBufC* iEmailAddress; + CCalAttendee::TCalRole iRole; + CCalAttendee::TCalStatus iStatus; +}; + +class CCalenderInterimParameters : public CCreatorModuleBaseParameters + { +public: + + void ParseL(CCommandParser* parser, TParseParams aCase); + TBool IsAllowedEntryStatus(CCalEntry::TType aType, CCalEntry::TStatus aStatus); + + TCalRRule::TType iRecurrentFrequency; + TInt iRecurrentInterval; + TTime iRecurrentStartTime; + TTime iRecurrentEndTime; + TInt iRepeatingCount; // This is used when running a script... + TTime iAlarmTime; // NullTTime means no alarm + TBool iUseRandomAlarmTime; // ETrue if random alarm should be set. Overwrites the iAlarmTime. + + RPointerArray iAttendees; + RArray iAttendeeLinkIds; // For attendees. Stores the linked contact ids. + HBufC* iOrganizerName; + HBufC* iOrganizerEmail; + + HBufC* iDescription; + HBufC* iSummary; + HBufC* iLocation; + TTime iStartTime; + TTime iEndTime; + TInt iNumberRepeatingEntries; // This is used when user input is used... + TInt iNumberOfAttendees; // Number of randomly generated attendees + TInt iNumberOfExistingAttendees; // Number of attendees selected from existing contacts. + + //An appointment, which has a start time and end time. + TTime iAppointmentStartTime; + TTime iAppointmentEndTime; + HBufC* iAppointmentLocation; + HBufC* iAppointmentReason; + + //An event, which has a start time and end time. + + TTime iEventStartTime; + TTime iEventEndTime; + HBufC* iEventReason; + + //A reminder, which has a start time only. + TTime iReminderStartTime; + HBufC* iReminderReason; + + //An anniversary, which has a start time and end time. + TTime iAnniversaryStartTime; + TTime iAnniversaryEndTime; + HBufC* iAnniversaryReason; + + //A to-do, which can have a start time and end time (the end time is the due date), or can be undated. + TTime iTodoStartTime;//optional + TTime iTodoDueTime;//also end time (optional) + HBufC* iTodoTask; + TInt iTodoPriority; + + TTime iRandomModeStartTime; + TTime iRandomModeEndTime; + + CCalEntry::TStatus iStatus; + +public: + CCalenderInterimParameters(); + ~CCalenderInterimParameters(); + + }; + + + +#endif // __CREATORCALENDARINTERIM_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_calendarbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_calendarbase.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,44 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CCREATORCALENDARBASE_ +#define CCREATORCALENDARBASE_ + +#include "creator_modulebase.h" + +class CCreatorModuleBaseParameters; + +class CCreatorCalendarBase : public CBase, public MCreatorModuleBase{ +public: + + + //An appointment, which has a start time and end time. EAppt. + virtual TInt CreateAppointmentEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + //An event, which has a start time and end time. EEvent. + virtual TInt CreateEventEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + //An anniversary, which has a start time and end time. EAnniv. + virtual TInt CreateAnniversaryEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + //A to-do, which can have a start time and end time (the end time is the due date), or can be undated. ETodo. + virtual TInt CreateTodoEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + //A reminder, which has a start time only. EReminder. + virtual TInt CreateReminderEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + +}; + +#endif /*CCREATORCALENDARBASE_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_calendarelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_calendarelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,119 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORCALENDARELEMENT_H_ +#define CREATORCALENDARELEMENT_H_ + +#include "creator_scriptelement.h" + +class CCalenderInterimParameters; + +// Calendar elements: +namespace creatorcalendar +{ + _LIT(KCalendar, "calendar"); + + // Calendar entry types: + _LIT(KType, "type"); + _LIT(KCalTypeAppointment, "appointment"); + _LIT(KCalTypeEvent, "event"); + _LIT(KCalTypeReminder, "reminder"); + _LIT(KCalTypeAnniversary, "anniversary"); + _LIT(KCalTypeTodo, "todo"); + + // Calendar entry field elements: + _LIT(KSummary, "summary"); + _LIT(KDescription, "description"); + _LIT(KLocation, "location"); + _LIT(KStarttime, "starttime"); + _LIT(KEndtime, "endtime"); + _LIT(KRecurrentFreq, "recurrentfrequency"); + _LIT(KRecurrentInterval, "recurrentinterval"); + _LIT(KRecurrentFrom, "recurrentfrom"); + _LIT(KRecurrentTo, "recurrentto"); + _LIT(KRepeatingCount, "repeatingcount"); + _LIT(KAlarmtime, "alarmtime"); + _LIT(KSynchronization, "synchronization"); + _LIT(KOrganizername, "organizername"); + _LIT(KOrganizeremail, "organizeremail"); + _LIT(KAttendees, "attendees"); + _LIT(KAttendee, "attendee"); + _LIT(KCommonname, "commonname"); + _LIT(KEmail, "email"); + _LIT(KRole, "role"); + _LIT(KStatus, "status"); + _LIT(KPriority, "priority"); + + // Recurrency frequency values: + _LIT(KNotRepeated, "not-repeated"); + _LIT(KWeekly, "weekly"); + _LIT(KDaily, "daily"); + _LIT(KMonthly, "monthly"); + _LIT(KYearly, "yearly"); + + // Attendee role values: + _LIT(KRoleRequired, "required"); + _LIT(KRoleOptional, "optional"); + _LIT(KRoleNonPart, "non-participant"); + _LIT(KRoleChair, "chair"); + + // Calendar entry status values: + _LIT(KCalStatusTentative, "tentative"); + _LIT(KCalStatusConfirmed, "confirmed"); + _LIT(KCalStatusCancelled, "cancelled"); + _LIT(KCalStatusNeedsAction, "todoneedsaction"); + _LIT(KCalStatusCompleted, "todocompleted"); + _LIT(KCalStatusInProcess, "todoinprocess"); + + // Attendee status values: + _LIT(KStatusNeedsAction, "needsaction"); + _LIT(KStatusAccepted, "accepted"); + _LIT(KStatusTentative, "tentative"); + _LIT(KStatusConfirmed, "confirmed"); + _LIT(KStatusDeclined, "declined"); + _LIT(KStatusCompleted, "completed"); + _LIT(KStatusDelegated, "delegated"); + _LIT(KStatusInProcess, "inprocess"); + + // Priority values: + _LIT(KPriorityHigh, "high"); + _LIT(KPriorityMedium, "medium"); + _LIT(KPriorityLow, "low"); +} + +class CCreatorCalendarElement : public CCreatorScriptElement +{ +public: + static CCreatorCalendarElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); +protected: + CCreatorCalendarElement(CCreatorEngine* aEngine); + + enum TEntryType { + EAppointment, + EEvent, + EReminder, + EAnniversary, + ETodo + }; + + void FillEntryParamsL(TEntryType aType, const RPointerArray& fields, CCalenderInterimParameters* parameters); +}; + +#endif /*CREATORCALENDARELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_connectionmethod.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_connectionmethod.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,154 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORCONNECTIONSETTINGS_H__ +#define __CREATORCONNECTIONSETTINGS_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" +#include "creator_connectionmethodbase.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +using namespace CMManager; + +#include //ETel Packet API needed for enums + +class CCreatorEngine; +class CConnectionSettingsParameters; + +class CCreatorConnectionSettings : public CCreatorConnectionSettingsBase, public MMsvSessionObserver + { +public: + static CCreatorConnectionSettings* NewL(CCreatorEngine* aEngine); + static CCreatorConnectionSettings* NewLC(CCreatorEngine* aEngine); + ~CCreatorConnectionSettings(); + +private: + CCreatorConnectionSettings(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + + TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters); + TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse ); + + //Setting default connection method, if not set + void SetDefaultCML(RCmConnectionMethodExt conMethod); + //Set random parameters + void SetRandomParametersL(CConnectionSettingsParameters& parameters); + void SetRandomBearerTypeL(CConnectionSettingsParameters& parameters); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); +private: + void DeleteAllDestinationsL( TBool aOnlyCreatedWithCreator ); +private: + CCommsDatabase* iCommsDb; + + RCmManagerExt iCmManagerExt; + + CConnectionSettingsParameters* iParameters; + + RArray iEntryIds; // TUint32 RCmDestinationExt::Id() + +public: + }; + + +class CConnectionSettingsParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iConnectionName; // connection name + TUint iBearerType; // bearer type + HBufC* iStartPage; // start page + TWapWSPOption iWapWspOption; // Indicating whether connection-oriented or connectionless API should be used. + + RPacketContext::TProtocolType iProtocolType; //Type of protocol EPdpTypeIPv4 or EPdpTypeIPv4 + + HBufC* iLoginName; // username + TBool iSecureAuthentication; // password authentication + HBufC* iLoginPass; // password + TBool iPromptPassword; // prompt password + HBufC* iGatewayAddress; // gateway address + HBufC* iSubnetMask; // subnet mask + HBufC* iIPAddr; // phone IP + HBufC* iIP4NameServer1; // primary name server + HBufC* iIP4NameServer2; // secondary name server + HBufC* iDefaultTelNumber; // datacall number + TUint32 iBearerCallTypeIsdn; // datacall type + TUint32 iBearerSpeed; // max connection speed + TBool iUseProxy; //Use proxy or not + HBufC* iProxyServerAddress; // proxy address + TUint32 iProxyPortNumber; // proxy number + HBufC* iWLANName;//WLAN network name + HBufC* iWlanIpAddr;//IP address of EPOC. + TWlanSecMode iWLanSecMode;//WLAN security modes + TWlanNetMode iWlanNetMode;//WLAN connection mode. Ad-hoc or infrastructure. + + HBufC* iIP6NameServer1; // primary name server for IP v6 + HBufC* iIP6NameServer2; // secondary name server for IP v6 + TBool iDisableTextAuth; // Disable plaintext authentication + + CCreatorEngine* iEngine; + +public: + CConnectionSettingsParameters(); + ~CConnectionSettingsParameters(); + + void SetRandomCMNameL(CCreatorEngine& aEngine); + void SetRandomWLANNameL(CCreatorEngine& aEngine); + void SetRandomWLANNetModeL(CCreatorEngine& aEngine); + void SetRandomWLANSecurityModeL(CCreatorEngine& aEngine); + void SetRandomLoginNameL(CCreatorEngine& aEngine); + void SetRandomLoginPassL(CCreatorEngine& aEngine); + void SetRandomSecureAuthenticationL(CCreatorEngine& aEngine); + void SetRandomPromptPasswordL(CCreatorEngine& aEngine); + void SetRandomUseProxyL(CCreatorEngine& aEngine); + void SetRandomProxyAddressL(CCreatorEngine& aEngine); + void SetRandomProxyPortL(CCreatorEngine& aEngine); + void SetRandomStartPageL(CCreatorEngine& aEngine); + void SetRandomIPAddressL(CCreatorEngine& aEngine); + void SetRandomIP4NameServer1L(CCreatorEngine& aEngine); + void SetRandomIP4NameServer2L(CCreatorEngine& aEngine); + void SetRandomProtocolTypeL(CCreatorEngine& aEngine); + void SetRandomTelephoneNumberL(CCreatorEngine& aEngine); + void SetRandomBearerTypeIsdnL(CCreatorEngine& aEngine); + void SetRandomBearerSpeedL(CCreatorEngine& aEngine); + void SetRandomWapWspOptionL(CCreatorEngine& aEngine); + void SetRandomSubnetMaskL(CCreatorEngine& aEngine); + void SetRandomGatewayAddressL(CCreatorEngine& aEngine); + void SetRandomWlanIpAddrL(CCreatorEngine& aEngine); + void SetRandomIPv6NameServer1L(CCreatorEngine& aEngine); + void SetRandomIPv6NameServer2L(CCreatorEngine& aEngine); + void SetRandomDisableTextAuthL(CCreatorEngine& aEngine); + }; + + + +#endif // __CREATORCONNECTIONSETTINGS_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_connectionmethodbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_connectionmethodbase.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CCREATORCONNECTIONSETTINGSBASE_H_ +#define __CCREATORCONNECTIONSETTINGSBASE_H_ + +#include "creator_modulebase.h" + +class CCreatorModuleBaseParameters; + +const TUint KRandomBearerType = 0xEEEEEEEE; + +class CCreatorConnectionSettingsBase : public CBase, public MCreatorModuleBase + { +public: + + virtual ~CCreatorConnectionSettingsBase(){}; + + virtual TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + virtual TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse ) = 0; + virtual void DeleteAllConnectionMethodsL(){}; + }; + +#endif /*__CCREATORCONNECTIONSETTINGSBASE_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_connectionmethodelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_connectionmethodelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,98 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORCONNECTIONMETHODELEMENT_H_ +#define CREATORCONNECTIONMETHODELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatorconnectionmethod +{ + _LIT(KCm, "connectionmethod"); + _LIT(Kconnectionname, "connectionname"); + _LIT(Kbearertype, "bearertype"); + _LIT(Kstartpage, "startpage"); + _LIT(Kwapwspoption, "wapwspoption"); + _LIT(Kprotocoltype, "protocoltype"); + _LIT(Kloginname, "loginname"); + _LIT(Ksecureauthentication, "secureauthentication"); + _LIT(Kloginpass, "loginpass"); + _LIT(Kpromptpassword, "promptpassword"); + _LIT(Kgatewayaddress, "gatewayaddress"); + _LIT(Ksubnetmask, "subnetmask"); + _LIT(Kdeviceipaddr, "deviceipaddr"); + _LIT(Kip4nameserver1, "ip4nameserver1"); + _LIT(Kip4nameserver2, "ip4nameserver2"); + _LIT(Kdatacalltelnumber, "datacalltelnumber"); + _LIT(Kdatacalltypeisdn, "datacalltypeisdn"); + _LIT(Kdatacalllinespeed, "datacalllinespeed"); + _LIT(Kuseproxy, "useproxy"); + _LIT(Kproxyserveraddress, "proxyserveraddress"); + _LIT(Kproxyportnumber, "proxyportnumber"); + _LIT(Kip6nameserver1, "ip6nameserver1"); + _LIT(Kip6nameserver2, "ip6nameserver2"); + _LIT(Kdisabletextauth, "disabletextauth"); + _LIT(Kwlanname, "wlanname"); + _LIT(Kwlanipaddr, "wlanipaddr"); + _LIT(Kwlansecmode, "wlansecmode"); + _LIT(Kwlannetmode, "wlannetmode"); + + // Bearer type: + _LIT(Kwlan, "wlan"); + _LIT(Kgprs, "gprs"); + _LIT(Kdatacall, "datacall"); + _LIT(Khsgsm, "hsgsm"); + _LIT(Kembedded, "embedded"); + _LIT(Kvpn, "vpn"); + _LIT(Klan, "lan"); + + // Data call type isdn: + _LIT(Kanalogue, "analogue"); + _LIT(Kisdnv110, "isdnv110"); + _LIT(Kisdnv120, "isdnv120"); + + // Line speed: + _LIT(Kautomatic, "automatic"); + // WAP wps options: + _LIT(Kconnectionless, "connectionless"); // ECmWapWspOptionConnectionless + _LIT(Kconnectionoriented, "connectionoriented"); // ECmWapWspOptionConnectionOriented + + // Protocol + _LIT(Kipv4, "ipv4"); + _LIT(Kipv6, "ipv6"); + + // WLAN security mode: + _LIT(Kopen, "open"); + _LIT(Kwep, "wep"); + _LIT(Ke802_1x, "e802_1x"); + _LIT(Kwpa, "wpa"); + _LIT(Kwpa2, "wpa2"); +} + +class CCreatorConnectionMethodElement : public CCreatorScriptElement +{ +public: + static CCreatorConnectionMethodElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorConnectionMethodElement(CCreatorEngine* aEngine); +}; + +#endif /*CREATORCONNECTIONMETHODELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_contactelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_contactelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,186 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORCONTACTELEMENT_H_ +#define CREATORCONTACTELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatorcontact +{ + _LIT(KContact, "contact"); + _LIT(KContactSet, "contact-set"); + _LIT(KContactGroup, "contactgroup"); + _LIT(KMembers, "members"); + _LIT(KName, "name"); + + // Contact field elements: + _LIT(KFirstname, "firstname"); + _LIT(KLastname, "lastname"); + _LIT(KFirstnameReading, "firstnamereading"); + _LIT(KLastnameReading, "lastnamereading"); + _LIT(KPrefix, "prefix"); + _LIT(KSuffix, "suffix"); + _LIT(KSecondname, "secondname"); + _LIT(KLandphoneHome, "landphonehome"); + + _LIT(KMobilephoneHome, "mobilephonehome"); + _LIT(KVideonumberHome, "videonumberhome"); + _LIT(KFaxnumberHome, "faxnumberhome"); + _LIT(KVoipHome, "voiphome"); + _LIT(KEmailHome, "emailhome"); + _LIT(KUrlHome, "urlhome"); + _LIT(KAddrlabelHome, "addrlabelhome"); + _LIT(KAddrpoHome, "addrpohome"); + + _LIT(KAddrextHome, "addrexthome"); + _LIT(KAddrstreetHome, "addrstreethome"); + _LIT(KAddrlocalHome, "addrlocalhome"); + _LIT(KAddrregionHome, "addrregionhome"); + _LIT(KAddrpostcodeHome, "addrpostcodehome"); + _LIT(KAddrcountryHome, "addrcountryhome"); + _LIT(KJobtitle, "jobtitle"); + _LIT(KCompanyname, "company"); + + _LIT(KLandphoneWork, "landphonework"); + _LIT(KMobilephoneWork, "mobilephonework"); + _LIT(KVideonumberWork, "videonumberwork"); + _LIT(KFaxnumberWork, "faxnumberwork"); + _LIT(KVoipWork, "voipwork"); + _LIT(KEmailWork, "emailwork"); + _LIT(KUrlWork, "urlwork"); + _LIT(KAddrlabelWork, "addrlabelwork"); + + _LIT(KAddrpoWork, "addrpowork"); + _LIT(KAddrextWork, "addrextwork"); + _LIT(KAddrstreetWork, "addrstreetwork"); + _LIT(KAddrlocalWork, "addrlocalwork"); + _LIT(KAddrregionWork, "addrregionwork"); + _LIT(KAddrpostcodeWork, "addrpostcodework"); + _LIT(KAddrcountryWork, "addrcountrywork"); + _LIT(KLandphoneGen, "landphonegen"); + + _LIT(KMobilephoneGen, "mobilephonegen"); + _LIT(KVideonumberGen, "videonumbergen"); + _LIT(KFaxnumberGen, "faxnumbergen"); + _LIT(KVoipGen, "voipgen"); + _LIT(KPoc, "poc"); + _LIT(KSwis, "swis"); + _LIT(KSip, "sip"); + _LIT(KEmailGen, "emailgen"); + + _LIT(KUrlGen, "urlgen"); + _LIT(KAddrlabelGen, "addrlabelgen"); + _LIT(KAddrpoGen, "addrpogen"); + _LIT(KAddrextGen, "addrextgen"); + _LIT(KAddrstreetGen, "addrstreetgen"); + _LIT(KAddrlocalGen, "addrlocalgen"); + _LIT(KAddrregionGen, "addrregiongen"); + _LIT(KAddrpostcodeGen, "addrpostcodegen"); + + _LIT(KAddrcountryGen, "addrcountrygen"); + _LIT(KPagerNumber, "pagernumber"); + _LIT(KDtmfString, "dtmfstring"); + _LIT(KWvAddress, "wvaddress"); + _LIT(KDate, "date"); + _LIT(KNote, "note"); + _LIT(KThumbnailPath, "thumbnailpath"); + _LIT(KThumbnailId, "thumbnailid"); + _LIT(KRingTone, "ringtonepath"); + _LIT(KRingToneId, "ringtoneid"); + + _LIT(KCallerobjImg, "callerobjimg"); + _LIT(KCallerobjText, "callerobjtext"); + _LIT(KMiddlename, "middlename"); + _LIT(KDepartment, "department"); + _LIT(KAsstname, "asstname"); + _LIT(KSpouse, "spouse"); + _LIT(KChildren, "children"); + _LIT(KAsstphone, "asstphone"); + + _LIT(KCarphone, "caphone"); + _LIT(KAnniversary, "anniversary"); + _LIT(KSyncclass, "synchronization"); + _LIT(KLocPrivacy, "locprivacy"); + _LIT(KGenlabel, "genlabel"); +} +/** + * Contact elements + */ + +/** + * Base class for contact elements + */ +class CCreatorContactElementBase : public CCreatorScriptElement +{ +public: + static CCreatorContactElementBase* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); +protected: + CCreatorContactElementBase(CCreatorEngine* aEngine); +}; + +/** + * Contact element + */ +class CCreatorContactElement : public CCreatorContactElementBase +{ +public: + static CCreatorContactElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); +protected: + CCreatorContactElement(CCreatorEngine* aEngine); +}; + +/** + * Contact-set element + */ +class CCreatorContactSetElement : public CCreatorContactElementBase +{ +public: + static CCreatorContactSetElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + virtual void AddToCacheL(); +protected: + CCreatorContactSetElement(CCreatorEngine* aEngine); +}; + +/** + * Contact group element + */ +class CCreatorContactGroupElement : public CCreatorContactElementBase +{ +public: + static CCreatorContactGroupElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); +protected: + CCreatorContactGroupElement(CCreatorEngine* aEngine); +}; + +/** + * Contact field element + */ +class CCreatorContactFieldElement : public CCreatorScriptElement +{ +public: + static CCreatorContactFieldElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); +protected: + CCreatorContactFieldElement(CCreatorEngine* aEngine); +}; + +#endif /*CREATORCONTACTELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_contactsetcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_contactsetcache.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,81 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORCONTACTSETCACHE_H_ +#define CREATORCONTACTSETCACHE_H_ + +#include +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#endif + +// Forward declarations +class CContactLinkCacheImp; + +class CCreatorContactSet : public CBase +{ +public: + static CCreatorContactSet* NewL(TInt aLinkId, TInt aNumOfExistingContacts); + virtual ~CCreatorContactSet(); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + void AppendL(MVPbkContactLink*); + TInt NumberOfExistingContacts() const; + RPointerArray& ContactLinks(); + const RPointerArray& ContactLinks() const; +#endif + TInt LinkId() const; + +private: + CCreatorContactSet(TInt aLinkId, TInt aNumOfExistingContacts); + //void ConstructL(); + TInt iLinkId; + TInt iNumOfExistingContacts; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + RPointerArray iContactLinks; +#endif +}; + +class MContactLinkCache +{ +public: + virtual void AppendL(CCreatorContactSet* aContactSet) = 0; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + virtual RPointerArray& ContactLinks(TInt aLinkId) = 0; + virtual const RPointerArray& ContactLinks(TInt aLinkId) const = 0; +#endif + virtual RPointerArray& ContactSets() = 0; + virtual const RPointerArray& ContactSets() const = 0; + virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const = 0; + virtual CCreatorContactSet& ContactSet(TInt aLinkId) = 0; +}; + +class ContactLinkCache +{ +public: + static void InitializeL(); + static void DestroyL(); + + static MContactLinkCache* Instance(); + +private: + ContactLinkCache(){}; + static CContactLinkCacheImp* iImp; +}; + +#endif /*CREATORCONTACTSETCACHE_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_container.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_container.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,130 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORAPPVIEW_H__ +#define __CREATORAPPVIEW_H__ + +#include + +/*! + @class CCreatorAppView + + @discussion An instance of the Application View object for the Creator + example application + */ +class CCreatorAppView : public CCoeControl + { +public: + + + +/*! + @function NewL + + @discussion Create a CCreatorAppView object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @result a pointer to the created instance of CCreatorAppView + */ + static CCreatorAppView* NewL(const TRect& aRect); + +/*! + @function NewLC + + @discussion Create a CCreatorAppView object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @result a pointer to the created instance of CCreatorAppView + */ + static CCreatorAppView* NewLC(const TRect& aRect); + + +/*! + @function ~CCreatorAppView + + @discussion Destroy the object and release all memory + */ + ~CCreatorAppView(); + +/*! + @function UserDraw + + @discussion Draw this CHelloWorldAppView to the screen + @param aRect the rectangle of this view that needs updating + */ + void UserDraw() const; + + +public: // from CCoeControl +/*! + @function Draw + + @discussion Draw this CCreatorAppView to the screen + @param aRect the rectangle of this view that needs updating + */ + void Draw(const TRect& aRect) const; + + +/*! + @function OfferKeyEventL + + @discussion Handle any user keypresses + @param aKeyEvent holds the data for the event that occurred + @param aType holds the type of key event that occured + @result a TKeyResponse indicating if the key was consumed or not + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +/*! + @function InputCapabilities + + @discussion Return the capabilities of the OfferKeyEventL + method for this class + @result a TCoeInputCapabilities indicating the capabilities + for this class + */ + TCoeInputCapabilities InputCapabilities() const; + + + +private: + +/*! + @function ConstructL + + @discussion Perform the second phase construction of a CCreatorAppView object + @param aRect the rectangle this view will be drawn to + */ + void ConstructL(const TRect& aRect); + +/*! + @function CCreatorAppView + + @discussion Perform the first phase of two phase construction + */ + CCreatorAppView(); + + + TBool MMC_OK() const; + +public: + void HandleResourceChange(TInt aType); + }; + + +#endif // __CREATORAPPVIEW_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_document.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_document.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,96 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_DOCUMENT_H__ +#define __CREATOR_DOCUMENT_H__ + + +#include + +// Forward references +class CCreatorAppUi; +class CEikApplication; + + +/*! + @class CCreatorDocument + + @discussion An instance of class CCreatorDocument is the Document part of the AVKON + application framework for the Creator example application + */ +class CCreatorDocument : public CAknDocument + { +public: + +/*! + @function NewL + + @discussion Construct a CCreatorDocument for the AVKON application aApp + using two phase construction, and return a pointer to the created object + @param aApp application creating this document + @result a pointer to the created instance of CCreatorDocument + */ + static CCreatorDocument* NewL(CEikApplication& aApp); + +/*! + @function NewLC + + @discussion Construct a CCreatorDocument for the AVKON application aApp + using two phase construction, and return a pointer to the created object + @param aApp application creating this document + @result a pointer to the created instance of CCreatorDocument + */ + static CCreatorDocument* NewLC(CEikApplication& aApp); + +/*! + @function ~CCreatorDocument + + @discussion Destroy the object and release all memory objects + */ + ~CCreatorDocument(); + +/*! + @function CreateAppUiL + + @discussion Create a CCreatorAppUi object and return a pointer to it + @result a pointer to the created instance of the AppUi created + */ + CEikAppUi* CreateAppUiL(); +private: + +/*! + @function ConstructL + + @discussion Perform the second phase construction of a CCreatorDocument object + */ + void ConstructL(); + +/*! + @function CCreatorDocument + + @discussion Perform the first phase of two phase construction + @param aApp application creating this document + */ + CCreatorDocument(CEikApplication& aApp); + + }; + + +#endif // __CREATOR_DOCUMENT_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_factory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_factory.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,42 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 TCREATORFACTORY_H_ +#define TCREATORFACTORY_H_ + +#include "creator_modulebase.h" + +class CCreatorEngine; +class CCreatorPhonebookBase; +class CCreatorConnectionSettingsBase; + + +class TCreatorFactory{ + +public: + static CCreatorPhonebookBase* CreatePhoneBookL(CCreatorEngine* aEngine); + static CCreatorModuleBaseParameters* CreatePhoneBookParametersL(); + + static CCreatorConnectionSettingsBase* CreateConnectionSettingsL(CCreatorEngine* aEngine); + static CCreatorModuleBaseParameters* CreateConnectionSettingsParametersL(); + + +}; + +#endif /*TCREATORFACTORY_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_file.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_file.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,96 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORFiles_H__ +#define __CREATORFiles_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" + +#include +using namespace ContentAccess; + +#include +#include +#include +#include // RApaLsSession + +class CCreatorEngine; +class CFilesParameters; +class CDRMPermission; +class CDRMConstraint; + +class CCreatorFiles : public CBase, public MCreatorModuleBase + { +public: + static CCreatorFiles* NewL(CCreatorEngine* aEngine); + static CCreatorFiles* NewLC(CCreatorEngine* aEngine); + ~CCreatorFiles(); + +private: + CCreatorFiles(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + TInt CreateFileEntryL(CFilesParameters *aParameters, TInt aCommand); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +private: + + void EncryptFileL( const TDesC& aFileName, const TDesC& aOutFileName, CFilesParameters *aParameters ); + void SetPermissionsL( CMetaDataArray* aMetaData, const TDesC& aOutFileName, CFilesParameters *aParameters ); + void SetMimeTypeL( const TDesC& aFileName, TDes8& aMime, CFilesParameters *aParameters ); + TBool AskDRMDataFromUserL(); + TBool AskDRMCDDataFromUserL(); + void StorePathsForDeleteL( CDesCArray& aPaths ); + void GenerateFileNameL( TFileName& aRootName ); + +private: + CFilesParameters* iParameters; + CFilesParameters* iUserParameters; + HBufC* iDirectoryQueriedFromUser; + RFs& iFs; + RApaLsSession iApaLs; + CDesCArray* iFilePaths; + TInt iFileId; + +public: + }; + + +class CFilesParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iFullFilePath; + TInt iFileCommand; + CDRMPermission* iPermission; + TBool iEncrypt; + +public: + CFilesParameters(); + CFilesParameters( CFilesParameters& aCopy ); + ~CFilesParameters(); + }; + + + +#endif // __CREATORFiles_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_fileelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_fileelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,66 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORFILEELEMENT_H_ +#define CREATORFILEELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatorfile +{ + _LIT(KFile, "file"); + _LIT(KType, "type"); + _LIT(KDirectory, "directory"); + _LIT(KDefaultDir, "c:\\data"); + _LIT(KEncryption, "encryption"); + _LIT(KDRMRight, "right"); + _LIT(KDRMFL, "DRM-FL"); + _LIT(KDRMCD, "DRM-CD"); + _LIT(KDRMPlayRight, "play"); + _LIT(KDRMDisplayRight, "display"); + _LIT(KDRMPrintRight, "print"); + _LIT(KDRMExecuteRight, "execute"); + _LIT(KDRMCount, "count"); + _LIT(KDRMInterval, "interval"); + _LIT(KDRMStartTime, "starttime"); + _LIT(KDRMEndTime, "endtime"); + _LIT(KDRMAccumulated, "accumulated"); +} + +class CDRMConstraint; +class CFilesParameters; + +class CCreatorFileElement : public CCreatorScriptElement +{ +public: + static CCreatorFileElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorFileElement(CCreatorEngine* aEngine); + TInt GetFileCommandL( const TDesC& aFileIdStr, TBool aRandom ) const; +private: + void ParseDRMElementsL( CCreatorScriptElement* aField, CFilesParameters* aParam ); + void ParseDRMConstraintsL( CCreatorScriptElement* aRight, CDRMConstraint* aConstraint ); + TTimeIntervalSeconds ParseTimeInterval( TDesC& aTimeString ); +private: // Data + TInt64 iTimeZone; +}; + +#endif // CREATORFILEELEMENT_H_ \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_imps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_imps.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,88 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORIMPS_H__ +#define __CREATORIMPS_H__ + +#ifdef __PRESENCE + +#include "creator_model.h" +#include "creator_modulebase.h" + +#include + +#include +#include + + +class CCreatorEngine; +class CIMPSParameters; + + +class CCreatorIMPS : public CBase, public MCreatorModuleBase + { +public: + static CCreatorIMPS* NewL(CCreatorEngine* aEngine); + static CCreatorIMPS* NewLC(CCreatorEngine* aEngine); + ~CCreatorIMPS(); + +private: + CCreatorIMPS(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + TInt CreateIMPSServerEntryL(CIMPSParameters *aParameters); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +private: + CIMPSSAPSettingsStore* iIMPSSAPSettingsStore; + + CIMPSParameters* iParameters; + RArray iEntryIds; // TUint32 CIMPSSAPSettings::Uid() + +public: + }; + + +class CIMPSParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iServerName; + HBufC* iServerURL; + HBufC* iServerUsername; + HBufC* iServerPassword; + HBufC* iServerAccessPointName; + + void SetRandomNameL(CCreatorEngine& aEngine); + void SetRandomUrlL(CCreatorEngine& aEngine); + void SetRandomUsernameL(CCreatorEngine& aEngine); + void SetRandomPasswordL(CCreatorEngine& aEngine); + void SetDefaultAccessPointL(); + +public: + CIMPSParameters(); + ~CIMPSParameters(); + }; + +#endif //__PRESENCE + +#endif // __CREATORIMPS_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_impselement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_impselement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORIMPSSERVERELEMENT_H_ +#define CREATORIMPSSERVERELEMENT_H_ + +#ifdef __PRESENCE + +#include "creator_scriptelement.h" + +namespace creatorimps +{ + _LIT(KImpsServer, "impsserver"); + _LIT(KName, "name"); + _LIT(KUrl, "url"); + _LIT(KUsername, "username"); + _LIT(KPassword, "password"); + _LIT(KConnectionMethodName, "connectionmethodname"); + _LIT(KDefault, "default"); +} + +class CCreatorImpsServerElement : public CCreatorScriptElement +{ +public: + static CCreatorImpsServerElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorImpsServerElement(CCreatorEngine* aEngine); +}; + +#endif // __PRESENCE + +#endif /*CREATORIMPSSERVERELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_landmark.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_landmark.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,104 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 LANDMARKS_H_ +#define LANDMARKS_H_ + +#include "creator_model.h" +#include "creator_modulebase.h" + +#include +#include + +class CLandmarkParameters; +class CPosLandmarkDatabase; +class CPosLmOperation; + +static const TInt KLandmarkFieldLength = 256; + +class CCreatorLandmarks : public CBase, public MCreatorModuleBase + { +public: + static CCreatorLandmarks* NewL(CCreatorEngine* aEngine); + static CCreatorLandmarks* NewLC(CCreatorEngine* aEngine); + ~CCreatorLandmarks(); + +private: + CCreatorLandmarks(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + TPosLmItemId GetCategoryIdL( TPosLmGlobalCategory aGlobalCategoryID ); + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + TInt CreateLandmarkEntryL(CLandmarkParameters *aParameters); + static TPosLmGlobalCategory GetCategoryIdL(const TDesC& aCategoryStr); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +private: + CPosLandmarkDatabase* iLandmarkDb; + CLandmarkParameters* iParameters; + CPosLmOperation* iLmOperation; + RArray iEntryIds; // TPosLmItemId (==TUint32) CPosLandmark::LandmarkId() +public: + }; + + +class CLandmarkParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iName; + RArray iCategories; + HBufC* iStreet; + HBufC* iCity; + HBufC* iState; + HBufC* iCountry; + HBufC* iPostCode; + HBufC* iDescription; + HBufC* iPhonenumber; + HBufC* iUrl; + TReal64 iLatitude; + TReal64 iLongitude; + TReal32 iPositionAccuracy; + TReal32 iAltitude; + TReal32 iAltitudeAccuracy; + + void SetRandomNameL(CCreatorEngine& aEngine); + void SetRandomUrlL(CCreatorEngine& aEngine); + void AddRandomCategoryL(CCreatorEngine& aEngine); + void SetRandomStreetL(CCreatorEngine& aEngine); + void SetRandomCityL(CCreatorEngine& aEngine); + void SetRandomStateL(CCreatorEngine& aEngine); + void SetRandomCountryL(CCreatorEngine& aEngine); + void SetRandomPostCodeL(CCreatorEngine& aEngine); + void SetRandomLatitudeL(CCreatorEngine& aEngine); + void SetRandomLongitudeL(CCreatorEngine& aEngine); + void SetRandomPositionAccuracyL(CCreatorEngine& aEngine); + void SetRandomAltitudeL(CCreatorEngine& aEngine); + void SetRandomAltitudeAccuracyL(CCreatorEngine& aEngine); + void SetRandomDescriptionL(CCreatorEngine& aEngine); + void SetRandomPhoneNumberL(CCreatorEngine& aEngine); + +private: + +public: + CLandmarkParameters(); + ~CLandmarkParameters(); + }; +#endif /*LANDMARKS_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_landmarkelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_landmarkelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,55 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORLANDMARKELEMENT_H_ +#define CREATORLANDMARKELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatorlandmark +{ + _LIT(KLandmark, "landmark"); + _LIT(KName, "name"); + _LIT(KCategory, "category"); + _LIT(KDescription, "description"); + _LIT(KStreet, "street"); + _LIT(KPostalcode, "postalcode"); + _LIT(KCity, "city"); + _LIT(KState, "state"); + _LIT(KCountry, "country"); + _LIT(KPhonenumber, "phonenbr"); + _LIT(KUrl, "url"); + _LIT(KLatitude, "latitude"); + _LIT(KLongitude, "longitude"); + _LIT(KPositionaccuracy, "positionaccuracy"); + _LIT(KAltitude, "altitude"); + _LIT(KAltitudeaccuracy, "altitudeaccuracy"); +} + +class CCreatorLandmarkElement : public CCreatorScriptElement +{ +public: + static CCreatorLandmarkElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorLandmarkElement(CCreatorEngine* aEngine); +}; + +#endif /*CREATORLANDMARKELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_log.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_log.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,114 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORLOGS_H__ +#define __CREATORLOGS_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" + + +#include +#include +#include +#include + + + +class CCreatorEngine; +class CLogsParameters; + +// Creator log ids: +typedef TInt32 TLogIdCreator; +typedef TInt8 TLogDurationTypeCreator; +typedef TUint32 TLogDurationCreator; +typedef TUint32 TLogLinkCreator; + +const TLogIdCreator KLogNullIdCreator = -1; +const TLogLinkCreator KLogNullLinkCreator = 0; +const TLogDurationTypeCreator KLogNullDurationTypeCreator = -1; +const TLogDurationCreator KLogNullDurationCreator = 0; +const TLogDurationTypeCreator KLogDurationNoneCreator = 0; +const TLogDurationTypeCreator KLogDurationValidCreator = 1; +const TLogDurationTypeCreator KLogDurationDataCreator = 2; + + + + +class CCreatorLogs : public CActive, public MCreatorModuleBase + { +public: + static CCreatorLogs* NewL(CCreatorEngine* aEngine); + static CCreatorLogs* NewLC(CCreatorEngine* aEngine); + ~CCreatorLogs(); + +private: + CCreatorLogs(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + + void RunL(); // from CActive + void DoCancel(); // from CActive + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + + TInt CreateMissedCallEntryL(CLogsParameters *aParameters); + TInt CreateReceivedCallEntryL(CLogsParameters *aParameters); + TInt CreateDialledNumberEntryL(CLogsParameters *aParameters); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +private: + CLogClient* iLogClient; + CLogEvent* iLogEvent; + CActiveSchedulerWait iLogWriteWait; + + CLogsParameters* iParameters; + RArray iEntryIds; // TLogId ( == TInt32) CLogEvent::Id() + +public: + }; + + +class CLogsParameters : public CCreatorModuleBaseParameters + { +public: + /*HBufC* iMissedCallPhoneNumber; + TTime iMissedCallEventTime; + + HBufC* iReceivedCallPhoneNumber; + TTime iReceivedCallEventTime; + TLogDuration iReceivedCallDuration; + + HBufC* iDialledNumberPhoneNumber; + TTime iDialledNumberEventTime; + TLogDuration iDialledNumberDuration;*/ + HBufC* iPhoneNumber; + TTime iEventTime; + TLogDuration iDuration; + +public: + CLogsParameters(); + ~CLogsParameters(); + }; + + + +#endif // __CREATORLOGS_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_logelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_logelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORLOGELEMENT_H_ +#define CREATORLOGELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatorlog +{ + _LIT(KLog, "log"); + _LIT(KDirection, "direction"); + _LIT(KDuration, "duration"); + _LIT(KPhonenumber, "phonenumber"); + _LIT(KDatetime, "datetime"); + _LIT(KMissed, "missed"); + _LIT(KIn, "in"); + _LIT(KOut, "out"); +} + +class CCreatorLogElement : public CCreatorScriptElement +{ +public: + static CCreatorLogElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorLogElement(CCreatorEngine* aEngine); + TInt GetLogCommandL( const TDesC& aFileIdStr, TBool aRandom ) const; +}; + +#endif /*CREATORLOGELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_mailbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_mailbox.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,188 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORMAILBOXES_H__ +#define __CREATORMAILBOXES_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" + + +#include +#include +#include +#include +#include +#include +#include +#include + +class CCreatorEngine; +class CMailboxesParameters; + +const TInt KDefaultSmtpPort = 25; + +enum TMailboxType + { + EMailboxPOP3, + EMailboxIMAP4 + }; + +class CCreatorMailboxes : public CBase, public MCreatorModuleBase, public MMsvSessionObserver + { +public: + static CCreatorMailboxes* NewL(CCreatorEngine* aEngine); + static CCreatorMailboxes* NewLC(CCreatorEngine* aEngine); + ~CCreatorMailboxes(); + +private: + CCreatorMailboxes(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver + void StoreIMEIToEntryL(const TMsvId aMailboxId); + void GetIMEIFromThePhoneL(); + + void PopulateSmtpSettingsL( + CEmailAccounts& aEmailAccount, + CImSmtpSettings& aSmtpSettings, + CImIAPPreferences& aIApSettings, + const CMailboxesParameters& aParameters ); + + void PopulateImapSettingsL( + CEmailAccounts& aEmailAccount, + CImImap4Settings& aImapSettings, + CImIAPPreferences& aIApSettings, + const CMailboxesParameters& aParameters ); + + void PopulatePopSettingsL( + CEmailAccounts& aEmailAccount, + CImPop3Settings& aPopSettings, + CImIAPPreferences& aIApSettings, + const CMailboxesParameters& aParameters ); + + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + TInt CreateMailboxEntryL(CMailboxesParameters *aParameters); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + + +private: + CMailboxesParameters* iParameters; + TBuf<50> iIMEI; + RArray iEntryIds; + +public: + }; + + +class CMailboxesParameters : public CCreatorModuleBaseParameters + { +public: +// HBufC* iMailboxName; +// HBufC* iAccessPoint; +// HBufC* iMyMailAddress; +// HBufC* iOutgoingMailServer; +// TBool iSendMessageImmediately; +// TBool iSendCopyToSelf; +// TBool iIncludeSignature; +// HBufC* iUserName; +// HBufC* iPassword; +// HBufC* iIncomingMailServer; +// TMailboxType iMailboxType; // IMAP4 or POP3 +// TBool iSecurityOn; // SecureSockets +// TBool iSSLWrapper; // SSL Wrapper +// TBool iAPOPSecureLogin; // POP3 only +// TBool iRetrieveAttachment; // IMAP4 only +// TInt32 iRetrieveHeaders; // IMAP4 only + + enum TGetEmailOption + { + EUndef = 0, + EGetHeaders, + EGetBodyText, + EGetBodyTextAndAttachments, + EGetAttachments, + EGetBodyAlternativeText, + EGetEmailOptionLast + }; + + HBufC* iMailboxName; + HBufC* iIncomingLoginName; + HBufC* iIncomingPassword; + HBufC* iIncomingServerName; + HBufC* iIncomingConnectionMethod; + HBufC* iIncomingFolderPath; + HBufC* iPathSeparator; + HBufC* iOutgoingLoginName; + HBufC* iOutgoingPassword; + HBufC* iOutgoingServerName; + HBufC* iOutgoingConnectionMethod; + HBufC* iOwnEmailAddress; + HBufC* iOwnEmailAlias; + HBufC* iReceiptAddress; + HBufC* iReplyToAddress; + + TInt iIncomingPort; + TInt iAttachmentSizeLimit; + TInt iBodyTextSizeLimit; + TInt iAttachmentFetchSize; + TInt iImapIdleTimeout; + TInt iMaxEmailSize; + TInt iSyncRate; + TInt iInboxSyncLimit; // -1 = All + TInt iMailboxSyncLimit; // -1 = All + TInt iOutgoingPort; + TInt iToCCIncludeLimit; + + TBool iIncomingSSLWrapper; + TBool iIncomingSecureSockets; + TBool iAcknowledgeReceipts; + TBool iAutoSendOnConnect; + TBool iDeleteEmailsAtDisconnect; + TBool iImapIdleCommand; + TBool iMarkSeenInSync; + TBool iEnableExpungeMode; + TBool iUseApop; + TBool iDisconnectedUserMode; + TBool iOutgoingSSLWrapper; + TBool iOutgoingSecureSockets; + TBool iIncludeSignature; + TBool iAddVCard; + TBool iRequestReceipts; + TBool iSmtpAuth; + + TGetEmailOption iGetEmailOptions; + TFolderSubscribeType iSubscribeType; + TFolderSyncType iSyncType; + TImSMTPSendCopyToSelf iSendCopyToSelf; + TImSMTPSendMessageOption iSendOption; + TMailboxType iMailboxType; // IMAP4 or POP3 + +public: + CMailboxesParameters(); + ~CMailboxesParameters(); + }; + + + +#endif // __CREATORMAILBOXES_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_mailboxelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_mailboxelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,129 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORMAILBOXELEMENT_H_ +#define CREATORMAILBOXELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatormailbox +{ + _LIT(Kmailbox, "mailbox"); + _LIT(Kname, "name"); + _LIT(Kincomingport, "incomingport"); + _LIT(Kincomingsslwrapper, "incomingsslwrapper"); + _LIT(Kincomingsecuresockets, "incomingsecuresockets"); + _LIT(Kincomingloginname, "incomingloginname"); + _LIT(Kincomingpassword, "incomingpassword"); + _LIT(Kincomingservername, "incomingservername"); + _LIT(Kincomingconnectionmethod, "incomingconnectionmethod"); + _LIT(Kacknowledgereceipts, "acknowledgereceipts"); + _LIT(Kattachmentsizelimit, "attachmentsizelimit"); + _LIT(Kautosendonconnect, "autosendonconnect"); + _LIT(Kbodytextsizelimit, "bodytextsizelimit"); + _LIT(Kdeletemailsatdisconnect, "deletemailsatdisconnect"); + _LIT(Kattachmentfetchsize, "attachmentfetchsize"); + _LIT(Kincomingfolderpath, "incomingfolderpath"); + _LIT(Kpathseparator, "pathseparator"); + _LIT(Kgetemailoptions, "getemailoptions"); + _LIT(Kimapidlecommand, "imapidlecommand"); + _LIT(Kimapidletimeout, "imapidletimeout"); + _LIT(Kmaxemailsize, "maxemailsize"); + _LIT(Ksubscribetype, "subscribetype"); + _LIT(Ksyncrate, "syncrate"); + _LIT(Kfoldersynctype, "foldersynctype"); + _LIT(Kmarkseeninsync, "markseeninsync"); + _LIT(Kenableexpungemode, "enableexpungemode"); + _LIT(Kuseapopsecurelogin, "useapopsecurelogin"); + _LIT(Kinboxsynclimit, "inboxsynclimit"); + _LIT(Kmailboxsynclimit, "mailboxsynclimit"); + _LIT(Kdisconnectedusermode, "disconnectedusermode"); + _LIT(Koutgoingport, "outgoingport"); + _LIT(Koutgoingsslwrapper, "outgoingsslwrapper"); + _LIT(Koutgoingsecuresockets, "outgoingsecuresockets"); + _LIT(Koutgoingloginname, "outgoingloginname"); + _LIT(Koutgoingpassword, "outgoingpassword"); + _LIT(Koutgoingservername, "outgoingservername"); + _LIT(Koutgoingconnectionmethod, "outgoingconnectionmethod"); + _LIT(Kincludesignature, "includesignature"); + _LIT(Kaddvcard, "addvcard"); + _LIT(Kownemail, "ownemail"); + _LIT(Kemailalias, "emailalias"); + _LIT(Kreceiptaddress, "receiptaddress"); + _LIT(Kreplytoaddress, "replytoaddress"); + _LIT(Krequestreceipts, "requestreceipts"); + _LIT(Ksmtpauth, "smtpauth"); + _LIT(Kcopytoself, "copytoself"); + _LIT(Ksendoption, "sendoption"); + _LIT(Ktoccincludelimit, "toccincludelimit"); + + + // Get email options: + _LIT(Kgetheaders, "getheaders"); + _LIT(Kgetbodytext, "getbodytext"); + _LIT(Kgetbodytextandattachments, "getbodytextandattachments"); + _LIT(Kgetattachments, "getattachments"); + _LIT(Kgetbodyalternativetext, "getbodyalternativetext"); + + // Subscribe types: + _LIT(Kupdateneither, "updateneither"); + _LIT(Kupdatelocal, "updatelocal"); + _LIT(Kupdateremote, "updateremote"); + _LIT(Kupdateboth, "updateboth"); + + // Folder sync. types: + _LIT(Kusecombination, "usecombination"); + _LIT(Kuselocal, "uselocal"); + _LIT(Kuseremote, "useremote"); + + // Send copy to self option: + _LIT(Kno, "no"); + _LIT(Kto, "to"); + _LIT(Kcc, "cc"); + _LIT(Kbcc, "bcc"); + + // Send option: + _LIT(Kimmediately, "immediately"); + _LIT(Konnextconnection, "onnextconnection"); + _LIT(Konrequest, "onrequest"); + + // Mailbox types: + _LIT(KMailboxType, "type"); + _LIT(Kpop3, "pop3"); + _LIT(Kimap4, "imap4"); + _LIT(Ksyncml, "syncml"); +} + +class CCreatorMailboxElement : public CCreatorScriptElement +{ +public: + static CCreatorMailboxElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorMailboxElement(CCreatorEngine* aEngine); + TBool SetTextParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* aParams, TBool aSetRandom ); + TBool SetBooleanParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* aParams, TBool aSetRandom ); + TBool SetIntegerParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* aParams, TBool aSetRandom ); + TBool SetEnumParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* aParams, TBool aSetRandom ); + + TBool GetBooleanValueL(const TDesC& aElemContent, TBool aSetRandom); +}; + +#endif /*CREATORMAILBOXELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_message.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_message.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,226 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORMESSAGES_H__ +#define __CREATORMESSAGES_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#include +#include +class CVPbkContactManager; +#endif + +class CCreatorEngine; +class CMessagesParameters; +class CAsyncWaiter; + +enum TMessageType + { + ESMS = 0, + EMMS, + EAMS, + EEmail, + ESmartMessage, + EIrMessage, + EBTMessage + }; + +enum TFolderType + { + EInbox = 0, + EDrafts, + EOutbox, + ESent, + EMailbox + }; + +class CRecipientInfo : public CBase +{ +public: + CRecipientInfo(); + virtual ~CRecipientInfo(); + + void SetPhoneNumber(HBufC* aPhone); + void SetEmailAddress(HBufC* aEmail); + const HBufC* PhoneNumber() const; + const HBufC* EmailAddress() const; + +private: + HBufC* iPhoneNumber; + HBufC* iEmailAddress; +}; + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +class CCreatorMessages : public CBase, public MCreatorModuleBase, public MMsvSessionObserver, + public MVPbkSingleContactOperationObserver, public MVPbkContactStoreListObserver, public MVPbkContactFindObserver +#else +class CCreatorMessages : public CBase, public MCreatorModuleBase, public MMsvSessionObserver +#endif + { +public: + static CCreatorMessages* NewL(CCreatorEngine* aEngine); + static CCreatorMessages* NewLC(CCreatorEngine* aEngine); + ~CCreatorMessages(); + +private: + CCreatorMessages(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + + TInt CreateSMSEntryL(const CMessagesParameters& parameters); + TInt CreateMMSEntryL(const CMessagesParameters& parameters); + TInt CreateAMSEntryL(const CMessagesParameters& parameters); + TInt CreateEmailEntryL(const CMessagesParameters& parameters); + TInt CreateSmartMessageEntryL(const CMessagesParameters& parameters); + TInt CreateObexEntryL(TUid aMtm, const CMessagesParameters& parameters); + void HandleAttachementsL(const CMessagesParameters& parameters, CMsvStore* store, TInt err ); + void HandleAttachementL(CMsvStore* store, TInt err, TFileName& sourceFileName ); + + CMsvEntrySelection* DoGetListOfAccountsL(CMsvSession& aSession, TUid aMtm, TBool aAlwaysListHidden); + TMsvId DefaultServiceForMTML(CMsvSession& aSession, TUid aMtm, TBool aFindFirstServiceIfNoDefault); + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver + + void AddRecipientsL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress ); + void GetLinkedAddressesL( RPointerArray& aAddressArray, + const RArray& aLinkIds, + TBool aUseEmailAddress, + TInt aNumOfExistingAddresses ); + + void GetAllRecipientsL(RPointerArray& aRecipientArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress ); + void SetSenderToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress); + void SetRecipientToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress); + void AddSenderToMtmAddresseeL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress ); + void AddMtmSenderL(CMmsClientMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress ); + void GetSendersL(RPointerArray& aSenderArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress, TInt aMaxNum ); + void DeleteAllMessagesL( TBool aOnlyCreatedWithCreator ); + void DeleteAllFromFolderL( const TMsvId aContext, CMsvSession* aSession, CSmsClientMtm* aClientMtm, TBool aOnlyCreatedWithCreator = EFalse ); + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + + TInt CreateMessageEntryL(CMessagesParameters *aParameters, TBool aTakeUserGivenParameters=EFalse); + TInt CreateRandomMessageEntryL(TInt aCommand); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + // From MVPbkSingleContactOperationObserver: + virtual void VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& aOperation, + MVPbkStoreContact* aContact ); + + virtual void VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& aOperation, + TInt aError ); + + void HandleSingleContactResultL(); + + // From MVPbkContactStoreListObserver + virtual void OpenComplete(); + virtual void StoreReady(MVPbkContactStore&); + virtual void StoreUnavailable(MVPbkContactStore&, TInt); + virtual void HandleStoreEventL(MVPbkContactStore&, TVPbkContactStoreEvent); + + // From MVPbkContactFindObserver + virtual void FindCompleteL( MVPbkContactLinkArray* aResults ); + virtual void FindFailed( TInt aError ); +#endif + +private: + CMessagesParameters* iParameters; + TMessageType iMessageType; + TFolderType iFolderType; + TInt iDefinedMessageLength; + CArrayFixFlat* iAttachments; + //RPointerArray iAttachmentPaths; + TBool iCreateAsUnread; + TMsvId iUserSelectedMailbox; + HBufC* iTmpPhoneNumber; + HBufC* iTmpEmail; + RArray iEntryIds; // TMsvId ( == TInt32 ) TMsvEntry::Id() + CMsvSession* iSession; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + MVPbkContactLinkArray* iExistingContacts; + CVPbkContactManager* iContactManager; + MVPbkContactStore* iStore; + MVPbkStoreContact* iTempContact; +#endif + CAsyncWaiter* iWaiter; + RPointerArray iSenderArray; + RPointerArray iRecipientArray; +public: + }; + + +class CMessagesParameters : public CCreatorModuleBaseParameters + { +public: + TMessageType iMessageType; + TFolderType iFolderType; + HBufC* iSenderAddress; + HBufC* iRecipientAddress; + RPointerArray iRecipientAddressArray; + HBufC* iMessageSubject; + HBufC* iMessageBodyText; + CArrayFixFlat* iAttachments; + RPointerArray iAttachmentPaths; + TInt iDefinedMessageLength; + TUid iBIOMessageType; + TBool iCreateAsUnread; + RArray iRecipientLinkIds; + RArray iSenderLinkIds; + TInt iNumberOfExistingRecipients; + TInt iNumberOfExistingSenders; + +public: + CMessagesParameters(); + ~CMessagesParameters(); + }; + + + +#endif // __CREATORMESSAGES_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_messageelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_messageelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,92 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORMESSAGEELEMENT_H_ +#define CREATORMESSAGEELEMENT_H_ + +#include "creator_scriptelement.h" +#include "creator_message.h" + +namespace creatormsg +{ + _LIT(KMessage, "message"); + _LIT(KType, "type"); + _LIT(KTo, "to"); + _LIT(KFrom, "from"); + _LIT(KFolder, "folder"); + _LIT(KSubject, "subject"); + _LIT(KText, "text"); + _LIT(KAttachmentPath, "attachmentpath"); + _LIT(KAttachmentId, "attachmentid"); + _LIT(KStatus, "status"); + _LIT(KSms, "sms"); + _LIT(KMms, "mms"); + _LIT(KAms, "ams"); + _LIT(KEmail, "email"); + _LIT(KSmart, "smart"); + _LIT(KBt, "bt"); + _LIT(KIr, "ir"); + _LIT(KSent, "sent"); + _LIT(KInbox, "inbox"); + _LIT(KDraft, "draft"); + _LIT(KOutbox, "outbox"); + _LIT(KMailbox, "mailbox"); + _LIT(KRead, "read"); + _LIT(KNew, "new"); +} + +/* + * Builds message parameters from the parsed script and adds a command to the engine + */ +class CCreatorMessageElement : public CCreatorScriptElement +{ +public: + static CCreatorMessageElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); +protected: + CCreatorMessageElement(CCreatorEngine* aEngine); + /* + * Creates message address. The address type is based on the message type. + * @return Phone number string for SMS, MMS, AMS and Smart messages. Email address for other types. + * @param msgType Message type. + */ + HBufC* CreateMessageAddressLC(const TDesC& msgType); + /* + * Sets message type to parameters + * @param aParameters Message parameters + * @param aMsgTypeStr Message type string + */ + void SetMessageTypeL(CMessagesParameters& aParameters, const TDesC& aMsgTypeStr ) const; + /* + * Gets length of the random data + * @return Length of the random data + * @param aRandomLenStr String defining the random length (from the script) + * @param aMsgType Message type string + */ + TInt GetRandomBodyLengthL(const TDesC& aRandomLenStr, const TDesC& aMsgType ) const; + /* + * Gets maximum length of the body text + * @return Maximum length of the body text + * @param aMsgType Message type string + */ + TInt GetMaxBodyLength( const TDesC& aMsgType ) const; + +}; + + +#endif /*CREATORMESSAGEELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_model.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_model.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,455 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORENGINE_H__ +#define __CREATORENGINE_H__ + + +#include "creator_appui.h" +#include "creator.hrh" + +#include "creator_std.h" +#include "creator_scriptentry.h" +#include "creator_modulebase.h" +#include "creator_browser.h" +#include "creator_calendar.h" +#include "creator_phonebookbase.h" +#include "creator_note.h" +#include "creator_log.h" +#include "creator_connectionmethodbase.h" +#include "creator_mailbox.h" +#include "creator_imps.h" +#include "creator_message.h" +#include "creator_landmark.h" +#include "creator_randomdataparser.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //TFrameInfo + +class CCreatorAppUi; +class TCommand; +class CCreatorBrowser; +class CCreatorCalendarBase; +class CCreatorNotepad; +class CCreatorLogs; +class CCreatorAccessPoints; +class CCreatorMailboxes; +class CCreatorIMPS; +class CCreatorFiles; +class CCreatorMessages; +class CCreatorLandmarks; +class CDictionaryFileStore; +class CImageDecoder; +class CFbsBitmap; +class CBitmapScaler; + +// Common constant for undefined integer value: +const TInt KUndef = KErrNotFound; + +class CCreatorEngine : public CActive, public MProgressDialogCallback + { +public: + + enum TRandomStringType + { + EFirstName = 0, + ESurname, + ECompany, + EAddress, + EJobTitle, + EPhoneNumber, + EGroupName, + EMeetingReason, + EMeetingPlace, + EMemoText, + EAnniversaryReason, + EToDoText, + EReminderText, + EMessageSubject, + EMessageText, + ECity, + ECountry, + EPostcode, + EState, + EPobox, + EPrefix, + ESuffix, + ELandmarkName, + ELandmarkDescription + }; + + +// note! changing order will cause regression in other modules + + enum TTestDataPath + { + EJPEG_25kB = 0, + EJPEG_200kB, + EJPEG_500kB, + EPNG_15kB, + EGIF_2kB, + ERNG_1kB, + EMIDI_10kB, + EWAVE_20kB, + EAMR_20kB, + EExcel_15kB, + EWord_20kB, + EPowerPoint_40kB, + EText_10kB, + EText_70kB, + E3GPP_70kB, + EMP3_250kB, + EAAC_100kB, + ERM_95kB, + EBMP_25kB, + EHTML_20kB, + EJAD_1kB, + EJAR_10kB, + EJP2_65kB, + EMP4_200kB, + EMXMF_40kB, + ERAM_1kB, + ESVG_15kB, + ESWF_15kB, + ETIF_25kB, + EVCF_1kB, + EVCS_1kB, + ESISX_10kB, + EWMA_50kB, + EWMV_200kB, + ESavedDeck_1kB, + LAST_FILE_ID//When you add new items to enum, add them before last item, so random number generations does not need to be updated also + }; + + enum TRandomDateType + { + EDatePast, + EDateFuture + }; + +public: + static CCreatorEngine* NewL(CCreatorAppUi* aAppUi); + ~CCreatorEngine(); + +private: + CCreatorEngine(); + void ConstructL(CCreatorAppUi* aAppUi); + void Init(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + + void ExecuteFirstCommandL(const TDesC& aText); + void ExecuteCommand(); + void StartEnginesL(); + void ShutDownEnginesL(); + void CheckForMoreCommandsL(); + void DialogDismissedL(TInt aButtonId); //from MProgressDialogCallback + + TBool IsDeleteCommand( TInt aCommand ); + + TInt ReadRandomDataL(const TRandomStringType aRandomStringType, + const TInt aResourceId, + const TDesC& aFilename, + const CCreatorRandomDataParser::TRandomDataType aRandomDataType); + void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName ); + void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize ); + +public: + void ExecuteOptionsMenuCommandL(TInt aCommand); + void RunScriptL(); + TInt RunScriptL(const TDesC& aScriptFile); + + void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1); + TInt CommandArrayCount(); + + TBool EntriesQueryDialogL(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero=EFalse); + TBool TimeQueryDialogL(TTime& aTime, TInt aResourceId); + TBool YesNoQueryDialogL(const TDesC& aPrompt); + + TPtrC TestDataPathL(enum TTestDataPath aTestDataPath); + TPtrC RandomSoundFileL(); // Returns temporary path, which will be removed on shutdown + TPtrC RandomPictureFileL(); // Returns temporary path, which will be removed on shutdown + TPtrC CreateRandomSoundFileL(); // Copies file to new location and returns the new path + TPtrC CreateSoundFileL(TTestDataPath aId); // Copies file to new location and returns the new path + + void CopyFileL(const TFileName& aSourceFile, const TFileName& aTargetFile, TBool aOverwrite = EFalse ); + /* + * Gets attacment file id based on the file id string + * @return Attachment file id + * @param aAttachmentIdStr Attachment file id string + */ + TInt GetAttachmentIdL( const TDesC& aAttachmentIdStr ) const; + + TUint32 GetDefaultIAPL(); + TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse ); + + TPtrC RandomString(enum TRandomStringType aRandomStringType); + TInt RandomNumber(TInt aRange); + TInt RandomNumber(TInt aMin, TInt aMax); + TTime RandomDate(TRandomDateType type, TInt aMinDays = 0, TInt aMaxDays = 360 ); + TTime RandomDate(TTime baseTime, TRandomDateType type, TInt aMinDays = 0, TInt aMaxDays = 360); + TTime RandomTime(TTime baseTime, TRandomDateType type, TInt aMinHours=0, TInt aMaxHours=24, TInt aMinMinutes=0, TInt aMaxMinutes=60 ); + CDesCArrayFlat* SoundFilesL(); + CDesCArrayFlat* PictureFilesL(); + + HBufC* CreateEmailAddressLC(); + HBufC* CreateHTTPUrlLC(); + HBufC* CreateRandomStringLC(TInt aStrLen); + + HBufC* CreateEmailAddressLC( + const TDesC& firstname, + const TDesC& lastname, + const TDesC& domain, + const TDesC& country ) const; + + HBufC* CreateUrlLC( + const TDesC& protocol, + const TDesC& prefix, + const TDesC& domain, + const TDesC& country) const; + + void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath); + + TBool GetRandomDataFilenameL(TDes& aFilename); + TBool GetRandomDataFromFileL(const TDesC& aFilename); + void CancelComplete(); + CDictionaryFileStore* FileStoreLC(); + void ReadEntryIdsFromStoreL( RArray& aEntryIds, const TUid aModuleUid ); + void WriteEntryIdsToStoreL( RArray& aEntryIds, const TUid aModuleUid ); + void ReadEntryIdsFromStoreL( RArray& aEntryIds, const TUid aModuleUid ); + void WriteEntryIdsToStoreL( RArray& aEntryIds, const TUid aModuleUid ); + void RemoveStoreL( const TUid aModuleUid ); + +private: + // needed by the engine itself + RTimer iTimer; + CEikonEnv* iEnv; + CCreatorAppUi* iAppUi; + TInt iCurrentEntry; + TInt iEntriesToBeCreated; + TInt iFailedCommands; + + CDesCArrayFlat* iSoundFileArray; + CDesCArrayFlat* iPictureFileArray; + CCommandArray* iCommandArray; + RPointerArray iParameterArray; + // progress bar + CAknProgressDialog* iProgressDialog; + CEikProgressInfo* iProgressInfo; + + // for the random data generator + TInt64 iSeed; + + class TStringArrayPtr + { + public: + TStringArrayPtr(TRandomStringType aType, CDesCArray* aPtr) + { + iStringType = aType; + iArrayPtr = aPtr; + }; + TRandomStringType iStringType; + CDesCArray* iArrayPtr; + }; + + RArray iStringArrays; + + // modules + CCreatorBrowser* iBrowser; + CCreatorCalendarBase* iCalendar; + CCreatorPhonebookBase* iPhonebook; + CCreatorNotepad* iNotepad; + CCreatorLogs* iLogs; + CCreatorConnectionSettingsBase* iAccessPoints; + CCreatorMailboxes* iMailboxes; + CCreatorIMPS* iIMPS; + CCreatorFiles* iFiles; + CCreatorMessages* iMessages; + CCreatorLandmarks* iLandmarks; + + // options menu command home module + MCreatorModuleBase* iUsedOptionsMenuModule; + + HBufC* iTempPath; + + RPointerArray iAllocatedFilePaths; + TBool iUserCancelled; + + // For generating missing bitmaps + HBufC8* iBitmapData; + CFbsBitmap* iBitmap; + CFbsBitmap* iScaledBitmap; + CImageDecoder* iDecoder; + TFrameInfo iFrameinfo; + CImageEncoder* iEncoder; + CFrameImageData* iFrameImageData; + CBitmapScaler* iScaler; + +public: + + }; + +// this class contains a command which will be executed +class TCommand + { +public: + TInt iCommandId; + CCreatorModuleBaseParameters* iParameters; +public: + TCommand(TInt aCommandId, CCreatorModuleBaseParameters* aParameters); + ~TCommand(); + + }; + + +// utility class for waiting for asychronous requests +class CAsyncWaiter : public CActive + { +public: + static CAsyncWaiter* NewL( TInt aPriority = EPriorityStandard ); + static CAsyncWaiter* NewLC( TInt aPriority = EPriorityStandard ); + ~CAsyncWaiter(); + + void StartAndWait(); + TInt Result() const; + +private: + CAsyncWaiter( TInt aPriority ); + + // from CActive + void RunL(); + void DoCancel(); + +private: + CActiveSchedulerWait iWait; + TInt iError; + }; + + +/* + * Maps file id string (file name) to TTestDataPath (file id) and TCreatorIds (command id) + */ +// File ids: + + _LIT(K3GPP_70KB, "3GPP-70kB"); + _LIT(KAAC_100KB, "AAC-100kB"); + _LIT(KAMR_20KB, "AMR-20kB"); + _LIT(KXLS_15KB, "XLS-15kB"); + _LIT(KGIF_2KB, "GIF-2kB"); + _LIT(KJPEG_200KB, "JPEG-200kB"); + _LIT(KJPEG_25KB, "JPEG-25kB"); + _LIT(KJPEG_500KB, "JPEG-500kB"); + _LIT(KMIDI_10KB, "MIDI-10kB"); + _LIT(KMP3_250KB, "MP3-250kB"); + _LIT(KPNG_15KB, "PNG-15kB"); + _LIT(KPPT_40KB, "PPT-40kB"); + _LIT(KRM_95KB, "RM-95kB"); + _LIT(KRNG_1KB, "RNG-1kB"); + _LIT(KTXT_10KB, "TXT-10kB"); + _LIT(KTXT_70KB, "TXT-70kB"); + _LIT(KWAV_20KB, "WAV-20kB"); + _LIT(KDOC_20KB, "DOC-20kB"); + _LIT(KSWF_15KB, "SWF-15kB"); + _LIT(KJAD_1KB, "JAD-1kB"); + _LIT(KJAR_10KB, "JAR-10kB"); + _LIT(KTIF_25KB, "TIF-25kB"); + _LIT(KMXMF_40KB, "MXMF-40kB"); + _LIT(KBMP_25KB, "BMP-25kB"); + _LIT(KJP2_25KB, "JP2-25kB"); + _LIT(KSVG_15KB, "SVG-15kB"); + _LIT(KHTML_20KB, "HTML-20kB"); + _LIT(KVCF_1KB, "VCF-1kB"); + _LIT(KVCS_1KB, "VCS-1kB"); + _LIT(KMP4_200KB, "MP4-200kB"); + _LIT(KSISX_10KB, "SISX-10kB"); + _LIT(KRAM_1KB, "RAM-1kB"); + _LIT(KDECK_1KB, "DECK-1kB"); + _LIT(KWMA_50KB, "WMA-50kB"); + _LIT(KWMV_200KB, "WMV-200kB"); + +class FileMapping + { + public: + FileMapping(const TDesC& aFileName, TInt aFileId, TInt aCommandId ); + const TDesC& FileName() const; + TInt FileId() const; + TInt CommandId() const; + + private: + const TDesC& iFileName; + TInt iFileId; + TInt iCommandId; + }; + + /* + * This table contains the string <-> TTestDataPath mappings for the file types + */ + static FileMapping FileMap[] = + { + + FileMapping(K3GPP_70KB, CCreatorEngine::E3GPP_70kB, ECmdCreateFileEntry3GPP_70kB), + FileMapping(KAAC_100KB, CCreatorEngine::EAAC_100kB, ECmdCreateFileEntryAAC_100kB), + FileMapping(KAMR_20KB, CCreatorEngine::EAMR_20kB, ECmdCreateFileEntryAMR_20kB), + FileMapping(KXLS_15KB, CCreatorEngine::EExcel_15kB, ECmdCreateFileEntryXLS_15kB), + FileMapping(KGIF_2KB, CCreatorEngine::EGIF_2kB, ECmdCreateFileEntryGIF_2kB), + FileMapping(KJPEG_200KB, CCreatorEngine::EJPEG_200kB, ECmdCreateFileEntryJPEG_200kB), + FileMapping(KJPEG_25KB, CCreatorEngine::EJPEG_25kB, ECmdCreateFileEntryJPEG_25kB), + FileMapping(KJPEG_500KB, CCreatorEngine::EJPEG_500kB, ECmdCreateFileEntryJPEG_500kB), + FileMapping(KMIDI_10KB, CCreatorEngine::EMIDI_10kB, ECmdCreateFileEntryMIDI_10kB), + FileMapping(KMP3_250KB, CCreatorEngine::EMP3_250kB, ECmdCreateFileEntryMP3_250kB), + FileMapping(KPNG_15KB, CCreatorEngine::EPNG_15kB, ECmdCreateFileEntryPNG_15kB), + FileMapping(KPPT_40KB, CCreatorEngine::EPowerPoint_40kB, ECmdCreateFileEntryPPT_40kB), + FileMapping(KRM_95KB, CCreatorEngine::ERM_95kB, ECmdCreateFileEntryRM_95kB), + FileMapping(KRNG_1KB, CCreatorEngine::ERNG_1kB, ECmdCreateFileEntryRNG_1kB), + FileMapping(KTXT_10KB, CCreatorEngine::EText_10kB, ECmdCreateFileEntryTXT_10kB), + FileMapping(KTXT_70KB, CCreatorEngine::EText_70kB, ECmdCreateFileEntryTXT_70kB), + FileMapping(KWAV_20KB, CCreatorEngine::EWAVE_20kB, ECmdCreateFileEntryWAV_20kB), + FileMapping(KDOC_20KB, CCreatorEngine::EWord_20kB, ECmdCreateFileEntryDOC_20kB), + FileMapping(KBMP_25KB, CCreatorEngine::EBMP_25kB, ECmdCreateFileEntryBMP_25kB), + FileMapping(KDECK_1KB, CCreatorEngine::ESavedDeck_1kB, ECmdCreateFileEntryDeck_1kB), + FileMapping(KHTML_20KB, CCreatorEngine::EHTML_20kB, ECmdCreateFileEntryHTML_20kB), + FileMapping(KJAD_1KB, CCreatorEngine::EJAD_1kB, ECmdCreateFileEntryJAD_1kB), + FileMapping(KJAR_10KB, CCreatorEngine::EJAR_10kB, ECmdCreateFileEntryJAR_10kB), + FileMapping(KJP2_25KB, CCreatorEngine::EJP2_65kB, ECmdCreateFileEntryJP2_65kB), + FileMapping(KMP4_200KB, CCreatorEngine::EMP4_200kB, ECmdCreateFileEntryMP4_200kB), + FileMapping(KMXMF_40KB, CCreatorEngine::EMXMF_40kB, ECmdCreateFileEntryMXMF_40kB), + FileMapping(KRAM_1KB, CCreatorEngine::ERAM_1kB, ECmdCreateFileEntryRAM_1kB), + FileMapping(KSVG_15KB, CCreatorEngine::ESVG_15kB, ECmdCreateFileEntrySVG_15kB), + FileMapping(KSWF_15KB, CCreatorEngine::ESWF_15kB, ECmdCreateFileEntrySWF_15kB), + FileMapping(KTIF_25KB, CCreatorEngine::ETIF_25kB, ECmdCreateFileEntryTIF_25kB), + FileMapping(KVCF_1KB, CCreatorEngine::EVCF_1kB, ECmdCreateFileEntryVCF_1kB), + FileMapping(KVCS_1KB, CCreatorEngine::EVCS_1kB, ECmdCreateFileEntryVCS_1kB), + FileMapping(KSISX_10KB, CCreatorEngine::ESISX_10kB, ECmdCreateFileEntrySISX_10kB), + FileMapping(KWMA_50KB, CCreatorEngine::EWMA_50kB, ECmdCreateFileEntryWMA_50kB), + FileMapping(KWMV_200KB, CCreatorEngine::EWMV_200kB, ECmdCreateFileEntryWMV_200kB) + }; + +#endif // __CREATORENGINE_H__ + diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_modulebase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_modulebase.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,114 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_MODULEBASE_H__ +#define __CREATOR_MODULEBASE_H__ + +#include + +// Dictionary uids for each Creator module. +// Dictionaries are for storing item identifiers created by Creator. +// Item identifiers are for enabling deletion of only items created by Creator. +const TUid KUidDictionaryUidContacts = { 0x00 }; +const TUid KUidDictionaryUidContactGroups = { 0x01 }; +const TUid KUidDictionaryUidCalendar = { 0x02 }; +const TUid KUidDictionaryUidBrowserBookmarks = { 0x03 }; +const TUid KUidDictionaryUidFiles = { 0x04 }; +const TUid KUidDictionaryUidLogs = { 0x05 }; +const TUid KUidDictionaryUidMessages = { 0x06 }; +const TUid KUidDictionaryUidMailbox = { 0x07 }; +const TUid KUidDictionaryUidIAP = { 0x08 }; +const TUid KUidDictionaryUidIMPS = { 0x09 }; +const TUid KUidDictionaryUidNotes = { 0x0A }; +const TUid KUidDictionaryUidLandmarks = { 0x0B }; +const TUid KUidDictionaryUidBrowserSavedPg = { 0x0C }; +const TUid KUidDictionaryUidBrowserBookmarkF = { 0x0D }; +const TUid KUidDictionaryUidBrowserSavedPgF = { 0x0E }; + +class CCreatorEngine; +class MCreatorModuleBaseParameters; +class CCommandParser; + +class MCreatorModuleBase + { +public: + +private: + // constructs the module, add "iEngine = aEngine" and other construction stuff to the body + virtual void ConstructL(CCreatorEngine* aEngine) = 0; + +public: + // this one is called when user select some features directly from menu, not running a script + // should call CreateRandomData() function + // returns ETrue when success, EFalse when user has cancelled + virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) = 0; + virtual void DeleteAllL() = 0; + virtual void DeleteAllCreatedByCreatorL() = 0; + +public: + CCreatorEngine* iEngine; + +private: + + }; + + +class MCreatorModuleBaseParameters + { + // a base class for the parameters, no default implementation + + public: + enum TParseParams + { + EParamNone = 0, + ECalendarMeeting, + ECalendarMemo, + ECalendarAnniv, + ECalendarTodo + }; + +public: + virtual void ParseL(CCommandParser* /*aParser*/, TParseParams /*aCase = 0*/) = 0; + + + }; + +// Following struct represents the parameters that links for example contact groups +// to contac-sets. +typedef struct + { + TInt iLinkId; // ID + TInt iLinkAmount; // Amount of elements in linked set + } TLinkIdParam; + + +class CCreatorModuleBaseParameters : public CBase, public MCreatorModuleBaseParameters + { + public: + virtual void ParseL(CCommandParser* /*aParser*/, TParseParams /*aCase = 0*/){}; + virtual TInt ScriptLinkId() const {return -1;}; + virtual void SetScriptLinkId(TInt) {}; + // a base class for the parameters, no default implementation + }; + + + + +#endif // __CREATOR_MODULEBASE_H__ + \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_note.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_note.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,77 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORNOTEPAD_H__ +#define __CREATORNOTEPAD_H__ + +#include "creator_model.h" +#include "creator_modulebase.h" + + +#include +#include + + +static const TInt KNotepadFieldLength = 1024; + +class CCreatorEngine; +class CNotepadParameters; + + +class CCreatorNotepad : public CBase, public MCreatorModuleBase + { +public: + static CCreatorNotepad* NewL(CCreatorEngine* aEngine); + static CCreatorNotepad* NewLC(CCreatorEngine* aEngine); + ~CCreatorNotepad(); + +private: + CCreatorNotepad(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + TInt CreateNoteEntryL(CNotepadParameters *aParameters); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + +private: + CNotepadApi *iNotepadApi; + + CNotepadParameters* iParameters; + RFs& iFs; + +public: + }; + + +class CNotepadParameters : public CCreatorModuleBaseParameters + { +public: + HBufC* iNoteText; + +public: + CNotepadParameters(); + ~CNotepadParameters(); + }; + + + +#endif // __CREATORNOTEPAD_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_noteelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_noteelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORNOTEELEMENT_H_ +#define CREATORNOTEELEMENT_H_ + +#include "creator_scriptelement.h" + +namespace creatornote +{ + _LIT(KNote, "note"); + _LIT(KText, "text"); +} + +class CCreatorNoteElement : public CCreatorScriptElement +{ +public: + static CCreatorNoteElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void ExecuteCommandL(); + +protected: + CCreatorNoteElement(CCreatorEngine* aEngine); +}; + +#endif /*CREATORNOTEELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_phonebook.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_phonebook.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,117 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORPHONEBOOK_H__ +#define __CREATORPHONEBOOK_H__ + +#include "creator_model.h" +#include "creator_phonebookbase.h" + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +class CCreatorEngine; +class CCreatorModuleBaseParameters; +class CPhonebookParameters; + + +class CCreatorPhonebook : public CCreatorPhonebookBase + { +public: + static CCreatorPhonebook* NewL(CCreatorEngine* aEngine); + static CCreatorPhonebook* NewLC(CCreatorEngine* aEngine); + ~CCreatorPhonebook(); + +private: + CCreatorPhonebook(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + + TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters); + TBool IsActive(){ return EFalse; }; + void CancelOperation() {}; + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + void DeleteAllGroupsL(); + void DeleteAllGroupsCreatedByCreatorL(); + + +private: + void CompactPbkDatabase(TBool aCompressImmediately=EFalse); + void AddFieldToContactItemL(CPbkContactItem& aItem, TPbkFieldId aFieldId, const TDesC& aFieldText); + void DeleteAllItemsL( TUid aStoreUid ); + void DeleteItemsCreatedWithCreatorL( TUid aStoreUid ); + + +private: + CPbkContactEngine* iContactDBEngine; + TInt iOpCounter; + CPhonebookParameters* iParameters; + RArray iContactIds; + RArray iGroupIds; // TContactItemId ( = TInt32 ) CContactItem::Id() + RArray iEntriesToDelete; // TContactItemId ( = TInt32 ) CContactItem::Id() + +public: + }; + + +class CPhonebookParameters : public CCreatorModuleBaseParameters + { +public: + void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/); + HBufC* iContactFirstName; + HBufC* iContactLastName; + HBufC* iContactCompanyName; + HBufC* iContactJobTitle; + HBufC* iContactPostalAddress; + HBufC* iWvUserId; + HBufC* iRingingtone; + HBufC* iThumbnailImage; + HBufC* iContactPhoneNumberGeneral; TInt iNumberOfPhoneNumberFields; + HBufC* iContactURL; TInt iNumberOfURLFields; + HBufC* iContactEmailAddress; TInt iNumberOfEmailAddressFields; + + HBufC* iGroupName; + TInt iContactsInGroup; + + +public: + CPhonebookParameters(); + ~CPhonebookParameters(); + }; + + + +#endif // __CREATORPHONEBOOK_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_phonebookbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_phonebookbase.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,53 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CCREATORPHONEBOOKBASE_H_ +#define __CCREATORPHONEBOOKBASE_H_ + +#include "creator_modulebase.h" + +static const TInt KPhonebookFieldLength = 128; +static const TInt KCreateRandomAmountOfGroups = -9999; + +class CCreatorModuleBaseParameters; + +class CCreatorPhonebookBase : public CBase, public MCreatorModuleBase{ +public: + + virtual TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + virtual TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + virtual TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters) = 0; + virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase + virtual TBool IsActive() = 0; + virtual void CancelOperation() = 0; + virtual void DeleteAllGroupsL() = 0; + virtual void DeleteAllGroupsCreatedByCreatorL() = 0; + +protected: + + virtual void SetDefaultParameters(); + TInt iNumberOfPhoneNumberFields; + TInt iNumberOfURLFields; + TInt iNumberOfEmailAddressFields; + TInt iContactsInGroup; + TBool iDefaultFieldsSelected; +}; + + +#endif /*__CCREATORPHONEBOOKBASE_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_randomdatafield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_randomdatafield.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,44 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORDATAFIELD_H_ +#define CREATORDATAFIELD_H_ + +#include + +class MCreatorRandomDataField +{ +public: + enum TRandomLengthType + { + ERandomLengthUndefined, + ERandomLengthDefault, // Default length (use data from engine) + ERandomLengthMax, // Maximum length + ERandomLengthExplicit // Explicitly defined length + }; + + /** + * Set field content to random. + * @param aRandomLenType Random length type + * @param aExplicitRandomLen Random length when ERandomLengthExplicit is used. Ignored otherwise. + */ + virtual void SetRandomParametersL( TRandomLengthType aRandomLenType, TInt aRandomLen ) = 0; +}; + +#endif /*CREATORDATAFIELD_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_randomdataparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_randomdataparser.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,130 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORRANDOMDATAPARSER_H_ +#define CREATORRANDOMDATAPARSER_H_ + +#include +#include +#include +#include + +//using namespace Xml; + +class CCreatorRandomDataParser : public CBase, public Xml::MContentHandler + { + +public: + enum TRandomDataType + { + EFirstName, + ESurname, + ECompany, + EAddress, + EJobTitle, + EPhoneNumber, + EGroupName, + EMeetingReason, + EMeetingPlace, + EMemoText, + EAnniversaryReason, + EToDoText, + EReminderText, + EMessageSubject, + EMessageText, + ECity, + ECountry, + EPostcode, + EState, + EPobox, + EPrefix, + ESuffix, + ELandmarkName, + ELandmarkDescription + }; + +public: + + virtual ~CCreatorRandomDataParser(); + static CCreatorRandomDataParser* NewL(); + static CCreatorRandomDataParser* NewLC(); + CDesCArrayFlat* ParseL(const TDesC& aFileName, const TRandomDataType aDataType); + + TInt GetError() const; + +private: + + CCreatorRandomDataParser(); + void ConstructL(); + + /** + * Converts 8 bit descriptor to 16 bit descriptor + * @param aDes 8 bit descriptor to be converted + * @return Pointer to the new 16 bit descriptor + */ + HBufC* Convert8BitTo16BitLC(const TDesC8& aInput); + void GetTextFileMode(RFile& aFile, TInt& aFileSize); + + +public: + // From MContentHandler: + void OnStartDocumentL(const Xml::RDocumentParameters &aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const Xml::RTagInfo& aElement, + const Xml::RAttributeArray& aAttributes, + TInt aErrorCode); + void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, + const RString& aUri, + TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + void OnProcessingInstructionL(const TDesC8& aTarget, + const TDesC8& aData, + TInt aErrorCode); + void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + +private: + TRandomDataType iDataType; + CDesCArray* iElementNameArray; + HBufC* iContentData; + TBool iInsideRootElement; + TBool iContentParsingActive; + + CDesCArrayFlat* iResultArray; + + enum TFileFormat + { + EFormatANSIASCII, + EFormatUTF8, + EFormatUTF16LE, + EFormatUTF16BE + }; + + // XML parser + Xml::CParser* iParser; + + TFileFormat iScriptTextFormat; + TInt iLastError; +}; + +#endif /*CREATORRANDOMDATAPARSER_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_scriptelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_scriptelement.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,349 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORSCRIPTELEMENT_H_ +#define CREATORSCRIPTELEMENT_H_ + +#include "creator_randomdatafield.h" +#include "creator_modulebase.h" +#include "creator_model.h" +#include + +class CCreatorScriptElement; +class CCreatorEngine; + +_LIT(KEmpty, ""); +_LIT(KContextSep, "::"); + +// Common attributes: +_LIT(KAmount, "amount"); +_LIT(KRandomLength, "randomlength"); +_LIT(KId, "id"); +_LIT(KMaxAmount, "maxamount"); + +// Common element names: +_LIT(KScript, "creatorscript"); +_LIT(KFields, "fields"); +_LIT(KContactSetRef, "contact-set-reference"); +_LIT(KExistingContacts, "numberofexistingcontacts"); + +// Common attribute values: +_LIT(KMax, "max"); +_LIT(KDefault, "default"); +_LIT(KIncrease, "incvalueforeachcopy"); + +class CCreatorScriptElementCache : public CBase +{ +public: + static CCreatorScriptElementCache* CCreatorScriptElementCache::NewL(); + virtual ~CCreatorScriptElementCache(); + + void RemoveElements(); + void AddElementL(CCreatorScriptElement* aElement); +private: + CCreatorScriptElementCache(); + void ConstructL(); + RPointerArray iElementCache; + +}; + + +class CCreatorScriptAttribute : public CBase +{ +public: + static CCreatorScriptAttribute* NewL(const TDesC& aName, const TDesC& aValue); + static CCreatorScriptAttribute* NewLC(const TDesC& aName, const TDesC& aValue); + virtual ~CCreatorScriptAttribute(); + + TPtrC Name() const; + void SetNameL(const TDesC& aName); + TPtrC Value() const; + void SetValueL(const TDesC& aValue); + +protected: + + CCreatorScriptAttribute(); + virtual void ConstructL(const TDesC& aName, const TDesC& aValue); + +private: + HBufC* iName; + HBufC* iValue; +}; + +/** + * Base class for all elements + */ +class CCreatorScriptElement : public CBase +{ +public: + + static CCreatorScriptElement* CCreatorScriptElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + + /** + * Destructor + */ + virtual ~CCreatorScriptElement(); + + /** + * Returns the array of sub-elements. + * @return Reference to the sub-element array. + */ + virtual RPointerArray const& SubElements() const; + virtual RPointerArray& SubElements(); + + /** + * Returns a sub-element. + * @param aIndex Sub-element array index. + * @return Pointer to a sub-element + */ + virtual CCreatorScriptElement* SubElement(TInt aIndex); + + /** + * Finds a sub-element by a name. + * @param aName Name of the sub-element + * @return Pointer to the first matching sub-element. NULL if not found. + */ + virtual CCreatorScriptElement* FindSubElement(const TDesC& aName); + + /** + * Removes all sub-elements. + */ + virtual void RemoveSubElements(); + + /** + * Removes a sub-element + * @param aIndex Index of the element to be removed + */ + virtual void RemoveSubElementL(TInt aIndex); + + /** + * Adds an element to the sub-element list. + * Leaves with error KErrNotSupported, if sub-element is illegal. + * Leaves with error KErrArgument, if the index in out of bounds. + * @param aElem Pointer to the element to be added. Takes ownership of the pointer. + * @param aIndex Sub-element array index where to add the element. -1 means that + * the element is added to the end of the array. + */ + virtual void AddSubElementL(CCreatorScriptElement* aElem, TInt aIndex = -1); + + /** + * Returns the array of attributes. + * @return Reference to the attribute array. + */ + virtual RPointerArray const& Attributes() const; + + /** + * Returns an attribute. + * @param aIndex Attribute array index. + * @return Pointer to a attribute + */ + virtual CCreatorScriptAttribute* Attribute(TInt aIndex); + + /** + * Removes all attributes. + */ + virtual void RemoveAttributes(); + + /** + * Removes an attribute + * @param aIndex Index of the attribute to be removed + */ + virtual void RemoveAttributeL(TInt aIndex); + + /** + * Adds an attribute to the attribute list. + * Leaves with error KErrNotSupported, if attribute is illegal. + * @param aAttribute Pointer to the element to be added. Takes ownership of the pointer. + * @param aIndex Attribute array index where to add the attribute. -1 means that + * the attribute is added to the end of the array. + */ + virtual void AddAttributeL(CCreatorScriptAttribute* aAttribute, TInt aIndex = -1); + + /** + * Finds attribute with the given name. First match is returned. + */ + virtual const CCreatorScriptAttribute* FindAttributeByName(const TDesC& aName) const; + virtual CCreatorScriptAttribute* FindAttributeByName(const TDesC& aName); + + /** + * Returns element name + * @return Element name + */ + virtual TPtrC Name() const; + + /** + * Sets the element name. + * @param aName Element name + */ + virtual void SetNameL(const TDesC& aName); + + /** + * Returns element content + * @return Element content + */ + virtual TPtrC Content() const; + + /** + * Set the content of the element. + * @param aContenct Element content + */ + virtual void SetContentL(const TDesC& aContent); + virtual void AppendContentL(const TDesC& aContent); + + /** + * Returns element context + * @return Element context + */ + virtual TPtrC Context() const; + + /** + * Set the context of the element. + * @param aContenct Element context + */ + virtual void SetContextL(const TDesC& aContext); + + /** + * Tells whether the element should be cached for future use. + * @return ETrue if the element should be cached for future use, EFalse otherwise. + */ + virtual TBool IsCacheNeeded(); + virtual void AddToCacheL(CCreatorScriptElementCache& aCache); + virtual void AddToCacheL(); + virtual TBool IsCommandElement() const; + virtual void ExecuteCommandL(); + //virtual void SaveCommandResultsL(); + //virtual void DiscardCommandResultsL(); + virtual TBool IsRoot() const; + virtual RPointerArray& CommandParameters(); + virtual const RPointerArray& CommandParameters() const; + +protected: + + /** + * Constructors. + */ + CCreatorScriptElement(CCreatorEngine* aEngine = 0); + + /** + * @param aName Name of the element. + */ + virtual void ConstructL(const TDesC& aName, const TDesC& aContext = KNullDesC); + + /** + * Tells whethet the sub-element is allowed or not. + * @param aElem Sub-element to be tested. + * @return Boolean value telling whether the sub-element is allowed + * to be added or not. + */ + virtual TBool IsSubElementSupported(const CCreatorScriptElement& aElem) const; + + virtual MCreatorRandomDataField::TRandomLengthType ResolveRandomDataTypeL(const CCreatorScriptAttribute& aAttr, TInt& aRandomLen ) const; + + virtual TBool ConvertStrToBooleanL(const TDesC& aStr) const; + virtual TInt ConvertStrToIntL(const TDesC& aStr) const; + virtual TUint ConvertStrToUintL(const TDesC& aStr) const; + virtual void ConvertStrToReal64L(const TDesC& aStr, TReal64& aVal) const; + virtual void ConvertStrToReal32L(const TDesC& aStr, TReal32& aVal) const; + + virtual void AppendContactSetReferenceL(const CCreatorScriptElement& aContactSetRefElem, RArray& aLinkArray ) const; + + virtual void SetContentToTextParamL(HBufC*& aPtr, const TDesC& aContent ); + + virtual TTime ConvertToDateTimeL(const TDesC& aDtStr) const; + + virtual TInt CompareIgnoreCase(const TDesC& aStr1, const TDesC& aStr2 ) const; + + /** + * Increases phonenumber by aDelta. + * + * Special cases, that are handled: + * +9 -> +9, +10, +11... + * +3584098#99 -> +3584098#99, +3584098#100, +3584098#101... + * # -> #0, #1, #2... + * 123# -> 123#0, 123#1, 123#2... + * 099 -> 099, 100, 101... + * + * @param aOriginal original phonenumber + * @param aDelta number to be added to original number. Must be >= 0. + * @param aIncreased on return contains the increased number. + * The buffer must be allocated by the caller. + */ + void IncreasePhoneNumL( const TDesC& aOriginal, TInt aDelta, HBufC* aIncreased ) const; + +protected: + + // Sub-element array + RPointerArray iSubElements; + // Attribute array + RPointerArray iAttributes; + // Element name (e.g. "contact") + HBufC* iName; + // Element content + HBufC* iContent; + // Context + HBufC* iContext; + + TBool iIsCommandElement; + TBool iIsRoot; + CCreatorEngine* iEngine; + RPointerArray iParameters; +}; + +/** + * Script element + */ +class CCreatorScriptRoot : public CCreatorScriptElement +{ +public: + static CCreatorScriptRoot* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); +protected: + CCreatorScriptRoot(CCreatorEngine* aEngine); +}; + +/** + * Calendar elements + */ + +/** + * Base class for calendar elements + */ +class CCreatorCalendarElementBase : public CCreatorScriptElement +{ +public: + static CCreatorCalendarElementBase* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); +protected: + CCreatorCalendarElementBase(CCreatorEngine* aEngine); +}; + +/** + * Message elements + */ + +/** + * Base class for message elements + */ +class CCreatorMessageElementBase : public CCreatorScriptElement +{ +public: + static CCreatorMessageElementBase* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); +protected: + CCreatorMessageElementBase(CCreatorEngine* aEngine); +}; + +#endif /*CREATORSCRIPTELEMENT_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_scriptelementfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_scriptelementfactory.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORSCRIPTELEMENTFACTORY_H_ +#define CREATORSCRIPTELEMENTFACTORY_H_ + +#include "creator_scriptelement.h" + +/** + * Creates script element instance based on the element name and context. + */ +class TCreatorScriptElementFactory +{ +public: + static CCreatorScriptElement* CreateElementL(CCreatorEngine* aEngine, const TDesC& aElementName, const TDesC& aContext = KNullDesC); +}; + +#endif /*CREATORSCRIPTELEMENTFACTORY_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_scriptentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_scriptentry.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,85 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FILEUTILS_H__ +#define __FILEUTILS_H__ + + +#include "creator_model.h" + +#include +#include +#include +#include +#include +#include +#include + + +class CCreatorEngine; + +class CreatorFileUtils +{ +public: + static TInt FindFiles(CDesCArrayFlat* aFileArray, const TDesC& aFileName, const TDesC& aPath); + static TInt FindFilesRecursiveL(CDesCArrayFlat* aFileArray, const TDesC& aFileName, const TDesC& aPath); +}; + +class CCommandParser : public CBase, public MMsvSessionObserver + { +public: + static CCommandParser* NewL(CCreatorEngine* aEngine); + static CCommandParser* NewLC(CCreatorEngine* aEngine); + ~CCommandParser(); + + void StrParserL(HBufC*& aDestinationBuf, TUint aToken); + void StrParserL(HBufC8*& aDestinationBuf, TUint aToken); + +private: + CCommandParser(); + void ConstructL(CCreatorEngine* aEngine); + + TInt FindFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath); + TInt FindFiles(const TDesC& aFileName, const TDesC& aPath); + TInt ReadLineFromFileL(RFile& aInputFile); + //void ParseCommandFromDescriptorL(); + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver + +public: + void OpenScriptL(); + TBool OpenScriptL(RFile& aScriptFile); + TBool GetRandomDataFilenameL(TDes& aFilename); + +private: + CCreatorEngine* iEngine; + CDesCArrayFlat* iSearchArray; + + TInt iParserPosition; + TInt iParserOldPosition; + + HBufC8* iReadBuf; + + }; + + + +#endif // __FILEUTILS_H__ + diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_scriptparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_scriptparser.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,139 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORSCRIPTPARSER_H_ +#define CREATORSCRIPTPARSER_H_ + +#include +#include +#include + +using namespace Xml; + +class CCreatorScriptElement; +class CCreatorEngine; +class CCreatorScriptElementCache; + +class TCreatorScriptElementInfo +{ +public: + enum TElementStatus + { + EStatusUndefined, // undefined + EStatusParsing, // currently being parsed + EStatusParsed // parsed + }; + TCreatorScriptElementInfo() + { + iStatus = EStatusUndefined; + iElement = 0; + } + TCreatorScriptElementInfo(TElementStatus aStatus, CCreatorScriptElement* aElement) + { + iStatus = aStatus; + iElement = aElement; + }; + + TElementStatus iStatus; + CCreatorScriptElement* iElement; +}; + +class CCreatorScriptParser : public CBase, public MContentHandler +{ +public: + + virtual ~CCreatorScriptParser(); + static CCreatorScriptParser* NewL(CCreatorEngine* aEngine); + static CCreatorScriptParser* NewLC(CCreatorEngine* aEngine); + void ParseL(const TDesC& aFileName); + void ParseL(RFile& aFile); + + TInt GetError() const; + +private: + + CCreatorScriptParser(); + void ConstructL(CCreatorEngine* aEngine); + + /** + * Converts 8 bit descriptor to 16 bit descriptor + * @param aDes 8 bit descriptor to be converted + * @return Pointer to the new 16 bit descriptor + */ + HBufC* Convert8BitTo16BitLC(const TDesC8& aInput); + const TCreatorScriptElementInfo& LastElementInfo() const; + void GetTextFileMode(RFile& aFile, TInt& aFileSize); + + +public: + // From MContentHandler: + void OnStartDocumentL(const RDocumentParameters &aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL( const RTagInfo& aElement, + const RAttributeArray& aAttributes, + TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL( const RString& aPrefix, + const RString& aUri, + TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + void OnProcessingInstructionL( const TDesC8& aTarget, + const TDesC8& aData, + TInt aErrorCode); + void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + +private: + + enum TFileFormat + { + EFormatANSIASCII, + EFormatUTF8, + EFormatUTF16LE, + EFormatUTF16BE + }; + // XML parser + CParser* iParser; + + /** + * Element stack holding the elements that are currently being parsed. + */ + RArray iElementStack; + + /** + * Cache object containig the elements that are referred in future and thus should + * not be deleted after parsing. + */ + CCreatorScriptElementCache* iElementCache; + + /** + * Pointer to the engine + */ + CCreatorEngine* iEngine; + + TCreatorScriptElementInfo iDefaultElement; + + TFileFormat iScriptTextFormat; + TInt iLastError; +}; + +#endif /*CREATORSCRIPTPARSER_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_std.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_std.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_STD_H__ +#define __CREATOR_STD_H__ + +#include + +class TCommand; +typedef CArrayFixSeg CCommandArray; + + +#endif // __CREATOR_STD_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_traces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_traces.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,106 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_TRACES_H__ +#define __CREATOR_TRACES_H__ + +#include + + +// --------------------------------------------------------------------------- +// You change these logging method values below! Recompile the application to take changes effect. + + // logging methods + // 0 = No logging + // 1 = Flogger + // 2 = RDebug + // 3 = Flogger and RDebug + + #ifndef _DEBUG + + // Logging method for UREL builds: + #define CREATOR_LOGGING_METHOD 3 + + #else + + // Logging method for UDEB builds: + #define CREATOR_LOGGING_METHOD 3 + + #endif + + + +// --------------------------------------------------------------------------- +// Do not make any changes to lines below... + + #if CREATOR_LOGGING_METHOD == 1 || CREATOR_LOGGING_METHOD == 3 + + #include + _LIT(KLogFolder,"Creator"); + _LIT(KLogFile,"Creator_Trace.txt"); + + #endif + + #if CREATOR_LOGGING_METHOD == 2 || CREATOR_LOGGING_METHOD == 3 + + #include + + #endif + + + #if CREATOR_LOGGING_METHOD == 0 + + #define LOGTEXT(AAA) + #define LOGSTRING(AAA) + #define LOGSTRING2(AAA,BBB) + #define LOGSTRING3(AAA,BBB,CCC) + #define LOGSTRING4(AAA,BBB,CCC,DDD) + + + #elif CREATOR_LOGGING_METHOD == 1 + + #define LOGTEXT(AAA) RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA) + #define LOGSTRING(AAA) do { _LIT(tempLogDes,AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0) + #define LOGSTRING2(AAA,BBB) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB); } while (0) + #define LOGSTRING3(AAA,BBB,CCC) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC); } while (0) + #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC,DDD); } while (0) + + #elif CREATOR_LOGGING_METHOD == 2 + + #define LOGTEXT(AAA) RDebug::Print(AAA) + #define LOGSTRING(AAA) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); } while (0) + #define LOGSTRING2(AAA,BBB) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); } while (0) + #define LOGSTRING3(AAA,BBB,CCC) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); } while (0) + #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); } while (0) + + #elif CREATOR_LOGGING_METHOD == 3 + + #define LOGTEXT(AAA) RDebug::Print(AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA) + #define LOGSTRING(AAA) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0) + #define LOGSTRING2(AAA,BBB) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB); } while (0) + #define LOGSTRING3(AAA,BBB,CCC) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC); } while (0) + #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC,DDD); } while (0) + + #endif + +// --------------------------------------------------------------------------- + +#endif // __LAUNCHER_TRACES_H__ + diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_virtualphonebook.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_virtualphonebook.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,300 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATORVIRTUALPHONEBOOK_H__ +#define __CREATORVIRTUALPHONEBOOK_H__ + +#include "creator_model.h" +#include "creator_phonebookbase.h" +#include "creator_randomdatafield.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class CCreatorEngine; +class CCreatorModuleBaseParameters; + +class MVPbkStoreContact; +class MVPbkContactStore; +class CAsyncWaiter; +class CContactDatabase; +class MVPbkContactLinkArray; +class CVirtualPhonebookParameters; + + +class CCreatorVirtualPhonebook : public CCreatorPhonebookBase, + public MVPbkContactStoreListObserver, public MVPbkBatchOperationObserver, + public MVPbkContactFindObserver, public MVPbkContactObserver, public MPbk2ImageSetObserver, + public MVPbkSingleContactOperationObserver, public MVPbkContactViewObserver + { +public: + static CCreatorVirtualPhonebook* NewL(CCreatorEngine* aEngine); + static CCreatorVirtualPhonebook* NewLC(CCreatorEngine* aEngine); + ~CCreatorVirtualPhonebook(); + +private: + CCreatorVirtualPhonebook(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); + TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters); + + void AddFieldToContactItemL(MVPbkStoreContact& aItem, TPbkFieldId aFieldId, const TDesC& aFieldText); + void AddFieldToContactItemL(MVPbkStoreContact& aItem, TPbkFieldId aFieldId, const TDesC8& aFieldText); + void AddFieldToContactItemL(MVPbkStoreContact& aItem, TPbkFieldId aFieldId, const TTime& aFieldText); + + void AddImageToContactL(MVPbkStoreContact& aContact, TInt aFieldResId, const TDesC& aFileName); + TBool IsActive(); + void CancelOperation(); + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + void DeleteAllGroupsL(); + void DeleteAllGroupsCreatedByCreatorL(); + +private: + void CompactPbkDatabaseL(TBool aCompressImmediately=EFalse); + void AddFieldToParamsL(TInt aFieldType, const TDesC& aData); + void AddFieldToParamsL(TInt aFieldType, const TDesC8& aData); + void AddFieldToParamsL(TInt aFieldType, const TTime& aData); + void InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/); + TBool IsContactGroupL(const MVPbkContactLink& aLink); + void StoreLinksForDeleteL( MVPbkContactLinkArray& aLinks, TUid aStoreUid ); + void DeleteContactsL( MVPbkContactLinkArray* aContacts, TBool aGroup ); + void DeleteItemsCreatedWithCreatorL( TUid aStoreUid ); + void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore ); + TBool HasOtherThanGroupsL( MVPbkContactLinkArray* aContacts ); + +public: // MVPbkSingleContactOperationObserver + + void VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& aOperation, + MVPbkStoreContact* aContact ); + void VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& aOperation, + TInt aError ); + +private: // MVPbkContactViewObserver + + void ContactViewReady( MVPbkContactViewBase& aView ); + void ContactViewUnavailable( + MVPbkContactViewBase& aView ); + void ContactAddedToView( + MVPbkContactViewBase& aView, + TInt aIndex, + const MVPbkContactLink& aContactLink ); + void ContactRemovedFromView( + MVPbkContactViewBase& aView, + TInt aIndex, + const MVPbkContactLink& aContactLink ); + void ContactViewError( + MVPbkContactViewBase& aView, + TInt aError, + TBool aErrorNotified ); + +private: + CVPbkContactManager* iContactManager; + TInt iOpCounter; + + CVirtualPhonebookParameters* iParameters; + + static TInt iPhoneNumberFields[]; + static TInt iUrlFields[]; + static TInt iEmailFields[]; + TBool iAddAllFields; + CVPbkContactLinkArray* iContactLinkArray; + CVPbkContactLinkArray* iContactsToDelete; + CVPbkContactLinkArray* iContactGroupsToDelete; + RPointerArray iPreviousDeleteLinks; + +private: + //new variables + /// Ref: the target of the copy + MVPbkContactStore* iStore; + + CAsyncWaiter* iWaiter; + + /// Own: Contact database for this store + CContactDatabase* iContactDb; + + //Contacts found in contacts db. + MVPbkContactLinkArray* iContactResults; + // Contact groups that are found in the store. These are used in filtering + // the groups from the find results. + MVPbkContactLinkArray* iContactGroupsInStore; + + // Phonebook asynchronous operation + MVPbkContactOperationBase* iOperation; + + // Flag to indicate whether it is required to notify + // iEngine after operation is complete. This happens + // when user has cancelled the operation during + // iOperation exists. + TBool iCancelCbRequested; + + TInt iLastError; + +public: + //Observer implentation from MVPbkContactStoreListObserver + void OpenComplete(); + + //observer implentation from MVPbkContactStoreObserver + + void StoreReady(MVPbkContactStore& aContactStore); + + void StoreUnavailable(MVPbkContactStore& aContactStore, + TInt aReason); + + void HandleStoreEventL( + MVPbkContactStore& aContactStore, + TVPbkContactStoreEvent aStoreEvent); + + TAny* ContactStoreObserverExtension(TUid aExtensionUid); + + + + + +public: + //Observer implementation for MVPbkBatchOperationObserver + + void StepComplete( + MVPbkContactOperationBase& aOperation, + TInt aStepSize ); + + TBool StepFailed( + MVPbkContactOperationBase& aOperation, + TInt aStepSize, TInt aError ); + + void OperationComplete( + MVPbkContactOperationBase& aOperation ); + + TAny* BatchOperationObserverExtension( + TUid aExtensionUid ) ; + + + //-------------------------------------------- + //Observer implementation for MVPbkContactFindObserver + public: // Interface + + void FindCompleteL( MVPbkContactLinkArray* aResults ); + + void FindFailed( TInt aError ); + + TAny* ContactFindObserverExtension( + TUid aExtensionUid ); + + + + //-------------------------------------------- + //Observer implementation for MVPbkContactObserver + + public: + void ContactOperationCompleted(TContactOpResult aResult); + + void ContactOperationFailed + (TContactOp aOpCode, TInt aErrorCode, TBool aErrorNotified); + + TAny* ContactObserverExtension(TUid aExtensionUid) ; + //~MVPbkContactObserver(); + + //-------------------------------------------- + // Implementation of MPbk2ImageSetObserver: + public: + void Pbk2ImageSetComplete(MPbk2ImageOperation& aOperation); + void Pbk2ImageSetFailed(MPbk2ImageOperation& aOperation, TInt aError ); + }; + +class CCreatorContactFieldImpl; +class CCreatorContactField : public CBase, public MCreatorRandomDataField + { +public: + static CCreatorContactField* NewL(TInt aFieldType, const TDesC& aData); + static CCreatorContactField* NewL(TInt aFieldType, const TDesC8& aData); + static CCreatorContactField* NewL(TInt aFieldType, const TTime& aData); + + static CCreatorContactField* NewL(TInt aFieldType, TRandomLengthType aRandomLenType, TInt aRandomLen); + + ~CCreatorContactField(); + TInt FieldType(); + virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk); + virtual void SetRandomParametersL( MCreatorRandomDataField::TRandomLengthType aRandomLenType = MCreatorRandomDataField::ERandomLengthDefault, + TInt aRandomLen = 0 ); + virtual void ParseL(CCommandParser* parser); + +private: + CCreatorContactField(); + void ConstructL(TInt aFieldType, const TDesC& aData); + void ConstructL(TInt aFieldType, const TDesC8& aData); + void ConstructL(TInt aFieldType, const TTime& aData); + CCreatorContactFieldImpl* pImpl; + }; + + +/** + * Virtual phonebook parameters + */ + + +class CVirtualPhonebookParameters : public CCreatorModuleBaseParameters + { +public: + void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/); + + TInt CVirtualPhonebookParameters::ScriptLinkId() const; + void CVirtualPhonebookParameters::SetScriptLinkId(TInt aLinkId); + RPointerArray iContactFields; + + HBufC* iGroupName; + TInt iContactsInGroup; + TInt iNumberOfPhoneNumberFields; + TInt iNumberOfURLFields; + TInt iNumberOfEmailAddressFields; + TInt iContactSetPtr; + RArray iLinkIds; // For contactgroup. Stores the linked contact ids. + +public: + CVirtualPhonebookParameters(); + ~CVirtualPhonebookParameters(); + +private: + TInt iLinkId; // For contact. Stores the contact id + }; + + + +#endif // __CREATORVIRTUALPHONEBOOK_H__ diff -r 000000000000 -r d6fe6244b863 creator/inc/creator_wepsecuritysettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/inc/creator_wepsecuritysettings.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,142 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 CREATORWEPSECURITYSETTINGS_H_ +#define CREATORWEPSECURITYSETTINGS_H_ + +// +// Methods copied from WEPSecuritySettingsImpl.h +// (Part of : WEP Security Settings UI) +// @see \s60\mw\networking\networkingutilities\WEPSecuritySettingsUI\inc\WEPSecuritySettingsImpl.h +// + + +// INCLUDES + +//#include "creator_model.h" + +#include +#include +using namespace CommsDat; + +// FORWARD DECLARATIONS + +class CCommsDatabase; + +// Index of first key +const TInt KFirstKey = 0; + +// Index of second key +const TInt KSecondKey = 1; + +// Index of third key +const TInt KThirdKey = 2; + +// Index of fourth key +const TInt KFourthKey = 3; + +const TInt KMaxNumberofKeys = 4; + +// Number of characters for a 232 bits key +const TUint KKeyDataLength232Bits = 58; + +// The maximum length of key data +const TUint KMaxLengthOfKeyData = KKeyDataLength232Bits; + + + + +class CCreatorWEPSecuritySettings : public CBase + { +public: + static CCreatorWEPSecuritySettings* NewL(); + static CCreatorWEPSecuritySettings* NewLC(); + ~CCreatorWEPSecuritySettings(); + +private: + CCreatorWEPSecuritySettings(); + void ConstructL(); // from MCreatorModuleBase + + +public: +/** +* Save to database. +* @param aIapId Wlan Service Table Id of the IAP to be saved +* @param aCommsDb Comms database. +*/ +void SaveL( TUint32 aIapId, CCommsDatabase& aCommsDb ) const; + +public: +// Enumeration of the possible keys in use +enum TWEPKeyInUse + { + EKeyNumber1, // Key number 1 + EKeyNumber2, // Key number 2 + EKeyNumber3, // Key number 3 + EKeyNumber4 // Key number 4 + }; + + +// Enumeration of the possible authentication types +enum TWEPAuthentication + { + EAuthOpen, // Open authentication + EAuthShared // Shared authentication + }; + + +// Possible lengths of the keys +enum TWEPKeyLength + { + E40Bits, // 40 bits + E104Bits, // 104 bits + E232Bits // 232 bits + }; + + +// Possible formats of the keys +enum TWEPKeyFormat + { + EAscii, // Ascii format + EHexadecimal // Hex format + }; + + + +private: + +// Index of the key currently in use (EKeyNumber1, EKeyNumber2, +// EKeyNumber3, EKeyNumber4 +CCreatorWEPSecuritySettings::TWEPKeyInUse iKeyInUse; + +// Type of authentication (EAuthOpen, EAuthShared) +CCreatorWEPSecuritySettings::TWEPAuthentication iAuthentication; + +// Length of the key (E40Bits, E104Bits, E232Bits) +CCreatorWEPSecuritySettings::TWEPKeyLength iKeyLength[KMaxNumberofKeys]; + +// Format of the key (EAscii, EHexadecimal) +CCreatorWEPSecuritySettings::TWEPKeyFormat iKeyFormat[KMaxNumberofKeys]; + + + }; + + + +#endif /*CREATORWEPSECURITYSETTINGS_H_*/ diff -r 000000000000 -r d6fe6244b863 creator/rom/creator.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/rom/creator.iby Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,64 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __CREATOR_IBY__ +#define __CREATOR_IBY__ + +S60_APP_EXE(Creator) +S60_APP_AIF_ICONS(Creator) +S60_APP_RESOURCE(Creator) +#ifdef S60_UPGRADABLE_APP_REG_RSC + S60_UPGRADABLE_APP_REG_RSC(Creator) +#else + S60_APP_AIF_RSC(Creator) +#endif + +data=ZPRIVATE\20011383\backup_registration.xml private\20011383\backup_registration.xml +data=ZSYSTEM\Install\Creator_stub.sis \system\install\Creator_stub.sis + +// test files (remove largest files if running out of ROM space): +data=ZPRIVATE\20011383\3GPP-70kB.3gpp private\20011383\3GPP-70kB.3gpp +data=ZPRIVATE\20011383\AAC-100kB.aac private\20011383\AAC-100kB.aac +data=ZPRIVATE\20011383\AMR-20kB.amr private\20011383\AMR-20kB.amr +data=ZPRIVATE\20011383\Deck-1kB.saveddeck private\20011383\Deck-1kB.saveddeck +data=ZPRIVATE\20011383\DOC-20kB.doc private\20011383\DOC-20kB.doc +data=ZPRIVATE\20011383\HTML-20kB.html private\20011383\HTML-20kB.html +data=ZPRIVATE\20011383\JAD-1kB.jad private\20011383\JAD-1kB.jad +data=ZPRIVATE\20011383\JAR-10kB.jar private\20011383\JAR-10kB.jar +data=ZPRIVATE\20011383\JP2-65kB.jp2 private\20011383\JP2-65kB.jp2 +data=ZPRIVATE\20011383\MIDI-10kB.mid private\20011383\MIDI-10kB.mid +data=ZPRIVATE\20011383\MP3-250kB.mp3 private\20011383\MP3-250kB.mp3 +data=ZPRIVATE\20011383\MP4-200kB.mp4 private\20011383\MP4-200kB.mp4 +data=ZPRIVATE\20011383\MXMF-40kB.mxmf private\20011383\MXMF-40kB.mxmf +data=ZPRIVATE\20011383\PNG-15kB.png private\20011383\PNG-15kB.png +data=ZPRIVATE\20011383\PPT-40kB.ppt private\20011383\PPT-40kB.ppt +data=ZPRIVATE\20011383\RAM-1kB.ram private\20011383\RAM-1kB.ram +data=ZPRIVATE\20011383\RM-95kB.rm private\20011383\RM-95kB.rm +data=ZPRIVATE\20011383\RNG-1kB.rng private\20011383\RNG-1kB.rng +data=ZPRIVATE\20011383\SVG-15kB.svg private\20011383\SVG-15kB.svg +data=ZPRIVATE\20011383\SWF-15kB.swf private\20011383\SWF-15kB.swf +data=ZPRIVATE\20011383\TIF-25kB.tif private\20011383\TIF-25kB.tif +data=ZPRIVATE\20011383\VCF-1kB.vcf private\20011383\VCF-1kB.vcf +data=ZPRIVATE\20011383\VCS-1kB.vcs private\20011383\VCS-1kB.vcs +data=ZPRIVATE\20011383\WAV-20kB.wav private\20011383\WAV-20kB.wav +data=ZPRIVATE\20011383\XLS-15kB.xls private\20011383\XLS-15kB.xls +data=ZPRIVATE\20011383\SISX-10kB.sisx private\20011383\SISX-10kB.sisx +data=ZPRIVATE\20011383\WMA-50kB.wma private\20011383\WMA-50kB.wma +data=ZPRIVATE\20011383\WMV-200kB.wmv private\20011383\WMV-200kB.wmv + +#endif // __CREATOR_IBY__ diff -r 000000000000 -r d6fe6244b863 creator/scripts/browserEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/browserEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,48 @@ + + + + + + + Creator bookmark + http://example.net + User + passwd + + + + + + + + + + + + + + + + + Creator bookmarks + + + + + + + Creator saved pages + + + + + + + Creator saved page + + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/calendarEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/calendarEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,103 @@ + + + + + + + + + + + + Project meeting + Let's have a bi-weekly project meeting. Welcome everyone! + Meeting room 1 + 2008-03-27T13:02:57 + 2008-03-27T16:15:00 + weekly + 2 + 2008-03-27 + 2009-03-27 + + + + + John Doe + john.doe@example.net + + + + + + + + + + + + + + + + + + Jane + + + + + + + + + + + Appointment with Jane + 2008-02-29T14:00:00 + 2008-02-29T15:00:00 + + + + + + + + + + + Tech Days + Annual tech days, let's have fun! + 2008-05-01 + 2008-05-03 + + + + + + + Remember to buy Lotto! + 2008-02-28T18:00:00 + 2008-02-28T18:00:00 + + + + + + + + + + + + + + + Should do something...? + 2008-02-29T10:00:00 + 2008-02-29T12:00:00 + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/connectionmethodEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/connectionmethodEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,54 @@ + + + + + + CR_Example + GPRS + http://wap.example.net + connectionoriented + ipv4 + john + no + doe + no + 10.10.10.101 + 255.255.255.0 + 10.10.10.102 + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/contactEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/contactEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + John + Smith + +35800101010101 + 00101010102 + john.smith@example.com + Mr. + + + + + + + + + + + + + + + ExampleCompany Ltd. + Software Designer + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/creator.xsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/creator.xsd Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + There are three different contact related elements: contact, contact-set and contactgroup. The contact element describes one + contact in a database. The contact can be defined explicitly by giving the contact fields and their data, or it can just define the fields to be + used and let the Creator fill the fields with random data. There can also be several same type of fields, for example multiple emailwork fields. + + When contact is defined without fields sub-element, a contact with all fields containing default length random data is created. + + + + + + + + + + + + + + + + + + + + + The contact-set element can be used to bind multiple contacts together and linking them to contactgroups, messages and + calendars. When contact-set is used as a link target it must have a unique id attribute. See example usage of contact-set in + contactEx.creatorxml. + + + + + + + + + + + Amount of members in the group. Indicates how many existing contacts should be taken to the set. + + + + + + + + + + The contactgroup element describes one contact group that should be created to the device's database. + + + + + + + + + + + + + + + + + + + + Note: If alarmtime element is not set, alarm is set as not active and if alarmtime is set, alarm is set to active. + Note: If recurrentfrequency is not set, or set to not-repeated recurrentinterval will be skipped, even if set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Note: If type is not set, a directory will be created. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Data can have following format: -nn.nnnn - nn.nnnn, where positive latitude means north and negative south, zero + point is Equator. + + + + + + + Data can have following format: -nn.nnnn - nn.nnnn, where positive longitude means east and negative west, zero + point is Prime Meridian. + + + + + + + + Data can have following format: -nn.nnnn - nn.nnnn, where zero point is sea level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Root element of a Creator script. The sub-elements can be thought as 'commands', e.g. one contact element with explicitly + defined fields create one contact to the database of the device. + + + + + + + + + + Declares the script version. Can be used to indicate the evolution of each script. + + + + + + + Declares the schema version used when designing a script file. This version information must be in sync with the schema used. Schema version is defined + at the beginning of the creator.xsd file in comment block. + + + + + + + \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/scripts/filesEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/filesEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,60 @@ + + + + + + + + JPEG-25kB + c:\data\images + + + + + + + MIDI-10kB + c:\data\Sounds + + + + + + + + + 3GPP-70kB + c:\data\Videos + + + + + P0Y0M0DT0H21M1S + + 2 + + + + + + + + + GIF-2kB + c:\data\Images + + + + + P0Y0M0DT1H30M0S + + 2008-09-26T13:49:57 + 2009-03-27T16:15:00 + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/impsEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/impsEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,17 @@ + + + + + + + Creator_test_imps + + + + + + + + \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/scripts/landmarkEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/landmarkEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,52 @@ + + + + + + + CreatorExample + accommodation + business + communication + educational + entertainment + food + geographical + outdoor + people + public + religious + shopping + sightseeing + sports + transport + This is an example landmark! + Landmark street 1 + 00445 + Landmark City + Landmark State + Landmark Country + 111222333 + http://www.example.net + -76.0023 + 98.1002 + 2 + -4.1 + 3 + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 creator/scripts/logEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/logEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,45 @@ + + + + + + + missed + 2008-03-25T13:11:21 + 1115555554112 + + + + + + + in + 2008-03-24T10:21:56 + 11155554112 + 241 + + + + + + + out + 2008-03-22T12:01:06 + 0555554555 + 445 + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/mailboxEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/mailboxEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,35 @@ + + + + + + cr_pop mail + + + yes + no + no + + + + + + + + cr_imap4 mail + creator@example.net + cc + yes + yes + creator + creator + cr_mail.example.net + no + no + no + getbodytextandattachments + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/messagesEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/messagesEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + inbox + This is an example SMS created by Creator. + new + + + + + + + sent + Good music! + new + MP3-250kB + + + + + + + + + inbox + + + new + JPEG-200kB + + + + + + 123456 + inbox + This is an example SMS created by Creator. + new + + + + diff -r 000000000000 -r d6fe6244b863 creator/scripts/notepadEx.creatorxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/scripts/notepadEx.creatorxml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,27 @@ + + + + + + + This is a Creator example note! + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 creator/sis/Creator_S60-30.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/sis/Creator_S60-30.pkg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,75 @@ +; +; 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 "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"Creator"},(0x20011383),5,3,5,TYPE=SA + +; Supports S60 v 3.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\UREL\Creator.exe"-"!:\sys\bin\Creator.exe" +"\epoc32\data\z\Resource\apps\Creator_aif.mif"-"!:\Resource\Apps\Creator_aif.mif" +"\epoc32\data\z\Resource\apps\Creator.rsc"-"!:\Resource\Apps\Creator.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\Creator_reg.rsc"-"!:\private\10003a3f\import\apps\Creator_reg.rsc" +"..\group\backup_registration.xml"-"!:\private\20011383\backup_registration.xml" + +; test data: +"\epoc32\data\Z\private\20011383\3GPP-70kB.3gpp"-"!:\private\20011383\3GPP-70kB.3gpp" +"\epoc32\data\Z\private\20011383\AAC-100kB.aac"-"!:\private\20011383\AAC-100kB.aac" +"\epoc32\data\Z\private\20011383\AMR-20kB.amr"-"!:\private\20011383\AMR-20kB.amr" +"\epoc32\data\Z\private\20011383\BMP-25kB.bmp"-"!:\private\20011383\BMP-25kB.bmp" +"\epoc32\data\Z\private\20011383\Deck-1kB.saveddeck"-"!:\private\20011383\Deck-1kB.saveddeck" +"\epoc32\data\Z\private\20011383\DOC-20kB.doc"-"!:\private\20011383\DOC-20kB.doc" +"\epoc32\data\Z\private\20011383\GIF-2kB.gif"-"!:\private\20011383\GIF-2kB.gif" +"\epoc32\data\Z\private\20011383\HTML-20kB.html"-"!:\private\20011383\HTML-20kB.html" +"\epoc32\data\Z\private\20011383\JAD-1kB.jad"-"!:\private\20011383\JAD-1kB.jad" +"\epoc32\data\Z\private\20011383\JAR-10kB.jar"-"!:\private\20011383\JAR-10kB.jar" +"\epoc32\data\Z\private\20011383\JP2-65kB.jp2"-"!:\private\20011383\JP2-65kB.jp2" +"\epoc32\data\Z\private\20011383\JPEG-200kB.jpg"-"!:\private\20011383\JPEG-200kB.jpg" +"\epoc32\data\Z\private\20011383\JPEG-25kB.jpg"-"!:\private\20011383\JPEG-25kB.jpg" +"\epoc32\data\Z\private\20011383\JPEG-500kB.jpg"-"!:\private\20011383\JPEG-500kB.jpg" +"\epoc32\data\Z\private\20011383\MIDI-10kB.mid"-"!:\private\20011383\MIDI-10kB.mid" +"\epoc32\data\Z\private\20011383\MP3-250kB.mp3"-"!:\private\20011383\MP3-250kB.mp3" +"\epoc32\data\Z\private\20011383\MP4-200kB.mp4"-"!:\private\20011383\MP4-200kB.mp4" +"\epoc32\data\Z\private\20011383\MXMF-40kB.mxmf"-"!:\private\20011383\MXMF-40kB.mxmf" +"\epoc32\data\Z\private\20011383\PNG-15kB.png"-"!:\private\20011383\PNG-15kB.png" +"\epoc32\data\Z\private\20011383\PPT-40kB.ppt"-"!:\private\20011383\PPT-40kB.ppt" +"\epoc32\data\Z\private\20011383\RAM-1kB.ram"-"!:\private\20011383\RAM-1kB.ram" +"\epoc32\data\Z\private\20011383\RM-95kB.rm"-"!:\private\20011383\RM-95kB.rm" +"\epoc32\data\Z\private\20011383\RNG-1kB.rng"-"!:\private\20011383\RNG-1kB.rng" +"\epoc32\data\Z\private\20011383\SVG-15kB.svg"-"!:\private\20011383\SVG-15kB.svg" +"\epoc32\data\Z\private\20011383\SWF-15kB.swf"-"!:\private\20011383\SWF-15kB.swf" +"\epoc32\data\Z\private\20011383\TIF-25kB.tif"-"!:\private\20011383\TIF-25kB.tif" +"\epoc32\data\Z\private\20011383\TXT-10kB.txt"-"!:\private\20011383\TXT-10kB.txt" +"\epoc32\data\Z\private\20011383\TXT-70kB.txt"-"!:\private\20011383\TXT-70kB.txt" +"\epoc32\data\Z\private\20011383\VCF-1kB.vcf"-"!:\private\20011383\VCF-1kB.vcf" +"\epoc32\data\Z\private\20011383\VCS-1kB.vcs"-"!:\private\20011383\VCS-1kB.vcs" +"\epoc32\data\Z\private\20011383\WAV-20kB.wav"-"!:\private\20011383\WAV-20kB.wav" +"\epoc32\data\Z\private\20011383\XLS-15kB.xls"-"!:\private\20011383\XLS-15kB.xls" +"\epoc32\data\Z\private\20011383\SISX-10kB.sisx"-"!:\private\20011383\SISX-10kB.sisx" +"\epoc32\data\Z\private\20011383\WMA-50kB.wma"-"!:\private\20011383\WMA-50kB.wma" +"\epoc32\data\Z\private\20011383\WMV-200kB.wmv"-"!:\private\20011383\WMV-200kB.wmv" diff -r 000000000000 -r d6fe6244b863 creator/sis/Creator_S60-30.sis Binary file creator/sis/Creator_S60-30.sis has changed diff -r 000000000000 -r d6fe6244b863 creator/sis/Creator_S60-32.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/sis/Creator_S60-32.pkg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,75 @@ +; +; 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 "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"Creator"},(0x20011383),5,3,5,TYPE=SA + +; Supports S60 v 3.2 +[0x102752AE], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\UREL\Creator.exe"-"!:\sys\bin\Creator.exe" +"\epoc32\data\z\Resource\apps\Creator_aif.mif"-"!:\Resource\Apps\Creator_aif.mif" +"\epoc32\data\z\Resource\apps\Creator.rsc"-"!:\Resource\Apps\Creator.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\Creator_reg.rsc"-"!:\private\10003a3f\import\apps\Creator_reg.rsc" +"..\group\backup_registration.xml"-"!:\private\20011383\backup_registration.xml" + +; test data: +"\epoc32\data\Z\private\20011383\3GPP-70kB.3gpp"-"!:\private\20011383\3GPP-70kB.3gpp" +"\epoc32\data\Z\private\20011383\AAC-100kB.aac"-"!:\private\20011383\AAC-100kB.aac" +"\epoc32\data\Z\private\20011383\AMR-20kB.amr"-"!:\private\20011383\AMR-20kB.amr" +"\epoc32\data\Z\private\20011383\BMP-25kB.bmp"-"!:\private\20011383\BMP-25kB.bmp" +"\epoc32\data\Z\private\20011383\Deck-1kB.saveddeck"-"!:\private\20011383\Deck-1kB.saveddeck" +"\epoc32\data\Z\private\20011383\DOC-20kB.doc"-"!:\private\20011383\DOC-20kB.doc" +"\epoc32\data\Z\private\20011383\GIF-2kB.gif"-"!:\private\20011383\GIF-2kB.gif" +"\epoc32\data\Z\private\20011383\HTML-20kB.html"-"!:\private\20011383\HTML-20kB.html" +"\epoc32\data\Z\private\20011383\JAD-1kB.jad"-"!:\private\20011383\JAD-1kB.jad" +"\epoc32\data\Z\private\20011383\JAR-10kB.jar"-"!:\private\20011383\JAR-10kB.jar" +"\epoc32\data\Z\private\20011383\JP2-65kB.jp2"-"!:\private\20011383\JP2-65kB.jp2" +"\epoc32\data\Z\private\20011383\JPEG-200kB.jpg"-"!:\private\20011383\JPEG-200kB.jpg" +"\epoc32\data\Z\private\20011383\JPEG-25kB.jpg"-"!:\private\20011383\JPEG-25kB.jpg" +"\epoc32\data\Z\private\20011383\JPEG-500kB.jpg"-"!:\private\20011383\JPEG-500kB.jpg" +"\epoc32\data\Z\private\20011383\MIDI-10kB.mid"-"!:\private\20011383\MIDI-10kB.mid" +"\epoc32\data\Z\private\20011383\MP3-250kB.mp3"-"!:\private\20011383\MP3-250kB.mp3" +"\epoc32\data\Z\private\20011383\MP4-200kB.mp4"-"!:\private\20011383\MP4-200kB.mp4" +"\epoc32\data\Z\private\20011383\MXMF-40kB.mxmf"-"!:\private\20011383\MXMF-40kB.mxmf" +"\epoc32\data\Z\private\20011383\PNG-15kB.png"-"!:\private\20011383\PNG-15kB.png" +"\epoc32\data\Z\private\20011383\PPT-40kB.ppt"-"!:\private\20011383\PPT-40kB.ppt" +"\epoc32\data\Z\private\20011383\RAM-1kB.ram"-"!:\private\20011383\RAM-1kB.ram" +"\epoc32\data\Z\private\20011383\RM-95kB.rm"-"!:\private\20011383\RM-95kB.rm" +"\epoc32\data\Z\private\20011383\RNG-1kB.rng"-"!:\private\20011383\RNG-1kB.rng" +"\epoc32\data\Z\private\20011383\SVG-15kB.svg"-"!:\private\20011383\SVG-15kB.svg" +"\epoc32\data\Z\private\20011383\SWF-15kB.swf"-"!:\private\20011383\SWF-15kB.swf" +"\epoc32\data\Z\private\20011383\TIF-25kB.tif"-"!:\private\20011383\TIF-25kB.tif" +"\epoc32\data\Z\private\20011383\TXT-10kB.txt"-"!:\private\20011383\TXT-10kB.txt" +"\epoc32\data\Z\private\20011383\TXT-70kB.txt"-"!:\private\20011383\TXT-70kB.txt" +"\epoc32\data\Z\private\20011383\VCF-1kB.vcf"-"!:\private\20011383\VCF-1kB.vcf" +"\epoc32\data\Z\private\20011383\VCS-1kB.vcs"-"!:\private\20011383\VCS-1kB.vcs" +"\epoc32\data\Z\private\20011383\WAV-20kB.wav"-"!:\private\20011383\WAV-20kB.wav" +"\epoc32\data\Z\private\20011383\XLS-15kB.xls"-"!:\private\20011383\XLS-15kB.xls" +"\epoc32\data\Z\private\20011383\SISX-10kB.sisx"-"!:\private\20011383\SISX-10kB.sisx" +"\epoc32\data\Z\private\20011383\WMA-50kB.wma"-"!:\private\20011383\WMA-50kB.wma" +"\epoc32\data\Z\private\20011383\WMV-200kB.wmv"-"!:\private\20011383\WMV-200kB.wmv" diff -r 000000000000 -r d6fe6244b863 creator/sis/Creator_S60-32.sis Binary file creator/sis/Creator_S60-32.sis has changed diff -r 000000000000 -r d6fe6244b863 creator/sis/Creator_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/sis/Creator_stub.pkg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,70 @@ +; +; 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 "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"Creator"},(0x20011383),1,0,0 + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +""-"z:\sys\bin\creator.exe" +""-"z:\resource\apps\creator_aif.mif" +""-"z:\resource\apps\creator.rsc" +""-"z:\private\10003a3f\import\apps\creator_reg.rsc" +""-"z:\private\20011383\backup_registration.xml" + +; test data: +""-"z:\private\20011383\3GPP-70kB.3gpp" +""-"z:\private\20011383\AAC-100kB.aac" +""-"z:\private\20011383\AMR-20kB.amr" +""-"z:\private\20011383\BMP-25kB.bmp" +""-"z:\private\20011383\Deck-1kB.saveddeck" +""-"z:\private\20011383\DOC-20kB.doc" +""-"z:\private\20011383\GIF-2kB.gif" +""-"z:\private\20011383\HTML-20kB.html" +""-"z:\private\20011383\JAD-1kB.jad" +""-"z:\private\20011383\JAR-10kB.jar" +""-"z:\private\20011383\JP2-65kB.jp2" +""-"z:\private\20011383\JPEG-200kB.jpg" +""-"z:\private\20011383\JPEG-25kB.jpg" +""-"z:\private\20011383\JPEG-500kB.jpg" +""-"z:\private\20011383\MIDI-10kB.mid" +""-"z:\private\20011383\MP3-250kB.mp3" +""-"z:\private\20011383\MP4-200kB.mp4" +""-"z:\private\20011383\MXMF-40kB.mxmf" +""-"z:\private\20011383\PNG-15kB.png" +""-"z:\private\20011383\PPT-40kB.ppt" +""-"z:\private\20011383\RAM-1kB.ram" +""-"z:\private\20011383\RM-95kB.rm" +""-"z:\private\20011383\RNG-1kB.rng" +""-"z:\private\20011383\SVG-15kB.svg" +""-"z:\private\20011383\SWF-15kB.swf" +""-"z:\private\20011383\TIF-25kB.tif" +""-"z:\private\20011383\TXT-10kB.txt" +""-"z:\private\20011383\TXT-70kB.txt" +""-"z:\private\20011383\VCF-1kB.vcf" +""-"z:\private\20011383\VCS-1kB.vcs" +""-"z:\private\20011383\WAV-20kB.wav" +""-"z:\private\20011383\XLS-15kB.xls" +""-"z:\private\20011383\SISX-10kB.sisx" diff -r 000000000000 -r d6fe6244b863 creator/src/creator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,39 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_app.h" + +#include + + +LOCAL_C CApaApplication* NewApplication() + { + return new CCreatorApplication; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + + + + + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_accesspoint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_accesspoint.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,469 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_accesspoint.h" +#include "creator_traces.h" +#include +#include + +static const TInt KAccessPointsFieldLength = 128; + +_LIT(KCreatorAccessPointsPrefixName, "CR_"); +_LIT(KZeroIP, "0.0.0.0"); + +//---------------------------------------------------------------------------- + +CAccessPointsParameters::CAccessPointsParameters() + { + LOGSTRING("Creator: CAccessPointsParameters::CAccessPointsParameters"); + + iConnectionName = HBufC::New(KAccessPointsFieldLength); + iWapStartPage = HBufC::New(KAccessPointsFieldLength); + iGprsAcessPointName = HBufC::New(KAccessPointsFieldLength); + iIspLoginName = HBufC::New(KAccessPointsFieldLength); + iIspLoginPass = HBufC::New(KAccessPointsFieldLength); + iWapGatewayAddress = HBufC::New(KAccessPointsFieldLength); + iIspIPAddr = HBufC::New(KAccessPointsFieldLength); + iIspIPNameServer1 = HBufC::New(KAccessPointsFieldLength); + iIspIPNameServer2 = HBufC::New(KAccessPointsFieldLength); + iIspDefaultTelNumber = HBufC::New(KAccessPointsFieldLength); + iProxyServerAddress = HBufC::New(KAccessPointsFieldLength); + } + +CAccessPointsParameters::~CAccessPointsParameters() + { + LOGSTRING("Creator: CAccessPointsParameters::~CAccessPointsParameters"); + + delete iProxyServerAddress; + delete iIspDefaultTelNumber; + delete iIspIPNameServer2; + delete iIspIPNameServer1; + delete iIspIPAddr; + delete iWapGatewayAddress; + delete iIspLoginPass; + delete iIspLoginName; + delete iGprsAcessPointName; + delete iWapStartPage; + delete iConnectionName; + } + +void CAccessPointsParameters::SetRandomCMNameL(CCreatorEngine& aEngine) + { + TInt num = aEngine.RandomNumber(1, 3); + TBuf<10> apType; + + if (num==1) + apType = _L("mms"); + else if (num==2) + apType = _L("wap"); + else + apType = _L("internet"); + + TBuf<160> company = aEngine.RandomString(CCreatorEngine::ECompany); + + iConnectionName->Des() = KCreatorAccessPointsPrefixName; + iConnectionName->Des().Append( company ); + iConnectionName->Des().Append(_L(" ")); + iConnectionName->Des().Append(apType); + } + +void CAccessPointsParameters::SetRandomLoginNameL(CCreatorEngine& aEngine) + { + iIspLoginName->Des() = aEngine.RandomString(CCreatorEngine::EFirstName); + iIspLoginName->Des().LowerCase(); + } + +void CAccessPointsParameters::SetRandomLoginPassL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomSecureAuthenticationL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomPromptPasswordL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomProxyAddressL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomProxyPortL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomStartPageL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomIPAddressL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomIP4NameServer1L(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomIP4NameServer2L(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomTelephoneNumberL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomBearerTypeIsdnL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomBearerSpeedL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomWapWspOptionL(CCreatorEngine& /*aEngine*/) + {} + +void CAccessPointsParameters::SetRandomGatewayAddressL(CCreatorEngine& /*aEngine*/) + {} + +//---------------------------------------------------------------------------- + +CCreatorAccessPoints* CCreatorAccessPoints::NewL(CCreatorEngine* aEngine) + { + CCreatorAccessPoints* self = CCreatorAccessPoints::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorAccessPoints* CCreatorAccessPoints::NewLC(CCreatorEngine* aEngine) + { + CCreatorAccessPoints* self = new (ELeave) CCreatorAccessPoints; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorAccessPoints::CCreatorAccessPoints() + { + } + +void CCreatorAccessPoints::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorAccessPoints::ConstructL"); + + iEngine = aEngine; + + iCommsDb = CCommsDatabase::NewL();; + iApDataHandler = CApDataHandler::NewLC(*iCommsDb); + CleanupStack::Pop(); + iApUtils = CApUtils::NewLC(*iCommsDb); + CleanupStack::Pop(); + } + +CCreatorAccessPoints::~CCreatorAccessPoints() + { + LOGSTRING("Creator: CCreatorAccessPoints::~CCreatorAccessPoints"); + + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidIAP ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + delete iApUtils; + delete iApDataHandler; + delete iCommsDb; + + if (iParameters) + delete iParameters; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorAccessPoints::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorAccessPoints::AskDataFromUserL"); + + if( aCommand == ECmdDeleteIAPs ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all Access Points?") ); + } + else if( aCommand == ECmdDeleteCreatorIAPs ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all Access Points created with Creator?") ); + } + + return iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?")); + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorAccessPoints::CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters) + { + LOGSTRING("Creator: CCreatorAccessPoints::CreateAccessPointEntryL"); + + CAccessPointsParameters* parameters = (CAccessPointsParameters*) aParameters; + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + + + // random data needed if no predefined data available + if (!parameters) + { + TBuf<160> company = iEngine->RandomString(CCreatorEngine::ECompany); + TInt num = iEngine->RandomNumber(1, 3); + TBuf<10> apType; + + if (num==1) + apType = _L("mms"); + else if (num==2) + apType = _L("wap"); + else + apType = _L("internet"); + + iParameters = new(ELeave) CAccessPointsParameters; + parameters = iParameters; + + parameters->SetRandomCMNameL(*iEngine); + + // in random mode just create GPRS access points + parameters->iBearerType = EApBearerTypeGPRS; + + parameters->SetRandomLoginNameL(*iEngine); + + iParameters->iIspLoginPass->Des() = iEngine->RandomString(CCreatorEngine::ESurname); + iParameters->iIspLoginPass->Des().LowerCase(); + + iParameters->iSecureAuthentication = EFalse; + iParameters->iPromptPassword = EFalse; + + iParameters->iProxyServerAddress->Des() = _L("127.0.0.1"); + iParameters->iProxyPortNumber = 80; + + iParameters->iWapStartPage->Des() = _L("http://"); + iParameters->iWapStartPage->Des().Append(apType); + iParameters->iWapStartPage->Des().Append(_L(".")); + iParameters->iWapStartPage->Des().Append(company); + iParameters->iWapStartPage->Des().Append(_L(".com")); + iParameters->iWapStartPage->Des().LowerCase(); + + iParameters->iIspIPAddr->Des() = KZeroIP; + iParameters->iIspIPNameServer1->Des() = KZeroIP; + iParameters->iIspIPNameServer1->Des() = KZeroIP; + iParameters->iGprsAcessPointName->Des() = apType; + iParameters->iIspDefaultTelNumber->Des() = iEngine->RandomString(CCreatorEngine::EPhoneNumber); + iParameters->iIspBearerCallTypeIsdn = ECallTypeISDNv110; + iParameters->iIspBearerSpeed = KSpeed14400; + + iParameters->iWapWspOption = EWapWspOptionConnectionOriented; + iParameters->iWapGatewayAddress->Des() = KZeroIP; + } + else + { + // otherwise replace the parameters object + iParameters = parameters; + } + + TInt err = KErrNone; + + // access point item + CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); + + // set the bearer type, if it fails try to set a default type + TRAPD(bearerErr, apItem->SetBearerTypeL(iParameters->iBearerType)); + if (bearerErr != KErrNone) + { + iParameters->iBearerType = EApBearerTypeGPRS; + TRAPD(bearerErr2, apItem->SetBearerTypeL(iParameters->iBearerType)); + bearerErr2=bearerErr2; + } + + if (iParameters->iBearerType == EApBearerTypeGPRS) // GPRS + { + err = apItem->WriteLongTextL(EApGprsAccessPointName, iParameters->iGprsAcessPointName->Des()); + } + else // CSD or HCSD + { + err = apItem->WriteTextL(EApIspDefaultTelNumber, iParameters->iIspDefaultTelNumber->Des()); + err = apItem->WriteUint(EApIspBearerCallTypeIsdn, iParameters->iIspBearerCallTypeIsdn); + err = apItem->WriteUint(EApIspBearerSpeed, iParameters->iIspBearerSpeed); + } + + err = apItem->WriteTextL(EApIspLoginName, iParameters->iIspLoginName->Des()); + err = apItem->WriteTextL(EApIspIfAuthName, iParameters->iIspLoginName->Des()); + err = apItem->WriteTextL(EApIspLoginPass, iParameters->iIspLoginPass->Des()); + err = apItem->WriteTextL(EApIspIfAuthPass, iParameters->iIspLoginPass->Des()); + err = apItem->WriteTextL(EApGprsIfAuthPassword, iParameters->iIspLoginPass->Des()); + err = apItem->WriteBool(EApIspDisablePlainTextAuth, iParameters->iSecureAuthentication); + err = apItem->WriteBool(EApIspPromptForLogin, iParameters->iPromptPassword); + err = apItem->WriteTextL(EApWapGatewayAddress, iParameters->iWapGatewayAddress->Des()); + err = apItem->WriteLongTextL(EApProxyServerAddress, iParameters->iProxyServerAddress->Des()); + err = apItem->WriteUint(EApProxyPortNumber, iParameters->iProxyPortNumber); + err = apItem->WriteLongTextL(EApWapStartPage, iParameters->iWapStartPage->Des()); + err = apItem->WriteUint(EApWapWspOption, iParameters->iWapWspOption); + err = apItem->WriteTextL(EApGprsIPNameServer1, iParameters->iIspIPNameServer1->Des()); + err = apItem->WriteTextL(EApGprsIPNameServer2, iParameters->iIspIPNameServer2->Des()); + err = apItem->WriteTextL(EApIspIPAddr, iParameters->iIspIPAddr->Des()); + + + TUint32 uid = iApDataHandler->CreateFromDataL(*apItem); // save the access point, returns the uid of the AP + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( uid ); + + TBuf<256> name = iParameters->iConnectionName->Des(); + iApUtils->SetNameL(name, uid); // sets the AP name + + + // if no defaults set, set the created AP as a default + + // MMS access point + if (iParameters->iWapStartPage->Des().FindF(_L("mms")) >=0 || iParameters->iConnectionName->Des().FindF(_L("mms")) >=0 ) + { + //User::Panic(_L("Not done yet..."), 123); + } + + + // WAP access point + else if (iParameters->iConnectionName->Des().FindF(_L("wap")) >=0 || iParameters->iGprsAcessPointName->Des().FindF(_L("wap")) >= 0) + { + TUint32 defID = 0; + TRAP( err, defID = iApDataHandler->DefaultL(ETrue) ); // ETrue==WAP + + if (defID <= 1) + TRAP( err, iApDataHandler->SetAsDefaultL(uid, EIspTypeWAPOnly) ); + + } + + // Internet access point + else if (iParameters->iConnectionName->Des().FindF(_L("internet")) >=0 || iParameters->iGprsAcessPointName->Des().FindF(_L("internet")) >= 0) + { + TUint32 defID = 0; + TRAP( err, defID = iApDataHandler->DefaultL(EFalse) ); // EFalse==IAP + + if (defID <= 1) + TRAP( err, iApDataHandler->SetAsDefaultL(uid, EIspTypeInternetOnly) ); // <-- POSSIBLY NOT CORRECT, NEEDS MORE TESTING + } + + + + CleanupStack::PopAndDestroy(); //apItem + + return err; + } + +//---------------------------------------------------------------------------- + +TUint32 CCreatorAccessPoints::AccessPointNameToIdL(const TDesC& aAPName, TBool /*aAnyIfNotFound*/ ) + { + LOGSTRING("Creator: CCreatorEngine::AccessPointNameToIdL"); + + TBuf<256> apName = aAPName.Left(256); + apName.Trim(); + + TUint32 APId = iEngine->GetDefaultIAPL(); + + // return default IAP if requested + if (apName.CompareF(_L("DEFAULT-IAP")) == 0 || apName.CompareF(_L("DEFAULT")) == 0) + { + return APId; + } + + CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP); + CleanupStack::PushL(db); + CApUtils* apUtils = CApUtils::NewLC(*db); + CApSelect* apSelect = CApSelect::NewLC(*db, KEApIspTypeAll, EApBearerTypeAll, KEApSortNameAscending); + + + // loop through all access points and try to find a matching name + if (apSelect->MoveToFirst()) + { + do + { + TBuf<256> apName2; + apUtils->NameL(apSelect->Uid(), apName2); + apName2.Trim(); + + if (apName2.CompareF( apName ) == 0) + { + // match found, get uid and break the loop + TRAPD( err, APId = apUtils->IapIdFromWapIdL(apSelect->Uid()) ); + err=err; + break; + } + } + while (apSelect->MoveNext()); + } + + CleanupStack::PopAndDestroy(3); //apSelect, apUtils, db + + return APId; + } + +//---------------------------------------------------------------------------- + +void CCreatorAccessPoints::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) // from MMsvSessionObserver + { + } + +//---------------------------------------------------------------------------- +void CCreatorAccessPoints::DeleteAllL() + { + LOGSTRING("Creator: CCreatorEngine::DeleteAllL"); + + CApSelect* selector = CApSelect::NewLC( *iCommsDb, + KEApIspTypeAll, + EApBearerTypeAllBearers, + KEApSortUidAscending ); + + CApListItemList* list = new (ELeave) CApListItemList(); + CleanupStack::PushL( list ); + TInt count = selector->AllListItemDataL( *list ); + for ( TInt i = 0; i < count; i++ ) + { + TRAP_IGNORE( iApDataHandler->RemoveAPL( (*list)[i]->Uid() ) ); + } + + CleanupStack::PopAndDestroy( list ); + CleanupStack::PopAndDestroy( selector ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Logs related registry + iEngine->RemoveStoreL( KUidDictionaryUidIAP ); + } + +//---------------------------------------------------------------------------- + +void CCreatorAccessPoints::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorEngine::DeleteAllCreatedByCreatorL"); + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidIAP ); + + // delete entries + for ( TInt i = 0; i < iEntryIds.Count(); i++ ) + { + TRAP_IGNORE( iApDataHandler->RemoveAPL( iEntryIds[i] ) ); + } + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Logs related registry + iEngine->RemoveStoreL( KUidDictionaryUidIAP ); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_app.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_document.h" +#include "creator_app.h" + +CApaDocument* CCreatorApplication::CreateDocumentL() + { + // Create an Creator document, and return a pointer to it + CApaDocument* document = CCreatorDocument::NewL(*this); + return document; + } + +TUid CCreatorApplication::AppDllUid() const + { + // Return the UID for the Creator application + return KUidCreatorApp; + } + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_appui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_appui.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,360 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator.pan" +#include "creator_appui.h" +#include "creator_container.h" +#include "creator.hrh" + +#include +#include +#include +#include +#include +#include +#include +#include + +// delay before script running and application exiting in seconds +// when script is run from command line +const TInt KCommandLineDelay = 3; + +// ConstructL is called by the application framework +void CCreatorAppUi::ConstructL() + { + BaseConstructL(EAknEnableSkin); + + iAppView = CCreatorAppView::NewL(ClientRect()); + + AddToStackL(iAppView); + + iEnv=CEikonEnv::Static(); + + iEngine = CCreatorEngine::NewL(this); + + iMode = ETimerModeNone; + iTickCount = 0; + iTimer = CHeartbeat::NewL(0); + + // parse script name and random data file name from command line + iCommandLineScriptName = HBufC::NewL(User::CommandLineLength()); + iCommandLineRandomDataFileName = HBufC::NewL(User::CommandLineLength()); + HBufC* commandLine = HBufC::NewLC(User::CommandLineLength()); + TPtr16 ptr = commandLine->Des(); + User::CommandLine(ptr); + commandLine->Des().Trim(); + + TInt pos = commandLine->Des().Find(_L(" ")); + if (pos != KErrNotFound) + { + iCommandLineScriptName->Des().Copy(commandLine->Des().Left(pos)); + iCommandLineRandomDataFileName->Des().Copy(commandLine->Des().Mid(pos)); + iCommandLineRandomDataFileName->Des().Trim(); + } + else + { + iCommandLineScriptName->Des().Copy(commandLine->Des()); + iCommandLineRandomDataFileName->Des().Copy(KNullDesC); + } + + CleanupStack::PopAndDestroy(commandLine); + + if (iCommandLineScriptName->Des().Length() > 0) + { + iMode = ETimerModeStartScript; + iTimer->Start(ETwelveOClock, this); + } + } + + +CCreatorAppUi::CCreatorAppUi() + { + // add any construction that cannot leave here + } + + +CCreatorAppUi::~CCreatorAppUi() + { + + delete iCommandLineRandomDataFileName; + delete iCommandLineScriptName; + + if (iTimer) + { + iTimer->Cancel(); + delete iTimer; + iTimer = NULL; + } + + delete iEngine; + + if (iAppView) + { + RemoveFromStack(iAppView); + delete iAppView; + iAppView = NULL; + } + } + + +// handle any menu commands +void CCreatorAppUi::HandleCommandL(TInt aCommand) + { + switch(aCommand) + { + // main menus, not assigned to any commands + case ECmdCreateCalendarEntries: + case ECmdCreateBrowserEntries: + case ECmdCreateFileEntries: + case ECmdCreateLogEntries: + case ECmdCreateMessagingEntries: + case ECmdCreateMiscEntries: + case ECmdCreatePhoneBookEntries: + { + User::Panic (_L("Unused command"), 102); + } + break; + + // about + case ECmdAboutCreator: + { + CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog; + dialog->ExecuteLD(R_CREATOR_ABOUT_DIALOG); + } + break; + + + // run script + case ECmdCreateFromFile: + { + iEngine->RunScriptL(); + } + break; + + // select random data file + case ECmdSelectRandomDataFile: + { + TFileName filename; + if (iEngine->GetRandomDataFilenameL(filename)) + { + iEngine->GetRandomDataFromFileL(filename); + } + } + break; + + + // commands: + case ECmdCreateCalendarEntryAppointments: + case ECmdCreateCalendarEntryEvents: + case ECmdCreateCalendarEntryAnniversaries: + case ECmdCreateCalendarEntryToDos: + case ECmdCreateCalendarEntryReminders: + + case ECmdCreateBrowserBookmarkEntries: + case ECmdCreateBrowserBookmarkFolderEntries: + case ECmdCreateBrowserSavedPageEntries: + case ECmdCreateBrowserSavedPageFolderEntries: + + case ECmdCreatePhoneBookEntryContacts: + case ECmdCreatePhoneBookEntryGroups: + + case ECmdCreateMiscEntryNotes: + case ECmdCreateMiscEntryLandmarks: + + case ECmdCreateLogEntryMissedCalls: + case ECmdCreateLogEntryReceivedCalls: + case ECmdCreateLogEntryDialledNumbers: + + case ECmdCreateMiscEntryAccessPoints: + case ECmdCreateMiscEntryIMPSServers: + + case ECmdCreateMessagingEntryMailboxes: + case ECmdCreateMessagingEntryMessages: + + case ECmdCreateFileEntryEmptyFolder: + case ECmdCreateFileEntry3GPP_70kB: + case ECmdCreateFileEntryAAC_100kB: + case ECmdCreateFileEntryAMR_20kB: + case ECmdCreateFileEntryBMP_25kB: + case ECmdCreateFileEntryDeck_1kB: + case ECmdCreateFileEntryDOC_20kB: + case ECmdCreateFileEntryGIF_2kB: + case ECmdCreateFileEntryHTML_20kB: + case ECmdCreateFileEntryJAD_1kB: + case ECmdCreateFileEntryJAR_10kB: + case ECmdCreateFileEntryJP2_65kB: + case ECmdCreateFileEntryJPEG_200kB: + case ECmdCreateFileEntryJPEG_25kB: + case ECmdCreateFileEntryJPEG_500kB: + case ECmdCreateFileEntryMIDI_10kB: + case ECmdCreateFileEntryMP3_250kB: + case ECmdCreateFileEntryMP4_200kB: + case ECmdCreateFileEntryMXMF_40kB: + case ECmdCreateFileEntryPNG_15kB: + case ECmdCreateFileEntryPPT_40kB: + case ECmdCreateFileEntryRAM_1kB: + case ECmdCreateFileEntryRM_95kB: + case ECmdCreateFileEntryRNG_1kB: + case ECmdCreateFileEntrySVG_15kB: + case ECmdCreateFileEntrySWF_15kB: + case ECmdCreateFileEntryTIF_25kB: + case ECmdCreateFileEntryTXT_10kB: + case ECmdCreateFileEntryTXT_70kB: + case ECmdCreateFileEntryVCF_1kB: + case ECmdCreateFileEntryVCS_1kB: + case ECmdCreateFileEntryWAV_20kB: + case ECmdCreateFileEntryXLS_15kB: + case ECmdCreateFileEntrySISX_10kB: + case ECmdCreateFileEntryWMA_50kB: + case ECmdCreateFileEntryWMV_200kB: + case ECmdDeleteAllEntries: + case ECmdDeleteAllCreatorEntries: + case ECmdDeleteContacts: + case ECmdDeleteCreatorContacts: + case ECmdDeleteContactGroups: + case ECmdDeleteCreatorContactGroups: + case ECmdDeleteCalendarEntries: + case ECmdDeleteCreatorCalendarEntries: + case ECmdDeleteBrowserBookmarks: + case ECmdDeleteCreatorBrowserBookmarks: + case ECmdDeleteBrowserBookmarkFolders: + case ECmdDeleteCreatorBrowserBookmarkFolders: + case ECmdDeleteBrowserSavedPages: + case ECmdDeleteCreatorBrowserSavedPages: + case ECmdDeleteBrowserSavedPageFolders: + case ECmdDeleteCreatorBrowserSavedPageFolders: + case ECmdDeleteCreatorFiles: + case ECmdDeleteLogs: + case ECmdDeleteCreatorLogs: + case ECmdDeleteMessages: + case ECmdDeleteCreatorMessages: + case ECmdDeleteMailboxes: + case ECmdDeleteCreatorMailboxes: + case ECmdDeleteIAPs: + case ECmdDeleteCreatorIAPs: + case ECmdDeleteIMPSs: + case ECmdDeleteCreatorIMPSs: + case ECmdDeleteNotes: + case ECmdDeleteLandmarks: + case ECmdDeleteCreatorLandmarks: + { + iEngine->ExecuteOptionsMenuCommandL(aCommand); + } + break; + + case ECmdDeleteEntries: + case ECmdCreatePhoneBookEntrySubscribedContacts: + case ECmdCreateMessagingEntryCBSTopics: + case ECmdCreateMessagingEntrySMSMessageCenters: + case ECmdCreateMessagingEntryTemplates: + case ECmdCreateMiscEntryAppMenuFolders: + case ECmdCreateMiscEntrySyncSettings: + case ECmdCreateMessagingEntryDocumentsFolders: + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Please contact S60 CO if you need this feature...")); + } + break; + + case EEikCmdExit: + case EAknSoftkeyExit: + { + Exit(); + } + break; + + default: + User::Panic (_L("Invalid command"), 101); + break; + } + } + + +void CCreatorAppUi::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) + { + } + +void CCreatorAppUi::RunScriptDone() + { + if (iMode == ETimerModeStartScript) + { + iMode = ETimerModeExitAppUi; + iTimer->Start(ETwelveOClock, this); + } + } + +void CCreatorAppUi::Beat() + { + Tick(); + } + +void CCreatorAppUi::Synchronize() + { + Tick(); + } + +void CCreatorAppUi::Tick() + { + iTickCount++; + if (iTickCount > KCommandLineDelay) + { + iTimer->Cancel(); + iTickCount = 0; + if (iMode == ETimerModeStartScript) + { + iEngine->GetRandomDataFromFileL(*iCommandLineRandomDataFileName); + TInt status = iEngine->RunScriptL(*iCommandLineScriptName); + if (status != KErrNone) + { + TBuf<128> noteMsg; + if (status == KErrNotFound) + { + _LIT(KMessage1, "Error in opening script file."); + noteMsg.Copy(KMessage1); + } + else if (status == KErrCorrupt) + { + _LIT(KMessage2, "Error in parsing script file."); + noteMsg.Copy(KMessage2); + } + else if (status == KErrCompletion) + { + _LIT(KMessage3, "Script file does not contain any elements."); + noteMsg.Copy(KMessage3); + } + else + { + _LIT(KMessage4, "Unknown error in opening script file."); + noteMsg.Copy(KMessage4); + } + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(noteMsg); + RunScriptDone(); + } + } + else if (iMode == ETimerModeExitAppUi) + { + iMode = ETimerModeNone; + Exit(); + } + } + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_browser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_browser.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,592 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_browser.h" +#include "creator_traces.h" + +#include + + +static const TInt KBrowserFieldLength = 128; + +_LIT(KCreatorBrowserPrefixName, "CR_"); +_LIT(KCreatorBrowserPrefixFolderName, "CR_FLDR_"); + +//---------------------------------------------------------------------------- + +CBrowserParameters::CBrowserParameters() + { + LOGSTRING("Creator: CBrowserParameters::CBrowserParameters"); + + iBookmarkName = HBufC::New(KBrowserFieldLength); + iBookmarkAddress = HBufC::New(KBrowserFieldLength); + iBookmarkUsername = HBufC::New(KBrowserFieldLength); + iBookmarkPassword = HBufC::New(KBrowserFieldLength); + iBookmarkFolderName = HBufC::New(KBrowserFieldLength); + iSavedDeckLinkName = HBufC::New(KBrowserFieldLength); + iSavedDeckLocalAddress = HBufC::New(KBrowserFieldLength); + iSavedDeckFolderName = HBufC::New(KBrowserFieldLength); + } + +CBrowserParameters::~CBrowserParameters() + { + LOGSTRING("Creator: CBrowserParameters::~CBrowserParameters"); + + delete iSavedDeckFolderName; + delete iSavedDeckLocalAddress; + delete iSavedDeckLinkName; + delete iBookmarkFolderName; + delete iBookmarkPassword; + delete iBookmarkUsername; + delete iBookmarkAddress; + delete iBookmarkName; + + } + +//---------------------------------------------------------------------------- + +CCreatorBrowser* CCreatorBrowser::NewL(CCreatorEngine* aEngine) + { + CCreatorBrowser* self = CCreatorBrowser::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorBrowser* CCreatorBrowser::NewLC(CCreatorEngine* aEngine) + { + CCreatorBrowser* self = new (ELeave) CCreatorBrowser; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorBrowser::CCreatorBrowser() + { + } + +void CCreatorBrowser::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorBrowser::ConstructL"); + + iEngine = aEngine; + } + +CCreatorBrowser::~CCreatorBrowser() + { + LOGSTRING("Creator: CCreatorBrowser::~CCreatorBrowser"); + if ( iEngine && iBmEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iBmEntryIds, KUidDictionaryUidBrowserBookmarks ) ); + } + iBmEntryIds.Reset(); + iBmEntryIds.Close(); + + if ( iEngine && iBmFEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iBmFEntryIds, KUidDictionaryUidBrowserBookmarkF ) ); + } + iBmFEntryIds.Reset(); + iBmFEntryIds.Close(); + + if ( iEngine && iSpEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iSpEntryIds, KUidDictionaryUidBrowserSavedPg ) ); + } + iSpEntryIds.Reset(); + iSpEntryIds.Close(); + + if ( iEngine && iSpFEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iSpFEntryIds, KUidDictionaryUidBrowserSavedPgF ) ); + } + iSpFEntryIds.Reset(); + iSpFEntryIds.Close(); + + delete iParameters; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorBrowser::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorBrowser::AskDataFromUserL"); + + TBool result( EFalse ); + switch ( aCommand ) + { + case ECmdDeleteBrowserBookmarks: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser bookmarks?") ); + break; + } + case ECmdDeleteCreatorBrowserBookmarks: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser bookmarks created with Creator?") ); + break; + } + case ECmdDeleteBrowserBookmarkFolders: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser bookmark folders?") ); + break; + } + case ECmdDeleteCreatorBrowserBookmarkFolders: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser bookmark folders created with Creator?") ); + break; + } + case ECmdDeleteBrowserSavedPages: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser saved pages?") ); + break; + } + case ECmdDeleteCreatorBrowserSavedPages: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser saved pages created with Creator?") ); + break; + } + case ECmdDeleteBrowserSavedPageFolders: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser saved pages folders?") ); + break; + } + case ECmdDeleteCreatorBrowserSavedPageFolders: + { + result = iEngine->YesNoQueryDialogL( _L("Delete all Browser saved pages folders created with Creator?") ); + break; + } + default: + { + result = iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?")); + break; + } + } + return result; + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorBrowser::CreateBookmarkEntryL(CBrowserParameters *aParameters) + { + LOGSTRING("Creator: CCreatorBrowser::CreateBookmarkEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CBrowserParameters* parameters = aParameters; + + // random data needed if no predefined data available + if( !parameters ) + { + iParameters = new(ELeave) CBrowserParameters; + parameters = iParameters; + + TFileName userAndPassword = iEngine->RandomString(CCreatorEngine::EFirstName); + TFileName name = iEngine->RandomString(CCreatorEngine::ECompany); + TFileName url = name; + url.Insert(0, _L("http://www.")); + url.Append(_L(".com/")); + name.Insert(0, KCreatorBrowserPrefixName); + + parameters->iBookmarkName->Des() = name; + parameters->iBookmarkAddress->Des() = url; + parameters->iBookmarkUsername->Des() = userAndPassword; + parameters->iBookmarkPassword->Des() = userAndPassword; + } + + TInt err = KErrNone; + + RFavouritesSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + RFavouritesDb db; + User::LeaveIfError( db.Open(session, KBrowserBookmarks) ); + CleanupClosePushL(db); + + CFavouritesItem* item = CFavouritesItem::NewLC(); + item->SetType( CFavouritesItem::EItem ); + item->SetParentFolder( KFavouritesRootUid ) ; + item->SetNameL( parameters->iBookmarkName->Des() ); + item->SetUrlL( parameters->iBookmarkAddress->Des() ); + item->SetUserNameL( parameters->iBookmarkUsername->Des() ); + item->SetPasswordL( parameters->iBookmarkPassword->Des() ); + err = db.Add(*item, /*aAutoRename=*/ETrue); + if (err) + db.Commit(); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iBmEntryIds.Append( item->Uid() ); + + CleanupStack::PopAndDestroy(3); //db, session, item + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorBrowser::CreateBookmarkFolderEntryL(CBrowserParameters *aParameters) + { + LOGSTRING("Creator: CCreatorBrowser::CreateBookmarkFolderEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CBrowserParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CBrowserParameters; + parameters = iParameters; + + TFileName name = iEngine->RandomString(CCreatorEngine::ECompany); + name.Insert(0, KCreatorBrowserPrefixFolderName); + + parameters->iBookmarkFolderName->Des() = name; + } + + TInt err = KErrNone; + + RFavouritesSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + RFavouritesDb db; + User::LeaveIfError( db.Open(session, KBrowserBookmarks) ); + CleanupClosePushL(db); + + CFavouritesItem* item = CFavouritesItem::NewLC(); + item->SetType( CFavouritesItem::EFolder ); + item->SetParentFolder( KFavouritesRootUid ) ; + item->SetNameL( parameters->iBookmarkFolderName->Des() ); + + err = db.Add(*item, /*aAutoRename=*/ETrue); + if (err) + db.Commit(); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iBmFEntryIds.Append( item->Uid() ); + + CleanupStack::PopAndDestroy(3); //db, session, item + + + return err; + + } + +//---------------------------------------------------------------------------- + +TInt CCreatorBrowser::CreateSavedDeckEntryL(CBrowserParameters *aParameters) + { + LOGSTRING("Creator: CCreatorBrowser::CreateSavedDeckEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CBrowserParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CBrowserParameters; + parameters = iParameters; + + TFileName name = iEngine->RandomString(CCreatorEngine::ECompany); + name.Insert(0, KCreatorBrowserPrefixName); + + parameters->iSavedDeckLinkName->Des() = name; + parameters->iSavedDeckLocalAddress->Des() = iEngine->TestDataPathL(CCreatorEngine::ESavedDeck_1kB); + } + + TInt err = KErrNone; + + // check the deck address is correct + if ( parameters->iSavedDeckLocalAddress->Des().Length() == 0 || + !BaflUtils::FileExists( CEikonEnv::Static()->FsSession(), parameters->iSavedDeckLocalAddress->Des() )) + { + // not found, use a default deck instead + delete parameters->iSavedDeckLocalAddress; + parameters->iSavedDeckLocalAddress = 0; + TPtrC tmp = iEngine->TestDataPathL(CCreatorEngine::ESavedDeck_1kB); + parameters->iSavedDeckLocalAddress = HBufC::NewL(tmp.Length()); + parameters->iSavedDeckLocalAddress->Des() = tmp; + } + + + RFavouritesSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + RFavouritesDb db; + User::LeaveIfError( db.Open(session, KBrowserSavedPages) ); + CleanupClosePushL(db); + + CFavouritesItem* item = CFavouritesItem::NewLC(); + item->SetType( CFavouritesItem::EItem ); + item->SetParentFolder( KFavouritesRootUid ) ; + item->SetNameL( parameters->iSavedDeckLinkName->Des() ); + item->SetUrlL( _L(" ") ); + + TFavouritesWapAp favouritesAp; + favouritesAp.SetDefault(); + item->SetWapAp( favouritesAp ); + + + err = db.Add(*item, /*aAutoRename=*/ETrue); + if (err) + db.Commit(); + + // read the source deck to buffer + RFile sourceFile; + User::LeaveIfError( sourceFile.Open(CEikonEnv::Static()->FsSession(), parameters->iSavedDeckLocalAddress->Des(), EFileRead) ); + CleanupClosePushL(sourceFile); + TInt sourceFileSize(0); + err = sourceFile.Size(sourceFileSize); + HBufC8* sourceBuf = HBufC8::NewLC(sourceFileSize); + TPtr8 sourcePtr = sourceBuf->Des(); + sourceFile.Read(sourcePtr); + + // write the deck + RFavouritesFile destinationFile; + User::LeaveIfError( destinationFile.Replace(db, item->Uid() )); + CleanupClosePushL(destinationFile); + err = destinationFile.Write(sourceBuf->Des()); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iSpEntryIds.Append( item->Uid() ); + + + CleanupStack::PopAndDestroy(6); //db, session, item, sourceFile, destinationFile, sourceBuf + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorBrowser::CreateSavedDeckFolderEntryL(CBrowserParameters *aParameters) + { + LOGSTRING("Creator: CCreatorBrowser::CreateSavedDeckFolderEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CBrowserParameters* parameters = aParameters; + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CBrowserParameters; + parameters = iParameters; + + TFileName name = iEngine->RandomString(CCreatorEngine::ECompany); + name.Insert(0, KCreatorBrowserPrefixFolderName); + + parameters->iSavedDeckFolderName->Des() = name; + } + + TInt err = KErrNone; + + RFavouritesSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + RFavouritesDb db; + User::LeaveIfError( db.Open(session, KBrowserSavedPages) ); + CleanupClosePushL(db); + + CFavouritesItem* item = CFavouritesItem::NewLC(); + item->SetType( CFavouritesItem::EFolder ); + item->SetParentFolder( KFavouritesRootUid ) ; + item->SetNameL( parameters->iSavedDeckFolderName->Des() ); + + err = db.Add(*item, /*aAutoRename=*/ETrue); + if (err) + db.Commit(); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iSpFEntryIds.Append( item->Uid() ); + + CleanupStack::PopAndDestroy(3); //db, session, item + + return err; + + } + + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllL"); + User::Leave( KErrNotSupported ); + // will not be supported, see separate implementations below + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllCreatedByCreatorL"); + User::Leave( KErrNotSupported ); + // will not be supported, see separate implementations below + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllBookmarksL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllBookmarksL"); + DeleteAllItemsL( KBrowserBookmarks, + CFavouritesItem::EItem, + EFalse, + iBmEntryIds, // ignored, because deleting all + KUidDictionaryUidBrowserBookmarks ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllBookmarksCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllBookmarksCreatedByCreatorL"); + DeleteAllItemsL( KBrowserBookmarks, + CFavouritesItem::EItem, + ETrue, + iBmEntryIds, + KUidDictionaryUidBrowserBookmarks ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllBookmarkFoldersL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllBookmarkFoldersL"); + DeleteAllItemsL( KBrowserBookmarks, + CFavouritesItem::EFolder, + EFalse, + iBmFEntryIds, // ignored, because deleting all + KUidDictionaryUidBrowserBookmarkF ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllBookmarkFoldersCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllBookmarkFoldersCreatedByCreatorL"); + DeleteAllItemsL( KBrowserBookmarks, + CFavouritesItem::EFolder, + ETrue, + iBmFEntryIds, + KUidDictionaryUidBrowserBookmarkF ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllSavedPagesL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllSavedPagesL"); + DeleteAllItemsL( KBrowserSavedPages, + CFavouritesItem::EItem, + EFalse, + iSpEntryIds, // ignored, because deleting all + KUidDictionaryUidBrowserSavedPg ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllSavedPagesCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllSavedPagesCreatedByCreatorL"); + DeleteAllItemsL( KBrowserSavedPages, + CFavouritesItem::EItem, + ETrue, + iSpEntryIds, + KUidDictionaryUidBrowserSavedPg ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllSavedPageFoldersL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllSavedPageFoldersL"); + DeleteAllItemsL( KBrowserSavedPages, + CFavouritesItem::EFolder, + EFalse, + iSpFEntryIds, // ignored, because deleting all + KUidDictionaryUidBrowserSavedPgF ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllSavedPageFoldersCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorBrowser::DeleteAllSavedPageFolderssCreatedByCreatorL"); + DeleteAllItemsL( KBrowserSavedPages, + CFavouritesItem::EFolder, + ETrue, + iSpFEntryIds, + KUidDictionaryUidBrowserSavedPgF ); + } + +//---------------------------------------------------------------------------- +void CCreatorBrowser::DeleteAllItemsL( const TDesC& aDbName, + CFavouritesItem::TType aTypeFilter, + TBool aOnlyCreatedWithCreator, + RArray& aEntryIds, + const TUid aDictUid ) + { + LOGSTRING("Creator: CCreatorBrowser::DeleteItemL"); + RFavouritesSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL( session ); + RFavouritesDb db; + User::LeaveIfError( db.Open( session, aDbName ) ); + CleanupClosePushL( db ); + + if ( aOnlyCreatedWithCreator ) + { + // read uids from Creator internal store + aEntryIds.Reset(); + iEngine->ReadEntryIdsFromStoreL( aEntryIds, aDictUid ); + + // delete entries from db + for ( TInt i = 0; i < aEntryIds.Count(); i++ ) + { + db.Delete( aEntryIds[i] ); + } + } + else + { + CArrayFixFlat* uids = new (ELeave) CArrayFixFlat(64); + CleanupStack::PushL( uids ); + + // read uids from browser db + User::LeaveIfError( db.GetUids( *uids, KFavouritesRootUid, aTypeFilter ) ); + + // delete entries from db + for ( TInt i = 0; i < uids->Count(); i++ ) + { + db.Delete( uids->At(i) ); + } + + // db.Commit() seems to panic with EFavouritesNoTransaction + // deletion is successful even without commit, so not calling it + CleanupStack::PopAndDestroy( uids ); + } + + // entries deleted, remove the Browser related registry + aEntryIds.Reset(); + iEngine->RemoveStoreL( aDictUid ); + + CleanupStack::PopAndDestroy( &db ); + CleanupStack::PopAndDestroy( &session ); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_browserelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_browserelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,215 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_browserelement.h" +#include "creator_traces.h" +#include "creator_browser.h" + +using namespace creatorbrowser; + +/* + * + */ +CCreatorBrowserElement* CCreatorBrowserElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorBrowserElement* self = new (ELeave) CCreatorBrowserElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorBrowserElement::CCreatorBrowserElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } + + +/* + * + */ +void CCreatorBrowserElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt entryAmount = 1; + TBool addAll = EFalse; + if( amountAttr ) + { + entryAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create browser entries, the amount of entries is defined by entryAmount: + for( TInt cI = 0; cI < entryAmount; ++cI ) + { + CBrowserParameters* param = 0; + + if( fields.Count() > 0 ) + param = new (ELeave) CBrowserParameters; + else + { + // No fields defined --> Add all fields with random values: + addAll = ETrue; + break; + } + + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + if( elemName == KName ) + { + if( randomAttr || elemContent.Length() == 0) + { + elemContent.Set(iEngine->RandomString(CCreatorEngine::ECompany)); + } + if( iName->Des() == KBookmark ) + { + SetContentToTextParamL(param->iBookmarkName, elemContent); + } + else if( iName->Des() == KBookmarkFolder ) + { + SetContentToTextParamL(param->iBookmarkFolderName, elemContent); + } + else if( iName->Des() == KSavedPage ) + { + SetContentToTextParamL(param->iSavedDeckLinkName, elemContent); + } + else if( iName->Des() == KSavedPageFolder ) + { + SetContentToTextParamL(param->iSavedDeckFolderName, elemContent); + } + } + + else if( elemName == KPath ) + { + if( randomAttr || elemContent.Length() == 0) + { + SetContentToTextParamL(param->iSavedDeckLocalAddress, iEngine->TestDataPathL(CCreatorEngine::ESavedDeck_1kB)); + } + else + { + SetContentToTextParamL(param->iSavedDeckLocalAddress, elemContent); + } + } + else if( elemName == KUsername ) + { + if( randomAttr || elemContent.Length() == 0) + { + // Set username and password to same string + if( param->iBookmarkPassword && param->iBookmarkPassword->Length() > 0 ) + { + SetContentToTextParamL(param->iBookmarkUsername, param->iBookmarkPassword->Des()); + } + else + { + SetContentToTextParamL(param->iBookmarkUsername, iEngine->RandomString(CCreatorEngine::EFirstName)); + } + } + else + { + SetContentToTextParamL(param->iBookmarkUsername, elemContent); + } + } + else if( elemName == KPassword ) + { + if( randomAttr || elemContent.Length() == 0) + { + // Set username and password to same string + if( param->iBookmarkUsername && param->iBookmarkUsername->Length() > 0 ) + { + SetContentToTextParamL(param->iBookmarkPassword, param->iBookmarkUsername->Des()); + } + else + { + SetContentToTextParamL(param->iBookmarkPassword, iEngine->RandomString(CCreatorEngine::EFirstName)); + } + } + else + { + SetContentToTextParamL(param->iBookmarkPassword, elemContent); + } + } + else if( elemName == KUrl ) + { + if( randomAttr || elemContent.Length() == 0) + { + TDesC* tmpUrl = iEngine->CreateHTTPUrlLC(); + if( tmpUrl ) + { + SetContentToTextParamL(param->iBookmarkAddress, *tmpUrl ); + } + CleanupStack::PopAndDestroy(); // tmpUrl + } + else + { + SetContentToTextParamL(param->iBookmarkAddress, elemContent); + } + } + } + iEngine->AppendToCommandArrayL(GetBrowserCommandL(), param); + CleanupStack::Pop(); // param + } + } + else + { + addAll = ETrue; + } + + if( addAll ) + { + iEngine->AppendToCommandArrayL(GetBrowserCommandL(), 0, entryAmount); + } + } + +TInt CCreatorBrowserElement::GetBrowserCommandL() const + { + if( iName->Des() == KBookmark ) + { + return ECmdCreateBrowserBookmarkEntries; + } + else if( iName->Des() == KBookmarkFolder ) + { + return ECmdCreateBrowserBookmarkFolderEntries; + } + else if( iName->Des() == KSavedPage ) + { + return ECmdCreateBrowserSavedPageEntries; + } + else if( iName->Des() == KSavedPageFolder ) + { + return ECmdCreateBrowserSavedPageFolderEntries; + } + + LOGSTRING("CCreatorFileElement::GetBrowserCommandL: Unknown browser entry"); + User::Leave(KErrGeneral); + return 0; // Not reached, but disables compiler warning... + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_calendar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_calendar.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1601 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_calendar.h" +#include "creator_traces.h" +#include "creator_scriptentry.h" +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include "creator_contactsetcache.h" +#include "creator_virtualphonebook.h" +#endif +#include +#include +#include +#include + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +static const TInt KCalendarFieldLength = 128; + + +CCreatorCalenderAttendee::CCreatorCalenderAttendee() + {} + +CCreatorCalenderAttendee::~CCreatorCalenderAttendee() + { + delete iCommonName; + delete iEmailAddress; + } + +CCreatorCalenderAttendee* CCreatorCalenderAttendee::NewL() + { + CCreatorCalenderAttendee* self = new (ELeave) CCreatorCalenderAttendee; + return self; + } + +void CCreatorCalenderAttendee::SetCommonNameL(const TDesC& aName) + { + delete iCommonName; + iCommonName = 0; + iCommonName = HBufC::NewL(aName.Length()); + iCommonName->Des().Copy(aName); + } + +void CCreatorCalenderAttendee::SetEmailAddressL(const TDesC& aEmail) + { + delete iEmailAddress; + iEmailAddress = 0; + iEmailAddress = HBufC::NewL(aEmail.Length()); + iEmailAddress->Des().Copy(aEmail); + } + +void CCreatorCalenderAttendee::SetRole(CCalAttendee::TCalRole aRole) + { + iRole = aRole; + } + +void CCreatorCalenderAttendee::SetStatus(CCalAttendee::TCalStatus aStatus) + { + iStatus = aStatus; + } + +const TDesC& CCreatorCalenderAttendee::CommonName() const + { + if( iCommonName == 0 ) + return iDummy; + return *iCommonName; + } + +const TDesC& CCreatorCalenderAttendee::EmailAddress() const + { + if( iEmailAddress == 0 ) + return iDummy; + + return *iEmailAddress; + } + +CCalAttendee::TCalRole CCreatorCalenderAttendee::Role() const + { + return iRole; + } + +CCalAttendee::TCalStatus CCreatorCalenderAttendee::Status() const + { + return iStatus; + } + +TBool CCalenderInterimParameters::IsAllowedEntryStatus(CCalEntry::TType aType, CCalEntry::TStatus aStatus) + { + if( aType == CCalEntry::ETodo ) + { + return aStatus == CCalEntry::ECancelled || + aStatus == CCalEntry::ETodoNeedsAction || + aStatus == CCalEntry::ETodoCompleted || + aStatus == CCalEntry::ETodoInProcess; + } + + return aStatus == CCalEntry::ETentative || + aStatus == CCalEntry::EConfirmed || + aStatus == CCalEntry::ECancelled; + } + +//---------------------------------------------------------------------------- + +CCalenderInterimParameters::CCalenderInterimParameters ( ) + { + LOGSTRING("Creator: CCalenderInterimParameters::CCalenderInterimParameters"); + + iAppointmentLocation = HBufC::New (KCalendarFieldLength ); + iAppointmentReason = HBufC::New (KCalendarFieldLength ); + iEventReason = HBufC::New (KCalendarFieldLength ); + iAnniversaryReason = HBufC::New (KCalendarFieldLength ); + iTodoTask = HBufC::New (KCalendarFieldLength ); + iReminderReason = HBufC::New (KCalendarFieldLength ); + iDescription = HBufC::New (KCalendarFieldLength ); + iSummary = HBufC::New (KCalendarFieldLength ); + iLocation = HBufC::New (KCalendarFieldLength ); + iOrganizerName = HBufC::New (KCalendarFieldLength ); + iOrganizerEmail = HBufC::New (KCalendarFieldLength ); + + // set defaults, start date today and end date = today + 1 month + iRandomModeStartTime.HomeTime ( ); + iRandomModeEndTime = iRandomModeStartTime; + iRandomModeEndTime += TTimeIntervalMonths (1 ); + iAlarmTime = Time::NullTTime(); + iUseRandomAlarmTime = EFalse; + iStatus = CCalEntry::ENullStatus; + } + +CCalenderInterimParameters::~CCalenderInterimParameters ( ) + { + LOGSTRING("Creator: CCalenderInterimParameters::~CCalenderInterimParameters"); + + delete iTodoTask; + delete iAnniversaryReason; + delete iEventReason; + delete iAppointmentReason; + delete iAppointmentLocation; + delete iReminderReason; + delete iDescription; + delete iSummary; + delete iLocation; + delete iOrganizerName; + delete iOrganizerEmail; + iAttendees.ResetAndDestroy(); + iAttendees.Close(); + iAttendeeLinkIds.Reset(); + iAttendeeLinkIds.Close(); + } + +void CCalenderInterimParameters::ParseL (CCommandParser* parser, + TParseParams aCase ) + { + LOGSTRING("Creator: CCalenderInterimParameters::ParseL"); + + HBufC* tempBuf= NULL; + + switch (aCase ) + { + + case MCreatorModuleBaseParameters::ECalendarTodo: + { + + parser->StrParserL (tempBuf, '|' ); + + CleanupStack::PushL (tempBuf ); + + this->iTodoDueTime = TTime (tempBuf->Des ( ) ); + + parser->StrParserL (this->iTodoTask, '|' ); + + parser->StrParserL (tempBuf, ';' ); + this->iTodoPriority = 2; + if (tempBuf->Compare (_L("LOW") ) == 0 ) + this->iTodoPriority = 3; + else + if (tempBuf->Compare (_L("HIGH") ) == 0 ) + this->iTodoPriority = 1; + + CleanupStack::PopAndDestroy (tempBuf ); + + } + + case MCreatorModuleBaseParameters::ECalendarMemo: + { + + parser->StrParserL (tempBuf, '|' ); + + this->iStartTime = TTime (tempBuf->Des ( ) ); + + parser->StrParserL (tempBuf, '|' ); + this->iEndTime = TTime (tempBuf->Des ( ) ); + + parser->StrParserL (this->iDescription, ';' ); + + CleanupStack::PopAndDestroy (tempBuf ); + } + + case MCreatorModuleBaseParameters::ECalendarMeeting: + { + + parser->StrParserL (tempBuf, '|' ); + + CleanupStack::PushL (tempBuf ); + + this->iStartTime = TTime (tempBuf->Des ( ) ); + + parser->StrParserL (tempBuf, '|' ); + this->iEndTime = TTime (tempBuf->Des ( ) ); + + parser->StrParserL (this->iLocation, '|' ); + parser->StrParserL (this->iDescription, ';' ); + + CleanupStack::PopAndDestroy (tempBuf ); + } + + case MCreatorModuleBaseParameters::ECalendarAnniv: + { + + parser->StrParserL (tempBuf, '|' ); + + CleanupStack::PushL (tempBuf ); + + this->iStartTime = TTime (tempBuf->Des ( ) ); + + parser->StrParserL (this->iDescription, ';' ); + + CleanupStack::PopAndDestroy (tempBuf ); + + } + default: + { + //implement + } + } + } +//---------------------------------------------------------------------------- + +CCreatorInterimCalendar* CCreatorInterimCalendar::NewL (CCreatorEngine* aEngine ) + { + CCreatorInterimCalendar* self = CCreatorInterimCalendar::NewLC (aEngine ); + CleanupStack::Pop (self ); + return self; + } + +CCreatorInterimCalendar* CCreatorInterimCalendar::NewLC (CCreatorEngine* aEngine ) + { + CCreatorInterimCalendar* self = new (ELeave) CCreatorInterimCalendar; + CleanupStack::PushL (self ); + self->ConstructL (aEngine ); + return self; + } + +CCreatorInterimCalendar::CCreatorInterimCalendar ( ) + { + } + +void CCreatorInterimCalendar::ConstructL (CCreatorEngine* aEngine ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::ConstructL"); + + iEngine = aEngine; + + // set defaults, start date today and end date = today + 1 month + iRandomModeStartTime.HomeTime ( ); + iRandomModeEndTime = iRandomModeStartTime; + iRandomModeEndTime += TTimeIntervalMonths (1 ); + + iCalSession = CCalSession::NewL ( ); + // Create and open a calendar file + const TDesC& fileName = iCalSession->DefaultFileNameL ( );//default filename is: "C:Calendar" + TRAPD(err, iCalSession->CreateCalFileL(fileName)) + ; + // ignore KErrAlreadyExists leave code + if (err != KErrAlreadyExists ) + { + User::LeaveIfError (err ); + } + // Open the calendar file + iCalSession->OpenL (fileName ); + iCalEntryView = CCalEntryView::NewL (*iCalSession, *this ); + iNumberRepeatingEntries = 0; + iNumberOfAttendees = 0; //iEngine->RandomNumber(2, 15); + iSetAlarm = EFalse; + iWaiter = CAsyncWaiter::NewL(); + } + +CCreatorInterimCalendar::~CCreatorInterimCalendar ( ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::~CCreatorInterimCalendar"); + + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidCalendar ) ); + } + + iEntryIds.Reset(); + iEntryIds.Close(); + + if (iParameters ) + { + delete iParameters; + } + + if (iCalEntryView ) + { + delete iCalEntryView; + } + + if (iCalSession ) + { + delete iCalSession; + } + delete iSoundFileArray; + delete iWaiter; + delete iTmpCN; + delete iTmpEmail; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + delete iExistingContacts; + delete iTempContact; + delete iContactManager; +#endif + } + +//---------------------------------------------------------------------------- + +TBool CCreatorInterimCalendar::AskDataFromUserL (TInt aCommand, + TInt& aNumberOfEntries ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::AskDataFromUserL"); + + if( aCommand == ECmdDeleteCalendarEntries ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all calendar entries?") ); + } + if( aCommand == ECmdDeleteCreatorCalendarEntries ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all calendar entries created with Creator?") ); + } + + // display queries + if (iEngine->EntriesQueryDialogL (aNumberOfEntries, _L("How many entries to create?") ) ) // ask number of entries to create + { + if( aCommand == ECmdCreateCalendarEntryEvents || + aCommand == ECmdCreateCalendarEntryAppointments) + { + _LIT(KRepeatingNum, "How many repeating (weekly) entries"); + if( !iEngine->EntriesQueryDialogL(iNumberRepeatingEntries, KRepeatingNum, ETrue)) + { + return EFalse; + } + _LIT(KAttendeesNum, "How many attendees to create"); + if( !iEngine->EntriesQueryDialogL(iNumberOfAttendees, KAttendeesNum, ETrue)) + { + return EFalse; + } + } + if (iEngine->TimeQueryDialogL (iRandomModeStartTime, R_START_DATE_QUERY ) ) // ask start date + { + if (iEngine->TimeQueryDialogL (iRandomModeEndTime, R_END_DATE_QUERY ) ) // ask end date + { + if (iRandomModeStartTime > iRandomModeEndTime ) // check end date is ok + { + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD (_L("End date must be after start date") ); + + return EFalse; + } + else + { + if( iEngine->YesNoQueryDialogL(_L("Add default alarm?"))) + { + iSetAlarm = ETrue; + } + } + return ETrue; + } + else + return EFalse; + } + else + return EFalse; + } + else + return EFalse; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorInterimCalendar::CreateAppointmentEntryL ( + CCreatorModuleBaseParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::CreateAppointmentEntryL"); + + delete iParameters; + iParameters = 0; + + CCalenderInterimParameters* parameters = (CCalenderInterimParameters*)aParameters; + + if( !parameters ) + { + iParameters = new(ELeave) CCalenderInterimParameters; + parameters = iParameters; + parameters->iRandomModeStartTime = iRandomModeStartTime; + parameters->iRandomModeEndTime = iRandomModeEndTime; + + // difference between start and end times + TTimeIntervalMinutes differenceInMinutes; + parameters->iRandomModeEndTime.MinutesFrom ( + parameters->iRandomModeStartTime, differenceInMinutes ); + + // start time (= something between the period start and end date) + parameters->iStartTime = parameters->iRandomModeStartTime; + parameters->iStartTime + += TTimeIntervalMinutes (iEngine->RandomNumber (differenceInMinutes.Int ( ) ) ); + // set end time (= start time + some random time) + parameters->iEndTime = parameters->iStartTime; + parameters->iEndTime + += TTimeIntervalMinutes (iEngine->RandomNumber (5, 500 ) ); + + + // strings + parameters->iLocation->Des ( ) + = iEngine->RandomString (CCreatorEngine::EMeetingPlace ); + parameters->iDescription->Des ( ) + = iEngine->RandomString (CCreatorEngine::EMeetingReason ); + + parameters->iSummary->Des() + = parameters->iDescription->Des(); + + parameters->iNumberRepeatingEntries = iNumberRepeatingEntries; + parameters->iNumberOfAttendees = iNumberOfAttendees; + } + + TInt err = KErrNone; + HBufC8* guid = HBufC8::NewLC (255 ); + TPtr8 uidP=guid->Des ( ); + GenerateRandomId (uidP ); + CCalEntry* entry = CCalEntry::NewL (CCalEntry::EAppt, guid, + CCalEntry::EMethodAdd, 0 ); + CleanupStack::PushL (entry ); + + //Using same text as description and summary + entry->SetDescriptionL (parameters->iDescription->Des ( ) ); + entry->SetSummaryL (parameters->iSummary->Des ( ) ); + entry->SetLocationL (parameters->iLocation->Des ( ) ); + + TCalTime startTime; + TCalTime endTime; + // Set the start and end times using time values local to the current system time zone + TInt month = (TInt) parameters->iStartTime.DateTime().Month(); + TInt date = parameters->iStartTime.DateTime().Day(); + startTime.SetTimeLocalL (parameters->iStartTime ); + endTime.SetTimeLocalL (parameters->iEndTime ); + entry->SetStartAndEndTimeL (startTime, endTime ); + + if( parameters->IsAllowedEntryStatus(CCalEntry::EAppt, parameters->iStatus)) + { + LOGSTRING2("Creator: CCreatorInterimCalendar::CreateAppointmentEntryL setting entry status: %d", parameters->iStatus); + entry->SetStatusL(parameters->iStatus); + } + + // Repeating times: + AddRepeatingRuleL(startTime, *entry, parameters); + SetOrganizerL(*entry, parameters); + + // Alarm: + if( iSetAlarm || parameters->iUseRandomAlarmTime ) + { + SetRandomAlarmL(*entry); + } + else + { + SetAlarmL(*entry, parameters); + } + + // Add attendees: + AddAttendeesL(*entry, parameters); + + RPointerArray array; + CleanupClosePushL (array ); + array.AppendL (entry ); + + TInt success(0); + //If StoreL() leaves, 'success' contains the number of entries that were stored before it failed + iCalEntryView->StoreL (array, success ); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( entry->LocalUidL() ); + + //One item should be added at time + if (success != 1 ) + { + err = 1; + } + + CleanupStack::PopAndDestroy (&array ); + CleanupStack::PopAndDestroy (entry ); + CleanupStack::Pop (guid );//guid has been destroyed by entry, which has ownership to guid + + return err; + } + +void CCreatorInterimCalendar::SetOrganizerL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters ) + { + HBufC* orgName = 0; + HBufC* orgEmail = 0; + _LIT(KSpace, " "); + + // + // Common name + // + if( parameters == 0 || + parameters->iOrganizerName == 0 || + parameters->iOrganizerName->Length() == 0 ) + { + // Random: + TPtrC firstname = iEngine->RandomString(CCreatorEngine::EFirstName); + TPtrC lastname = iEngine->RandomString(CCreatorEngine::ESurname); + orgName = HBufC::NewL(firstname.Length() + lastname.Length() + 1 ); + CleanupStack::PushL(orgName); + orgName->Des().Copy(firstname); + orgName->Des().Append(KSpace); + orgName->Des().Append(lastname); + } + else + { + orgName = HBufC::NewL(parameters->iOrganizerName->Length()); + CleanupStack::PushL(orgName); + orgName->Des().Copy(parameters->iOrganizerName->Des()); + } + + // + // Email + // + if( parameters == 0 || + parameters->iOrganizerEmail == 0 || + parameters->iOrganizerEmail->Length() == 0 ) + { + // Random: + TDesC* tmp = iEngine->CreateEmailAddressLC(); + orgEmail = HBufC::NewL(tmp->Length()); + orgEmail->Des().Copy(*tmp); + CleanupStack::PopAndDestroy(); // tmp + CleanupStack::PushL(orgEmail); + } + else + { + orgEmail = HBufC::NewL(parameters->iOrganizerEmail->Length()); + CleanupStack::PushL(orgEmail); + orgEmail->Des().Copy(parameters->iOrganizerEmail->Des()); + } + + SetOrganizerL(aCalEntry, orgName->Des(), orgEmail->Des(), orgEmail->Des()); + CleanupStack::PopAndDestroy(); // orgName + CleanupStack::PopAndDestroy(); // orgEmail + } + +void CCreatorInterimCalendar::AddRepeatingRuleL(const TCalTime& aStartTime, CCalEntry& aCalEntry, CCalenderInterimParameters* parameters ) + { + RArray days; + CleanupClosePushL(days); + + // Recurrence rule. Weekly event. + if( parameters->iNumberRepeatingEntries > 0 ) + { + TCalRRule calRepeat(TCalRRule::EWeekly); + calRepeat.SetDtStart(aStartTime); + calRepeat.SetCount(parameters->iNumberRepeatingEntries); + calRepeat.SetInterval(1); + //days.AppendL((TDay) iEngine->RandomNumber((TInt)EMonday, (TInt) ESunday)); + TDay tempDay(aStartTime.TimeLocalL().DayNoInWeek()); + days.AppendL(tempDay); + calRepeat.SetByDay(days); + aCalEntry.SetRRuleL(calRepeat); + } + else if(parameters->iRecurrentFrequency > TCalRRule::EInvalid) + { + TCalTime calTime; + // Recurrent frequency + TCalRRule calRepeat(parameters->iRecurrentFrequency); + // Recurrent start + calRepeat.SetDtStart(aStartTime); + if( parameters->iRecurrentFrequency == TCalRRule::EWeekly ) + { + TDay tempDay(aStartTime.TimeLocalL().DayNoInWeek()); + days.AppendL(tempDay); + calRepeat.SetByDay(days); + } + else if( parameters->iRecurrentFrequency == TCalRRule::EMonthly ) + { + RArray< TInt > daysInMonth; + CleanupClosePushL(daysInMonth); + daysInMonth.AppendL(aStartTime.TimeLocalL().DayNoInMonth()); + calRepeat.SetByMonthDay(daysInMonth); + CleanupStack::PopAndDestroy(&daysInMonth); + } + else if( parameters->iRecurrentFrequency == TCalRRule::EYearly) + { + RArray< TMonth > monthsInYear; + CleanupClosePushL(monthsInYear); + monthsInYear.AppendL(aStartTime.TimeLocalL().DateTime().Month()); + calRepeat.SetByMonth(monthsInYear); + CleanupStack::PopAndDestroy(&monthsInYear); + } + + // Recurrent interval + if( parameters->iRecurrentInterval > 0 ) + calRepeat.SetInterval(parameters->iRecurrentInterval); + + // Recurrent end. End can be given as a number of repeating entries or as an end date. + // End date must be later than the start date, otherwise CCalEntry::SetRRuleL() panics. + if( parameters->iRepeatingCount > 0 ) + { + calRepeat.SetCount(parameters->iRepeatingCount); + aCalEntry.SetRRuleL(calRepeat); + } + else + { + TCalTime endTime; + endTime.SetTimeLocalL(parameters->iRecurrentEndTime); + if( endTime.TimeLocalL() > aStartTime.TimeLocalL()) + { + calRepeat.SetUntil(endTime); + aCalEntry.SetRRuleL(calRepeat); + } + } + } + CleanupStack::PopAndDestroy(&days); + } + +void CCreatorInterimCalendar::SetAlarmL(CCalEntry& aCalEntry, CCalenderInterimParameters* params) + { + if( params->iAlarmTime != Time::NullTTime() ) + { + CCalAlarm* alarm = CCalAlarm::NewL(); + CleanupStack::PushL(alarm); + //if( params->iAlarmTime <= params->iStartTime ) + // { + TTimeIntervalMinutes diff; + TInt err = params->iStartTime.MinutesFrom(params->iAlarmTime, diff); + if( err == KErrNone) + { + alarm->SetTimeOffset(diff); + TRAP(err, aCalEntry.SetAlarmL(alarm)); + if( err != KErrNone && err != KErrNotSupported ) + { + User::Leave(err); + } + } + // } + CleanupStack::PopAndDestroy(alarm); + } + } + +void CCreatorInterimCalendar::SetRandomAlarmL(CCalEntry& aCalEntry) + { + CCalAlarm* alarm = CCalAlarm::NewL(); + CleanupStack::PushL(alarm); + alarm->SetTimeOffset(TTimeIntervalMinutes(iEngine->RandomNumber(0, 60))); + + TRAPD(err, aCalEntry.SetAlarmL(alarm)); + if( err != KErrNone && err != KErrNotSupported ) + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(alarm); + } + +void CCreatorInterimCalendar::SetPhoneOwnerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy ) + { + CCalUser* phOwner = CCalUser::NewL(aEmail, aSentBy); + CleanupStack::PushL(phOwner); + TRAPD(err, aCalEntry.SetPhoneOwnerL(phOwner)); + CleanupStack::Pop(phOwner); + if( err == KErrNone ) + { + phOwner->SetCommonNameL(aCN); + } + else + { + delete phOwner; + } + } + +void CCreatorInterimCalendar::SetOrganizerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy) + { + CCalUser* organizer = CCalUser::NewL(aEmail, aSentBy); + CleanupStack::PushL(organizer); + TRAPD(err, aCalEntry.SetOrganizerL(organizer)); + CleanupStack::Pop(organizer); + if( err == KErrNone ) + { + organizer->SetCommonNameL(aCN); + } + else + { + delete organizer; + } + } + +void CCreatorInterimCalendar::AddAttendeesL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters ) + { + if( !parameters ) + return; + + // Random attendees: + TInt numOfAttendees = parameters->iNumberOfAttendees; + for( TInt i = 0; i < numOfAttendees; ++i ) + { + TPtrC firstname = iEngine->RandomString(CCreatorEngine::EFirstName); + TPtrC lastname = iEngine->RandomString(CCreatorEngine::ESurname); + TPtrC company = iEngine->RandomString(CCreatorEngine::ECompany); + _LIT(KCountry, "com"); + TDesC* emailAddr = iEngine->CreateEmailAddressLC(firstname, lastname, company, KCountry); + CCalAttendee* attendee = CCalAttendee::NewL(*emailAddr); + CleanupStack::PushL(attendee); + aCalEntry.AddAttendeeL(attendee); + CleanupStack::Pop(attendee); + attendee->SetCommonNameL(firstname); + + // Set phone owner: + if( i == 1 ) + { + SetPhoneOwnerL(aCalEntry, firstname, *emailAddr, *emailAddr); + attendee->SetRoleL(CCalAttendee::EReqParticipant); + } + // Set organizer: + else if ( i == 0 ) + { + // Organizer is the chairman of the meeting: + SetOrganizerL(aCalEntry, firstname, *emailAddr, *emailAddr); + attendee->SetRoleL(CCalAttendee::EChair); + } + else if( i % 3 == 0 ) + { + // every third attendee is optional: + attendee->SetRoleL(CCalAttendee::EOptParticipant); + } + else + { + // Others are required attendees: + attendee->SetRoleL(CCalAttendee::EReqParticipant); + } + + TInt attStatus = iEngine->RandomNumber(0,5); + attendee->SetStatusL((CCalAttendee::TCalStatus) attStatus); + + CleanupStack::PopAndDestroy(emailAddr); + } + + // Explicit attendees: + for( TInt i = 0; i < parameters->iAttendees.Count(); ++i ) + { + CCreatorCalenderAttendee* attendeeInfo = parameters->iAttendees[i]; + if( attendeeInfo && attendeeInfo->EmailAddress().Length() > 0) + { + CCalAttendee* attendee = CCalAttendee::NewL(attendeeInfo->EmailAddress()); + CleanupStack::PushL(attendee); + if( attendeeInfo->CommonName().Length() > 0 ) + attendee->SetCommonNameL(attendeeInfo->CommonName()); + attendee->SetRoleL(attendeeInfo->Role()); + attendee->SetStatusL(attendeeInfo->Status()); + attendee->SetResponseRequested(ETrue); + aCalEntry.AddAttendeeL(attendee); + CleanupStack::Pop(); // attendee + } + } + + // Linked attendees: +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + + CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC(); + uriArray->AppendL( TVPbkContactStoreUriPtr(VPbkContactStoreUris::DefaultCntDbUri())); + + if( iContactManager == 0 ) + { + iContactManager = CVPbkContactManager::NewL( *uriArray, &CCoeEnv::Static()->FsSession()); + } + CleanupStack::PopAndDestroy(uriArray); + + if( iContactManager ) + { + MVPbkContactStoreList& storeList = iContactManager->ContactStoresL(); + storeList.OpenAllL(*this); + iWaiter->StartAndWait(); + + // Sum number of existing contacts: + for( TInt i = 0; i < parameters->iAttendeeLinkIds.Count(); ++i ) + { + TLinkIdParam id = parameters->iAttendeeLinkIds[i]; + parameters->iNumberOfExistingAttendees += ContactLinkCache::Instance()->ContactSet(id.iLinkId).NumberOfExistingContacts(); + } + + // Existing attendees: + if( parameters->iNumberOfExistingAttendees > 0 ) + { + _LIT(dbUri, "cntdb://c:contacts.cdb"); + TVPbkContactStoreUriPtr uri(dbUri); + MVPbkContactStore* store = storeList.Find(uri); + if( store ) + { + const MVPbkFieldTypeList& fieldList = store->StoreProperties().SupportedFields(); + + // get contacts, results will be set to iContactResults + MVPbkContactOperationBase* operation = iContactManager->FindL(_L(""), fieldList , *this); + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait();//Making asynchronous FindL to synchronous + CleanupStack::Pop(operation); + delete operation; + } + if( iExistingContacts ) + { + for( TInt i = 0; i < iExistingContacts->Count() && i < parameters->iNumberOfExistingAttendees; ++i ) + { + MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( iExistingContacts->At(i), *this ); + + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait(); // Making asynchronous RetrieveContactL to synchronous + CleanupStack::Pop(); // operation + delete operation; + operation = 0; + HandleSingleContactResultL(); + CCalAttendee* attendee = 0; + if( iTmpEmail && iTmpEmail->Length() > 0 ) + { + attendee = CCalAttendee::NewL(*iTmpEmail); + } + else + { + _LIT(KDummy, ""); + attendee = CCalAttendee::NewL(KDummy); + } + CleanupStack::PushL(attendee); + if( iTmpCN && iTmpCN->Length() > 0 ) + { + attendee->SetCommonNameL(*iTmpCN); + } + attendee->SetRoleL(CCalAttendee::EReqParticipant); + attendee->SetStatusL(CCalAttendee::EAccepted); + attendee->SetResponseRequested(ETrue); + aCalEntry.AddAttendeeL(attendee); + CleanupStack::Pop(attendee); + } + } + } + } + } + + for( TInt i = 0; i < parameters->iAttendeeLinkIds.Count(); ++i ) + { + TLinkIdParam id = parameters->iAttendeeLinkIds[i]; + RPointerArray& links = ContactLinkCache::Instance()->ContactLinks(id.iLinkId); + for( TInt j = 0; j < links.Count() && (id.iLinkAmount < 0 || j < id.iLinkAmount); ++j ) + { + MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( *(links[j]), *this ); + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait(); // Making asynchronous RetrieveContactL to synchronous + CleanupStack::Pop(operation); + delete operation; + operation = 0; + HandleSingleContactResultL(); + CCalAttendee* attendee = 0; + if( iTmpEmail && iTmpEmail->Length() > 0 ) + { + attendee = CCalAttendee::NewL(*iTmpEmail); + } + else + { + _LIT(KDummy, ""); + attendee = CCalAttendee::NewL(KDummy); + } + CleanupStack::PushL(attendee); + if( iTmpCN && iTmpCN->Length() > 0 ) + { + attendee->SetCommonNameL(*iTmpCN); + } + attendee->SetRoleL(CCalAttendee::EReqParticipant); + attendee->SetStatusL(CCalAttendee::EAccepted); + attendee->SetResponseRequested(ETrue); + aCalEntry.AddAttendeeL(attendee); + CleanupStack::Pop(attendee); + } + } + } + + storeList.CloseAll(*this); + } +#endif + } +//---------------------------------------------------------------------------- + +TInt CCreatorInterimCalendar::CreateEventEntryL ( + CCreatorModuleBaseParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::CreateEventEntryL"); + + delete iParameters; + iParameters = 0; + + CCalenderInterimParameters* parameters = (CCalenderInterimParameters*)aParameters; + + // random data needed if no predefined data available + if (!parameters ) + { + iParameters = new(ELeave) CCalenderInterimParameters; + + iParameters->iRandomModeStartTime = iRandomModeStartTime; + iParameters->iRandomModeEndTime = iRandomModeEndTime; + iParameters->iNumberRepeatingEntries = iNumberRepeatingEntries; + iParameters->iNumberOfAttendees = iNumberOfAttendees; + + // difference between start and end times + TTimeIntervalMinutes differenceInMinutes; + iParameters->iRandomModeEndTime.MinutesFrom ( + iParameters->iRandomModeStartTime, differenceInMinutes ); + + // start time (= something between the period start and end date) + iParameters->iStartTime = iParameters->iRandomModeStartTime; + iParameters->iStartTime + += TTimeIntervalMinutes (iEngine->RandomNumber (differenceInMinutes.Int ( ) ) ); + + // set end time (= start time + some random time) + iParameters->iEndTime = iParameters->iStartTime; + iParameters->iEndTime + += TTimeIntervalMinutes (iEngine->RandomNumber (5, 500 ) ); + + // strings + iParameters->iDescription->Des() + = iEngine->RandomString (CCreatorEngine::EMemoText ); + + iParameters->iSummary->Des() = iParameters->iDescription->Des(); + + // Random event status: + iParameters->iStatus = + (CCalEntry::TStatus) iEngine->RandomNumber(0, (TInt) CCalEntry::ECancelled); + + parameters = iParameters; + } + + TInt err = KErrNone; + HBufC8* guid = HBufC8::NewLC (255 ); + TPtr8 uidP=guid->Des ( ); + GenerateRandomId (uidP ); + CCalEntry* entry = CCalEntry::NewL (CCalEntry::EEvent, guid, + CCalEntry::EMethodAdd, 0 ); + CleanupStack::PushL (entry ); + // iEntryUids->AppendL( *guid->Alloc() ); + + entry->SetDescriptionL (parameters->iDescription->Des ( ) ); + entry->SetSummaryL (parameters->iSummary->Des ( ) ); + + TCalTime startTime; + TCalTime endTime; + // Set the start and end times using time values local to the current system time zone + startTime.SetTimeLocalL (parameters->iStartTime ); + endTime.SetTimeLocalL (parameters->iEndTime ); + entry->SetStartAndEndTimeL (startTime, endTime ); + + // Repeating times: + AddRepeatingRuleL(startTime, *entry, parameters); + + if( iSetAlarm || parameters->iUseRandomAlarmTime ) + { + SetRandomAlarmL(*entry); + } + else + { + SetAlarmL(*entry, parameters); + } + + // Add attendees: + AddAttendeesL(*entry, parameters); + + if( parameters->IsAllowedEntryStatus(CCalEntry::EEvent, parameters->iStatus)) + { + LOGSTRING2("Creator: CCreatorInterimCalendar::CreateEventEntryL setting entry status: %d", parameters->iStatus); + entry->SetStatusL(parameters->iStatus); + } + + RPointerArray array; + CleanupClosePushL (array ); + array.AppendL (entry ); + + TInt success(0); + //If StoreL() leaves, 'success' contains the number of entries that were stored before it failed + iCalEntryView->StoreL (array, success ); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( entry->LocalUidL() ); + + //One item should be added at time + if (success != 1 ) + { + err = 1; + } + + CleanupStack::PopAndDestroy (&array ); + CleanupStack::PopAndDestroy (entry ); + CleanupStack::Pop (guid );//guid has been destroyed by entry, which has ownership to guid + return err; + + } + +//---------------------------------------------------------------------------- + + +TInt CCreatorInterimCalendar::CreateReminderEntryL ( + CCreatorModuleBaseParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::CreateReminderEntryL"); + + delete iParameters; + iParameters = NULL; + + CCalenderInterimParameters* parameters = (CCalenderInterimParameters*)aParameters; + + // random data needed if no predefined data available + if (!parameters ) + { + iParameters = new(ELeave) CCalenderInterimParameters; + + iParameters->iRandomModeStartTime = iRandomModeStartTime; + iParameters->iRandomModeEndTime = iRandomModeEndTime; + + // difference between start and end times + TTimeIntervalDays + differenceInDays = iParameters->iRandomModeEndTime.DaysFrom (iParameters->iRandomModeStartTime ); + + // due time (= something between the period start and end date) + iParameters->iStartTime = iParameters->iRandomModeStartTime; + iParameters->iStartTime + += TTimeIntervalDays (iEngine->RandomNumber (differenceInDays.Int ( ) ) ); + + // strings + iParameters->iDescription->Des() + = iEngine->RandomString (CCreatorEngine::EReminderText ); + + iParameters->iSummary->Des() = iParameters->iDescription->Des(); + + parameters = iParameters; + } + + TInt err = KErrNone; + + HBufC8* guid = HBufC8::NewLC (255 ); + TPtr8 uidP=guid->Des ( ); + GenerateRandomId (uidP ); + + CCalEntry* entry = CCalEntry::NewL (CCalEntry::EReminder, guid, + CCalEntry::EMethodAdd, 0 ); + CleanupStack::PushL (entry ); + + //Using same text as description and summary + entry->SetDescriptionL (parameters->iDescription->Des ( ) ); + entry->SetSummaryL (parameters->iSummary->Des ( ) ); + + TCalTime startTime; + TCalTime endTime; + // Set the start and end times using time values local to the current system time zone + startTime.SetTimeLocalL (parameters->iStartTime ); + TTime nullTime = Time::NullTTime ( ); + endTime.SetTimeLocalL (nullTime ); + entry->SetStartAndEndTimeL (startTime, endTime ); + + if( parameters->IsAllowedEntryStatus(CCalEntry::EReminder, parameters->iStatus)) + { + LOGSTRING2("Creator: CCreatorInterimCalendar::CreateReminderEntryL setting entry status: %d", parameters->iStatus); + entry->SetStatusL(parameters->iStatus); + } + + if( iSetAlarm || parameters->iUseRandomAlarmTime ) + { + SetRandomAlarmL(*entry); + } + else + { + SetAlarmL(*entry, parameters); + } + + RPointerArray array; + CleanupClosePushL (array ); + array.AppendL (entry ); + + TInt success(0); + //If StoreL() leaves, 'success' contains the number of entries that were stored before it failed + iCalEntryView->StoreL (array, success ); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( entry->LocalUidL() ); + + //One item should be added at time + if (success != 1 ) + { + err = 1; + } + + CleanupStack::PopAndDestroy (&array ); + CleanupStack::PopAndDestroy (entry ); + CleanupStack::Pop (guid );//guid has been destroyed by entry, which has ownership to guid + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorInterimCalendar::CreateAnniversaryEntryL ( + CCreatorModuleBaseParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::CreateAnniversaryEntryL"); + + delete iParameters; + iParameters = NULL; + + CCalenderInterimParameters* parameters = (CCalenderInterimParameters*)aParameters; + + // random data needed if no predefined data available + if (!parameters ) + { + iParameters = new(ELeave) CCalenderInterimParameters; + + iParameters->iRandomModeStartTime = iRandomModeStartTime; + iParameters->iRandomModeEndTime = iRandomModeEndTime; + + // difference between start and end times + TTimeIntervalDays differenceInDays = iParameters->iRandomModeEndTime.DaysFrom(iParameters->iRandomModeStartTime); + + // start time (= something between the period start and end date) + iParameters->iStartTime = iParameters->iRandomModeStartTime; + iParameters->iStartTime += TTimeIntervalDays( iEngine->RandomNumber(differenceInDays.Int()) ); + + // strings + iParameters->iDescription->Des().Copy (iEngine->RandomString (CCreatorEngine::EFirstName ) ); + iParameters->iDescription->Des().Append ( _L("'s ") ); + iParameters->iDescription->Des().Append (iEngine->RandomString (CCreatorEngine::EAnniversaryReason ) ); + iParameters->iSummary->Des() = iParameters->iDescription->Des(); + parameters = iParameters; + } + + TInt err = KErrNone; + + HBufC8* guid = HBufC8::NewLC (255 ); + TPtr8 uidP=guid->Des ( ); + GenerateRandomId (uidP ); + + CCalEntry* entry = CCalEntry::NewL (CCalEntry::EAnniv, guid, + CCalEntry::EMethodNone, 0 ); + CleanupStack::PushL (entry ); + + //Using same text as description and summary + entry->SetDescriptionL (parameters->iDescription->Des ( ) ); + entry->SetSummaryL (parameters->iSummary->Des ( ) ); + + TCalTime startTime; + TCalTime endTime; + TTime nullTime = Time::NullTTime ( ); + endTime.SetTimeLocalL (nullTime ); + + // Set the start time using time value local to the current system time zone + startTime.SetTimeLocalL (parameters->iStartTime ); + + entry->SetStartAndEndTimeL (startTime, endTime ); + + if( iSetAlarm || parameters->iUseRandomAlarmTime ) + { + SetRandomAlarmL(*entry); + } + else + { + SetAlarmL(*entry, parameters); + } + + //set repeating rule + TCalRRule yearlyRptRule(TCalRRule::EYearly); + yearlyRptRule.SetDtStart (startTime ); + //Set repeating until forever, not setting it to stop + //yearlyRptRule.SetUntil(endTime); + entry->SetRRuleL (yearlyRptRule ); + + RPointerArray array; + CleanupClosePushL (array ); + array.AppendL (entry ); + + TInt success(0); + //If StoreL() leaves, 'success' contains the number of entries that were stored before it failed + iCalEntryView->StoreL (array, success ); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( entry->LocalUidL() ); + + //One item should be added at time + if (success != 1 ) + { + err = 1; + } + + CleanupStack::PopAndDestroy (&array ); + CleanupStack::PopAndDestroy (entry ); + CleanupStack::Pop (guid );//guid has been destroyed by entry, which has ownership to guid + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorInterimCalendar::CreateTodoEntryL ( + CCreatorModuleBaseParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::CreateTodoEntryL"); + + delete iParameters; + iParameters = NULL; + + CCalenderInterimParameters* parameters = (CCalenderInterimParameters*)aParameters; + + // random data needed if no predefined data available + if (!parameters ) + { + iParameters = new(ELeave) CCalenderInterimParameters; + + iParameters->iRandomModeStartTime = iRandomModeStartTime; + iParameters->iRandomModeEndTime = iRandomModeEndTime; + + // difference between start and end times + TTimeIntervalDays + differenceInDays = iParameters->iRandomModeEndTime.DaysFrom (iParameters->iRandomModeStartTime ); + + // due time (= something between the period start and end date) + iParameters->iTodoDueTime = iParameters->iRandomModeStartTime; + iParameters->iTodoDueTime + += TTimeIntervalDays (iEngine->RandomNumber (differenceInDays.Int ( ) ) ); + + // strings + iParameters->iDescription->Des ( ) + = iEngine->RandomString (CCreatorEngine::EToDoText ); + + iParameters->iSummary->Des() = iParameters->iDescription->Des(); + + //priority + iParameters->iTodoPriority = iEngine->RandomNumber (1, 3 ); + iParameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber((TInt) CCalEntry::ETodoNeedsAction, (TInt) CCalEntry::ETodoInProcess); + parameters = iParameters; + + } + + TInt err = KErrNone; + + HBufC8* guid = HBufC8::NewLC (255 ); + TPtr8 uidP=guid->Des ( ); + GenerateRandomId (uidP ); + + CCalEntry* entry = CCalEntry::NewL (CCalEntry::ETodo, guid, + CCalEntry::EMethodAdd, 0 ); + CleanupStack::PushL (entry ); + + //Using same text as description and summary + entry->SetDescriptionL (parameters->iDescription->Des ( ) ); + entry->SetSummaryL (parameters->iSummary->Des ( ) ); + + entry->SetPriorityL (parameters->iTodoPriority ); + + if( parameters->IsAllowedEntryStatus(CCalEntry::ETodo, parameters->iStatus)) + { + LOGSTRING2("Creator: CCreatorInterimCalendar::CreateTodoEntryL setting entry status: %d", parameters->iStatus); + entry->SetStatusL(parameters->iStatus); + } + + TCalTime startTime; + TCalTime endTime; + // Set the start and end times using time values local to the current system time zone + startTime.SetTimeLocalL (parameters->iTodoDueTime ); + endTime.SetTimeLocalL (parameters->iTodoDueTime ); + entry->SetStartAndEndTimeL (startTime, endTime ); + + if( iSetAlarm || parameters->iUseRandomAlarmTime ) + { + SetRandomAlarmL(*entry); + } + else + { + SetAlarmL(*entry, parameters); + } + + RPointerArray array; + CleanupClosePushL (array ); + array.AppendL (entry ); + + TInt success(0); + //If StoreL() leaves, 'success' contains the number of entries that were stored before it failed + iCalEntryView->StoreL (array, success ); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( entry->LocalUidL() ); + + //One item should be added at time + if (success != 1 ) + { + err = 1; + } + + CleanupStack::PopAndDestroy (&array ); + CleanupStack::PopAndDestroy (entry ); + CleanupStack::Pop (guid );//guid has been destroyed by entry, which has ownership to guid + + return err; + } + +//---------------------------------------------------------------------------- + +void CCreatorInterimCalendar::Progress (TInt /*aPercentageCompleted*/) + { + //Not really needed but observer need to be implement + } + +void CCreatorInterimCalendar::Completed (TInt aError ) + { + //Not really needed but observer need to be implement + LOGSTRING2("Creator: CCreatorInterimCalendar::Completed err=%d", aError); + } + +TBool CCreatorInterimCalendar::NotifyProgress ( ) + { + //Not really needed but observer need to be implement + return NULL; + } + +//---------------------------------------------------------------------------- + + +void CCreatorInterimCalendar::GenerateRandomId (TDes8& aText ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::GenerateRandomId"); + + aText.Zero ( ); + + TTime now; + now.UniversalTime ( ); + TInt64 time = now.Int64 ( ); + + // The number of characters in the guid should be + // more than 8 (to ensure the guids are not too small) + // less than 255 (this is the maximum length of a guid) + // less than MaxLength of the descriptor passed in + TInt numChar(0); + do + { + numChar = Math::Rand (time ) % (aText.MaxLength ( ) - 1); + } + while (numChar > 255|| numChar < 8 ); + + for (TInt i(0); i < numChar ; ++i ) + { + TInt character = Math::Rand (time )%6; + character = Math::Rand (time ) % 26+ ((character == 2) ? 'A' : 'a'); + aText.Append (character ); + } + + } + +//---------------------------------------------------------------------------- +void CCreatorInterimCalendar::DeleteAllL() + { + LOGSTRING("Creator: CCreatorInterimCalendar::DeleteAllL"); + TCalTime zeroTime; + zeroTime.SetTimeUtcL( TCalTime::MinTime() ); + RArray allIds; + CleanupClosePushL( allIds ); + iCalEntryView->GetIdsModifiedSinceDateL( zeroTime, allIds ); + if ( allIds.Count() ) + { + TInt successCount( KErrNotFound ); + iCalEntryView->DeleteL( allIds, successCount ); + if ( successCount != allIds.Count() ) + { + User::Leave( KErrGeneral ); + } + } + CleanupStack::PopAndDestroy( &allIds ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Calendar related registry + iEngine->RemoveStoreL( KUidDictionaryUidCalendar ); + } + +//---------------------------------------------------------------------------- +void CCreatorInterimCalendar::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorInterimCalendar::DeleteAllCreatedByCreatorL"); + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidCalendar ); + + // delete entries + TInt successCount(0); // ignore + TRAP_IGNORE( iCalEntryView->DeleteL( iEntryIds, successCount ) ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Calendar related registry + iEngine->RemoveStoreL( KUidDictionaryUidCalendar ); + } + + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorInterimCalendar::VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& /*aOperation*/, + MVPbkStoreContact* aContact ) + { + LOGSTRING("Creator: CCreatorInterimCalendar::VPbkSingleContactOperationComplete" ); + iWaiter->Cancel(); + delete iTempContact; + iTempContact = aContact; + } +void CCreatorInterimCalendar::HandleSingleContactResultL() + { + if( iTempContact ) + { + TPtrC firstName; + TPtrC lastName; + TPtrC email; + + // Put contact's name to temporary member: + delete iTmpCN; + iTmpCN = 0; + delete iTmpEmail; + iTmpEmail = 0; + + MVPbkStoreContactFieldCollection& fields = iTempContact->Fields(); + TInt fieldCount = fields.FieldCount(); + for (TInt i = 0; i < fieldCount; ++i) + { + MVPbkStoreContactField& field = fields.FieldAt(i); + MVPbkContactFieldData& fieldData = field.FieldData(); + const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); + + if( fieldType ) + { + TInt fieldId( fieldType->FieldTypeResId() ); + + TVPbkFieldStorageType dataType = fieldData.DataType(); + if( dataType == EVPbkFieldStorageTypeText) + { + MVPbkContactFieldTextData& textData = MVPbkContactFieldTextData::Cast(fieldData); + if( fieldId == R_VPBK_FIELD_TYPE_FIRSTNAME ) + { + firstName.Set(textData.Text()); + } + else if( fieldId == R_VPBK_FIELD_TYPE_LASTNAME ) + { + lastName.Set(textData.Text()); + } + else if( fieldId == R_VPBK_FIELD_TYPE_EMAILGEN || + fieldId == R_VPBK_FIELD_TYPE_EMAILHOME || + fieldId == R_VPBK_FIELD_TYPE_EMAILWORK ) + { + email.Set(textData.Text()); + } + } + } + } + if( firstName.Length() > 0 && lastName.Length() > 0 ) + { + _LIT(KSpace, " "); + TRAPD(err, iTmpCN = HBufC::NewL(firstName.Length() + lastName.Length() + 1 )); + if( err == KErrNone ) + { + iTmpCN->Des().Copy(firstName); + iTmpCN->Des().Append(KSpace); + iTmpCN->Des().Append(lastName); + } + } + else if( firstName.Length() > 0 ) + { + TRAPD(err, iTmpCN = HBufC::NewL(firstName.Length())); + if( err == KErrNone ) + { + iTmpCN->Des().Copy(firstName); + } + } + else if( lastName.Length() > 0 ) + { + TRAPD(err, iTmpCN = HBufC::NewL(lastName.Length())); + if( err == KErrNone ) + { + iTmpCN->Des().Copy(lastName); + } + } + + if( email.Length() > 0 ) + { + TRAPD(err, iTmpEmail = HBufC::NewL(email.Length())); + if( err == KErrNone ) + { + iTmpEmail->Des().Copy(email); + } + } + delete iTempContact; + iTempContact = 0; + } + } + +void CCreatorInterimCalendar::VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& /*aOperation*/, + TInt aError ) + { + LOGSTRING2("Creator: CCreatorInterimCalendar::VPbkSingleContactOperationFailed - Error: %d", aError ); + iWaiter->Cancel(); + delete iTempContact; + iTempContact = 0; + } + + + +void CCreatorInterimCalendar::OpenComplete() + { + LOGSTRING("Creator: CreatorInterimCalendar::OpenComplete()"); + iWaiter->Cancel(); + } + +void CCreatorInterimCalendar::StoreReady(MVPbkContactStore& /*aContactStore*/) + { + LOGSTRING("Creator: CreatorInterimCalendar::StoreReady()"); + iWaiter->Cancel(); + } + +void CCreatorInterimCalendar::StoreUnavailable(MVPbkContactStore& /*aContactStore*/, + TInt /*aReason*/) + { + LOGSTRING("Creator: CreatorInterimCalendar::StoreUnavailable()"); + iWaiter->Cancel(); + } + + +void CCreatorInterimCalendar::HandleStoreEventL( + MVPbkContactStore& /*aContactStore*/, + TVPbkContactStoreEvent /*aStoreEvent*/) + { + LOGSTRING("Creator: CreatorInterimCalendar::HandleStoreEventL()"); + iWaiter->Cancel(); + } + +void CCreatorInterimCalendar::FindCompleteL( MVPbkContactLinkArray* aResults ) + { + LOGSTRING("Creator: CreatorInterimCalendar::FindCompleteL()"); + iWaiter->Cancel(); + iExistingContacts = aResults; + } + +void CCreatorInterimCalendar::FindFailed( TInt aError ) + { + LOGSTRING2("Creator: CreatorInterimCalendar::FindFailed() - Error: %d", aError); + iWaiter->Cancel(); + delete iExistingContacts; + iExistingContacts = 0; + } +#endif +//---------------------------------------------------------------------------- + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_calendarelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_calendarelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,594 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_calendarelement.h" +#include "creator_traces.h" +#include "creator_calendar.h" + +using namespace creatorcalendar; + +CCreatorCalendarElement* CCreatorCalendarElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorCalendarElement* self = new (ELeave) CCreatorCalendarElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } + +void CCreatorCalendarElement::FillEntryParamsL(TEntryType aType, const RPointerArray& fields, CCalenderInterimParameters* parameters) + { + if( parameters == 0 ) + return; + + TBool startResolved = EFalse; + TBool endResolved = EFalse; + + for( TInt i = 0; i < fields.Count(); ++i ) + { + TPtrC elemName = fields[i]->Name(); + TPtrC elemContent = fields[i]->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + + if( elemName == KSummary || elemName == KDescription ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + TPtrC reason; + if( aType == EAppointment ) + { + reason.Set(iEngine->RandomString (CCreatorEngine::EMeetingReason )); + } + else if( aType == EEvent ) + { + reason.Set(iEngine->RandomString(CCreatorEngine::EMemoText)); + } + else if( aType == EReminder ) + { + reason.Set(iEngine->RandomString(CCreatorEngine::EReminderText)); + } + else if( aType == EAnniversary ) + { + reason.Set(iEngine->RandomString(CCreatorEngine::EAnniversaryReason)); + } + else if( aType == ETodo ) + { + reason.Set(iEngine->RandomString(CCreatorEngine::EToDoText)); + } + + if( elemName == KDescription ) + { + delete parameters->iDescription; + parameters->iDescription = 0; + parameters->iDescription = HBufC::NewL(reason.Length()); + parameters->iDescription->Des().Copy(reason); + } + else if(elemName == KSummary) + { + delete parameters->iSummary; + parameters->iSummary = 0; + parameters->iSummary = HBufC::NewL(reason.Length()); + parameters->iSummary->Des().Copy(reason); + } + } + else if( elemName == KDescription ) + { + delete parameters->iDescription; + parameters->iDescription = 0; + parameters->iDescription = HBufC::NewL(elemContent.Length()); + parameters->iDescription->Des().Copy(elemContent); + } + else if( elemName == KSummary) + { + delete parameters->iSummary; + parameters->iSummary = 0; + parameters->iSummary = HBufC::NewL(elemContent.Length()); + parameters->iSummary->Des().Copy(elemContent); + } + } + else if( elemName == KLocation ) + { + delete parameters->iLocation; + parameters->iLocation = 0; + + if( randomAttr || elemContent.Length() == 0 ) + { + TPtrC reason = iEngine->RandomString (CCreatorEngine::EMeetingPlace ); + parameters->iLocation = HBufC::NewL(reason.Length()); + parameters->iLocation->Des().Copy(reason); + } + else + { + parameters->iLocation = HBufC::NewL(elemContent.Length()); + parameters->iLocation->Des().Copy(elemContent); + } + } + else if( elemName == KStarttime ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + // Random start time used. If end time is already resolved, let's use that one for the basis. + if( endResolved ) + { + parameters->iStartTime = iEngine->RandomTime(parameters->iEndTime, CCreatorEngine::EDatePast); + } + else + { + // Past or future: + CCreatorEngine::TRandomDateType pastOrfuture = + (CCreatorEngine::TRandomDateType) iEngine->RandomNumber((TInt) CCreatorEngine::EDatePast, + (TInt) CCreatorEngine::EDateFuture); + + parameters->iStartTime = + iEngine->RandomTime(iEngine->RandomDate(pastOrfuture), pastOrfuture); + } + } + else + { + parameters->iStartTime = ConvertToDateTimeL(elemContent); + } + startResolved = ETrue; + } + else if( elemName == KEndtime ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + // Random end time used. If start time is already resolved, let's use that one. + if( startResolved ) + { + parameters->iEndTime = iEngine->RandomTime(parameters->iStartTime, CCreatorEngine::EDateFuture); + } + else + { + // Past or future: + CCreatorEngine::TRandomDateType pastOrfuture = + (CCreatorEngine::TRandomDateType) iEngine->RandomNumber((TInt) CCreatorEngine::EDatePast, + (TInt) CCreatorEngine::EDateFuture); + + parameters->iEndTime = + iEngine->RandomTime(iEngine->RandomDate(pastOrfuture), pastOrfuture); + } + } + else + { + parameters->iEndTime = ConvertToDateTimeL(elemContent); + } + if( aType == ETodo ) + { + parameters->iTodoDueTime = parameters->iEndTime; + } + } + else if( elemName == KRecurrentFreq ) + { + TInt randomFreq = 0; + if( randomAttr || elemContent.Length() == 0 ) + { + randomFreq = iEngine->RandomNumber(1, 4); + } + if(randomFreq == 1 || CompareIgnoreCase(elemContent, KDaily) == 0 ) + parameters->iRecurrentFrequency = TCalRRule::EDaily; + else if( randomFreq == 2 || CompareIgnoreCase(elemContent, KWeekly) == 0 ) + parameters->iRecurrentFrequency = TCalRRule::EWeekly; + else if( randomFreq == 3 || CompareIgnoreCase(elemContent, KMonthly) == 0 ) + parameters->iRecurrentFrequency = TCalRRule::EMonthly; + else if( randomFreq == 4 || CompareIgnoreCase(elemContent, KYearly) == 0 ) + parameters->iRecurrentFrequency = TCalRRule::EYearly; + else + parameters->iRecurrentFrequency = TCalRRule::EInvalid; + } + else if( elemName == KRecurrentInterval ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + parameters->iRecurrentInterval = iEngine->RandomNumber(1,7); + } + else + { + parameters->iRecurrentInterval = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KRecurrentFrom ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + if( startResolved ) + { + // Let's use the start time if it's resolved. + parameters->iRecurrentStartTime = parameters->iStartTime; + } + else + { + parameters->iRecurrentStartTime = iEngine->RandomDate(CCreatorEngine::EDateFuture); + } + } + else + { + parameters->iRecurrentStartTime = ConvertToDateTimeL(elemContent); + } + } + else if( elemName == KRecurrentTo ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + parameters->iRepeatingCount = iEngine->RandomNumber(1, 6); + //parameters->iRecurrentEndTime = iEngine->RandomDate(CCreatorEngine::EDateFuture); + } + else + { + parameters->iRecurrentEndTime = ConvertToDateTimeL(elemContent); + } + } + else if( elemName == KRepeatingCount ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + parameters->iRepeatingCount = iEngine->RandomNumber(1, 52); + } + else + { + parameters->iRepeatingCount = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KAlarmtime ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + parameters->iUseRandomAlarmTime = ETrue; + } + else + { + parameters->iAlarmTime = ConvertToDateTimeL(elemContent); + } + } + else if( elemName == KOrganizername ) + { + delete parameters->iOrganizerName; + parameters->iOrganizerName = 0; + if( randomAttr || elemContent.Length() == 0 ) + { + TPtrC name = iEngine->RandomString (CCreatorEngine::EFirstName ); + parameters->iOrganizerName = HBufC::NewL(name.Length()); + parameters->iOrganizerName->Des().Copy(name); + } + else + { + parameters->iOrganizerName = HBufC::NewL(elemContent.Length()); + parameters->iOrganizerName->Des().Copy(elemContent); + } + } + else if( elemName == KOrganizeremail ) + { + delete parameters->iOrganizerEmail; + parameters->iOrganizerEmail = 0; + if( randomAttr || elemContent.Length() == 0 ) + { + TDesC* email = iEngine->CreateEmailAddressLC(); + parameters->iOrganizerEmail = (HBufC*) email; + CleanupStack::Pop(); // email + } + else + { + parameters->iOrganizerEmail = HBufC::NewL(elemContent.Length()); + parameters->iOrganizerEmail->Des().Copy(elemContent); + } + } + else if( elemName == KStatus ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + if( aType == ETodo ) + { + parameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber(CCalEntry::ETodoNeedsAction, CCalEntry::ETodoInProcess); + } + else + { + parameters->iStatus = (CCalEntry::TStatus) iEngine->RandomNumber(CCalEntry::ETentative, CCalEntry::ECancelled); + } + } + else if( CompareIgnoreCase(elemContent, KCalStatusTentative) == 0 ) + { + parameters->iStatus = CCalEntry::ETentative; + } + else if( CompareIgnoreCase(elemContent, KCalStatusConfirmed) == 0 ) + { + parameters->iStatus = CCalEntry::EConfirmed; + } + else if( CompareIgnoreCase(elemContent, KCalStatusCancelled) == 0 ) + { + parameters->iStatus = CCalEntry::ECancelled; + } + else if( CompareIgnoreCase(elemContent, KCalStatusNeedsAction) == 0 ) + { + parameters->iStatus = CCalEntry::ETodoNeedsAction; + } + else if( CompareIgnoreCase(elemContent, KCalStatusCompleted) == 0 ) + { + parameters->iStatus = CCalEntry::ETodoCompleted; + } + else if( CompareIgnoreCase(elemContent, KCalStatusInProcess) == 0 ) + { + parameters->iStatus = CCalEntry::ETodoInProcess; + } + else + { + parameters->iStatus = CCalEntry::ENullStatus; + } + } + else if( elemName == KPriority ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + parameters->iTodoPriority = iEngine->RandomNumber(1,3); + } + else if( CompareIgnoreCase(elemContent, KPriorityHigh) == 0) + { + parameters->iTodoPriority = 1; + } + else if( CompareIgnoreCase(elemContent, KPriorityMedium) == 0) + { + parameters->iTodoPriority = 2; + } + else if( CompareIgnoreCase(elemContent, KPriorityLow) == 0 ) + { + parameters->iTodoPriority = 3; + } + else + { + parameters->iTodoPriority = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KAttendees ) + { + const RPointerArray& attendeesSubElems = fields[i]->SubElements(); + for( TInt j = 0; j < attendeesSubElems.Count(); ++j ) + { + TPtrC eName = attendeesSubElems[j]->Name(); + TPtrC eContent = attendeesSubElems[j]->Content(); + if( eName == KContactSetRef ) + { + AppendContactSetReferenceL(*attendeesSubElems[j], parameters->iAttendeeLinkIds); + } + else if( eName == KAttendee ) + { + CCreatorCalenderAttendee* calAtt = CCreatorCalenderAttendee::NewL(); + CleanupStack::PushL(calAtt); + const RPointerArray& attendeeFields = attendeesSubElems[j]->SubElements(); + // Make sure that at least email is given: + if(attendeeFields.Count() == 0 ) + { + CCreatorScriptElement* emailField = CCreatorScriptElement::NewL(iEngine, KEmail ); + CleanupStack::PushL(emailField); + fields[i]->SubElements().AppendL(emailField); + CleanupStack::Pop(); // emailField + } + for( TInt k = 0; k < attendeeFields.Count(); ++k ) + { + const CCreatorScriptAttribute* randomAttr = attendeeFields[k]->FindAttributeByName(KRandomLength); + TPtrC attElemName = attendeeFields[k]->Name(); + TPtrC attElemCont = attendeeFields[k]->Content(); + if( attElemName == KCommonname ) + { + if( randomAttr || attElemCont.Length() == 0) + { + // Random data: + calAtt->SetCommonNameL(iEngine->RandomString(CCreatorEngine::EFirstName)); + } + else + { + calAtt->SetCommonNameL(attElemCont); + } + } + else if( attElemName == KEmail ) + { + if( randomAttr || attElemCont.Length() == 0) + { + // Random data: + TDesC* email = iEngine->CreateEmailAddressLC(); + calAtt->SetEmailAddressL(*email); + CleanupStack::PopAndDestroy(); // email + } + else + { + calAtt->SetEmailAddressL(attElemCont); + } + } + else if( attElemName == KRole ) + { + if( randomAttr || attElemCont.Length() == 0) + { + // Random role: + CCalAttendee::TCalRole randomRole = + (CCalAttendee::TCalRole) iEngine->RandomNumber( + (TInt) CCalAttendee::EReqParticipant, + (TInt) CCalAttendee::EChair); + calAtt->SetRole(randomRole); + } + else if( CompareIgnoreCase(attElemCont, KRoleRequired) == 0 ) + { + calAtt->SetRole(CCalAttendee::EReqParticipant); + } + else if( CompareIgnoreCase(attElemCont, KRoleOptional) == 0 ) + { + calAtt->SetRole(CCalAttendee::EOptParticipant); + } + else if( CompareIgnoreCase(attElemCont, KRoleNonPart) == 0 ) + { + calAtt->SetRole(CCalAttendee::ENonParticipant); + } + else if( CompareIgnoreCase(attElemCont, KRoleChair) == 0 ) + { + calAtt->SetRole(CCalAttendee::EChair); + } + } + else if( attElemName == KStatus ) + { + if( randomAttr || attElemCont.Length() == 0) + { + // Random role: + CCalAttendee::TCalStatus randomStatus = + (CCalAttendee::TCalStatus) iEngine->RandomNumber( + (TInt) CCalAttendee::ENeedsAction, + (TInt) CCalAttendee::EInProcess); + calAtt->SetStatus(randomStatus); + } + else if( CompareIgnoreCase(attElemCont, KStatusNeedsAction) == 0 ) + { + calAtt->SetStatus(CCalAttendee::ENeedsAction); + } + else if( CompareIgnoreCase(attElemCont, KStatusAccepted) == 0 ) + { + calAtt->SetStatus(CCalAttendee::EAccepted); + } + else if( CompareIgnoreCase(attElemCont, KStatusTentative) == 0 ) + { + calAtt->SetStatus(CCalAttendee::ETentative); + } + else if( CompareIgnoreCase(attElemCont, KStatusConfirmed) == 0 ) + { + calAtt->SetStatus(CCalAttendee::EConfirmed); + } + else if( CompareIgnoreCase(attElemCont, KStatusDeclined) == 0 ) + { + calAtt->SetStatus(CCalAttendee::EDeclined); + } + else if( CompareIgnoreCase(attElemCont, KStatusCompleted) == 0 ) + { + calAtt->SetStatus(CCalAttendee::ECompleted); + } + else if( CompareIgnoreCase(attElemCont, KStatusDelegated) == 0 ) + { + calAtt->SetStatus(CCalAttendee::EDelegated); + } + else if( CompareIgnoreCase(attElemCont, KStatusInProcess) == 0 ) + { + calAtt->SetStatus(CCalAttendee::EInProcess); + } + } + } + parameters->iAttendees.AppendL(calAtt); + CleanupStack::Pop(); // calAtt + } + } + } + } + } + +void CCreatorCalendarElement::ExecuteCommandL() + { + LOGSTRING("Creator: CCreatorCalendarElement::ExecuteCommandL"); + // Amount of calendar entries: + const CCreatorScriptAttribute* calEntryAmountAttr = this->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* calEntryTypeAttr = this->FindAttributeByName(KType); + TInt entryAmount = 1; + if( calEntryAmountAttr ) + { + entryAmount = ConvertStrToIntL(calEntryAmountAttr->Value()); + } + if( calEntryTypeAttr == 0 ) + { + LOGSTRING("ERROR in CCreatorCalendarElement::ExecuteCommandL: Type attribute is missing."); + User::Leave(KErrGeneral); // type is required attribute + } + + // Find fields element: + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + + for( TInt cI = 0; cI < entryAmount; ++cI ) + { + CCalenderInterimParameters* param = new (ELeave) CCalenderInterimParameters; + CleanupStack::PushL(param); + if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAppointment) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EAppointment, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + break; // We can step out from the for-loop, because the amount is given to engine. + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeEvent ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EEvent, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + break; // We can step out from the for-loop, because the amount is given to engine. + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeReminder ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EReminder, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + break; // We can step out from the for-loop, because the amount is given to engine. + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAnniversary ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EAnniversary, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + break; // We can step out from the for-loop, because the amount is given to engine. + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeTodo ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(ETodo, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + break; // We can step out from the for-loop, because the amount is given to engine. + } + } + CleanupStack::Pop(); // param + } + } + +CCreatorCalendarElement::CCreatorCalendarElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_connectionmethod.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_connectionmethod.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,948 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_connectionmethod.h" +#include "creator_traces.h" + +using namespace CMManager; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include + +//#include //For WEP setting +//#include + +static const TInt KConnectionSettingssFieldLength = 128; + +_LIT(KCreatorConnectionSettingssPrefixName, "CR_"); + +//---------------------------------------------------------------------------- + +CConnectionSettingsParameters::CConnectionSettingsParameters() + { + LOGSTRING("Creator: CConnectionSettingsParameters::CConnectionSettingsParameters"); + + iConnectionName = HBufC::New(KConnectionSettingssFieldLength); + iStartPage = HBufC::New(KConnectionSettingssFieldLength); + iLoginName = HBufC::New(KConnectionSettingssFieldLength); + iLoginPass = HBufC::New(KConnectionSettingssFieldLength); + iIPAddr = HBufC::New(KConnectionSettingssFieldLength); + iIP4NameServer1 = HBufC::New(KConnectionSettingssFieldLength); + iIP4NameServer2 = HBufC::New(KConnectionSettingssFieldLength); + iDefaultTelNumber = HBufC::New(KConnectionSettingssFieldLength); + iProxyServerAddress = HBufC::New(KConnectionSettingssFieldLength); + iSubnetMask = HBufC::New(KConnectionSettingssFieldLength); + iGatewayAddress = HBufC::New(KConnectionSettingssFieldLength); + iWLANName = HBufC::New(KConnectionSettingssFieldLength); + iWlanIpAddr = HBufC::New(KConnectionSettingssFieldLength); + iIP6NameServer1 = HBufC::New(KConnectionSettingssFieldLength); + iIP6NameServer2 = HBufC::New(KConnectionSettingssFieldLength); + } + +CConnectionSettingsParameters::~CConnectionSettingsParameters() + { + LOGSTRING("Creator: CConnectionSettingssParameters::~CConnectionSettingssParameters"); + + delete iProxyServerAddress; + delete iDefaultTelNumber; + delete iIP4NameServer2; + delete iIP4NameServer1; + delete iIPAddr; + delete iLoginPass; + delete iLoginName; + delete iStartPage; + delete iConnectionName; + delete iSubnetMask; + delete iGatewayAddress; + delete iWLANName; + delete iWlanIpAddr; + delete iIP6NameServer1; + delete iIP6NameServer2; + } + +//---------------------------------------------------------------------------- + +CCreatorConnectionSettings* CCreatorConnectionSettings::NewL(CCreatorEngine* aEngine) + { + CCreatorConnectionSettings* self = CCreatorConnectionSettings::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorConnectionSettings* CCreatorConnectionSettings::NewLC(CCreatorEngine* aEngine) + { + CCreatorConnectionSettings* self = new (ELeave) CCreatorConnectionSettings; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorConnectionSettings::CCreatorConnectionSettings() + { + } + +void CCreatorConnectionSettings::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorConnectionSettings::ConstructL"); + + iEngine = aEngine; + + iCmManagerExt.CreateTablesAndOpenL(); + } + +CCreatorConnectionSettings::~CCreatorConnectionSettings() + { + LOGSTRING("Creator: CCreatorConnectionSettings::~CCreatorConnectionSettings"); + + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidIAP ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + if (iParameters) + { + delete iParameters; + } + + iCmManagerExt.Close(); + } + + +//---------------------------------------------------------------------------- + +TBool CCreatorConnectionSettings::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorConnectionSettings::AskDataFromUserL"); + + if( aCommand == ECmdDeleteIAPs ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all Connection Methods?") ); + } + else if( aCommand == ECmdDeleteCreatorIAPs ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all Connection Methods created with Creator?") ); + } + else + { + return iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?")); + } + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorConnectionSettings::CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters) + { + LOGSTRING("Creator: CCreatorConnectionSettings::CreateConnectionSettingsEntryL"); + + CConnectionSettingsParameters* parameters = (CConnectionSettingsParameters*) aParameters; + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new (ELeave) CConnectionSettingsParameters(); + parameters = iParameters; + SetRandomParametersL(*parameters); + } + + if( parameters->iBearerType == KRandomBearerType ) + { + SetRandomBearerTypeL(*parameters); + } + + TInt err = KErrNone; + + // create unique name for each network destination + RCmDestinationExt dest; + TInt destinationError = KErrNone; + TInt count = 0; + TBuf name; + name.Copy(parameters->iConnectionName->Des()); + do + { + TRAP(destinationError, dest = iCmManagerExt.CreateDestinationL(name)); + if (destinationError == KErrAlreadyExists) + { + name.Copy(parameters->iConnectionName->Des()); + count++; + name.AppendFormat(_L(" (%d)"), count); + } + else if (destinationError != KErrNone) + { + User::Leave(destinationError); + } + } + while (destinationError == KErrAlreadyExists); + parameters->iConnectionName->Des().Copy(name); + + CleanupClosePushL(dest); + dest.UpdateL(); + + RCmConnectionMethodExt conMethod = dest.CreateConnectionMethodL( parameters->iBearerType);//KUidPacketDataBearerType + CleanupClosePushL( conMethod ); + + if(parameters->iBearerType == KUidWlanBearerType) + { + //IP net mask of interface + conMethod.SetStringAttributeL( EWlanIpNetMask, parameters->iSubnetMask->Des() ); + + //IP address of EPOC. + conMethod.SetStringAttributeL( EWlanIpAddr, parameters->iWlanIpAddr->Des() ); + // + //following gateway ID:s is not workin, + //logically ID would be EWlanIpGateway because EWlanIpNetMask + //is going to net mask, which is just before gateway in ui + //---> + conMethod.SetStringAttributeL( EWlanIpGateway, parameters->iGatewayAddress->Des() ); + //conMethod.SetStringAttributeL( EApIspIPGateway, parameters->iGatewayAddress->Des() ); + conMethod.SetStringAttributeL( ECmWapIPGatewayAddress, parameters->iGatewayAddress->Des() ); + conMethod.SetStringAttributeL( ECmIPGateway, parameters->iGatewayAddress->Des() ); + //<--- + + //IP Address of primary and secondary name server (IP v4). + conMethod.SetStringAttributeL( EWlanIpNameServer1, parameters->iIP4NameServer1->Des() ); + conMethod.SetStringAttributeL( EWlanIpNameServer2, parameters->iIP4NameServer2->Des() ); + //The SSID of this WLAN connection. + conMethod.SetStringAttributeL( EWlanSSID, parameters->iWLANName->Des() ); + + //IP6 address of primary and secondary name servers + conMethod.SetStringAttributeL( EWlanIp6NameServer1, parameters->iIP6NameServer1->Des() ); + conMethod.SetStringAttributeL( EWlanIp6NameServer2, parameters->iIP6NameServer2->Des() ); + + // + //Setting secure mode settings + // + + //Network status (default: EWlanSecModeOpen) // EWlanAuthenticationMode use instead? + conMethod.SetIntAttributeL( EWlanSecurityMode, parameters->iWLanSecMode ); + //WLAN Network mode + conMethod.SetIntAttributeL( EWlanConnectionMode, parameters->iWlanNetMode ); + + + if(parameters->iWLanSecMode == EWlanSecModeOpen) + {}//Nothing to set when mode is open + else if(parameters->iWLanSecMode == EWlanSecModeWep) + { + //See WEPSecuritySettingsUI.h + + + ///CWEPSecuritySettings + // conMethod.SetIntAttributeL( EWlanSecurityMode, parameters->iWLanSecMode ); + } + else if(parameters->iWLanSecMode == EWlanSecMode802_1x) + { + } + else if(parameters->iWLanSecMode == EWlanSecModeWpa) + { + } + else if(parameters->iWLanSecMode == EWlanSecModeWpa2) + { + } + + //WLAN security setting + //conMethod.SetStringAttributeL( EWlanAuthenticationMode, parameters->iIP6NameServer2->Des() ); + //Utilise this method + //conMethod.SetStringAttributeL( EWlanSecurityMode, parameters->iWLanSecMode ); + } + //Not known special attributes for packet data + else if(parameters->iBearerType == KUidPacketDataBearerType) + { + + //Access point name. + conMethod.SetStringAttributeL( EPacketDataAPName, parameters->iConnectionName->Des() );//crash + + //Authentication user name + conMethod.SetStringAttributeL( EPacketDataIFAuthName, parameters->iLoginName->Des() ); + ///TProtocolType a; + //EPdpTypeIPv4 or EPdpTypeIPv6 + conMethod.SetIntAttributeL( EPacketDataPDPType, parameters->iProtocolType ); + + //IP6 address of primary and secondary name servers + conMethod.SetStringAttributeL( EPacketDataIPIP6NameServer1, parameters->iIP6NameServer1->Des() ); + conMethod.SetStringAttributeL( EPacketDataIPIP6NameServer2, parameters->iIP6NameServer2->Des() ); + //IP address of primary name server + conMethod.SetStringAttributeL( EPacketDataIPNameServer1, parameters->iIP4NameServer1->Des() ); + //IP address of secondary name server + conMethod.SetStringAttributeL( EPacketDataIPNameServer2, parameters->iIP4NameServer2->Des() ); + + //Also existing but UI not showing them: EPacketDataHeaderCompression, EPacketDataDisablePlainTextAuth + //EPacketDataIFAuthPass, EDialIFAuthPass, EPacketDataIFPromptForAuth, EPacketDataIPAddr + } + else if(parameters->iBearerType == KUidCSDBearerType || parameters->iBearerType == KUidHSCSDBearerType) + { + //Authentication user name + conMethod.SetStringAttributeL( EDialIFAuthName, parameters->iLoginName->Des() ); + //Dial-up number + conMethod.SetStringAttributeL( EDialDefaultTelNum, parameters->iDefaultTelNumber->Des() ); + //Call type + conMethod.SetIntAttributeL( EDialCallType , parameters->iBearerCallTypeIsdn ); + //Maximum speed + conMethod.SetIntAttributeL( EDialMaxConnSpeed, parameters->iBearerSpeed ); + //Prompt user for username and password? (Only for dial out) + conMethod.SetBoolAttributeL( EDialPromptForLogin, parameters->iPromptPassword ); + //IP6 address of primary and secondary name servers + conMethod.SetStringAttributeL( EDialIP6NameServer1, parameters->iIP6NameServer1->Des() ); + conMethod.SetStringAttributeL( EDialIP6NameServer2, parameters->iIP6NameServer2->Des() ); + //Disable plaintext authentication + conMethod.SetBoolAttributeL( EDialDisablePlainTextAuth, parameters->iDisableTextAuth ); + //IP address of primary name server + conMethod.SetStringAttributeL( EDialIPNameServer1, parameters->iIP4NameServer1->Des() ); + //IP address of secondary name server + conMethod.SetStringAttributeL( EDialIPNameServer2, parameters->iIP4NameServer2->Des() ); + + //Also existing EDialEnableIPHeaderComp; EDialIFPromptForAuth;EDialIPAddress parameters + + } + else if(parameters->iBearerType == KUidLanBearerType) + { + + conMethod.SetStringAttributeL( ELanBaseIpNetMask, parameters->iSubnetMask->Des() ); + conMethod.SetStringAttributeL( ELanBaseIpGateway, parameters->iGatewayAddress->Des()); + conMethod.SetStringAttributeL( ELanBaseIpAddr, parameters->iIPAddr->Des() ); + conMethod.SetStringAttributeL( ELanBaseIpNameServer1, parameters->iIP4NameServer1->Des() ); + conMethod.SetStringAttributeL( ELanBaseIpNameServer2, parameters->iIP4NameServer2->Des() ); + conMethod.SetStringAttributeL( ELanBaseIp6NameServer1,parameters->iIP6NameServer1->Des() ); + conMethod.SetStringAttributeL( ELanBaseIp6NameServer2,parameters->iIP6NameServer2->Des() ); + + } + else //KUidEmbeddedDestination and KPluginVPNBearerTypeUid + { + //NOTE: NOT Tested, because no supporting Emulator for them + + //Authentication user name + conMethod.SetStringAttributeL( ECmIFAuthName, parameters->iLoginName->Des() ); + //IP6 address of primary and secondary name servers + conMethod.SetStringAttributeL( ECmIP6NameServer1, parameters->iIP6NameServer1->Des() ); + conMethod.SetStringAttributeL( ECmIP6NameServer2, parameters->iIP6NameServer2->Des() ); + //Disable plaintext authentication + conMethod.SetBoolAttributeL( ECmDisablePlainTextAuth, parameters->iDisableTextAuth ); + //Prompt user for authentication + conMethod.SetBoolAttributeL( ECmIFPromptForAuth, parameters->iPromptPassword ); + //Authentication password + conMethod.SetStringAttributeL( ECmIFAuthPass, parameters->iLoginPass->Des() ); + } + + // + //Adding common attributes, all not neccessary used with all bearer types, but should not cause any problems eather + // + + //CM Name (Connection Method, formelly known as Access Point) + conMethod.SetStringAttributeL( ECmName, parameters->iConnectionName->Des() ); + // Start page of CM + conMethod.SetStringAttributeL( ECmStartPage, parameters->iStartPage->Des() ); + // Enable Proxy + conMethod.SetBoolAttributeL( ECmProxyUsageEnabled, parameters->iUseProxy ); + // Server Name + conMethod.SetStringAttributeL( ECmProxyServerName, parameters->iProxyServerAddress->Des() ); + // Port Number + conMethod.SetIntAttributeL( ECmProxyPortNumber, parameters->iProxyPortNumber ); + //Proxy login name + conMethod.SetStringAttributeL( ECmWapIPProxyLoginName, parameters->iLoginName->Des() ); + //Proxy login password + conMethod.SetStringAttributeL( ECmWapIPProxyLoginPass, parameters->iLoginPass->Des() ); + //IP address of gateway + conMethod.SetStringAttributeL( ECmIPGateway, parameters->iGatewayAddress->Des() ); + //connection-oriented or connectionless API should be used + //ECmWapIPWSPOption option TWapWSPOption: ECmWapWspOptionConnectionless or ECmWapWspOptionConnectionOriented + conMethod.SetIntAttributeL( ECmWapIPWSPOption, parameters->iWapWspOption ); + //NOT WORKING????? Attempt secure WTLS connection to the gateway + conMethod.SetBoolAttributeL( ECmWapIPSecurity, parameters->iSecureAuthentication ); + + // + //Adding advanced settings (Network type, Phone IP addr, DNS addr, proxy srv name, proxy port nbr + // + + //IP address of interface + conMethod.SetStringAttributeL( ECmIPAddress, parameters->iIPAddr->Des() ); + //IP address of primary name server + conMethod.SetStringAttributeL( ECmIPNameServer1, parameters->iIP4NameServer1->Des() ); + //IP address of secondary name server + conMethod.SetStringAttributeL( ECmIPNameServer2, parameters->iIP4NameServer2->Des() ); + + + conMethod.UpdateL(); + + //If no defaults set, set the created CM as a default + SetDefaultCML( conMethod ); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( dest.Id() ); + + conMethod.Close(); + CleanupStack::Pop( );//conMethod + + dest.UpdateL(); + dest.Close(); + CleanupStack::Pop(); // dest + + return err; + } + +//---------------------------------------------------------------------------- +void CConnectionSettingsParameters::SetRandomCMNameL(CCreatorEngine& aEngine) + { + LOGSTRING("Creator: CConnectionSettingsParameters::SetRandomCMNameL"); + + TInt num = aEngine.RandomNumber(1, 3); + TBuf<10> apType; + + if (num==1) + { + apType = _L("mms"); + } + else if (num==2) + { + apType = _L("wap"); + } + else + { + apType = _L("internet"); + } + TBuf<160> company = aEngine.RandomString(CCreatorEngine::ECompany); + iConnectionName->Des() = KCreatorConnectionSettingssPrefixName; + iConnectionName->Des().Append( company ); + iConnectionName->Des().Append(_L(" ")); + iConnectionName->Des().Append(apType); + } + +void CConnectionSettingsParameters::SetRandomWLANNameL(CCreatorEngine& aEngine) + { + LOGSTRING("Creator: CConnectionSettingsParameters::SetRandomWLANNameL"); + + TBuf<160> company = aEngine.RandomString(CCreatorEngine::ECompany); + iWLANName->Des() = KCreatorConnectionSettingssPrefixName; + iWLANName->Des().Append( company ); + iWLANName->Des().Append( _L(" WLAN") ); + } + +void CConnectionSettingsParameters::SetRandomWLANNetModeL(CCreatorEngine& aEngine) + { + LOGSTRING("Creator: CConnectionSettingsParameters::SetRandomWLANNetModeL"); + + TInt wlanNetModeRand = aEngine.RandomNumber(1, 2); + if(wlanNetModeRand == 1) + { + iWlanNetMode = EAdhoc;//Ad-Hoc mode + } + else + { + iWlanNetMode = CMManager::EInfra;//Infrastructure mode + } + } + +void CConnectionSettingsParameters::SetRandomWLANSecurityModeL(CCreatorEngine& aEngine) + { + LOGSTRING("Creator: CConnectionSettingsParameters::SetRandomWLANSecurityModeL"); + + TInt wlanSecModeRand = aEngine.RandomNumber(1, 5); + if(wlanSecModeRand == 1) + { + iWLanSecMode = EWlanSecModeOpen;///< Open security mode + } + else if(wlanSecModeRand == 2) + { + iWLanSecMode = EWlanSecModeWep;///< WEP security mode + //See WEPSecuritySettingsUI.h + + ///CWEPSecuritySettings + + //WEP key in us + + //Authentication type + + //WEP Key settings (key len, key format, key data) + } + else if(wlanSecModeRand == 3) + { + iWLanSecMode = EWlanSecMode802_1x; ///< 802.1x security mode + } + else if(wlanSecModeRand == 4) + { + iWLanSecMode = EWlanSecModeWpa;///< WPA security mode + } + else if(wlanSecModeRand == 5) + { + iWLanSecMode = EWlanSecModeWpa2;///< WPA@ security mode + } + } + +void CConnectionSettingsParameters::SetRandomLoginNameL(CCreatorEngine& aEngine) + { + iLoginName->Des() = aEngine.RandomString(CCreatorEngine::EFirstName); + iLoginName->Des().LowerCase(); + } + +void CConnectionSettingsParameters::SetRandomLoginPassL(CCreatorEngine& aEngine) + { + iLoginPass->Des() = aEngine.RandomString(CCreatorEngine::ESurname); + iLoginPass->Des().LowerCase(); + } + +void CConnectionSettingsParameters::SetRandomSecureAuthenticationL(CCreatorEngine& /*aEngine*/) + { + iSecureAuthentication = EFalse; + } + +void CConnectionSettingsParameters::SetRandomPromptPasswordL(CCreatorEngine& /*aEngine*/) + { + iPromptPassword = ETrue; + } + +void CConnectionSettingsParameters::SetRandomUseProxyL(CCreatorEngine& /*aEngine*/) + { + iUseProxy = ETrue; + } + +void CConnectionSettingsParameters::SetRandomProxyAddressL(CCreatorEngine& /*aEngine*/) + { + iProxyServerAddress->Des() = _L("127.0.0.1"); + } + +void CConnectionSettingsParameters::SetRandomProxyPortL(CCreatorEngine& /*aEngine*/) + { + iProxyPortNumber = 80; + } + +void CConnectionSettingsParameters::SetRandomStartPageL(CCreatorEngine& aEngine) + { + LOGSTRING("Creator: CConnectionSettingsParameters::SetRandomStartPageL"); + + TInt num = aEngine.RandomNumber(1, 3); + TBuf<10> apType; + + if (num==1) + { + apType = _L("mms"); + } + else if (num==2) + { + apType = _L("wap"); + } + else + { + apType = _L("internet"); + } + TBuf<160> company = aEngine.RandomString(CCreatorEngine::ECompany); + iStartPage->Des() = _L("http://"); + iStartPage->Des().Append(apType); + iStartPage->Des().Append(_L(".")); + iStartPage->Des().Append(company); + iStartPage->Des().Append(_L(".com")); + iStartPage->Des().LowerCase(); + } + +void CConnectionSettingsParameters::SetRandomIPAddressL(CCreatorEngine& /*aEngine*/) + { + iIPAddr->Des() = _L("10.10.10.10"); + } + +void CConnectionSettingsParameters::SetRandomIP4NameServer1L(CCreatorEngine& /*aEngine*/) + { + iIP4NameServer1->Des() = _L("10.1.1.1"); + } +void CConnectionSettingsParameters::SetRandomIP4NameServer2L(CCreatorEngine& /*aEngine*/) + { + iIP4NameServer2->Des() = _L("10.2.2.2"); + } + +void CConnectionSettingsParameters::SetRandomProtocolTypeL(CCreatorEngine& aEngine) + { + LOGSTRING("Creator: CConnectionSettingsParameters::SetRandomProtocolTypeL"); + + TInt protocolTypeRand = aEngine.RandomNumber(1, 2); + if(protocolTypeRand == 1) + { + iProtocolType = RPacketContext::EPdpTypeIPv4; + } + else + { + iProtocolType = RPacketContext::EPdpTypeIPv6; + } + } + +void CConnectionSettingsParameters::SetRandomTelephoneNumberL(CCreatorEngine& aEngine) + { + iDefaultTelNumber->Des() = aEngine.RandomString(CCreatorEngine::EPhoneNumber); + } + +void CConnectionSettingsParameters::SetRandomBearerTypeIsdnL(CCreatorEngine& /*aEngine*/) + { + iBearerCallTypeIsdn = ECmCallTypeISDNv110; + } + +void CConnectionSettingsParameters::SetRandomBearerSpeedL(CCreatorEngine& /*aEngine*/) + { + iBearerSpeed = ECmSpeed14400; + } + +void CConnectionSettingsParameters::SetRandomWapWspOptionL(CCreatorEngine& /*aEngine*/) + { + iWapWspOption = ECmWapWspOptionConnectionless; + } + +void CConnectionSettingsParameters::SetRandomSubnetMaskL(CCreatorEngine& /*aEngine*/) + { + iSubnetMask->Des() = _L("255.255.255.0"); + } + +void CConnectionSettingsParameters::SetRandomGatewayAddressL(CCreatorEngine& /*aEngine*/) + { + iGatewayAddress->Des() = _L("10.0.0.1"); + } + +void CConnectionSettingsParameters::SetRandomWlanIpAddrL(CCreatorEngine& /*aEngine*/) + { + iWlanIpAddr->Des() = _L("10.0.0.99"); + } + +void CConnectionSettingsParameters::SetRandomIPv6NameServer1L(CCreatorEngine& /*aEngine*/) + { + iIP6NameServer1->Des() = _L("2007:abcd:1000:2000:3000:4000:5000:6001"); + } + +void CConnectionSettingsParameters::SetRandomIPv6NameServer2L(CCreatorEngine& /*aEngine*/) + { + iIP6NameServer2->Des() = _L("2007:abcd:1000:2000:3000:4000:5000:6002"); + } + +void CConnectionSettingsParameters::SetRandomDisableTextAuthL(CCreatorEngine& /*aEngine*/) + { + iDisableTextAuth = EFalse; + } + +void CCreatorConnectionSettings::SetRandomBearerTypeL(CConnectionSettingsParameters& parameters) + { + LOGSTRING("Creator: CCreatorConnectionSettings::SetRandomBearerTypeL"); + + RArray supportedBearers = RArray( 10 ); + iCmManagerExt.SupportedBearersL(supportedBearers); + CleanupClosePushL( supportedBearers ); + + //In random mode, skipping KUidLanBearerType + //Because of Emulator migh show it as supported, when it's really not + //and that causes weird situation in UI when there is an item, but it can't be opened + TInt lanID = supportedBearers.Find(KUidLanBearerType); + if( lanID != KErrNotFound ) + { + supportedBearers.Remove(lanID); + } + + // in emulator remove WLAN + #ifdef __WINSCW__ + TInt wlanID = supportedBearers.Find(KUidWlanBearerType); + if( wlanID != KErrNotFound ) + { + supportedBearers.Remove(wlanID); + } + #endif + + /* + for(TInt i = 0; iRandomNumber(0, supportedCount-1); + + TUint bearerType = supportedBearers[bearerTypeID]; + + //Bearer types KUidEmbeddedDestination and KPluginVPNBearerTypeUid is not supported + if(bearerType == KUidWlanBearerType)//Wireless LAN + { + parameters.iBearerType = KUidWlanBearerType; + } + else if(bearerType == KUidPacketDataBearerType)//Packet data (GPRS) + { + parameters.iBearerType = KUidPacketDataBearerType; + } + else if(bearerType == KUidCSDBearerType)//Data Call + { + parameters.iBearerType = KUidCSDBearerType; + } + else if(bearerType == KUidHSCSDBearerType) //High speed GSM + { + parameters.iBearerType = KUidHSCSDBearerType; + } + else if(bearerType == KUidEmbeddedDestination) + { + parameters.iBearerType = KUidEmbeddedDestination; + } + else// if(bearerType == KPluginVPNBearerTypeUid) + { + parameters.iBearerType = KPluginVPNBearerTypeUid; + } + /* In random mode skipping LAN type + else// if(bearerType == KUidLanBearerType) + { + iBearerType = KUidLanBearerType; + }*/ + + CleanupStack::PopAndDestroy(); // supportedBearers + } + +void CCreatorConnectionSettings::SetRandomParametersL(CConnectionSettingsParameters& parameters) + { + LOGSTRING("Creator: CCreatorConnectionSettings::SetRandomParametersL"); + + // Connection method name: + parameters.SetRandomCMNameL(*iEngine); + + SetRandomBearerTypeL(parameters); + + if(parameters.iBearerType == KUidWlanBearerType)//Wireless LAN + { + // WLAN name: + parameters.SetRandomWLANNameL(*iEngine); + + //WLAN network mode + parameters.SetRandomWLANNetModeL(*iEngine); + + //WLAN security mode: + parameters.SetRandomWLANSecurityModeL(*iEngine); + } + + // Login name: + parameters.SetRandomLoginNameL(*iEngine); + + // Login password: + parameters.SetRandomLoginPassL(*iEngine); + + // Secure authentication: + parameters.SetRandomSecureAuthenticationL(*iEngine); + + // Prompt password: + parameters.SetRandomPromptPasswordL(*iEngine); + + // Use proxy: + parameters.SetRandomUseProxyL(*iEngine); + + // Proxy address + parameters.SetRandomProxyAddressL(*iEngine); + + // Proxy port number: + parameters.SetRandomProxyPortL(*iEngine); + + // Start page: + parameters.SetRandomStartPageL(*iEngine); + + // IP address: + parameters.SetRandomIPAddressL(*iEngine); + + // IPv4 name servers: + parameters.SetRandomIP4NameServer1L(*iEngine); + parameters.SetRandomIP4NameServer2L(*iEngine); + + // Protocol type: + parameters.SetRandomProtocolTypeL(*iEngine); + + // Default telephone number: + parameters.SetRandomTelephoneNumberL(*iEngine); + + // Bearer isdn + parameters.SetRandomBearerTypeIsdnL(*iEngine); + + // Bearer speed: + parameters.SetRandomBearerSpeedL(*iEngine); + + // WAP wsp option: + parameters.SetRandomWapWspOptionL(*iEngine); + + // Subnet mask: + parameters.SetRandomSubnetMaskL(*iEngine); + + // Gateway address: + parameters.SetRandomGatewayAddressL(*iEngine); + + // WLAN ip address: + parameters.SetRandomWlanIpAddrL(*iEngine); + + // IPv6 name servers: + parameters.SetRandomIPv6NameServer1L(*iEngine); + parameters.SetRandomIPv6NameServer2L(*iEngine); + + // Disable text authorization: + parameters.SetRandomDisableTextAuthL(*iEngine); + } + +//---------------------------------------------------------------------------- + +void CCreatorConnectionSettings::SetDefaultCML(RCmConnectionMethodExt conMethod) + { + LOGSTRING("Creator: CCreatorConnectionSettings::SetDefaultCM"); + + TCmDefConnValue defConnValue; + + //Returns the default connection method/SNAP. + TRAPD( err, iCmManagerExt.ReadDefConnL( defConnValue ) ); + if( err == KErrNotSupported ) + { + return; //If Default Connection NOT supported, just returning + } + else if ( err != KErrNone ) + { + User::Leave( err ); //If something else happend + } + else if ( defConnValue.iId == 0 ) // default not set + { + TCmDefConnValue newDefaultCM; + HBufC* cmName = conMethod.GetStringAttributeL( ECmName ); + CleanupStack::PushL( cmName ); + newDefaultCM.iId = AccessPointNameToIdL( cmName->Des() ); + newDefaultCM.iType = ECmDefConnDestination; + //Stores the default connection method/SNAP. + iCmManagerExt.WriteDefConnL( newDefaultCM ); + CleanupStack::PopAndDestroy( cmName ); + } + } + +//---------------------------------------------------------------------------- + +TUint32 CCreatorConnectionSettings::AccessPointNameToIdL(const TDesC& aAPName, + TBool aAnyIfNotFound ) + { + LOGSTRING("Creator: CCreatorConnectionSettings::AccessPointNameToIdL"); + + //RCmDestination destination + + RArray destIdArray = RArray( 10 ); + + iCmManagerExt.AllDestinationsL( destIdArray ); + + CleanupClosePushL( destIdArray ); + TUint32 id = 0 ; + TBool found = EFalse; + + for( TInt i = 0; i < destIdArray.Count(); i++ ) + { + RCmDestinationExt dest = iCmManagerExt.DestinationL( destIdArray[i] ); + CleanupClosePushL( dest ); + + HBufC* destName = dest.NameLC(); + + if (destName->CompareF(aAPName) == 0){ + id = dest.Id(); + found = ETrue; + } + if ( !found && id == 0 && aAnyIfNotFound ) + { + id = dest.Id(); + } + CleanupStack::PopAndDestroy( 2 ); // destName , dest + if(found) + { + break; + } + } + + CleanupStack::PopAndDestroy(); // destIdArray + return id; + } + +//---------------------------------------------------------------------------- + +void CCreatorConnectionSettings::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) // from MMsvSessionObserver + { + LOGSTRING("Creator: CCreatorConnectionSettings::HandleSessionEventL"); + } + +//---------------------------------------------------------------------------- +void CCreatorConnectionSettings::DeleteAllL() + { + LOGSTRING("Creator: CCreatorConnectionSettings::DeleteAllL"); + DeleteAllDestinationsL( EFalse ); + } + +//---------------------------------------------------------------------------- +void CCreatorConnectionSettings::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorConnectionSettings::DeleteAllCreatedByCreatorL"); + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidIAP ); + + // delete entries + DeleteAllDestinationsL( ETrue ); + } + +//---------------------------------------------------------------------------- + +void CCreatorConnectionSettings::DeleteAllDestinationsL( TBool aOnlyCreatedWithCreator ) + { + LOGSTRING("Creator: CCreatorConnectionSettings::DeleteAllDestinationsL"); + RArray destIdArray(5); + CleanupClosePushL( destIdArray ); + iCmManagerExt.AllDestinationsL( destIdArray ); + + for( TInt i = 0; i < destIdArray.Count(); i++ ) + { + TRAP_IGNORE + ( + RCmDestinationExt dest = iCmManagerExt.DestinationL( destIdArray[i] ); + CleanupClosePushL( dest ); + + if ( !aOnlyCreatedWithCreator || iEntryIds.Find( destIdArray[i]) != KErrNotFound ) + { + dest.DeleteLD(); + } + CleanupStack::PopAndDestroy(); // dest + ); + } + + CleanupStack::PopAndDestroy(); // destIdArray + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the IMPS related registry + iEngine->RemoveStoreL( KUidDictionaryUidIAP ); + } +//---------------------------------------------------------------------------- diff -r 000000000000 -r d6fe6244b863 creator/src/creator_connectionmethodelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_connectionmethodelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,754 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_connectionmethodelement.h" +#include "creator_traces.h" + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include "creator_connectionmethod.h" +#include +#include +#include +#include +#include +#include +#include +#else +#include "creator_accesspoint.h" +#endif + + +using namespace creatorconnectionmethod; + +// connection name needs extra space for possible renaming +const TInt KExtraSpace = 10; + +/* + * + */ +CCreatorConnectionMethodElement* CCreatorConnectionMethodElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorConnectionMethodElement* self = new (ELeave) CCreatorConnectionMethodElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorConnectionMethodElement::CCreatorConnectionMethodElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorConnectionMethodElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt cmAmount = 1; + if( amountAttr ) + { + cmAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create connection method entries, the amount of entries is defined by cmAmount: + for( TInt cI = 0; cI < cmAmount; ++cI ) + { + CConnectionSettingsParameters* param = new (ELeave) CConnectionSettingsParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == Kconnectionname ) + { + if( useRandom ) + { + param->SetRandomCMNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iConnectionName, elemContent); + // reserve extra space for possible renaming + TInt newLen = param->iConnectionName->Length() + KExtraSpace; + param->iConnectionName = param->iConnectionName->ReAllocL(newLen); + } + } + else if( elemName == Kstartpage ) + { + if( useRandom ) + { + param->SetRandomStartPageL(*iEngine); + } + else + { + SetContentToTextParamL(param->iStartPage, elemContent); + } + } + else if( elemName == Kwapwspoption ) + { + if( useRandom ) + { + param->SetRandomWapWspOptionL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kconnectionless) == 0 ) + { + param->iWapWspOption = ECmWapWspOptionConnectionless; + } + else if( CompareIgnoreCase(elemContent, Kconnectionoriented) == 0 ) + { + param->iWapWspOption = ECmWapWspOptionConnectionOriented; + } + } + } + else if( elemName == Kprotocoltype ) + { + if( useRandom ) + { + param->SetRandomProtocolTypeL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kipv4) == 0 ) + { + param->iProtocolType = RPacketContext::EPdpTypeIPv4; + } + else if( CompareIgnoreCase(elemContent, Kipv6) == 0 ) + { + param->iProtocolType = RPacketContext::EPdpTypeIPv6; + } + } + } + else if( elemName == Kloginname ) + { + if( useRandom ) + { + param->SetRandomLoginNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iLoginName, elemContent); + } + } + else if( elemName == Ksecureauthentication ) + { + if( useRandom ) + { + param->SetRandomSecureAuthenticationL(*iEngine); + } + else + { + param->iSecureAuthentication = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kloginpass ) + { + if( useRandom ) + { + param->SetRandomLoginPassL(*iEngine); + } + else + { + SetContentToTextParamL(param->iLoginPass, elemContent); + } + } + else if( elemName == Kpromptpassword ) + { + if( useRandom ) + { + param->SetRandomPromptPasswordL(*iEngine); + } + else + { + param->iPromptPassword = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kgatewayaddress ) + { + if( useRandom ) + { + param->SetRandomGatewayAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iGatewayAddress, elemContent); + } + } + else if( elemName == Ksubnetmask ) + { + if( useRandom ) + { + param->SetRandomSubnetMaskL(*iEngine); + } + else + { + SetContentToTextParamL(param->iSubnetMask, elemContent); + } + } + else if( elemName == Kdeviceipaddr ) + { + if( useRandom ) + { + param->SetRandomIPAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iIPAddr, elemContent); + } + } + else if( elemName == Kip4nameserver1 ) + { + if( useRandom ) + { + param->SetRandomIP4NameServer1L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP4NameServer1, elemContent); + } + } + else if( elemName == Kip4nameserver2 ) + { + if( useRandom ) + { + param->SetRandomIP4NameServer2L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP4NameServer2, elemContent); + } + } + else if( elemName == Kdatacalltelnumber ) + { + if( useRandom ) + { + param->SetRandomTelephoneNumberL(*iEngine); + } + else + { + SetContentToTextParamL(param->iDefaultTelNumber, elemContent); + } + } + else if( elemName == Kdatacalltypeisdn ) + { + if( useRandom ) + { + param->SetRandomBearerTypeIsdnL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kanalogue) == 0 ) + param->iBearerCallTypeIsdn = CMManager::ECmCallTypeAnalogue; + else if( CompareIgnoreCase( elemContent, Kisdnv110) == 0 ) + param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv110; + else if( CompareIgnoreCase( elemContent, Kisdnv120) == 0 ) + param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv120; + } + } + else if( elemName == Kbearertype ) + { + if( useRandom ) + { + param->iBearerType = KRandomBearerType; + } + else + { + if( CompareIgnoreCase(elemContent, Kwlan) == 0 ) + { + param->iBearerType = KUidWlanBearerType; + } + else if( CompareIgnoreCase(elemContent, Kgprs) == 0 ) + { + param->iBearerType = KUidPacketDataBearerType; + } + else if( CompareIgnoreCase(elemContent, Kdatacall) == 0 ) + { + param->iBearerType = KUidCSDBearerType; + } + else if( CompareIgnoreCase(elemContent, Khsgsm) == 0 ) + { + param->iBearerType = KUidHSCSDBearerType; + } + else if( CompareIgnoreCase(elemContent, Kembedded) == 0 ) + { + param->iBearerType = KUidEmbeddedDestination; + } + else if( CompareIgnoreCase(elemContent, Kvpn) == 0 ) + { + param->iBearerType = KPluginVPNBearerTypeUid; + } + else if( CompareIgnoreCase(elemContent, Klan) == 0 ) + { + param->iBearerType = KUidLanBearerType; + } + } + } + else if( elemName == Kdatacalllinespeed ) + { + if( useRandom ) + { + param->SetRandomBearerSpeedL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kautomatic) == 0 ) + { + param->iBearerSpeed = CMManager::ECmSpeedAutobaud; + } + else + { + TUint lineSpeed = ConvertStrToUintL(elemContent); + if( lineSpeed == 9600 ) + param->iBearerSpeed = CMManager::ECmSpeed9600; + else if( lineSpeed == 14400 ) + param->iBearerSpeed = CMManager::ECmSpeed14400; + else if( lineSpeed == 19200 ) + param->iBearerSpeed = CMManager::ECmSpeed19200; + else if( lineSpeed == 28800 ) + param->iBearerSpeed = CMManager::ECmSpeed28800; + else if( lineSpeed == 38400 ) + param->iBearerSpeed = CMManager::ECmSpeed38400; + else if( lineSpeed == 43200 ) + param->iBearerSpeed = CMManager::ECmSpeed43200; + else if( lineSpeed == 56000 ) + param->iBearerSpeed = CMManager::ECmSpeed56000; + } + } + } + else if( elemName == Kuseproxy ) + { + if( useRandom ) + { + param->SetRandomUseProxyL(*iEngine); + } + else + { + param->iUseProxy = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kproxyserveraddress ) + { + if( useRandom ) + { + param->SetRandomProxyAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iProxyServerAddress, elemContent); + } + } + else if( elemName == Kproxyportnumber ) + { + if( useRandom ) + { + param->SetRandomProxyPortL(*iEngine); + } + else + { + param->iProxyPortNumber = ConvertStrToUintL(elemContent); + } + } + else if( elemName == Kip6nameserver1 ) + { + if( useRandom ) + { + param->SetRandomIPv6NameServer1L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP6NameServer1, elemContent); + } + } + else if( elemName == Kip6nameserver2 ) + { + if( useRandom ) + { + param->SetRandomIPv6NameServer2L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP6NameServer2, elemContent); + } + } + else if( elemName == Kdisabletextauth ) + { + if( useRandom ) + { + param->SetRandomDisableTextAuthL(*iEngine); + } + else + { + param->iDisableTextAuth = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kwlanname ) + { + if( useRandom ) + { + param->SetRandomWLANNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iWLANName, elemContent); + } + } + else if( elemName == Kwlanipaddr ) + { + if( useRandom ) + { + param->SetRandomWlanIpAddrL(*iEngine); + } + else + { + SetContentToTextParamL(param->iWlanIpAddr, elemContent); + } + } + else if( elemName == Kwlansecmode ) + { + if( useRandom ) + { + param->SetRandomWLANSecurityModeL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kopen) == 0) + param->iWLanSecMode = CMManager::EWlanSecModeOpen; + else if( CompareIgnoreCase(elemContent, Kwep) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecModeWep; + else if( CompareIgnoreCase(elemContent, Ke802_1x) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecMode802_1x; + else if( CompareIgnoreCase(elemContent, Kwpa) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecModeWpa; + else if( CompareIgnoreCase(elemContent, Kwpa2) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecModeWpa2; + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, param); + CleanupStack::Pop(); // param + } + } + else + { + // No fields defined so add random entries: + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, 0, cmAmount); + } + } +#else +void CCreatorConnectionMethodElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt cmAmount = 1; + if( amountAttr ) + { + cmAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create connection method entries, the amount of entries is defined by cmAmount: + for( TInt cI = 0; cI < cmAmount; ++cI ) + { + CAccessPointsParameters* param = new (ELeave) CAccessPointsParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == Kconnectionname ) + { + if( useRandom ) + { + param->SetRandomCMNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iConnectionName, elemContent); + // reserve extra space for possible renaming + TInt newLen = param->iConnectionName->Length() + KExtraSpace; + param->iConnectionName = param->iConnectionName->ReAllocL(newLen); + + SetContentToTextParamL(param->iGprsAcessPointName, elemContent); + } + } + else if( elemName == Kstartpage ) + { + if( useRandom ) + { + param->SetRandomStartPageL(*iEngine); + } + else + { + SetContentToTextParamL(param->iWapStartPage, elemContent); + } + } + else if( elemName == Kwapwspoption ) + { + if( useRandom ) + { + param->SetRandomWapWspOptionL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kconnectionless) == 0 ) + { + param->iWapWspOption = EWapWspOptionConnectionless; + } + else if( CompareIgnoreCase(elemContent, Kconnectionoriented) == 0 ) + { + param->iWapWspOption = EWapWspOptionConnectionOriented; + } + } + } + else if( elemName == Kloginname ) + { + if( useRandom ) + { + param->SetRandomLoginNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iIspLoginName, elemContent); + } + } + else if( elemName == Ksecureauthentication ) + { + if( useRandom ) + { + param->SetRandomSecureAuthenticationL(*iEngine); + } + else + { + param->iSecureAuthentication = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kloginpass ) + { + if( useRandom ) + { + param->SetRandomLoginPassL(*iEngine); + } + else + { + SetContentToTextParamL(param->iIspLoginPass, elemContent); + } + } + else if( elemName == Kpromptpassword ) + { + if( useRandom ) + { + param->SetRandomPromptPasswordL(*iEngine); + } + else + { + param->iPromptPassword = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kgatewayaddress ) + { + if( useRandom ) + { + param->SetRandomGatewayAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iWapGatewayAddress, elemContent); + } + } + else if( elemName == Kdeviceipaddr ) + { + if( useRandom ) + { + param->SetRandomIPAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iIspIPAddr, elemContent); + } + } + else if( elemName == Kip4nameserver1 ) + { + if( useRandom ) + { + param->SetRandomIP4NameServer1L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIspIPNameServer1, elemContent); + } + } + else if( elemName == Kip4nameserver2 ) + { + if( useRandom ) + { + param->SetRandomIP4NameServer2L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIspIPNameServer2, elemContent); + } + } + else if( elemName == Kdatacalltelnumber ) + { + if( useRandom ) + { + param->SetRandomTelephoneNumberL(*iEngine); + } + else + { + SetContentToTextParamL(param->iIspDefaultTelNumber, elemContent); + } + } + else if( elemName == Kdatacalltypeisdn ) + { + if( useRandom ) + { + param->SetRandomBearerTypeIsdnL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kanalogue) == 0 ) + param->iIspBearerCallTypeIsdn = ECallTypeAnalogue; + else if( CompareIgnoreCase( elemContent, Kisdnv110) == 0 ) + param->iIspBearerCallTypeIsdn = ECallTypeISDNv110; + else if( CompareIgnoreCase( elemContent, Kisdnv120) == 0 ) + param->iIspBearerCallTypeIsdn = ECallTypeISDNv120; + } + } + else if( elemName == Kbearertype ) + { + if( useRandom ) + { + param->iBearerType = EApBearerTypeGPRS; + } + else + { + if( CompareIgnoreCase(elemContent, Kwlan) == 0 ) + { + param->iBearerType = EApBearerTypeWLAN; + } + else if( CompareIgnoreCase(elemContent, Kgprs) == 0 ) + { + param->iBearerType = EApBearerTypeGPRS; + } + else if( CompareIgnoreCase(elemContent, Kdatacall) == 0 ) + { + param->iBearerType = EApBearerTypeCSD; + } + else if( CompareIgnoreCase(elemContent, Khsgsm) == 0 ) + { + param->iBearerType = EApBearerTypeHSCSD; + } + else if( CompareIgnoreCase(elemContent, Klan) == 0 ) + { + param->iBearerType = EApBearerTypeLAN; + } + } + } + else if( elemName == Kdatacalllinespeed ) + { + if( useRandom ) + { + param->SetRandomBearerSpeedL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kautomatic) == 0 ) + { + param->iIspBearerSpeed = KSpeedAutobaud; + } + else + { + TUint lineSpeed = ConvertStrToUintL(elemContent); + if( lineSpeed == 9600 ) + param->iIspBearerSpeed = KSpeed9600; + else if( lineSpeed == 14400 ) + param->iIspBearerSpeed = KSpeed14400; + else if( lineSpeed == 19200 ) + param->iIspBearerSpeed = KSpeed19200; + else if( lineSpeed == 28800 ) + param->iIspBearerSpeed = KSpeed28800; + else if( lineSpeed == 38400 ) + param->iIspBearerSpeed = KSpeed38400; + else if( lineSpeed == 43200 ) + param->iIspBearerSpeed = KSpeed43200; + else if( lineSpeed == 56000 ) + param->iIspBearerSpeed = KSpeed56000; + } + } + } + else if( elemName == Kproxyserveraddress ) + { + if( useRandom ) + { + param->SetRandomProxyAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iProxyServerAddress, elemContent); + } + } + else if( elemName == Kproxyportnumber ) + { + if( useRandom ) + { + param->SetRandomProxyPortL(*iEngine); + } + else + { + param->iProxyPortNumber = ConvertStrToUintL(elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, param); + CleanupStack::Pop(); // param + } + } + } +#endif diff -r 000000000000 -r d6fe6244b863 creator/src/creator_contactelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_contactelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,472 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_contactelement.h" +#include "creator_traces.h" +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include "creator_virtualphonebook.h" +#endif +#include "creator_factory.h" +#include "creator_contactsetcache.h" +#include + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include "VPbkEng.rsg" +#endif + +using namespace Xml; +using namespace creatorcontact; + +/** + * Contact field element mappings: + */ +enum TContactFieldDataType + { + EDataTypeText, + EDataTypeBinary, + EDataTypeDateTime + }; + +class FieldMapping +{ +public: + TPtrC iElementName; + TInt iFieldCode; + TContactFieldDataType iDataType; +}; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +FieldMapping fieldMappingTbl[] = { + {TPtrC(KFirstname), R_VPBK_FIELD_TYPE_FIRSTNAME, EDataTypeText}, + {TPtrC(KLastname), R_VPBK_FIELD_TYPE_LASTNAME, EDataTypeText}, + {TPtrC(KFirstnameReading), R_VPBK_FIELD_TYPE_FIRSTNAMEREADING, EDataTypeText}, + {TPtrC(KLastnameReading), R_VPBK_FIELD_TYPE_LASTNAMEREADING, EDataTypeText}, + {TPtrC(KPrefix), R_VPBK_FIELD_TYPE_PREFIX, EDataTypeText}, + {TPtrC(KSuffix), R_VPBK_FIELD_TYPE_SUFFIX, EDataTypeText}, + {TPtrC(KSecondname), R_VPBK_FIELD_TYPE_SECONDNAME, EDataTypeText}, + {TPtrC(KLandphoneHome), R_VPBK_FIELD_TYPE_LANDPHONEHOME, EDataTypeText}, + + {TPtrC(KMobilephoneHome), R_VPBK_FIELD_TYPE_MOBILEPHONEHOME, EDataTypeText}, + {TPtrC(KVideonumberHome), R_VPBK_FIELD_TYPE_VIDEONUMBERHOME, EDataTypeText}, + {TPtrC(KFaxnumberHome), R_VPBK_FIELD_TYPE_FAXNUMBERHOME, EDataTypeText}, + {TPtrC(KVoipHome), R_VPBK_FIELD_TYPE_VOIPHOME, EDataTypeText}, + {TPtrC(KEmailHome), R_VPBK_FIELD_TYPE_EMAILHOME, EDataTypeText}, + {TPtrC(KUrlHome), R_VPBK_FIELD_TYPE_URLHOME, EDataTypeText}, + {TPtrC(KAddrlabelHome), R_VPBK_FIELD_TYPE_ADDRLABELHOME, EDataTypeText}, + {TPtrC(KAddrpoHome), R_VPBK_FIELD_TYPE_ADDRPOHOME, EDataTypeText}, + + {TPtrC(KAddrextHome), R_VPBK_FIELD_TYPE_ADDREXTHOME, EDataTypeText}, + {TPtrC(KAddrstreetHome), R_VPBK_FIELD_TYPE_ADDRSTREETHOME, EDataTypeText}, + {TPtrC(KAddrlocalHome), R_VPBK_FIELD_TYPE_ADDRLOCALHOME, EDataTypeText}, + {TPtrC(KAddrregionHome), R_VPBK_FIELD_TYPE_ADDRREGIONHOME, EDataTypeText}, + {TPtrC(KAddrpostcodeHome), R_VPBK_FIELD_TYPE_ADDRPOSTCODEHOME, EDataTypeText}, + {TPtrC(KAddrcountryHome), R_VPBK_FIELD_TYPE_ADDRCOUNTRYHOME, EDataTypeText}, + {TPtrC(KJobtitle), R_VPBK_FIELD_TYPE_JOBTITLE, EDataTypeText}, + {TPtrC(KCompanyname), R_VPBK_FIELD_TYPE_COMPANYNAME, EDataTypeText}, + + {TPtrC(KLandphoneWork), R_VPBK_FIELD_TYPE_LANDPHONEWORK, EDataTypeText}, + {TPtrC(KMobilephoneWork), R_VPBK_FIELD_TYPE_MOBILEPHONEWORK, EDataTypeText}, + {TPtrC(KVideonumberWork), R_VPBK_FIELD_TYPE_VIDEONUMBERWORK, EDataTypeText}, + {TPtrC(KFaxnumberWork), R_VPBK_FIELD_TYPE_FAXNUMBERWORK, EDataTypeText}, + {TPtrC(KVoipWork), R_VPBK_FIELD_TYPE_VOIPWORK, EDataTypeText}, + {TPtrC(KEmailWork), R_VPBK_FIELD_TYPE_EMAILWORK, EDataTypeText}, + {TPtrC(KUrlWork), R_VPBK_FIELD_TYPE_URLWORK, EDataTypeText}, + {TPtrC(KAddrlabelWork), R_VPBK_FIELD_TYPE_ADDRLABELWORK, EDataTypeText}, + + {TPtrC(KAddrpoWork), R_VPBK_FIELD_TYPE_ADDRPOWORK, EDataTypeText}, + {TPtrC(KAddrextWork), R_VPBK_FIELD_TYPE_ADDREXTWORK, EDataTypeText}, + {TPtrC(KAddrstreetWork), R_VPBK_FIELD_TYPE_ADDRSTREETWORK, EDataTypeText}, + {TPtrC(KAddrlocalWork), R_VPBK_FIELD_TYPE_ADDRLOCALWORK, EDataTypeText}, + {TPtrC(KAddrregionWork), R_VPBK_FIELD_TYPE_ADDRREGIONWORK, EDataTypeText}, + {TPtrC(KAddrpostcodeWork), R_VPBK_FIELD_TYPE_ADDRPOSTCODEWORK, EDataTypeText}, + {TPtrC(KAddrcountryWork), R_VPBK_FIELD_TYPE_ADDRCOUNTRYWORK, EDataTypeText}, + {TPtrC(KLandphoneGen), R_VPBK_FIELD_TYPE_LANDPHONEGEN, EDataTypeText}, + + {TPtrC(KMobilephoneGen), R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, EDataTypeText}, + {TPtrC(KVideonumberGen), R_VPBK_FIELD_TYPE_VIDEONUMBERGEN, EDataTypeText}, + {TPtrC(KFaxnumberGen), R_VPBK_FIELD_TYPE_FAXNUMBERGEN, EDataTypeText}, + {TPtrC(KVoipGen), R_VPBK_FIELD_TYPE_VOIPGEN, EDataTypeText}, + {TPtrC(KPoc), R_VPBK_FIELD_TYPE_POC, EDataTypeText}, + {TPtrC(KSwis), R_VPBK_FIELD_TYPE_SWIS, EDataTypeText}, + {TPtrC(KSip), R_VPBK_FIELD_TYPE_SIP, EDataTypeText}, + {TPtrC(KEmailGen), R_VPBK_FIELD_TYPE_EMAILGEN, EDataTypeText}, + + {TPtrC(KUrlGen), R_VPBK_FIELD_TYPE_URLGEN, EDataTypeText}, + {TPtrC(KAddrlabelGen), R_VPBK_FIELD_TYPE_ADDRLABELGEN, EDataTypeText}, + {TPtrC(KAddrpoGen), R_VPBK_FIELD_TYPE_ADDRPOGEN, EDataTypeText}, + {TPtrC(KAddrextGen), R_VPBK_FIELD_TYPE_ADDREXTGEN, EDataTypeText}, + {TPtrC(KAddrstreetGen), R_VPBK_FIELD_TYPE_ADDRSTREETGEN, EDataTypeText}, + {TPtrC(KAddrlocalGen), R_VPBK_FIELD_TYPE_ADDRLOCALGEN, EDataTypeText}, + {TPtrC(KAddrregionGen), R_VPBK_FIELD_TYPE_ADDRREGIONGEN, EDataTypeText}, + {TPtrC(KAddrpostcodeGen), R_VPBK_FIELD_TYPE_ADDRPOSTCODEGEN, EDataTypeText}, + + {TPtrC(KAddrcountryGen), R_VPBK_FIELD_TYPE_ADDRCOUNTRYGEN, EDataTypeText}, + {TPtrC(KPagerNumber), R_VPBK_FIELD_TYPE_PAGERNUMBER, EDataTypeText}, + {TPtrC(KDtmfString), R_VPBK_FIELD_TYPE_DTMFSTRING, EDataTypeText}, + {TPtrC(KWvAddress), R_VPBK_FIELD_TYPE_WVADDRESS, EDataTypeText}, + {TPtrC(KDate), R_VPBK_FIELD_TYPE_DATE, EDataTypeDateTime}, + {TPtrC(KNote), R_VPBK_FIELD_TYPE_NOTE, EDataTypeText}, + {TPtrC(KThumbnailPath), R_VPBK_FIELD_TYPE_THUMBNAILPIC, EDataTypeText}, + {TPtrC(KThumbnailId), R_VPBK_FIELD_TYPE_THUMBNAILPIC, EDataTypeText}, + {TPtrC(KRingTone), R_VPBK_FIELD_TYPE_RINGTONE, EDataTypeText}, + {TPtrC(KRingToneId), R_VPBK_FIELD_TYPE_RINGTONE, EDataTypeText}, + + {TPtrC(KCallerobjImg), R_VPBK_FIELD_TYPE_CALLEROBJIMG, EDataTypeText}, + {TPtrC(KCallerobjText), R_VPBK_FIELD_TYPE_CALLEROBJTEXT, EDataTypeText}, + {TPtrC(KMiddlename), R_VPBK_FIELD_TYPE_MIDDLENAME, EDataTypeText}, + {TPtrC(KDepartment), R_VPBK_FIELD_TYPE_DEPARTMENT, EDataTypeText}, + {TPtrC(KAsstname), R_VPBK_FIELD_TYPE_ASSTNAME, EDataTypeText}, + {TPtrC(KSpouse), R_VPBK_FIELD_TYPE_SPOUSE, EDataTypeText}, + {TPtrC(KChildren), R_VPBK_FIELD_TYPE_CHILDREN, EDataTypeText}, + {TPtrC(KAsstphone), R_VPBK_FIELD_TYPE_ASSTPHONE, EDataTypeText}, + + {TPtrC(KCarphone), R_VPBK_FIELD_TYPE_CARPHONE, EDataTypeText}, + {TPtrC(KAnniversary), R_VPBK_FIELD_TYPE_ANNIVERSARY, EDataTypeDateTime}, + {TPtrC(KSyncclass), R_VPBK_FIELD_TYPE_SYNCCLASS, EDataTypeText}, + {TPtrC(KLocPrivacy), R_VPBK_FIELD_TYPE_LOCPRIVACY, EDataTypeText}, + {TPtrC(KGenlabel), R_VPBK_FIELD_TYPE_GENLABEL, EDataTypeText} +}; +#endif + +CCreatorContactElementBase* CCreatorContactElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + LOGSTRING("Creator: CCreatorContactElementBase::NewL"); + CCreatorContactElementBase* self = new (ELeave) CCreatorContactElementBase(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorContactElementBase::CCreatorContactElementBase(CCreatorEngine* aEngine) : CCreatorScriptElement(aEngine) + { } + +CCreatorContactElement* CCreatorContactElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + LOGSTRING("Creator: CCreatorContactElement::NewL"); + CCreatorContactElement* self = new (ELeave) CCreatorContactElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorContactElement::CCreatorContactElement(CCreatorEngine* aEngine) +: +CCreatorContactElementBase(aEngine) + { + iIsCommandElement = ETrue; + } + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorContactElement::ExecuteCommandL() + { + LOGSTRING("Creator: CCreatorContactElement::ExecuteCommandL"); + // Find out how many contacts should we create: + const CCreatorScriptAttribute* contactAmountAttr = this->FindAttributeByName(KAmount); + TInt contactAmount = 1; + if( contactAmountAttr ) + { + contactAmount = ConvertStrToIntL(contactAmountAttr->Value()); + } + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + TInt fieldMappingTblSize = sizeof(fieldMappingTbl)/sizeof(FieldMapping); + for( TInt cI = 0; cI < contactAmount; ++cI ) + { + CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL(); + CleanupStack::PushL(param); + // Loop all the field elements + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + + const RPointerArray& fieldList = fieldsElement->SubElements(); + + if( fieldList.Count() == 0 ) + { + + } + for( TInt i = 0; i < fieldList.Count(); ++i ) + { + TPtrC fieldName = fieldList[i]->Name(); + const CCreatorScriptAttribute* amountAttr = fieldList[i]->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* rndLenAttr = fieldList[i]->FindAttributeByName(KRandomLength); + const CCreatorScriptAttribute* increaseAttr = fieldList[i]->FindAttributeByName(KIncrease); + TBool increase( EFalse ); + if ( increaseAttr ) + { + increase = ConvertStrToBooleanL( increaseAttr->Value() ); + } + CCreatorContactField* field = 0; + for( TInt j = 0; j < fieldMappingTblSize; ++j ) + { + const FieldMapping& mapping = fieldMappingTbl[j]; + if( fieldName == mapping.iElementName ) + { + TInt rndLen = 0; + TPtrC content = fieldList[i]->Content(); + + MCreatorRandomDataField::TRandomLengthType randomLenType = MCreatorRandomDataField::ERandomLengthUndefined; + + if( content == TPtrC(KEmpty) || content == TPtrC(KNullDesC) ) + { + if( rndLenAttr == 0 ) + { + randomLenType = MCreatorRandomDataField::ERandomLengthDefault; + } + else + { + randomLenType = ResolveRandomDataTypeL(*rndLenAttr, rndLen); + } + } + else + { + // Special handling for file id content: + if( fieldName == KThumbnailId ) + { + // Thumbnail data is copied to the contact entry, so we can use temporary file: + CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content); + content.Set(iEngine->TestDataPathL(id)); + } + else if( fieldName == KRingToneId ) + { + // Contact entry contains just a link to the sound file, so we must + // copy the temporary file to a permanent location: + CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content); + TPtrC fullTargetPath(iEngine->CreateSoundFileL(id)); + content.Set(fullTargetPath); + } + } + TInt amountValue = 1; + if( amountAttr ) + { + amountValue = ConvertStrToIntL(amountAttr->Value()); + } + for( TInt k = 0; k < amountValue; ++k ) + { + if ( increase && + ( fieldName.FindF( _L("number") ) > KErrNotFound || + fieldName.FindF( _L("phone") ) > KErrNotFound ) ) + { + // increase phonenumber for each copy + HBufC* incNum = HBufC::NewLC( content.Length() + 3 ); + if ( amountValue > 1 ) + { + // amount defined in number field level + IncreasePhoneNumL( content, k, incNum ); + } + else + { + // amount defined in contact field level + IncreasePhoneNumL( content, cI, incNum ); + } + field = CCreatorContactField::NewL( mapping.iFieldCode, *incNum ); + CleanupStack::PushL( field ); + field->SetRandomParametersL( randomLenType, rndLen ); + param->iContactFields.AppendL( field ); + CleanupStack::Pop( field ); + CleanupStack::PopAndDestroy( incNum ); + } + else + { + field = CCreatorContactField::NewL(mapping.iFieldCode, content); + CleanupStack::PushL(field); + field->SetRandomParametersL(randomLenType, rndLen); + param->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + } + break; + } + } + } + } + else + { + // No fields specified, so add all fields with random content: + for( TInt i = 0; i < fieldMappingTblSize; ++i ) + { + if( fieldMappingTbl[i].iElementName == KThumbnailId || + fieldMappingTbl[i].iElementName == KRingToneId ) + { + // Skip thumbnail and ringtone IDs, since they are duplicates with thumbnailpath and ringtonepath + continue; + } + CCreatorContactField* field = 0; + if(fieldMappingTbl[i].iDataType == EDataTypeText ) + { + field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC); + } + else if( fieldMappingTbl[i].iDataType == EDataTypeBinary ) + { + field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC8); + } + else if( fieldMappingTbl[i].iDataType == EDataTypeDateTime ) + { + TDateTime dateTime(Time::NullTTime().DateTime()); + field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, dateTime); + } + if( field ) + { + CleanupStack::PushL(field); + field->SetRandomParametersL(MCreatorRandomDataField::ERandomLengthDefault, 0); + param->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryContacts, param); + iParameters.AppendL(param); // Save the pointer to the parametes. + CleanupStack::Pop(param); + } + } +#else +void CCreatorContactElement::ExecuteCommandL() + {} +#endif + +CCreatorContactSetElement* CCreatorContactSetElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + LOGSTRING("Creator: CCreatorContactSetElement::NewL"); + CCreatorContactSetElement* self = new (ELeave) CCreatorContactSetElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorContactSetElement::CCreatorContactSetElement(CCreatorEngine* aEngine) +: +CCreatorContactElementBase(aEngine) + { } + +void CCreatorContactSetElement::ExecuteCommandL() + { } + +void CCreatorContactSetElement::AddToCacheL() + { + LOGSTRING("Creator: CCreatorContactSetElement::AddToCacheL"); + const CCreatorScriptAttribute* linkIdAttr = this->FindAttributeByName(KId); + const CCreatorScriptAttribute* existingElemsAttr = this->FindAttributeByName(KExistingContacts); + TInt numOfExistingContacts = 0; + if( existingElemsAttr ) + { + numOfExistingContacts = ConvertStrToIntL(existingElemsAttr->Value()); + } + if( linkIdAttr ) + { + TInt linkId = ConvertStrToIntL(linkIdAttr->Value()); + if( linkId > 0 ) + { + CCreatorContactSet* newSet = CCreatorContactSet::NewL(linkId, numOfExistingContacts); + CleanupStack::PushL(newSet); + ContactLinkCache::Instance()->AppendL(newSet); + CleanupStack::Pop(newSet); + + // Mark sub-elements (i.e. contacts) to this contact-set: + for( TInt i = 0; i < iSubElements.Count(); ++i ) + { + for( TInt j = 0; j < iSubElements[i]->CommandParameters().Count(); ++j) + { + CCreatorModuleBaseParameters* params = iSubElements[i]->CommandParameters()[j]; + if( params ) + { + params->SetScriptLinkId(linkId); + } + } + } + } + } + } + +CCreatorContactGroupElement* CCreatorContactGroupElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + LOGSTRING("Creator: CCreatorContactGroupElement::NewL"); + CCreatorContactGroupElement* self = new (ELeave) CCreatorContactGroupElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorContactGroupElement::CCreatorContactGroupElement(CCreatorEngine* aEngine) +: +CCreatorContactElementBase(aEngine) + { + iIsCommandElement = ETrue; + } + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ ) +void CCreatorContactGroupElement::ExecuteCommandL() + { + LOGSTRING("Creator: CCreatorContactGroupElement::ExecuteCommandL"); + // Get attributes (amount and name) + const CCreatorScriptAttribute* groupAmountAttr = this->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* groupNameAttr = this->FindAttributeByName(KName); + // How many groups to create: + TInt groupAmount = 1; + if( groupAmountAttr ) + { + groupAmount = ConvertStrToIntL(groupAmountAttr->Value()); + } + + for( TInt i = 0; i < groupAmount; ++i ) + { + CCreatorScriptElement* membersElement = FindSubElement(KMembers); + + if( membersElement ) + { + CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL(); + CleanupStack::PushL(param); + + // Links to contact-sets: + const RPointerArray& linkList = membersElement->SubElements(); + if( linkList.Count() > 0 ) + { + for( TInt i = 0; i < linkList.Count(); ++i ) + { + AppendContactSetReferenceL(*linkList[i], param->iLinkIds); + } + } + + if( groupNameAttr ) + { + param->iGroupName->Des().Copy( groupNameAttr->Value() ); + } + else + { + param->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) ); + } + iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryGroups, param); + CleanupStack::Pop(param); + } + } + } +#else +void CCreatorContactGroupElement::ExecuteCommandL() + {} +#endif + +CCreatorContactFieldElement* CCreatorContactFieldElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + LOGSTRING("Creator: CCreatorContactFieldElement::NewL"); + CCreatorContactFieldElement* self = new (ELeave) CCreatorContactFieldElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } + +CCreatorContactFieldElement::CCreatorContactFieldElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_contactsetcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_contactsetcache.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,229 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_contactsetcache.h" + + +CContactLinkCacheImp* ContactLinkCache::iImp = 0; + +CCreatorContactSet* CCreatorContactSet::NewL(TInt aLinkId, TInt aNumOfExistingContacts) + { + return new (ELeave) CCreatorContactSet(aLinkId, aNumOfExistingContacts); + } + +TInt CCreatorContactSet::LinkId() const + { + return iLinkId; + } + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorContactSet::AppendL(MVPbkContactLink* aContactLink) + { + iContactLinks.AppendL(aContactLink); + } + +RPointerArray& CCreatorContactSet::ContactLinks() + { + return iContactLinks; + } + +const RPointerArray& CCreatorContactSet::ContactLinks() const + { + return iContactLinks; + } + + +TInt CCreatorContactSet::NumberOfExistingContacts() const + { + return iNumOfExistingContacts; + } + +CCreatorContactSet::~CCreatorContactSet() + { + iContactLinks.Reset(); + iContactLinks.Close(); + } + +#else +CCreatorContactSet::~CCreatorContactSet() + { + } +#endif + + +CCreatorContactSet::CCreatorContactSet(TInt aLinkId, TInt aNumOfExistingContacts) + { + iLinkId = aLinkId; + iNumOfExistingContacts = aNumOfExistingContacts; + } + +class CContactLinkCacheImp : public CBase, public MContactLinkCache +{ +public: + static CContactLinkCacheImp* NewL(); + virtual ~CContactLinkCacheImp(); + virtual void AppendL(CCreatorContactSet* aContactSet); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + virtual RPointerArray& ContactLinks(TInt aLinkId); + virtual const RPointerArray& ContactLinks(TInt aLinkId) const; +#endif + virtual RPointerArray& ContactSets(); + virtual const RPointerArray& ContactSets() const; + virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const; + virtual CCreatorContactSet& ContactSet(TInt aLinkId); + +private: + void ConstructL(); + CContactLinkCacheImp(); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + RPointerArray iEmptyLinks; +#endif + RPointerArray iContactSets; + CCreatorContactSet* iDummyContactSet; +}; + +CContactLinkCacheImp* CContactLinkCacheImp::NewL() + { + CContactLinkCacheImp* self = new (ELeave) CContactLinkCacheImp(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CContactLinkCacheImp::ConstructL() + { + if( iDummyContactSet == 0 ) + iDummyContactSet = CCreatorContactSet::NewL(-1, 0); + } + +CContactLinkCacheImp::CContactLinkCacheImp() +: iDummyContactSet(0) + {} + +CContactLinkCacheImp::~CContactLinkCacheImp() + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + iEmptyLinks.ResetAndDestroy(); // just in case... + iEmptyLinks.Close(); +#endif + iContactSets.ResetAndDestroy(); + iContactSets.Close(); + delete iDummyContactSet; + } +void CContactLinkCacheImp::AppendL(CCreatorContactSet* aContactSet) + { + iContactSets.AppendL(aContactSet); + } + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + +RPointerArray& CContactLinkCacheImp::ContactLinks(TInt aLinkId) + { + for( TInt i = 0; i < iContactSets.Count(); ++i ) + { + if( iContactSets[i]->LinkId() == aLinkId ) + { + return iContactSets[i]->ContactLinks(); + } + } + return iEmptyLinks; + } + +const RPointerArray& CContactLinkCacheImp::ContactLinks(TInt aLinkId) const + { + for( TInt i = 0; i < iContactSets.Count(); ++i ) + { + if( iContactSets[i]->LinkId() == aLinkId ) + { + return iContactSets[i]->ContactLinks(); + } + } + return iEmptyLinks; + } + +#endif + +const CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) const + { + for( TInt i = 0; i < iContactSets.Count(); ++i ) + { + if( iContactSets[i]->LinkId() == aLinkId ) + { + return *iContactSets[i]; + } + } + + return *iDummyContactSet; + } + +CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) + { + for( TInt i = 0; i < iContactSets.Count(); ++i ) + { + if( iContactSets[i]->LinkId() == aLinkId ) + { + return *iContactSets[i]; + } + } + + return *iDummyContactSet; + } + +RPointerArray& CContactLinkCacheImp::ContactSets() + { + return iContactSets; + } + +const RPointerArray& CContactLinkCacheImp::ContactSets() const + { + return iContactSets; + } + + +void ContactLinkCache::InitializeL() + { + if( iImp == 0 ) + { + iImp = CContactLinkCacheImp::NewL(); + } + } + +void ContactLinkCache::DestroyL() + { + delete iImp; + iImp = 0; + } + +MContactLinkCache* ContactLinkCache::Instance() + { + return iImp; + } + + + /*{ +public: + static void ; + static void DestructLD(); + + static MContactLinkCache* Instance(); + +private: + CContactLinkImp* iImp; +};*/ + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_container.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_container.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,244 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +#include +#include +#include "creator_container.h" + + + +// Standard construction sequence +CCreatorAppView* CCreatorAppView::NewL(const TRect& aRect) + { + CCreatorAppView* self = CCreatorAppView::NewLC(aRect); + CleanupStack::Pop(self); + return self; + } + +CCreatorAppView* CCreatorAppView::NewLC(const TRect& aRect) + { + CCreatorAppView* self = new (ELeave) CCreatorAppView; + CleanupStack::PushL(self); + self->ConstructL(aRect); + return self; + } + +void CCreatorAppView::ConstructL(const TRect& aRect) + { + // Create a window for this application view + CreateWindowL(); + + // Set the windows size + SetRect(aRect); + + // Activate the window, which makes it ready to be drawn + ActivateL(); + + } + +CCreatorAppView::CCreatorAppView() + { + // Add any construction code that can not leave here + } + + +CCreatorAppView::~CCreatorAppView() + { + // Add any destruction code here + } + + +// Draw this application's view to the screen +void CCreatorAppView::Draw(const TRect& /*aRect*/) const + { + + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + + // Gets the control's extent + TRect rect = Rect(); + + // Clears the screen + gc.Clear(rect); + + // variables for memory and disk handling + TDriveNumber cDrive=EDriveC; + TDriveNumber dDrive=EDriveD; + TDriveNumber eDrive=EDriveE; + TVolumeInfo vinfo; + TBuf<16> cFree; + TBuf<16> dFree; + TBuf<16> eFree; + TBuf<16> cSize; + TBuf<16> dSize; + TBuf<16> eSize; + TBuf<64> cText; + TBuf<64> dText; + TBuf<64> eText; + TBuf<64> hText; + + // get an access to file server + RFs& fsSession = ControlEnv()->FsSession(); + + // check the C-drive + fsSession.Volume(vinfo, cDrive); + cFree.Num(TInt64(vinfo.iFree/1024)); + cSize.Num(TInt64(vinfo.iSize/1024)); + + // format the information about the C-drive + cText.Copy(_L("C: ")); + cText.Append(cFree); + cText.Append(_L("kB of ")); + cText.Append(cSize); + cText.Append(_L("kB")); + + + // the same thing for D-drive + fsSession.Volume(vinfo, dDrive); + dFree.Num(TInt64(vinfo.iFree/1024)); + dSize.Num(TInt64(vinfo.iSize/1024)); + + dText.Copy(_L("D: ")); + dText.Append(dFree); + dText.Append(_L("kB of ")); + dText.Append(dSize); + dText.Append(_L("kB")); + + + // the same thing for E-drive (MMC), if it exists + if (MMC_OK()) + { + fsSession.Volume(vinfo, eDrive); + eFree.Num(TInt64(vinfo.iFree/1024)); + eSize.Num(TInt64(vinfo.iSize/1024)); + + eText.Copy(_L("E: ")); + eText.Append(eFree); + eText.Append(_L("kB of ")); + eText.Append(eSize); + eText.Append(_L("kB")); + } + + + // available work memory + TMemoryInfoV1Buf memory; + UserHal::MemoryInfo(memory); + TInt64 freeMemBytes=(TInt64)(memory().iFreeRamInBytes); + TInt64 sizeMemBytes=(TInt64)(memory().iTotalRamInBytes); + + /// ... + TInt64 sizeWorkMemBytes = sizeMemBytes; + + + TBuf<16> freeMem; + TBuf<16> sizeWorkMem; + + freeMem.Num(TInt64(freeMemBytes/1024)); + sizeWorkMem.Num(TInt64(sizeWorkMemBytes/1024)); + + hText.Copy(freeMem); + hText.Append(_L("kB of ")); + hText.Append(sizeWorkMem); + hText.Append(_L("kB")); + + + // draw all the texts to the screen + gc.UseFont(AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont)); + + TSize mainPaneSize; + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, mainPaneSize); + + TReal X_factor = TReal(mainPaneSize.iWidth) / 176; + TReal Y_factor = TReal(mainPaneSize.iHeight) / 144; + + gc.SetPenColor(KRgbDarkBlue); + gc.DrawText(_L("Free RAM memory:"), TPoint(TInt(4*X_factor), TInt(15*Y_factor))); + gc.SetPenColor(KRgbBlack); + gc.DrawText(hText, TPoint(TInt(4*X_factor), TInt(30*Y_factor))); + + gc.SetPenColor(KRgbDarkBlue); + gc.DrawText(_L("Free disk memory:"), TPoint(TInt(4*X_factor), TInt(55*Y_factor))); + gc.SetPenColor(KRgbBlack); + gc.DrawText(cText, TPoint(TInt(4*X_factor), TInt(70*Y_factor))); + gc.DrawText(dText, TPoint(TInt(4*X_factor), TInt(85*Y_factor))); + + if (MMC_OK()) + { + gc.DrawText(eText, TPoint(TInt(4*X_factor), TInt(100*Y_factor))); + } + + } + +TKeyResponse CCreatorAppView::OfferKeyEventL( + const TKeyEvent& aKeyEvent,TEventCode aType) + { + // return the default functionality + return CCoeControl::OfferKeyEventL(aKeyEvent, aType); + } + + +TCoeInputCapabilities CCreatorAppView::InputCapabilities() const + { + // this class does not implement any 'unusual' input capabilities + return TCoeInputCapabilities::ENone; + } + + +void CCreatorAppView::UserDraw() const + { + ActivateGc(); + Draw(Rect()); + DeactivateGc(); + } + + + +TBool CCreatorAppView::MMC_OK() const + { + TBool MMCstatus = EFalse; + + TDriveNumber eDrive=EDriveE; + TVolumeInfo vinfo; + + // check if we can access the E-drive: + if ( iEikonEnv->FsSession().Volume(vinfo, eDrive) == KErrNone) + { + MMCstatus = ETrue; + } + else + { + MMCstatus = EFalse; + } + + // returns ETrue if MMC working properly + return MMCstatus; + } + + +void CCreatorAppView::HandleResourceChange(TInt aType) + { + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + SetRect(mainPaneRect); + } + } + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_document.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,61 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_appui.h" +#include "creator_document.h" + + +// Standard Symbian OS construction sequence +CCreatorDocument* CCreatorDocument::NewL(CEikApplication& aApp) + { + CCreatorDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; + } + +CCreatorDocument* CCreatorDocument::NewLC(CEikApplication& aApp) + { + CCreatorDocument* self = new (ELeave) CCreatorDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CCreatorDocument::ConstructL() + { + // Add any construction that can leave here + } + +CCreatorDocument::CCreatorDocument(CEikApplication& aApp) : CAknDocument(aApp) + { + // Add any construction that can not leave here + } + +CCreatorDocument::~CCreatorDocument() + { + // Any destruction code here + } + +CEikAppUi* CCreatorDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it + CEikAppUi* appUi = new (ELeave) CCreatorAppUi; + return appUi; + } + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_factory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_factory.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,65 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_factory.h" + +#if( defined __SERIES60_30__ || defined __SERIES60_31__ ) + #include "creator_phonebook.h" + #include "creator_accessPoint.h" +#else + #include "creator_virtualphonebook.h" + #include "creator_connectionmethod.h" +#endif + +CCreatorPhonebookBase* TCreatorFactory::CreatePhoneBookL(CCreatorEngine* aEngine) +{ +#if( defined __SERIES60_30__ || defined __SERIES60_31__ ) + return CCreatorPhonebook::NewL(aEngine); +#else + return CCreatorVirtualPhonebook::NewL(aEngine); +#endif + +} + +CCreatorModuleBaseParameters* TCreatorFactory::CreatePhoneBookParametersL() + { +#if( defined __SERIES60_30__ || defined __SERIES60_31__ ) + return new(ELeave) CPhonebookParameters; +#else + return new(ELeave) CVirtualPhonebookParameters; +#endif + } + +CCreatorConnectionSettingsBase* TCreatorFactory::CreateConnectionSettingsL(CCreatorEngine* aEngine) +{ +#if( defined __SERIES60_30__ || defined __SERIES60_31__ ) + return CCreatorAccessPoints::NewL(aEngine); +#else + return CCreatorConnectionSettings::NewL(aEngine); +#endif + +} + +CCreatorModuleBaseParameters* TCreatorFactory::CreateConnectionSettingsParametersL() + { +#if( defined __SERIES60_30__ || defined __SERIES60_31__ ) + return new(ELeave) CAccessPointsParameters; +#else + return new(ELeave) CConnectionSettingsParameters; +#endif + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_file.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_file.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,847 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_file.h" +#include +#include +#include +#include "creator_traces.h" + +using namespace ContentAccess; + +static const TInt KFilesFieldLength = 256; + +//_LIT(KCreatorFilesPrefixName, "CR_"); +//_LIT(KCreatorFilesPrefixFolderName, "CR_FLDR_"); + +//---------------------------------------------------------------------------- + +CFilesParameters::CFilesParameters() + { + LOGSTRING("Creator: CFilesParameters::CFilesParameters"); + iFullFilePath = HBufC::New(KFilesFieldLength); + } +CFilesParameters::CFilesParameters( CFilesParameters& aCopy ) + { + LOGSTRING("Creator: CFilesParameters::CFilesParameters"); + iFullFilePath = HBufC::New(KFilesFieldLength); + iFullFilePath->Des().Copy( *aCopy.iFullFilePath ); + iFileCommand = aCopy.iFileCommand; + iEncrypt = aCopy.iEncrypt; + if ( aCopy.iPermission ) + { + iPermission = CDRMPermission::NewL(); + iPermission->DuplicateL( *aCopy.iPermission ); + } + } +CFilesParameters::~CFilesParameters() + { + LOGSTRING("Creator: CFilesParameters::~CFilesParameters"); + delete iFullFilePath; + delete iPermission; + } + +//---------------------------------------------------------------------------- + +CCreatorFiles* CCreatorFiles::NewL(CCreatorEngine* aEngine) + { + CCreatorFiles* self = CCreatorFiles::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorFiles* CCreatorFiles::NewLC(CCreatorEngine* aEngine) + { + CCreatorFiles* self = new (ELeave) CCreatorFiles; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorFiles::CCreatorFiles() : + iFs ( CEikonEnv::Static()->FsSession() ) + { + } + +void CCreatorFiles::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorFiles::ConstructL"); + + iEngine = aEngine; + + iDirectoryQueriedFromUser = HBufC::New(KFilesFieldLength); + User::LeaveIfError( iApaLs.Connect() ); + + iFilePaths = new (ELeave) CDesCArrayFlat( 4 ); + + // Restore file id + CDictionaryFileStore* store = iEngine->FileStoreLC(); + User::LeaveIfNull( store ); + if ( store->IsPresentL( KUidDictionaryUidFiles ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, KUidDictionaryUidFiles ); + TRAPD( err, iFileId = in.ReadInt32L() ); + if ( err ) + { + iFileId = 1; + } + CleanupStack::PopAndDestroy(); // in + } + else + { + iFileId = 1; + } + CleanupStack::PopAndDestroy( store ); + } + +CCreatorFiles::~CCreatorFiles() + { + LOGSTRING("Creator: CCreatorFiles::~CCreatorFiles"); + + // this is done only once per file operation: + if ( iFilePaths && iFilePaths->Count() ) + { + TRAP_IGNORE( StorePathsForDeleteL( *iFilePaths ) ); + } + delete iFilePaths; + delete iDirectoryQueriedFromUser; + delete iParameters; + delete iUserParameters; + iApaLs.Close(); + } + +//---------------------------------------------------------------------------- + +TBool CCreatorFiles::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorFiles::AskDataFromUserL"); + + if ( aCommand == ECmdDeleteCreatorFiles ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all files created with Creator?") ); + } + + delete iUserParameters; + iUserParameters = NULL; + iUserParameters = new(ELeave) CFilesParameters(); + + iDirectoryQueriedFromUser->Des().Copy( KNullDesC ); + + if (iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?"))) + { + // set a default directory (eg. c:\Nokia\Images\) + TFileName directory; + iEngine->SetDefaultPathForFileCommandL(aCommand, directory); + + // directory query dialog + CAknTextQueryDialog* textDialog = CAknTextQueryDialog::NewL(directory, CAknQueryDialog::ENoTone); + textDialog->SetMaxLength(256); + + TBuf<50> promptText; + + if (aCommand == ECmdCreateFileEntryEmptyFolder) + promptText.Copy( _L("Specify the folder path and name") ); + else + promptText.Copy( _L("Specify the directory") ); + + if (textDialog->ExecuteLD(R_DIRECTORY_QUERY, promptText)) + { + // check that the root folder is correct + if (directory.Length() < 3 || BaflUtils::CheckFolder(iFs, directory.Left(3)) != KErrNone) + { + CAknErrorNote* errorNote = new (ELeave) CAknErrorNote; + errorNote->ExecuteLD(_L("Invalid path")); + return EFalse; + } + else + { + // check the directory contains a trailing backlash + if (directory.Right(1) != _L("\\")) + directory.Append(_L("\\")); + + // copy the directory name to a class member + iDirectoryQueriedFromUser->Des() = directory; + if ( aCommand == ECmdCreateFileEntryEmptyFolder ) return ETrue; + else return AskDRMDataFromUserL(); + } + } + else + return EFalse; + } + else + return EFalse; + + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorFiles::CreateFileEntryL(CFilesParameters *aParameters, TInt aCommand) + { + LOGSTRING("Creator: CCreatorFiles::CreateFileEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + TFileName directoryToBeCreated; + + CFilesParameters* parameters = aParameters; + + if (!parameters) + { + if ( iUserParameters ) + { + iParameters = new (ELeave) CFilesParameters( *iUserParameters ); + // iUserParameters = NULL; + } + else + { + // random data needed if no predefined data available + iParameters = new (ELeave) CFilesParameters; + } + parameters = iParameters; + } + + TInt err = KErrNone; + + // if we just create directories + if ( aCommand == ECmdCreateFileEntryEmptyFolder) + { + // strip the last backslash from the path + if( iDirectoryQueriedFromUser && iDirectoryQueriedFromUser->Des().Length() > 0) + directoryToBeCreated = iDirectoryQueriedFromUser->Des(); + else if( parameters->iFullFilePath && parameters->iFullFilePath->Des().Length() > 0 ) + directoryToBeCreated = parameters->iFullFilePath->Des(); + else + return err; + + _LIT(KSlash, "\\"); + if( directoryToBeCreated.Right(1) == KSlash ) + directoryToBeCreated.SetLength ( directoryToBeCreated.Length() - 1 ); + + // generate a unique file name + err = CApaApplication::GenerateFileName( iFs, directoryToBeCreated); + if (err != KErrNone) + return err; + + // now append the backslah back + directoryToBeCreated.Append( _L("\\") ); + + // now create the new directory + err = iFs.MkDirAll( directoryToBeCreated ); + + // Add directoryToBeCreated to store + iFilePaths->AppendL( directoryToBeCreated ); + + LOGSTRING3("Creator: CCreatorFiles::CreateFileEntryL creating empty directory %S returns err", &directoryToBeCreated, err); + } + + else // files + { + LOGSTRING2("Creator: CCreatorFiles::CreateFileEntryL file id is %d", aCommand); + + // get source + TFileName fullSourcePath; + switch (aCommand) + { + case ECmdCreateFileEntryJPEG_25kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EJPEG_25kB ); break; } + case ECmdCreateFileEntryJPEG_200kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EJPEG_200kB ); break; } + case ECmdCreateFileEntryJPEG_500kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EJPEG_500kB ); break; } + case ECmdCreateFileEntryPNG_15kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EPNG_15kB ); break; } + case ECmdCreateFileEntryGIF_2kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EGIF_2kB ); break; } + case ECmdCreateFileEntryRNG_1kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ERNG_1kB ); break; } + case ECmdCreateFileEntryMIDI_10kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EMIDI_10kB ); break; } + case ECmdCreateFileEntryWAV_20kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EWAVE_20kB ); break; } + case ECmdCreateFileEntryAMR_20kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EAMR_20kB ); break; } + case ECmdCreateFileEntryXLS_15kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EExcel_15kB ); break; } + case ECmdCreateFileEntryDOC_20kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EWord_20kB ); break; } + case ECmdCreateFileEntryPPT_40kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EPowerPoint_40kB ); break; } + case ECmdCreateFileEntryTXT_10kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EText_10kB ); break; } + case ECmdCreateFileEntryTXT_70kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EText_70kB ); break; } + case ECmdCreateFileEntry3GPP_70kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::E3GPP_70kB ); break; } + case ECmdCreateFileEntryMP3_250kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EMP3_250kB ); break; } + case ECmdCreateFileEntryAAC_100kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EAAC_100kB ); break; } + case ECmdCreateFileEntryRM_95kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ERM_95kB ); break; } + case ECmdCreateFileEntryBMP_25kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EBMP_25kB ); break; } + case ECmdCreateFileEntryDeck_1kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ESavedDeck_1kB ); break; } + case ECmdCreateFileEntryHTML_20kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EHTML_20kB ); break; } + case ECmdCreateFileEntryJAD_1kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EJAD_1kB ); break; } + case ECmdCreateFileEntryJAR_10kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EJAR_10kB ); break; } + case ECmdCreateFileEntryJP2_65kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EJP2_65kB ); break; } + case ECmdCreateFileEntryMP4_200kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EMP4_200kB ); break; } + case ECmdCreateFileEntryMXMF_40kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EMXMF_40kB ); break; } + case ECmdCreateFileEntryRAM_1kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ERAM_1kB ); break; } + case ECmdCreateFileEntrySVG_15kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ESVG_15kB ); break; } + case ECmdCreateFileEntrySWF_15kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ESWF_15kB ); break; } + case ECmdCreateFileEntryTIF_25kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ETIF_25kB ); break; } + case ECmdCreateFileEntryVCF_1kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EVCF_1kB ); break; } + case ECmdCreateFileEntryVCS_1kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EVCS_1kB ); break; } + case ECmdCreateFileEntrySISX_10kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::ESISX_10kB ); break; } + case ECmdCreateFileEntryWMA_50kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EWMA_50kB ); break; } + case ECmdCreateFileEntryWMV_200kB: { fullSourcePath = iEngine->TestDataPathL( CCreatorEngine::EWMV_200kB ); break; } + case ECmdCreateFileEntryEmptyFolder: { User::Panic(_L("EmptyFolder"), 801); break; } + default: { return KErrPathNotFound; } + } + + + // define the full target path + TFileName fullTargetPath; + + if ( parameters->iFullFilePath && parameters->iFullFilePath->Des().Length() > 3 ) + { + _LIT(KSlash, "\\"); + // check the path is ok + fullTargetPath = parameters->iFullFilePath->Des(); + + if(fullTargetPath.Right(1) == KSlash) + { + // Remove '\' from the end, because the filename check does not work with it: + fullTargetPath.SetLength ( fullTargetPath.Length() - 1 ); + } + + if (!iFs.IsValidName( fullTargetPath )) + User::Leave(KErrBadName); + + // target path = directory + the file name from source path + TParse parser; + parser.Set(fullSourcePath, NULL, NULL); + + // Add '\' to the end: + fullTargetPath.Append(KSlash); + // Add filename: + fullTargetPath.Append( parser.NameAndExt() ); + + LOGSTRING2("Creator: CCreatorFiles::CreateFileEntryL iFullFilePath used, fullTargetPath: %S", &fullTargetPath); + } + + else if ( iDirectoryQueriedFromUser && iDirectoryQueriedFromUser->Des().Length() > 0 ) + { + // target path = directory + the file name from source path + TParse parser; + parser.Set(fullSourcePath, NULL, NULL); + + fullTargetPath = iDirectoryQueriedFromUser->Des(); + fullTargetPath.Append( parser.NameAndExt() ); + + LOGSTRING2("Creator: CCreatorFiles::CreateFileEntryL iDirectoryQueriedFromUser used, fullTargetPath: %S", &fullTargetPath); + } + + else + { + LOGSTRING("Creator: CCreatorFiles::CreateFileEntryL leaving with KErrPathNotFound"); + User::Leave(KErrPathNotFound); + } + + TBool encrypt = parameters->iEncrypt; + if ( encrypt ) fullTargetPath.Append( KOma2DcfExtension ); + // check the target path has a unique filename ie we won't overwrite existing files + // also generates any missing directories + if ( BaflUtils::FileExists( iFs, fullTargetPath ) ) + { + GenerateFileNameL( fullTargetPath ); + } + User::LeaveIfError(CApaApplication::GenerateFileName( iFs, fullTargetPath ) ); + + if ( encrypt ) + { + EncryptFileL( fullSourcePath, fullTargetPath, parameters ); + } + else + { + // copy the file (synchronous function) + err = BaflUtils::CopyFile(iFs, fullSourcePath, fullTargetPath); + LOGSTRING4("Creator: CCreatorFiles::CreateFileEntryL copy %S to %S, err=%d", &fullSourcePath, &fullTargetPath, err); + } + + if (err != KErrNone) + User::Leave(err); // leave because copying failed + + // Add fullTargetPath to store + iFilePaths->AppendL( fullTargetPath ); + + // make sure that the file won't have a read only attribute + TEntry fileEntry; + iFs.Entry(fullTargetPath, fileEntry); + iFs.SetEntry(fullTargetPath, fileEntry.iModified, NULL, KEntryAttReadOnly); + + // clear variables + parameters->iFullFilePath->Des().Copy ( KNullDesC ); + } + + return err; + } + +//---------------------------------------------------------------------------- + +void CCreatorFiles::EncryptFileL( const TDesC& aInFileName, const TDesC& aOutFileName, CFilesParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorFiles::EncryptFileL"); + TBuf8<64> mime; + SetMimeTypeL( aInFileName, mime, aParameters ); + CSupplier* supplier = CSupplier::NewLC(); + + CMetaDataArray* metaData = CMetaDataArray::NewLC(); + + // Tell the agent which MIME type to use for the encrypted data + metaData->AddL( KOmaImportMimeTypeField, mime ); + + if ( aParameters && aParameters->iPermission ) + { + // Combined Delivery file will be created + SetPermissionsL( metaData, aOutFileName, aParameters ); + } + + supplier->SetOutputDirectoryL( *iDirectoryQueriedFromUser ); + + // The KOmaImportContentType is a OMA DRM agent specific MIME type which + // indicates that plain content is to be encrypted + CImportFile* importFile = supplier->ImportFileL( KOmaImportContentType, + *metaData, + aOutFileName ); + CleanupStack::PushL( importFile ); + + // Peek the source file size: + TInt fileLen( 0 ); + RFile file; + User::LeaveIfError( file.Open( iFs, aInFileName, EFileRead ) ); + CleanupClosePushL( file ); + User::LeaveIfError( file.Size( fileLen ) ); + CleanupStack::PopAndDestroy( &file ); + + // Read the source file to inmemory buffer + RFileReadStream rs; + User::LeaveIfError( rs.Open( iFs, + aInFileName, + EFileStream | EFileRead ) ); + CleanupClosePushL( rs ); + HBufC8* fileBuf = HBufC8::NewLC( fileLen ); + TPtr8 p = fileBuf->Des(); + rs.ReadL( p, fileLen ); + + // Start encryption + TInt err = importFile->WriteData( p ); + if ( err == KErrCANewFileHandleRequired ) + { + RFile file; + User::LeaveIfError( file.Create( iFs, aOutFileName, EFileWrite ) ); + CleanupClosePushL( file ); + importFile->ContinueWithNewOutputFile( file, aOutFileName ); + CleanupStack::PopAndDestroy( &file ); + } + else + { + User::LeaveIfError( err ); + } + User::LeaveIfError( importFile->WriteDataComplete() ); + CleanupStack::PopAndDestroy( fileBuf ); + CleanupStack::PopAndDestroy( &rs ); + CleanupStack::PopAndDestroy( importFile ); + CleanupStack::PopAndDestroy( metaData ); + CleanupStack::PopAndDestroy( supplier ); + } + +//---------------------------------------------------------------------------- + +void CCreatorFiles::SetPermissionsL( CMetaDataArray* aMetaData, const TDesC& aOutFileName, CFilesParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorFiles::SetPermissionsL"); + CDRMRights* rights = CDRMRights::NewL(); + CleanupStack::PushL( rights ); + + HBufC8* cnturi = HBufC8::NewL( KMaxFileName ); + cnturi->Des().Copy( aOutFileName ); + + CDRMAsset* asset = CDRMAsset::NewLC(); + asset->iUid = cnturi; + // Set the asset to the rights class, it will duplicate the asset + rights->SetAssetL( *asset ); + CleanupStack::PopAndDestroy( asset ); + + rights->SetPermissionL( *aParameters->iPermission ); + + // Construct externalized presentation of the rights object + TInt rightsSize = 1024 *100; + HBufC8* rightBuf = HBufC8::NewLC( rightsSize ); + TPtr8 bptr = rightBuf->Des(); + bptr.SetLength( rightsSize ); + RMemWriteStream iWriteStream; + iWriteStream.Open( (TAny*)(rightBuf->Ptr() ), rightsSize ); + CleanupClosePushL( iWriteStream ); + iWriteStream << *rights; + iWriteStream.CommitL(); + TPtr8 rp = rightBuf->Des(); + + // Add rights to metadata + aMetaData->AddL( KOmaImportRightsField, rp ); + CleanupStack::PopAndDestroy( &iWriteStream ); + CleanupStack::PopAndDestroy( rightBuf ); + CleanupStack::PopAndDestroy( rights ); + } + +//---------------------------------------------------------------------------- + +void CCreatorFiles::SetMimeTypeL( const TDesC& aFileName, TDes8& aMime, CFilesParameters *aParameters ) + { + LOGSTRING("Creator: CCreatorFiles::SetMimeTypeL"); + TUid appUid; + TDataType dataType; + User::LeaveIfError( iApaLs.AppForDocument( aFileName, appUid, dataType ) ); + if ( dataType.Des().Length() ) + { + aMime.Copy( dataType.Des() ); + } + else + { + // set default mime, because it was not recognized by iApaLs + aMime.Copy( _L("text/plain") ); + } + + // set DRM permissions according the type of the file + if ( aParameters->iPermission ) + { + if ( dataType.Des().FindF( _L("image") ) > KErrNotFound ) + { + aParameters->iPermission->iAvailableRights = ERightsDisplay | ERightsPrint; + } + else if ( dataType.Des().FindF( _L("audio") ) > KErrNotFound || + dataType.Des().FindF( _L("video") ) > KErrNotFound || + dataType.Des().FindF( _L("tone") ) > KErrNotFound || // e.g. application/vnd.nokia.ringing-tone + dataType.Des().FindF( _L("realmedia") ) > KErrNotFound ) + { + // media files + aParameters->iPermission->iAvailableRights = ERightsPlay; + } + else if ( dataType.Des().FindF( _L("archive") ) > KErrNotFound || + dataType.Des().FindF( _L("x-sis") ) > KErrNotFound ) + { + // application/java-archive + // x-epoc/x-sisx-app + aParameters->iPermission->iAvailableRights = ERightsExecute; + } + else if ( dataType.Des().FindF( _L("application") ) > KErrNotFound || + dataType.Des().FindF( _L("text") ) > KErrNotFound ) + { + // application/msexcel + // application/msword + // text/plain + // etc. + aParameters->iPermission->iAvailableRights = ERightsDisplay | ERightsPrint; + } + else + { + // other filetype + aParameters->iPermission->iAvailableRights = ERightsDisplay; + } + } + } + +//---------------------------------------------------------------------------- + +TBool CCreatorFiles::AskDRMDataFromUserL() + { + LOGSTRING("Creator: CCreatorFiles::AskDRMDataFromUserL"); + // Encryption -dialog + TInt encIndex( 0 ); + CAknListQueryDialog* encDlg = new (ELeave) CAknListQueryDialog( &encIndex ); + encDlg->PrepareLC( R_ENCRYPTION_DIALOG ); + //Create flat array from which list is built. + CDesCArrayFlat* items = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL(items); + + // Add entires to list + items->AppendL( _L("None") ); + items->AppendL( _L("DRM Forward Lock") ); + items->AppendL( _L("DRM Combined Delivery") ); + + // Add items into main list + encDlg->SetOwnershipType( ELbmOwnsItemArray ); + encDlg->SetItemTextArray( items ); + CleanupStack::Pop( items ); + encDlg->ListBox()->SetCurrentItemIndexAndDraw( 0 ); + + if ( encDlg->RunLD() ) + { + if ( encIndex > 0 ) + { + iUserParameters->iEncrypt = ETrue; + } + if ( encIndex == 2 ) + { + iUserParameters->iPermission = CDRMPermission::NewL(); + CDRMPermission* perm = iUserParameters->iPermission; + perm->iTopLevel->iActiveConstraints = EConstraintNone; + perm->iPlay->iActiveConstraints = EConstraintNone; + perm->iDisplay->iActiveConstraints = EConstraintNone; + perm->iPrint->iActiveConstraints = EConstraintNone; + perm->iExecute->iActiveConstraints = EConstraintNone; + perm->iUniqueID = 0; + // DRM Combined Delivery + return AskDRMCDDataFromUserL(); + } + return ETrue; + } + else + { + return EFalse; + } + } + +//---------------------------------------------------------------------------- + +TBool CCreatorFiles::AskDRMCDDataFromUserL() + { + LOGSTRING("Creator: CCreatorFiles::AskDRMCDDataFromUserL"); + TInt count( 0 ); + if ( iEngine->EntriesQueryDialogL( count, _L("How many counts\r\n(0=unlimited)?"), ETrue ) ) + { + if ( count > 0 ) + { + CDRMPermission* perm = iUserParameters->iPermission; + // apply constraints to all permission types + // applied type will be selected by setting iAvailableRights + // when determining the file type + perm->iDisplay->iActiveConstraints |= EConstraintCounter; + perm->iDisplay->iCounter = count; + perm->iDisplay->iOriginalCounter = count; + + perm->iPlay->iActiveConstraints |= EConstraintCounter; + perm->iPlay->iCounter = count; + perm->iPlay->iOriginalCounter = count; + + perm->iPrint->iActiveConstraints |= EConstraintCounter; + perm->iPrint->iCounter = count; + perm->iPrint->iOriginalCounter = count; + + perm->iExecute->iActiveConstraints |= EConstraintCounter; + perm->iExecute->iCounter = count; + perm->iExecute->iOriginalCounter = count; + } + } + else + { + return EFalse; + } + /* + TInt seconds( 0 ); + if ( iEngine->EntriesQueryDialogL( seconds, _L("How many accumulated seconds until expire (0=unlimited)?"), ETrue ) ) + { + if ( seconds > 0 ) + { + CDRMPermission* perm = iUserParameters->iPermission; + // apply constraints to all permission types + // applied type will be selected by setting iAvailableRights + // when determining the file type + perm->iDisplay->iActiveConstraints |= EConstraintAccumulated; + perm->iDisplay->iEndTime = Time::MaxTTime(); + perm->iDisplay->iStartTime = Time::MinTTime();; + perm->iDisplay->iAccumulatedTime = seconds; + + perm->iPlay->iActiveConstraints |= EConstraintAccumulated; + perm->iPlay->iEndTime = Time::MaxTTime(); + perm->iPlay->iStartTime = Time::MinTTime();; + perm->iPlay->iAccumulatedTime = seconds; + + perm->iPrint->iActiveConstraints |= EConstraintAccumulated; + perm->iPrint->iEndTime = Time::MaxTTime(); + perm->iPrint->iStartTime = Time::MinTTime();; + perm->iPrint->iAccumulatedTime = seconds; + + perm->iExecute->iActiveConstraints |= EConstraintAccumulated; + perm->iExecute->iEndTime = Time::MaxTTime(); + perm->iExecute->iStartTime = Time::MinTTime();; + perm->iExecute->iAccumulatedTime = seconds; + } + } + else + { + return EFalse; + } + */ + + TInt minutes( 0 ); + if ( iEngine->EntriesQueryDialogL( minutes, _L("How many minutes until expire (0=unlimited)?"), ETrue ) ) + { + if ( minutes > 0 ) + { + CDRMPermission* perm = iUserParameters->iPermission; + // apply constraints to all permission types + // applied type will be selected by setting iAvailableRights + // when determining the file type + perm->iDisplay->iActiveConstraints |= EConstraintInterval; + perm->iDisplay->iInterval = TTimeIntervalSeconds( 60 * minutes ); + perm->iDisplay->iIntervalStart = Time::NullTTime(); + + perm->iPlay->iActiveConstraints |= EConstraintInterval; + perm->iPlay->iInterval = TTimeIntervalSeconds( 60 * minutes ); + perm->iPlay->iIntervalStart = Time::NullTTime(); + + perm->iPrint->iActiveConstraints |= EConstraintInterval; + perm->iPrint->iInterval = TTimeIntervalSeconds( 60 * minutes ); + perm->iPrint->iIntervalStart = Time::NullTTime(); + + perm->iExecute->iActiveConstraints |= EConstraintInterval; + perm->iExecute->iInterval = TTimeIntervalSeconds( 60 * minutes ); + perm->iExecute->iIntervalStart = Time::NullTTime(); + } + } + else + { + return EFalse; + } + + return ETrue; + } + +//---------------------------------------------------------------------------- +void CCreatorFiles::DeleteAllL() + { + LOGSTRING("Creator: CCreatorFiles::DeleteAllL"); + User::Leave( KErrNotSupported ); // will not be supported + } + +//---------------------------------------------------------------------------- +void CCreatorFiles::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorFiles::DeleteAllCreatedByCreatorL"); + iFileId = 1; + CDictionaryFileStore* store = iEngine->FileStoreLC(); + User::LeaveIfNull( store ); + + if ( store->IsPresentL( KUidDictionaryUidFiles ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, KUidDictionaryUidFiles ); + CFileMan* fileMan = CFileMan::NewL( iFs ); + CleanupStack::PushL( fileMan ); + TFileName fullPath; + // ignore return value, don't update iFileId here: + TRAPD( err, in.ReadInt32L() ); + while ( !err ) + { + TInt len( KErrNotFound ); + TRAP( err, len = in.ReadInt8L() ); // will leave with KErrEof + if ( !err ) + { + TRAP( err, in.ReadL( fullPath, len ) ); + } + if ( !err ) + { + TEntry fileEntry; + iFs.Entry( fullPath, fileEntry ); + if ( fileEntry.IsDir() ) + { + fileMan->RmDir( fullPath ); // ignore return value + } + else + { + iFs.Delete( fullPath ); // ignore return value + } + } + } + CleanupStack::PopAndDestroy( fileMan ); + CleanupStack::PopAndDestroy( &in ); + + // files deleted, remove the Creator internal file registry + store->Remove( KUidDictionaryUidFiles ); + store->CommitL(); + } + CleanupStack::PopAndDestroy( store ); + } + +//---------------------------------------------------------------------------- +void CCreatorFiles::StorePathsForDeleteL( CDesCArray& aPaths ) + { + LOGSTRING("Creator: CCreatorFiles::StorePathsForDeleteL"); + CDictionaryFileStore* store = iEngine->FileStoreLC(); + User::LeaveIfNull( store ); + + // backup previous filepaths from store + // otherwise they would be overwritten when calling out.WriteL + CDesCArray* previousPaths = new (ELeave) CDesCArrayFlat( 4 ); + CleanupStack::PushL( previousPaths ); + + TFileName fullPath; + + if ( store->IsPresentL( KUidDictionaryUidFiles ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, KUidDictionaryUidFiles ); + // ignore return value, don't update iFileId here: + TRAPD( err, in.ReadInt32L() ); + while ( !err ) + { + TRAP( err, + TInt len = in.ReadInt8L(); // will leave with KErrEof + in.ReadL( fullPath, len ); + previousPaths->AppendL( fullPath ); + ); + } + CleanupStack::PopAndDestroy(); // in + } + + RDictionaryWriteStream out; + out.AssignLC( *store, KUidDictionaryUidFiles ); + + // write latest file id to store + out.WriteInt32L( iFileId ); + + // restore previous paths to store + for ( TInt i = 0; i < previousPaths->Count(); i++ ) + { + out.WriteInt8L( (*previousPaths)[i].Length() ); + out.WriteL( (*previousPaths)[i] ); + } + + // write new paths to store + for ( TInt i = 0; i < aPaths.Count(); i++ ) + { + out.WriteInt8L( aPaths[i].Length() ); + out.WriteL( aPaths[i] ); + } + + out.CommitL(); + CleanupStack::PopAndDestroy(); // out + + store->CommitL(); + CleanupStack::PopAndDestroy( previousPaths ); + CleanupStack::PopAndDestroy( store ); + } + +//---------------------------------------------------------------------------- +void CCreatorFiles::GenerateFileNameL( TFileName& aRootName ) + { + LOGSTRING("Creator: CCreatorFiles::GenerateFileNameL"); + if ( iFileId ) + { + TBuf<16> extension; + if ( iFileId < 10 ) + { + extension.Format( _L("(0%d)"), iFileId ); + } + else + { + extension.Format( _L("(%d)"), iFileId ); + } + aRootName.Insert( aRootName.Locate( '.' ), extension ); + } + iFileId++; + } + +// End of file diff -r 000000000000 -r d6fe6244b863 creator/src/creator_fileelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_fileelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,315 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_fileelement.h" +#include +#include +#include "creator_traces.h" +#include "creator_file.h" + +using namespace creatorfile; + +// 15 minutes per time zone, 60 seconds per minute +const TInt KSecondsPerTimeZone = 900; +const TInt KMinuteInMicroseconds = 60000000; +const TInt KTimeZoneIncrement = 15; + +/* + * + */ +CCreatorFileElement* CCreatorFileElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorFileElement* self = new (ELeave) CCreatorFileElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorFileElement::CCreatorFileElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + + TTime currUniversal; + TTime currLocal; + TInt64 result( 0 ); + currUniversal.UniversalTime(); + currLocal.HomeTime(); + result = currLocal.Int64() - currUniversal.Int64(); + result /= KMinuteInMicroseconds; + result /= KTimeZoneIncrement; + iTimeZone = I64INT( result ); + } +/* + * + */ +void CCreatorFileElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt fileAmount = 1; + if( amountAttr ) + { + fileAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create files, the amount of files is defined by fileAmount: + for( TInt cI = 0; cI < fileAmount; ++cI ) + { + CFilesParameters* param = new (ELeave) CFilesParameters; + CleanupStack::PushL( param ); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + + const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName( KRandomLength ); + + if( elemName == KType ) + { + param->iFileCommand = GetFileCommandL(elemContent, randomAttr || elemContent.Length() == 0); + } + else if( elemName == KDirectory ) + { + delete param->iFullFilePath; + param->iFullFilePath = 0; + if( randomAttr == 0 && elemContent.Length() > 0 ) + { + param->iFullFilePath = elemContent.AllocL(); + } + else + { + TFileName defaultPath; + iEngine->SetDefaultPathForFileCommandL( param->iFileCommand, defaultPath ); + param->iFullFilePath = defaultPath.AllocL(); + } + } + else if ( elemName == KEncryption ) + { + ParseDRMElementsL( field, param ); + } + } + + if ( !param->iFileCommand ) + { + param->iFileCommand = ECmdCreateFileEntryEmptyFolder; + } + iEngine->AppendToCommandArrayL( param->iFileCommand, param); + CleanupStack::Pop( param ); + } + } + else + { + _LIT(KDummy, ""); + for( TInt cI = 0; cI < fileAmount; ++cI ) + { + CFilesParameters* param = new (ELeave) CFilesParameters; + CleanupStack::PushL(param); + delete param->iFullFilePath; + param->iFullFilePath = 0; + TFileName defaultPath; + param->iFileCommand = GetFileCommandL(KDummy, ETrue); + iEngine->SetDefaultPathForFileCommandL(param->iFileCommand, defaultPath); + param->iFullFilePath = defaultPath.AllocL(); + + iEngine->AppendToCommandArrayL(param->iFileCommand, param); + CleanupStack::Pop(param); + } + } + } + +TInt CCreatorFileElement::GetFileCommandL( const TDesC& aFileIdStr, TBool aRandom ) const + { + TInt mapCount = sizeof(FileMap) / sizeof(FileMapping); + + if( aRandom ) + { + return FileMap[iEngine->RandomNumber(0, mapCount-1)].CommandId(); + } + + for( TInt i = 0; i < mapCount; ++i ) + { + if( CompareIgnoreCase(FileMap[i].FileName(), aFileIdStr) == 0 ) + return FileMap[i].CommandId(); + } + LOGSTRING2("CCreatorFileElement::GetFileCommandL: Unknown file id: %S", &aFileIdStr); + User::Leave(KErrGeneral); + return 0; // Not reached, but disables compiler warning... + } + +void CCreatorFileElement::ParseDRMElementsL( CCreatorScriptElement* aField, CFilesParameters* aParam ) + { + const CCreatorScriptAttribute* encryptionTypeAttr = aField->FindAttributeByName( KType ); + if ( encryptionTypeAttr && encryptionTypeAttr->Value().Length() > 0 ) + { + aParam->iEncrypt = ETrue; + if ( encryptionTypeAttr->Value() == KDRMCD ) + { + delete aParam->iPermission; + aParam->iPermission = NULL; + // ownership transferred: + aParam->iPermission = CDRMPermission::NewL(); + } + else if ( encryptionTypeAttr->Value() != KDRMFL ) + { + // must be either KDRMCD or KDRMFL + User::Leave( KErrArgument ); + } + } + else + { + User::Leave( KErrArgument ); + } + + const RPointerArray& rights = aField->SubElements(); + + if ( encryptionTypeAttr->Value() == KDRMFL && rights.Count() ) + { + // Right definitions not allowed with DRM Forward Lock + // User::Leave( KErrArgument ); // Do not leave here + return; // Just omit rights definitions + } + + // parse right elements + CDRMPermission* drmPermission = aParam->iPermission; + for ( TInt r = 0; r < rights.Count(); r++ ) + { + const CCreatorScriptAttribute* rightAttr = rights[r]->FindAttributeByName( KType ); + if ( rightAttr->Value() == KDRMPlayRight && + !( drmPermission->iAvailableRights & ERightsPlay ) ) + { + drmPermission->iAvailableRights |= ERightsPlay; + ParseDRMConstraintsL( rights[r], drmPermission->iPlay ); + } + else if ( rightAttr->Value() == KDRMDisplayRight && + !( drmPermission->iAvailableRights & ERightsDisplay )) + { + drmPermission->iAvailableRights |= ERightsDisplay; + ParseDRMConstraintsL( rights[r], drmPermission->iDisplay ); + } + else if ( rightAttr->Value() == KDRMPrintRight && + !( drmPermission->iAvailableRights & ERightsPrint ) ) + { + drmPermission->iAvailableRights |= ERightsPrint; + ParseDRMConstraintsL( rights[r], drmPermission->iPrint ); + } + else if ( rightAttr->Value() == KDRMExecuteRight && + !( drmPermission->iAvailableRights & ERightsExecute ) ) + { + drmPermission->iAvailableRights |= ERightsExecute; + ParseDRMConstraintsL( rights[r], drmPermission->iExecute ); + } + } + } + +void CCreatorFileElement::ParseDRMConstraintsL( CCreatorScriptElement* aRight, CDRMConstraint* aConstraint ) + { + const RPointerArray& constraints = aRight->SubElements(); + for ( TInt c = 0; c < constraints.Count(); c++ ) + { + TPtrC elemName = constraints[c]->Name(); + TPtrC elemContent = constraints[c]->Content(); + if ( elemName == KDRMCount ) + { + TInt count = ConvertStrToIntL( elemContent ); + // apply count constraint + aConstraint->iActiveConstraints |= EConstraintCounter; + aConstraint->iCounter = count; + aConstraint->iOriginalCounter = count; + } + else if ( elemName == KDRMInterval ) + { + // apply interval constraint + aConstraint->iActiveConstraints |= EConstraintInterval; + aConstraint->iInterval = ParseTimeInterval( elemContent ); + aConstraint->iIntervalStart = Time::NullTTime(); + } + else if ( elemName == KDRMStartTime ) + { + // apply start time constraint + aConstraint->iActiveConstraints |= EConstraintStartTime; + TTimeIntervalSeconds offset( iTimeZone * KSecondsPerTimeZone ); + aConstraint->iStartTime = ConvertToDateTimeL( elemContent ) - offset; + } + else if ( elemName == KDRMEndTime ) + { + // apply end time constraint + aConstraint->iActiveConstraints |= EConstraintEndTime; + TTimeIntervalSeconds offset( iTimeZone * KSecondsPerTimeZone ); + aConstraint->iEndTime = ConvertToDateTimeL( elemContent ) - offset; + } + else if ( elemName == KDRMAccumulated ) + { + // apply accumulated time constraint + aConstraint->iActiveConstraints |= EConstraintAccumulated; + if ( aConstraint->iEndTime == Time::NullTTime() ) + { + aConstraint->iEndTime = Time::MaxTTime(); + } + if ( aConstraint->iStartTime == Time::NullTTime() ) + { + aConstraint->iStartTime = Time::MinTTime(); + } + aConstraint->iAccumulatedTime = ParseTimeInterval( elemContent ); + } + } + } + +TTimeIntervalSeconds CCreatorFileElement::ParseTimeInterval( TDesC& aTimeString ) + { + // Iso8601 format (P1Y2M3DT4H5M6S) to TimeIntervalSeconds + TLex lex; + TInt year = 0; + TInt month = 0; + TInt day = 0; + TInt hour = 0; + TInt minute = 0; + TInt second = 0; + + if (aTimeString.Length() > 0) + { + lex = aTimeString; + lex.Inc(); // skip 'P' + lex.Val(year); + lex.Inc(); + lex.Val(month); + lex.Inc(); + lex.Val(day); + lex.Inc(2); + lex.Val(hour); + lex.Inc(); + lex.Val(minute); + lex.Inc(); + lex.Val(second); + } + TTimeIntervalSeconds result( ( ( ( year * 365 + month * 30 + day ) * 24 + hour ) + * 60 + minute ) * 60 + second ); + return result; + } + +// End of file diff -r 000000000000 -r d6fe6244b863 creator/src/creator_imps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_imps.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,260 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifdef __PRESENCE + +#include "creator_imps.h" +#include "creator_traces.h" + +#include + +static const TInt KIMPSFieldLength = 128; + +_LIT(KCreatorIMPSPrefixName, "CR_"); + + +//---------------------------------------------------------------------------- + +CIMPSParameters::CIMPSParameters() + { + LOGSTRING("Creator: CIMPSParameters::CIMPSParameters"); + + iServerName = HBufC::New(KIMPSFieldLength); + iServerURL = HBufC::New(KIMPSFieldLength); + iServerUsername = HBufC::New(KIMPSFieldLength); + iServerPassword = HBufC::New(KIMPSFieldLength); + iServerAccessPointName = HBufC::New(KIMPSFieldLength); + // User needs to set connectionmethod manually to be able to use the IMPS setting + iServerAccessPointName->Des().Copy(_L("DEFAULT-IAP")); + } + +CIMPSParameters::~CIMPSParameters() + { + LOGSTRING("Creator: CIMPSParameters::~CIMPSParameters"); + + delete iServerAccessPointName; + delete iServerPassword; + delete iServerUsername; + delete iServerURL; + delete iServerName; + } + +void CIMPSParameters::SetRandomNameL(CCreatorEngine& aEngine) + { + if(iServerName == 0) + { + iServerName = HBufC::New(KIMPSFieldLength); + } + TBuf<160> company = aEngine.RandomString(CCreatorEngine::ECompany); + iServerName->Des() = KCreatorIMPSPrefixName; + iServerName->Des().Append( company ); + iServerName->Des().Append( _L(" #") ); + iServerName->Des().AppendNum( aEngine.RandomNumber(1000, 9999) ); + } + +void CIMPSParameters::SetRandomUrlL(CCreatorEngine& aEngine) + { + if(iServerURL == 0) + { + iServerURL = HBufC::New(KIMPSFieldLength); + } + TBuf<160> company = aEngine.RandomString(CCreatorEngine::ECompany); + iServerURL->Des() = _L("http://imps."); + iServerURL->Des().Append( company ); + iServerURL->Des().Append( _L(".com:18080/CSP/csp") ); + } + +void CIMPSParameters::SetRandomUsernameL(CCreatorEngine& aEngine) + { + iServerUsername->Des() = aEngine.RandomString(CCreatorEngine::EFirstName); + iServerUsername->Des().LowerCase(); + } + +void CIMPSParameters::SetRandomPasswordL(CCreatorEngine& aEngine) + { + iServerPassword->Des() = aEngine.RandomString(CCreatorEngine::ESurname); + iServerPassword->Des().LowerCase(); + } +void CIMPSParameters::SetDefaultAccessPointL() + { + iServerAccessPointName->Des().Copy(_L("DEFAULT-IAP")); + } +//---------------------------------------------------------------------------- + +CCreatorIMPS* CCreatorIMPS::NewL(CCreatorEngine* aEngine) + { + CCreatorIMPS* self = CCreatorIMPS::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorIMPS* CCreatorIMPS::NewLC(CCreatorEngine* aEngine) + { + CCreatorIMPS* self = new (ELeave) CCreatorIMPS; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorIMPS::CCreatorIMPS() + { + } + +void CCreatorIMPS::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorIMPS::ConstructL"); + + iEngine = aEngine; + + iIMPSSAPSettingsStore = CIMPSSAPSettingsStore::NewL(); + } + +CCreatorIMPS::~CCreatorIMPS() + { + LOGSTRING("Creator: CCreatorIMPS::~CCreatorIMPS"); + + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidIMPS ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + delete iIMPSSAPSettingsStore; + + if (iParameters) + delete iParameters; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorIMPS::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorIMPS::AskDataFromUserL"); + if ( aCommand == ECmdDeleteIMPSs ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all IMPS server entries?") ); + } + else if ( aCommand == ECmdDeleteCreatorIMPSs ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all IMPS server entries created with Creator?") ); + } + return iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?")); + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorIMPS::CreateIMPSServerEntryL(CIMPSParameters *aParameters) + { + LOGSTRING("Creator: CCreatorIMPS::CreateIMPSServerEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CIMPSParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CIMPSParameters; + parameters = iParameters; + parameters->SetRandomNameL(*iEngine); + parameters->SetRandomUrlL(*iEngine); + parameters->SetRandomUsernameL(*iEngine); + parameters->SetRandomPasswordL(*iEngine); + parameters->SetDefaultAccessPointL(); + } + + TInt err = KErrNone; + + // set data to save item + CIMPSSAPSettings* settings = CIMPSSAPSettings::NewLC(); + TUint32 iapId = iEngine->AccessPointNameToIdL(parameters->iServerAccessPointName->Des(), ETrue ); + err = settings->SetAccessPoint( iapId ); + if( err != KErrNone ) + { + LOGSTRING("Creator: CCreatorIMPS::CreateIMPSServerEntryL - Unable to resolve access point."); + err = KErrNone; + } + settings->SetSAPNameL( parameters->iServerName->Des() ); + settings->SetSAPAddressL( parameters->iServerURL->Des() ); + settings->SetSAPUserIdL( parameters->iServerUsername->Des() ); + settings->SetSAPUserPasswordL( parameters->iServerPassword->Des() ); + + // save the item + TRAP(err, iIMPSSAPSettingsStore->StoreNewSAPL( settings, EIMPSIMAccessGroup )); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( settings->Uid() ); + + TRAP(err, iIMPSSAPSettingsStore->StoreNewSAPL( settings, EIMPSPECAccessGroup )); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( settings->Uid() ); + + CleanupStack::PopAndDestroy(); //settings + return err; + } + + +//---------------------------------------------------------------------------- +void CCreatorIMPS::DeleteAllL() + { + LOGSTRING("Creator: CCreatorIMPS::DeleteAllL"); + CIMPSSAPSettingsList* imps = CIMPSSAPSettingsList::NewLC(); + iIMPSSAPSettingsStore->PopulateSAPSettingsListL( *imps, EIMPSAccessFilterAll ); + for ( TInt i = 0; i < imps->Count(); i++ ) + { + iIMPSSAPSettingsStore->DeleteSAPL( imps->UidForIndex( i ) ); + } + CleanupStack::PopAndDestroy( imps ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the IMPS related registry + iEngine->RemoveStoreL( KUidDictionaryUidIMPS ); + } + +//---------------------------------------------------------------------------- +void CCreatorIMPS::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorIMPS::DeleteAllCreatedByCreatorL"); + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidIMPS ); + + // delete entries + for ( TInt i = 0; i < iEntryIds.Count(); i++ ) + { + TRAP_IGNORE( iIMPSSAPSettingsStore->DeleteSAPL( iEntryIds[i] ) ); + } + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the IMPS related registry + iEngine->RemoveStoreL( KUidDictionaryUidIMPS ); + } + +#endif //__PRESENCE + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_impselement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_impselement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,146 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifdef __PRESENCE + +#include "creator_impselement.h" +#include "creator_traces.h" +#include "creator_imps.h" + +using namespace creatorimps; + +/* + * + */ +CCreatorImpsServerElement* CCreatorImpsServerElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorImpsServerElement* self = new (ELeave) CCreatorImpsServerElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorImpsServerElement::CCreatorImpsServerElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } + +void CCreatorImpsServerElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt entryAmount = 1; + if( amountAttr ) + { + entryAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create note entries, the amount of entries is defined by entryAmount: + for( TInt cI = 0; cI < entryAmount; ++cI ) + { + CIMPSParameters* param = new (ELeave) CIMPSParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == KName ) + { + if( useRandom ) + { + param->SetRandomNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerName, elemContent); + } + } + if( elemName == KUrl ) + { + if( useRandom ) + { + param->SetRandomUrlL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerURL, elemContent); + } + } + if( elemName == KUsername ) + { + if( useRandom ) + { + param->SetRandomUsernameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerUsername, elemContent); + } + } + if( elemName == KPassword ) + { + if( useRandom ) + { + param->SetRandomPasswordL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerPassword, elemContent); + } + } + if( elemName == KConnectionMethodName ) + { + if( useRandom || CompareIgnoreCase(elemContent, creatorimps::KDefault) == 0 ) + { + param->SetDefaultAccessPointL(); + } + else + { + SetContentToTextParamL(param->iServerAccessPointName, elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryIMPSServers, param); + CleanupStack::Pop(); // param + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryIMPSServers, 0, entryAmount); + } + } + +#endif // __PRESENCE diff -r 000000000000 -r d6fe6244b863 creator/src/creator_landmark.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_landmark.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,497 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_landmark.h" +#include "creator_traces.h" + +#include +#include +#include + +_LIT(KAccommodation, "accommodation"); +_LIT(KBusiness, "business"); +_LIT(KCommunication, "communication"); +_LIT(KEducational, "educational"); +_LIT(KEntertainment, "entertainment"); +_LIT(KFoodAndBeverage, "food"); +_LIT(KGeographical, "geographical"); +_LIT(KOutdoor, "outdoor"); +_LIT(KPeople, "people"); +_LIT(KPublic, "public"); +_LIT(KReligious, "religious"); +_LIT(KShopping, "shopping"); +_LIT(KSightseeing, "sightseeing"); +_LIT(KSports, "sports"); +_LIT(KTransport, "transport"); + + +/** + * Class mapping the strings to global landmark categories + */ +class CategoryMapping +{ +public: + CategoryMapping(TUint aId, const TDesC& aCategoryStr) + : + iGlobalId(aId), + iStr(aCategoryStr) + {} + + TPosLmGlobalCategory iGlobalId; + const TDesC& iStr; +}; + +/** + * Global landmark categories + */ +CategoryMapping LandmarkCategories[] = { + CategoryMapping(3000, KAccommodation), // Accommodation + CategoryMapping(6000, KBusiness), // Business + CategoryMapping(9000, KCommunication), // Communication + CategoryMapping(12000, KEducational), // Educational institute + CategoryMapping(15000, KEntertainment), // Entertainment + CategoryMapping(18000, KFoodAndBeverage), // Food & Beverage + CategoryMapping(21000, KGeographical), // Geographical area + CategoryMapping(24000, KOutdoor), // Outdoor activities + CategoryMapping(27000, KPeople), // People + CategoryMapping(30000, KPublic), // Public service + CategoryMapping(33000, KReligious), // Religious places + CategoryMapping(36000, KShopping), // Shopping + CategoryMapping(39000, KSightseeing), // Sightseeing + CategoryMapping(42000, KSports), // Sports + CategoryMapping(45000, KTransport) // Transport +}; + +/** + * Return landmark global id + */ +TPosLmGlobalCategory CCreatorLandmarks::GetCategoryIdL(const TDesC& aCategoryStr) + { + TUint numOfCategories = sizeof(LandmarkCategories)/sizeof(CategoryMapping); + for( TUint i = 0; i < numOfCategories; ++i ) + { + if( LandmarkCategories[i].iStr == aCategoryStr ) + return LandmarkCategories[i].iGlobalId; + } + + return 0; + } + +/** + * + */ +CLandmarkParameters::CLandmarkParameters() + { + LOGSTRING("Creator: CLandmarkParameters::CLandmarkParameters"); + } + +/** + * + */ +CLandmarkParameters::~CLandmarkParameters() + { + LOGSTRING("Creator: CLandmarkParameters::~CLandmarkParameters"); + delete iName; + delete iStreet; + delete iCity; + delete iState; + delete iCountry; + delete iPostCode; + delete iDescription; + delete iPhonenumber; + delete iUrl; + iCategories.Close(); + } + +/** + * + */ +void CLandmarkParameters::SetRandomNameL(CCreatorEngine& aEngine) + { + TPtrC name(aEngine.RandomString(CCreatorEngine::ELandmarkName)); + delete iName; + iName = 0; + iName = HBufC::NewL(name.Length()); + iName->Des().Copy(name); + } + +/** + * + */ +void CLandmarkParameters::SetRandomUrlL(CCreatorEngine& aEngine) + { + _LIT(KUrlPrefix, "http://www."); + _LIT(KUrlPostfix, ".com"); + TPtrC company(aEngine.RandomString(CCreatorEngine::ECompany)); + delete iUrl; + iUrl = 0; + iUrl = HBufC::NewL(KUrlPrefix().Length()+company.Length()+KUrlPostfix().Length()); + iUrl->Des() = KUrlPrefix; + iUrl->Des().Append( company ); + iUrl->Des().Append( KUrlPostfix ); + } + +/** + * + */ +void CLandmarkParameters::AddRandomCategoryL(CCreatorEngine& aEngine) + { + TUint numOfCategories = sizeof(LandmarkCategories)/sizeof(CategoryMapping); + iCategories.AppendL(LandmarkCategories[aEngine.RandomNumber(0, numOfCategories-1)].iGlobalId); + } + +/** + * + */ +void CLandmarkParameters::SetRandomStreetL(CCreatorEngine& aEngine) + { + TPtrC street(aEngine.RandomString(CCreatorEngine::EAddress)); + delete iStreet; + iStreet = 0; + iStreet = HBufC::NewL(street.Length()); + iStreet->Des().Copy(street); + } + +/** + * + */ +void CLandmarkParameters::SetRandomCityL(CCreatorEngine& aEngine) + { + TPtrC city(aEngine.RandomString(CCreatorEngine::ECity)); + delete iCity; + iCity = 0; + iCity = HBufC::NewL(city.Length()); + iCity->Des().Copy(city); + } + +/** + * + */ +void CLandmarkParameters::SetRandomStateL(CCreatorEngine& aEngine) + { + TPtrC state(aEngine.RandomString(CCreatorEngine::EState)); + delete iState; + iState = 0; + iState = HBufC::NewL(state.Length()); + iState->Des().Copy(state); + } + +/** + * + */ +void CLandmarkParameters::SetRandomCountryL(CCreatorEngine& aEngine) + { + TPtrC country(aEngine.RandomString(CCreatorEngine::ECountry)); + delete iCountry; + iCountry = 0; + iCountry = HBufC::NewL(country.Length()); + iCountry->Des().Copy(country); + } + +/** + * + */ +void CLandmarkParameters::SetRandomPostCodeL(CCreatorEngine& aEngine) + { + TPtrC po(aEngine.RandomString(CCreatorEngine::EPostcode)); + delete iPostCode; + iPostCode = 0; + iPostCode = HBufC::NewL(po.Length()); + iPostCode->Des().Copy(po); + } + +/** + * + */ +void CLandmarkParameters::SetRandomLatitudeL(CCreatorEngine& aEngine) + { + iLatitude = aEngine.RandomNumber(-89, 89); // Degrees + TReal64 random = aEngine.RandomNumber(0, 9999); // Desimals + iLatitude += random / 10000.0; + } + +/** + * + */ +void CLandmarkParameters::SetRandomLongitudeL(CCreatorEngine& aEngine) + { + TInt minDegrees = -179; + TInt maxDegrees = 179; + TInt minDecimal = 0; + TInt maxDecimal = 9999; + TReal64 divider = 10000.0; + iLongitude = aEngine.RandomNumber(minDegrees, maxDegrees); // Degrees + TReal64 random = aEngine.RandomNumber(minDecimal, maxDecimal); + iLongitude += random / divider; + } + +/** + * + */ +void CLandmarkParameters::SetRandomPositionAccuracyL(CCreatorEngine& aEngine) + { + this->iPositionAccuracy = aEngine.RandomNumber(0,5); + } + +/** + * + */ +void CLandmarkParameters::SetRandomAltitudeL(CCreatorEngine& aEngine) + { + this->iAltitude = aEngine.RandomNumber(0,120); + } + +/** + * + */ +void CLandmarkParameters::SetRandomAltitudeAccuracyL(CCreatorEngine& aEngine) + { + this->iAltitudeAccuracy = aEngine.RandomNumber(0,5); + } + +/** + * + */ +void CLandmarkParameters::SetRandomDescriptionL(CCreatorEngine& aEngine) + { + delete iDescription; + iDescription = 0; + TPtrC desc(aEngine.RandomString(CCreatorEngine::ELandmarkDescription)); + iDescription = HBufC::NewL(desc.Length()); + iDescription->Des().Copy(desc); + } + +/** + * + */ +void CLandmarkParameters::SetRandomPhoneNumberL(CCreatorEngine& aEngine) + { + delete iPhonenumber; + iPhonenumber = 0; + TPtrC phone(aEngine.RandomString(CCreatorEngine::EPhoneNumber)); + iPhonenumber = HBufC::NewL(phone.Length()); + iPhonenumber->Des().Copy(phone); + } + +/** + * + */ +CCreatorLandmarks::CCreatorLandmarks() + { + } + +/** + * + */ +CCreatorLandmarks* CCreatorLandmarks::NewL(CCreatorEngine* aEngine) + { + CCreatorLandmarks* self = CCreatorLandmarks::NewLC(aEngine); + CleanupStack::Pop(); // self + return self; + } + +/** + * + */ +CCreatorLandmarks* CCreatorLandmarks::NewLC(CCreatorEngine* aEngine) + { + CCreatorLandmarks* self = new (ELeave) CCreatorLandmarks; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +/** + * + */ +void CCreatorLandmarks::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorLandmarks::ConstructL"); + iEngine = aEngine; + iLandmarkDb = CPosLandmarkDatabase::OpenL(); + if( iLandmarkDb->IsInitializingNeeded() ) + { + ExecuteAndDeleteLD(iLandmarkDb->InitializeL()); + } + } + +/** + * + */ +CCreatorLandmarks::~CCreatorLandmarks() + { + LOGSTRING("Creator: CCreatorLandmarks::~CCreatorLandmarks"); + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidLandmarks ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + delete iLandmarkDb; + delete iLmOperation; + delete iParameters; + } + +/** + * + */ +TBool CCreatorLandmarks::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorLandmarks::AskDataFromUserL"); + if ( aCommand == ECmdDeleteLandmarks ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all Landmarks?") ); + } + else if ( aCommand == ECmdDeleteCreatorLandmarks ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all Landmarks created with Creator?") ); + } + return iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many landmarks to create?")); + } + +/** + * Convert global category id to local category id + */ +TPosLmItemId CCreatorLandmarks::GetCategoryIdL( TPosLmGlobalCategory aGlobalCategoryID ) +{ + CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL( *iLandmarkDb ); + CleanupStack::PushL( categoryManager ); + + // Find ID of the given global category in given database + TPosLmItemId id = categoryManager->GetGlobalCategoryL( aGlobalCategoryID ); + CleanupStack::PopAndDestroy(); // categoryManager + return id; +} + +/** + * + */ +TInt CCreatorLandmarks::CreateLandmarkEntryL(CLandmarkParameters *aParameters) + { + LOGSTRING("Creator: CCreatorLandmarks::CreateLandmarkEntryL"); + TInt err = KErrNone; + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CLandmarkParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CLandmarkParameters; + parameters = iParameters; + + TBuf<160> company = iEngine->RandomString(CCreatorEngine::ECompany); + + parameters->SetRandomNameL(*iEngine); + parameters->SetRandomUrlL(*iEngine); + parameters->AddRandomCategoryL(*iEngine); + parameters->SetRandomStreetL(*iEngine); + parameters->SetRandomCityL(*iEngine); + parameters->SetRandomStateL(*iEngine); + parameters->SetRandomCountryL(*iEngine); + parameters->SetRandomPostCodeL(*iEngine); + parameters->SetRandomLatitudeL(*iEngine); + parameters->SetRandomLongitudeL(*iEngine); + parameters->SetRandomPositionAccuracyL(*iEngine); + parameters->SetRandomAltitudeL(*iEngine); + parameters->SetRandomAltitudeAccuracyL(*iEngine); + parameters->SetRandomDescriptionL(*iEngine); + parameters->SetRandomPhoneNumberL(*iEngine); + } + + CPosLandmark* newLandmark = CPosLandmark::NewLC(); + TCoordinate crd(parameters->iLatitude, parameters->iLongitude, parameters->iAltitude); + TLocality loc(crd, parameters->iPositionAccuracy, parameters->iAltitudeAccuracy); + newLandmark->SetPositionL(loc); + + // Add categories + for( TInt i = 0; i < parameters->iCategories.Count(); ++i ) + { + newLandmark->AddCategoryL(GetCategoryIdL(parameters->iCategories[i])); + } + if( parameters->iName ) + newLandmark->SetLandmarkNameL(parameters->iName->Des()); + if( parameters->iCountry ) + newLandmark->SetPositionFieldL(EPositionFieldCountry, parameters->iCountry->Des()); + if( parameters->iCity ) + newLandmark->SetPositionFieldL(EPositionFieldCity, parameters->iCity->Des()); + if( parameters->iPostCode ) + newLandmark->SetPositionFieldL(EPositionFieldPostalCode, parameters->iPostCode->Des()); + if( parameters->iState ) + newLandmark->SetPositionFieldL(EPositionFieldState, parameters->iState->Des()); + if( parameters->iStreet ) + newLandmark->SetPositionFieldL(EPositionFieldStreet, parameters->iStreet->Des()); + if( parameters->iPhonenumber ) + newLandmark->SetPositionFieldL(EPositionFieldBuildingTelephone, parameters->iPhonenumber->Des()); + if( parameters->iDescription ) + newLandmark->SetLandmarkDescriptionL(parameters->iDescription->Des()); + if( parameters->iUrl ) + newLandmark->SetPositionFieldL(EPositionFieldMediaLinksStart, parameters->iUrl->Des()); + + TRAP(err, iLandmarkDb->AddLandmarkL(*newLandmark)); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( newLandmark->LandmarkId() ); + + ExecuteAndDeleteLD(iLandmarkDb->CompactL()); + + CleanupStack::PopAndDestroy(newLandmark); + return err; + } + +//---------------------------------------------------------------------------- +void CCreatorLandmarks::DeleteAllL() + { + LOGSTRING("Creator: CCreatorLandmarks::DeleteAllL"); + ExecuteAndDeleteLD( iLandmarkDb->RemoveAllLandmarksL() ); + ExecuteAndDeleteLD( iLandmarkDb->CompactL() ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Landmarks related registry + iEngine->RemoveStoreL( KUidDictionaryUidLandmarks ); + } + +//---------------------------------------------------------------------------- +void CCreatorLandmarks::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorLandmarks::DeleteAllCreatedByCreatorL"); + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidLandmarks ); + + // delete entries + TRAP_IGNORE( + ExecuteAndDeleteLD( iLandmarkDb->RemoveLandmarksL( iEntryIds ) ); + ExecuteAndDeleteLD( iLandmarkDb->CompactL() ); + ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Landmarks related registry + iEngine->RemoveStoreL( KUidDictionaryUidLandmarks ); + } + + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_landmarkelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_landmarkelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,256 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_landmarkelement.h" +#include "creator_traces.h" +#include "creator_landmark.h" + +using namespace creatorlandmark; + +/* + * + */ +CCreatorLandmarkElement* CCreatorLandmarkElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorLandmarkElement* self = new (ELeave) CCreatorLandmarkElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorLandmarkElement::CCreatorLandmarkElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } + +void CCreatorLandmarkElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt lmAmount = 1; + if( amountAttr ) + { + lmAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create note entries, the amount of entries is defined by noteAmount: + for( TInt cI = 0; cI < lmAmount; ++cI ) + { + CLandmarkParameters* param = new (ELeave) CLandmarkParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == KName ) + { + if( useRandom ) + { + param->SetRandomNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iName, elemContent); + } + } + else if( elemName == KCategory ) + { + if( useRandom ) + { + param->AddRandomCategoryL(*iEngine); + } + else + { + TPosLmItemId categoryId = CCreatorLandmarks::GetCategoryIdL(elemContent); + if( categoryId > 0 ) + { + param->iCategories.AppendL(categoryId); + } + } + } + else if( elemName == KDescription ) + { + if( useRandom ) + { + param->SetRandomDescriptionL(*iEngine); + } + else + { + SetContentToTextParamL(param->iDescription, elemContent); + } + } + else if( elemName == KStreet ) + { + if( useRandom ) + { + param->SetRandomStreetL(*iEngine); + } + else + { + SetContentToTextParamL(param->iStreet, elemContent); + } + } + else if( elemName == KPostalcode ) + { + if( useRandom ) + { + param->SetRandomPostCodeL(*iEngine); + } + else + { + SetContentToTextParamL(param->iPostCode, elemContent); + } + } + else if( elemName == KCity ) + { + if( useRandom ) + { + param->SetRandomCityL(*iEngine); + } + else + { + SetContentToTextParamL(param->iCity, elemContent); + } + } + else if( elemName == KState ) + { + if( useRandom ) + { + param->SetRandomStateL(*iEngine); + } + else + { + SetContentToTextParamL(param->iState, elemContent); + } + } + else if( elemName == KCountry ) + { + if( useRandom ) + { + param->SetRandomCountryL(*iEngine); + } + else + { + SetContentToTextParamL(param->iCountry, elemContent); + } + } + else if( elemName == KPhonenumber ) + { + if( useRandom ) + { + param->SetRandomPhoneNumberL(*iEngine); + } + else + { + SetContentToTextParamL(param->iPhonenumber, elemContent); + } + } + else if( elemName == KUrl ) + { + if( useRandom ) + { + param->SetRandomUrlL(*iEngine); + } + else + { + SetContentToTextParamL(param->iUrl, elemContent); + } + } + else if( elemName == KLatitude ) + { + if( useRandom ) + { + param->SetRandomLatitudeL(*iEngine); + } + else + { + ConvertStrToReal64L(elemContent, param->iLatitude); + } + } + else if( elemName == KLongitude ) + { + if( useRandom ) + { + param->SetRandomLongitudeL(*iEngine); + } + else + { + ConvertStrToReal64L(elemContent, param->iLongitude); + } + } + else if( elemName == KPositionaccuracy ) + { + if( useRandom ) + { + param->SetRandomPositionAccuracyL(*iEngine); + } + else + { + param->iPositionAccuracy = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KAltitude ) + { + if( useRandom ) + { + param->SetRandomAltitudeL(*iEngine); + } + else + { + ConvertStrToReal32L(elemContent, param->iAltitude); + } + } + else if( elemName == KAltitudeaccuracy ) + { + if( useRandom ) + { + param->SetRandomAltitudeAccuracyL(*iEngine); + } + else + { + param->iAltitudeAccuracy = ConvertStrToIntL(elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryLandmarks, param); + CleanupStack::Pop(); // param + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryLandmarks, 0, lmAmount); + } + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_log.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_log.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,436 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_log.h" +#include "creator_traces.h" + +static const TInt KLogsFieldLength = 256; + +//_LIT(KCreatorLogsPrefixName, "CR_"); + +//---------------------------------------------------------------------------- + +CLogsParameters::CLogsParameters() + { + LOGSTRING("Creator: CLogsParameters::CLogsParameters"); + + iPhoneNumber = HBufC::New(KLogsFieldLength); + /*iMissedCallPhoneNumber = HBufC::New(KLogsFieldLength); + iReceivedCallPhoneNumber = HBufC::New(KLogsFieldLength); + iDialledNumberPhoneNumber = HBufC::New(KLogsFieldLength);*/ + } + +CLogsParameters::~CLogsParameters() + { + LOGSTRING("Creator: CLogsParameters::~CLogsParameters"); + + delete iPhoneNumber; + /*delete iDialledNumberPhoneNumber; + delete iReceivedCallPhoneNumber; + delete iMissedCallPhoneNumber;*/ + } + +//---------------------------------------------------------------------------- + +CCreatorLogs* CCreatorLogs::NewL(CCreatorEngine* aEngine) + { + CCreatorLogs* self = CCreatorLogs::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorLogs* CCreatorLogs::NewLC(CCreatorEngine* aEngine) + { + CCreatorLogs* self = new (ELeave) CCreatorLogs; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorLogs::CCreatorLogs() : CActive(0) + { + } + +void CCreatorLogs::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorLogs::ConstructL"); + + iEngine = aEngine; + + iLogClient = CLogClient::NewL(CEikonEnv::Static()->FsSession()); + iLogEvent = CLogEvent::NewL(); + + CActiveScheduler::Add(this); // needed by CActive + } + +CCreatorLogs::~CCreatorLogs() + { + LOGSTRING("Creator: CCreatorLogs::~CCreatorLogs"); + + Cancel(); //from CActive + + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidLogs ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + delete iLogEvent; + delete iLogClient; + + if (iParameters) + delete iParameters; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorLogs::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorLogs::AskDataFromUserL"); + if ( aCommand == ECmdDeleteLogs ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all log entries?") ); + } + else if ( aCommand == ECmdDeleteCreatorLogs ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all log entries created with Creator?") ); + } + return iEngine->EntriesQueryDialogL( aNumberOfEntries, _L("How many entries to create?") ); + } + +//---------------------------------------------------------------------------- + +void CCreatorLogs::RunL() + { + LOGSTRING("Creator: CCreatorLogs::RunL"); + + // log writing finished, stop the async waiting + iLogWriteWait.AsyncStop(); + } + +//---------------------------------------------------------------------------- + +void CCreatorLogs::DoCancel() + { + } + +//---------------------------------------------------------------------------- + +TInt CCreatorLogs::CreateMissedCallEntryL(CLogsParameters *aParameters) + { + LOGSTRING("Creator: CCreatorLogs::CreateMissedCallEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CLogsParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CLogsParameters; + parameters = iParameters; + + /*iParameters->iMissedCallPhoneNumber->Des().Zero(); + iParameters->iMissedCallPhoneNumber->Des().AppendNum( iEngine->RandomNumber(1000000, 9999999) ); + + iParameters->iMissedCallEventTime.UniversalTime(); + iParameters->iMissedCallEventTime -= TTimeIntervalMinutes( iEngine->RandomNumber(12000) );*/ + parameters->iPhoneNumber->Des().Zero(); + parameters->iPhoneNumber->Des().AppendNum( iEngine->RandomNumber(1000000, 9999999) ); + + parameters->iEventTime.UniversalTime(); + parameters->iEventTime -= TTimeIntervalMinutes( iEngine->RandomNumber(12000) ); + + } + + // defaults + iLogEvent->SetId( KLogNullIdCreator ); + iLogEvent->SetEventType( KNullUid ); + iLogEvent->SetRemoteParty( KNullDesC ); + iLogEvent->SetDirection( KNullDesC ); + iLogEvent->SetTime( Time::NullTTime() ); + iLogEvent->SetDurationType( KLogNullDurationTypeCreator ); + iLogEvent->SetDuration( KLogNullDurationCreator ); + iLogEvent->SetStatus( KNullDesC ); + iLogEvent->SetSubject( KNullDesC ); + iLogEvent->SetNumber( KNullDesC ); + iLogEvent->SetContact( KNullContactId ); + iLogEvent->SetLink( KLogNullLinkCreator ); + iLogEvent->SetDescription( KNullDesC ); + iLogEvent->SetFlags( KLogNullFlags ); + iLogEvent->SetEventType(KLogCallEventTypeUid); + iLogEvent->SetSubject(_L("A")); + + // set direction + TLogString missed; + iLogClient->GetString(missed, R_LOG_DIR_MISSED); + iLogEvent->SetDirection(missed); + + // set duration + iLogEvent->SetDurationType( KLogDurationNoneCreator ); + TLogDuration duration = 0; + iLogEvent->SetDuration(duration); + + // set the phone number + //iLogEvent->SetNumber( iParameters->iMissedCallPhoneNumber->Des() ); + iLogEvent->SetNumber( parameters->iPhoneNumber->Des() ); + + // set event time + //iLogEvent->SetTime( iParameters->iMissedCallEventTime ); + iLogEvent->SetTime( parameters->iEventTime ); + + // start writing + __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("LogWriter"), 150)); + iLogClient->AddEvent(*iLogEvent, iStatus); + SetActive(); + + // wait till adding has finished + iLogWriteWait.Start(); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( iLogEvent->Id() ); + + return iStatus.Int(); // should be KErrNone if writing was succesful + } + +//---------------------------------------------------------------------------- + +TInt CCreatorLogs::CreateReceivedCallEntryL(CLogsParameters *aParameters) + { + LOGSTRING("Creator: CCreatorLogs::CreateReceivedCallEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CLogsParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CLogsParameters; + parameters = iParameters; + + /*iParameters->iReceivedCallPhoneNumber->Des().Zero(); + iParameters->iReceivedCallPhoneNumber->Des().AppendNum( iEngine->RandomNumber(1000000, 9999999) ); + + iParameters->iReceivedCallEventTime.UniversalTime(); + iParameters->iReceivedCallEventTime -= TTimeIntervalMinutes( iEngine->RandomNumber(12000) ); + + iParameters->iReceivedCallDuration = iEngine->RandomNumber(7200);*/ + parameters->iPhoneNumber->Des().Zero(); + parameters->iPhoneNumber->Des().AppendNum( iEngine->RandomNumber(1000000, 9999999) ); + + parameters->iEventTime.UniversalTime(); + parameters->iEventTime -= TTimeIntervalMinutes( iEngine->RandomNumber(12000) ); + + parameters->iDuration = iEngine->RandomNumber(7200); + } + + // defaults + iLogEvent->SetId( KLogNullIdCreator ); + iLogEvent->SetEventType( KNullUid ); + iLogEvent->SetRemoteParty( KNullDesC ); + iLogEvent->SetDirection( KNullDesC ); + iLogEvent->SetTime( Time::NullTTime() ); + iLogEvent->SetDurationType( KLogNullDurationTypeCreator ); + iLogEvent->SetDuration( KLogNullDurationCreator ); + iLogEvent->SetStatus( KNullDesC ); + iLogEvent->SetSubject( KNullDesC ); + iLogEvent->SetNumber( KNullDesC ); + iLogEvent->SetContact( KNullContactId ); + iLogEvent->SetLink( KLogNullLinkCreator ); + iLogEvent->SetDescription( KNullDesC ); + iLogEvent->SetFlags( KLogNullFlags ); + iLogEvent->SetEventType(KLogCallEventTypeUid); + iLogEvent->SetSubject(_L("A")); + + // set direction + TLogString incoming; + iLogClient->GetString(incoming, R_LOG_DIR_IN); + iLogEvent->SetDirection(incoming); + + // set duration + iLogEvent->SetDurationType( KLogDurationValidCreator ); + //iLogEvent->SetDuration( iParameters->iReceivedCallDuration ); + iLogEvent->SetDuration( parameters->iDuration ); + + // set the phone number + //iLogEvent->SetNumber( iParameters->iReceivedCallPhoneNumber->Des() ); + iLogEvent->SetNumber( parameters->iPhoneNumber->Des() ); + + // set event time + //iLogEvent->SetTime( iParameters->iReceivedCallEventTime ); + iLogEvent->SetTime( parameters->iEventTime ); + + // start writing + __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("LogWriter"), 151)); + iLogClient->AddEvent(*iLogEvent, iStatus); + SetActive(); + + // wait till adding has finished + iLogWriteWait.Start(); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iEntryIds.Append( iLogEvent->Id() ); + + return iStatus.Int(); // should be KErrNone if writing was succesful + } + +//---------------------------------------------------------------------------- + + +TInt CCreatorLogs::CreateDialledNumberEntryL(CLogsParameters *aParameters) + { + LOGSTRING("Creator: CCreatorLogs::CreateDialledNumberEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CLogsParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CLogsParameters; + parameters = iParameters; + + /*iParameters->iDialledNumberPhoneNumber->Des().Zero(); + iParameters->iDialledNumberPhoneNumber->Des().AppendNum( iEngine->RandomNumber(1000000, 9999999) ); + + iParameters->iDialledNumberEventTime.UniversalTime(); + iParameters->iDialledNumberEventTime -= TTimeIntervalMinutes( iEngine->RandomNumber(12000) ); + + iParameters->iDialledNumberDuration = iEngine->RandomNumber(7200);*/ + parameters->iPhoneNumber->Des().Zero(); + parameters->iPhoneNumber->Des().AppendNum( iEngine->RandomNumber(1000000, 9999999) ); + + parameters->iEventTime.UniversalTime(); + parameters->iEventTime -= TTimeIntervalMinutes( iEngine->RandomNumber(12000) ); + + parameters->iDuration = iEngine->RandomNumber(7200); + + } + + // defaults + iLogEvent->SetId( KLogNullIdCreator ); + iLogEvent->SetEventType( KNullUid ); + iLogEvent->SetRemoteParty( KNullDesC ); + iLogEvent->SetDirection( KNullDesC ); + iLogEvent->SetTime( Time::NullTTime() ); + iLogEvent->SetDurationType( KLogNullDurationTypeCreator ); + iLogEvent->SetDuration( KLogNullDurationCreator ); + iLogEvent->SetStatus( KNullDesC ); + iLogEvent->SetSubject( KNullDesC ); + iLogEvent->SetNumber( KNullDesC ); + iLogEvent->SetContact( KNullContactId ); + iLogEvent->SetLink( KLogNullLinkCreator ); + iLogEvent->SetDescription( KNullDesC ); + iLogEvent->SetFlags( KLogNullFlags ); + iLogEvent->SetEventType(KLogCallEventTypeUid); + iLogEvent->SetSubject(_L("A")); + + // set direction + TLogString outgoing; + iLogClient->GetString(outgoing, R_LOG_DIR_OUT); + iLogEvent->SetDirection(outgoing); + + // set duration + iLogEvent->SetDurationType( KLogDurationValidCreator ); + //iLogEvent->SetDuration( iParameters->iDialledNumberDuration ); + iLogEvent->SetDuration( parameters->iDuration ); + + // set the phone number + //iLogEvent->SetNumber( iParameters->iDialledNumberPhoneNumber->Des() ); + iLogEvent->SetNumber( parameters->iPhoneNumber->Des() ); + + // set event time + //iLogEvent->SetTime( iParameters->iDialledNumberEventTime ); + iLogEvent->SetTime( parameters->iEventTime ); + + // start writing + __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("LogWriter"), 152)); + iLogClient->AddEvent(*iLogEvent, iStatus); + SetActive(); + + // wait till adding has finished + iLogWriteWait.Start(); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( iLogEvent->Id() ); + + return iStatus.Int(); // should be KErrNone if writing was succesful + } + +//---------------------------------------------------------------------------- +void CCreatorLogs::DeleteAllL() + { + LOGSTRING("Creator: CCreatorLogs::DeleteAllL"); + iLogClient->ClearLog( TTime( Time::MaxTTime() ), iStatus ); + SetActive(); + + // wait till delete has finished + iLogWriteWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Logs related registry + iEngine->RemoveStoreL( KUidDictionaryUidLogs ); + } + +//---------------------------------------------------------------------------- +void CCreatorLogs::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorLogs::DeleteAllCreatedByCreatorL"); + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidLogs ); + + // delete entries + for ( TInt i = 0; i < iEntryIds.Count(); i++ ) + { + // This could be implemented with while loop + // with additional cancel flag. That would enable + // using CancelOp() and cancelling would be bit smoother. + // With this for loop implementation all entries will be + // deleted whether or not user cancels during logs operation. + + iLogClient->DeleteEvent( iEntryIds[i], iStatus ); + SetActive(); + // wait till delete has finished + iLogWriteWait.Start(); + } + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Logs related registry + iEngine->RemoveStoreL( KUidDictionaryUidLogs ); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_logelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_logelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,170 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_logelement.h" +#include "creator_traces.h" +#include "creator_log.h" + +using namespace creatorlog; + +/* + * + */ +CCreatorLogElement* CCreatorLogElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorLogElement* self = new (ELeave) CCreatorLogElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorLogElement::CCreatorLogElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } +/* + * + */ +void CCreatorLogElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt logAmount = 1; + if( amountAttr ) + { + logAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create log entries, the amount of entries is defined by logAmount: + for( TInt cI = 0; cI < logAmount; ++cI ) + { + TInt direction = -1; + CLogsParameters* param = new (ELeave) CLogsParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName(KRandomLength); + const CCreatorScriptAttribute* increaseAttr = field->FindAttributeByName(KIncrease); + TBool increase( EFalse ); + if ( increaseAttr ) + { + increase = ConvertStrToBooleanL( increaseAttr->Value() ); + } + + if( elemName == KDirection ) + { + direction = GetLogCommandL(elemContent, randomAttr || elemContent.Length() == 0); + } + else if( elemName == KDuration ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + param->iDuration = iEngine->RandomNumber(7200); + } + else + { + param->iDuration = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KPhonenumber ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + SetContentToTextParamL(param->iPhoneNumber, iEngine->RandomString(CCreatorEngine::EPhoneNumber)); + } + else + { + if ( increase ) + { + delete param->iPhoneNumber; + param->iPhoneNumber = NULL; + param->iPhoneNumber = HBufC::NewL( elemContent.Length() + 3 ); + IncreasePhoneNumL( elemContent, cI, param->iPhoneNumber ); + } + else + { + SetContentToTextParamL(param->iPhoneNumber, elemContent); + } + } + } + else if( elemName == KDatetime ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + param->iEventTime = iEngine->RandomTime(iEngine->RandomDate(CCreatorEngine::EDatePast), CCreatorEngine::EDatePast); + } + else + { + param->iEventTime = ConvertToDateTimeL(elemContent); + } + } + } + + if( direction == -1 ) + { + direction = GetLogCommandL(KEmpty, ETrue); + } + iEngine->AppendToCommandArrayL(direction, param); + CleanupStack::Pop(); // param + } + } + else + { + for(TInt i = 0; i < logAmount; ++i ) + { + iEngine->AppendToCommandArrayL(GetLogCommandL(KEmpty, ETrue), 0, 1); + } + } + } + +TInt CCreatorLogElement::GetLogCommandL( const TDesC& aLogCmdStr, TBool aRandom ) const + { + if( aRandom ) + { + TInt commandArray[] = { + ECmdCreateLogEntryMissedCalls, + ECmdCreateLogEntryReceivedCalls, + ECmdCreateLogEntryDialledNumbers + }; + return commandArray[iEngine->RandomNumber(0, 2)]; + } + + if( CompareIgnoreCase(aLogCmdStr, KMissed) == 0 ) + return ECmdCreateLogEntryMissedCalls; + else if( CompareIgnoreCase(aLogCmdStr, KIn) == 0 ) + return ECmdCreateLogEntryReceivedCalls; + else if( CompareIgnoreCase(aLogCmdStr, KOut) == 0 ) + return ECmdCreateLogEntryDialledNumbers; + + LOGSTRING2("CCreatorLogElement::GetLogCommandL: Unknown log direction: %S", &aLogCmdStr); + User::Leave(KErrNotFound); + return -1; // Not reached, but disables compiler warning... + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_mailbox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_mailbox.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,793 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_mailbox.h" +#include "creator_traces.h" + +#include +#include + +static const TInt KMailboxesFieldLength = 160; + +_LIT(KCreatorMailboxesPrefixName, "CR_"); + +_LIT(KDefaultIncomingServer, "mail.example.com"); +_LIT(KDefaultOutgoingServer, "smtp.example.com"); +_LIT(KInternet, "internet"); + + +//---------------------------------------------------------------------------- + +CMailboxesParameters::CMailboxesParameters() + { + LOGSTRING("Creator: CMailboxesParameters::CMailboxesParameters"); + + iIncomingPort = KUndef; + iOutgoingPort = KUndef; + iMaxEmailSize = KUndef; + iSyncRate = KUndef; + iAttachmentFetchSize = KUndef; + iAttachmentSizeLimit = KUndef; + iBodyTextSizeLimit = KUndef; + iAttachmentFetchSize = KUndef; + iInboxSyncLimit = -1; // -1 = All + iMailboxSyncLimit = -1; // -1 = All + iToCCIncludeLimit = KUndef; + iImapIdleTimeout = KUndef; + + /*iMailboxName = HBufC::New(KMailboxesFieldLength); + iAccessPoint = HBufC::New(KMailboxesFieldLength); + iMyMailAddress = HBufC::New(KMailboxesFieldLength); + iOutgoingMailServer = HBufC::New(KMailboxesFieldLength); + iUserName = HBufC::New(KMailboxesFieldLength); + iPassword = HBufC::New(KMailboxesFieldLength); + iIncomingMailServer = HBufC::New(KMailboxesFieldLength);*/ + } + +CMailboxesParameters::~CMailboxesParameters() + { + LOGSTRING("Creator: CMailboxesParameters::~CMailboxesParameters"); + + /*delete iIncomingMailServer; + delete iPassword; + delete iUserName; + delete iOutgoingMailServer; + delete iMyMailAddress; + delete iAccessPoint; + delete iMailboxName;*/ + + delete iMailboxName; + delete iIncomingLoginName; + delete iIncomingPassword; + delete iIncomingServerName; + delete iIncomingConnectionMethod; + delete iIncomingFolderPath; + delete iPathSeparator; + delete iOutgoingLoginName; + delete iOutgoingPassword; + delete iOutgoingServerName; + delete iOutgoingConnectionMethod; + delete iOwnEmailAddress; + delete iOwnEmailAlias; + delete iReceiptAddress; + delete iReplyToAddress; + } + +//---------------------------------------------------------------------------- + +CCreatorMailboxes* CCreatorMailboxes::NewL(CCreatorEngine* aEngine) + { + CCreatorMailboxes* self = CCreatorMailboxes::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorMailboxes* CCreatorMailboxes::NewLC(CCreatorEngine* aEngine) + { + CCreatorMailboxes* self = new (ELeave) CCreatorMailboxes; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorMailboxes::CCreatorMailboxes() + { + } + +void CCreatorMailboxes::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorMailboxes::ConstructL"); + + iEngine = aEngine; + } + +CCreatorMailboxes::~CCreatorMailboxes() + { + LOGSTRING("Creator: CCreatorMailboxes::~CCreatorMailboxes"); + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidMailbox ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + if (iParameters) + delete iParameters; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorMailboxes::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorMailboxes::AskDataFromUserL"); + if ( aCommand == ECmdDeleteMailboxes ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all mailboxes?") ); + } + else if ( aCommand == ECmdDeleteCreatorMailboxes ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all mailboxes created with Creator?") ); + } + return iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?")); + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorMailboxes::CreateMailboxEntryL(CMailboxesParameters *aParameters) + { + LOGSTRING("Creator: CCreatorMailboxes::CreateMailboxEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CMailboxesParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CMailboxesParameters; + parameters = iParameters; + + TPtrC company(iEngine->RandomString(CCreatorEngine::ECompany)); + TPtrC firstName(iEngine->RandomString(CCreatorEngine::EFirstName)); + + delete parameters->iMailboxName; + parameters->iMailboxName = 0; + parameters->iMailboxName = HBufC::NewL(KMailboxesFieldLength); + parameters->iMailboxName->Des() = KCreatorMailboxesPrefixName; + parameters->iMailboxName->Des().Append( company ); + parameters->iMailboxName->Des().Append(_L(" #")); + parameters->iMailboxName->Des().AppendNum(iEngine->RandomNumber(1, 100)); + + delete parameters->iIncomingLoginName; + parameters->iIncomingLoginName = 0; + parameters->iIncomingLoginName = HBufC::NewL(KMailboxesFieldLength); + delete parameters->iOutgoingLoginName; + parameters->iOutgoingLoginName = 0; + parameters->iOutgoingLoginName = HBufC::NewL(KMailboxesFieldLength); + parameters->iIncomingLoginName->Des() = iEngine->RandomString(CCreatorEngine::EFirstName); + parameters->iIncomingLoginName->Des().LowerCase(); + parameters->iOutgoingLoginName->Des().Copy(parameters->iIncomingLoginName->Des()); + + delete parameters->iIncomingPassword; + parameters->iIncomingPassword = 0; + parameters->iIncomingPassword = HBufC::NewL(KMailboxesFieldLength); + delete parameters->iOutgoingPassword; + parameters->iOutgoingPassword = 0; + parameters->iOutgoingPassword = HBufC::NewL(KMailboxesFieldLength); + parameters->iIncomingPassword->Des() = iEngine->RandomString(CCreatorEngine::ESurname); + parameters->iIncomingPassword->Des().LowerCase(); + parameters->iOutgoingPassword->Des().Copy(parameters->iIncomingPassword->Des()); + + delete parameters->iIncomingServerName; + parameters->iIncomingServerName = 0; + parameters->iIncomingServerName = HBufC::NewL(KMailboxesFieldLength); + parameters->iIncomingServerName->Des() = _L("incoming."); + parameters->iIncomingServerName->Des().Append(company); + parameters->iIncomingServerName->Des().Append(_L(".com")); + parameters->iIncomingServerName->Des().LowerCase(); + + delete parameters->iIncomingConnectionMethod; + parameters->iIncomingConnectionMethod = 0; + parameters->iIncomingConnectionMethod = HBufC::NewL(KInternet().Length()); + parameters->iIncomingConnectionMethod->Des() = KInternet; // use always this one, if it's not found, default will be used instead + + delete parameters->iOutgoingServerName; + parameters->iOutgoingServerName = 0; + parameters->iOutgoingServerName = HBufC::NewL(KMailboxesFieldLength); + parameters->iOutgoingServerName->Des() = _L("smtp."); + parameters->iOutgoingServerName->Des().Append(company); + parameters->iOutgoingServerName->Des().Append(_L(".com")); + parameters->iOutgoingServerName->Des().LowerCase(); + + delete parameters->iOutgoingConnectionMethod; + parameters->iOutgoingConnectionMethod = 0; + parameters->iOutgoingConnectionMethod = HBufC::NewL(KInternet().Length()); + parameters->iOutgoingConnectionMethod->Des() = KInternet; // use always this one, if it's not found, default will be used instead + + delete parameters->iOwnEmailAddress; + parameters->iOwnEmailAddress = 0; + parameters->iOwnEmailAddress = iEngine->CreateEmailAddressLC(); + parameters->iOwnEmailAddress->Des().LowerCase(); + CleanupStack::Pop(); // parameters->iOwnEmailAddress + + delete parameters->iOwnEmailAlias; + parameters->iOwnEmailAlias = 0; + parameters->iOwnEmailAlias = HBufC::NewL(firstName.Length()); + parameters->iOwnEmailAlias->Des().Copy(firstName); + + delete parameters->iReceiptAddress; + parameters->iReceiptAddress = 0; + parameters->iReceiptAddress = iEngine->CreateEmailAddressLC(); + parameters->iReceiptAddress->Des().LowerCase(); + CleanupStack::Pop(); // parameters->iReceiptAddress + + delete parameters->iReplyToAddress; + parameters->iReplyToAddress = 0; + parameters->iReplyToAddress = iEngine->CreateEmailAddressLC(); + parameters->iReplyToAddress->Des().LowerCase(); + CleanupStack::Pop(); // parameters->iReplyToAddress + + parameters->iIncomingSSLWrapper = iEngine->RandomNumber(0, 1); + parameters->iIncomingSecureSockets = iEngine->RandomNumber(0, 1); + parameters->iAcknowledgeReceipts = iEngine->RandomNumber(0, 1); + parameters->iAutoSendOnConnect = iEngine->RandomNumber(0, 1); + parameters->iDeleteEmailsAtDisconnect = iEngine->RandomNumber(0, 1); + parameters->iImapIdleCommand = iEngine->RandomNumber(0, 1); + parameters->iMarkSeenInSync = iEngine->RandomNumber(0, 1); + parameters->iEnableExpungeMode = iEngine->RandomNumber(0, 1); + parameters->iUseApop = iEngine->RandomNumber(0, 1); + parameters->iDisconnectedUserMode = iEngine->RandomNumber(0, 1); + parameters->iOutgoingSSLWrapper = iEngine->RandomNumber(0, 1); + parameters->iOutgoingSecureSockets = iEngine->RandomNumber(0, 1); + parameters->iIncludeSignature = EFalse; + parameters->iAddVCard = EFalse; + parameters->iRequestReceipts = iEngine->RandomNumber(0, 1); + parameters->iSmtpAuth = iEngine->RandomNumber(0, 1); + + parameters->iIncomingPort = iEngine->RandomNumber(25, 500); + parameters->iAttachmentSizeLimit = iEngine->RandomNumber(1, KMaxTInt); + parameters->iBodyTextSizeLimit = iEngine->RandomNumber(1, KMaxTInt); + parameters->iAttachmentFetchSize = iEngine->RandomNumber(1, 40960); + parameters->iImapIdleTimeout = iEngine->RandomNumber(10, 2000); + parameters->iMaxEmailSize = iEngine->RandomNumber(1024, KMaxTInt); + parameters->iSyncRate = iEngine->RandomNumber(10, 500); + parameters->iInboxSyncLimit = iEngine->RandomNumber(-1, 256); + parameters->iMailboxSyncLimit = iEngine->RandomNumber(-1, 256); + parameters->iOutgoingPort = KDefaultSmtpPort; + parameters->iToCCIncludeLimit = iEngine->RandomNumber(0, 30); + + parameters->iGetEmailOptions = (CMailboxesParameters::TGetEmailOption) iEngine->RandomNumber(CMailboxesParameters::EUndef, CMailboxesParameters::EGetEmailOptionLast-1); + parameters->iSubscribeType = (TFolderSubscribeType) iEngine->RandomNumber(EUpdateNeither, EUpdateBoth); + parameters->iSyncType = (TFolderSyncType) iEngine->RandomNumber(EUseCombination, EUseRemote); + parameters->iSendCopyToSelf = (TImSMTPSendCopyToSelf) iEngine->RandomNumber(ESendNoCopy, ESendCopyAsBccRecipient); + parameters->iSendOption = (TImSMTPSendMessageOption) iEngine->RandomNumber(ESendMessageImmediately, ESendMessageOnRequest); + parameters->iMailboxType = (TMailboxType) iEngine->RandomNumber(EMailboxPOP3, EMailboxIMAP4); + } + + TInt err = KErrNone; + + // make sure we have some IMEI stored + if (iIMEI.Length() == 0) + { + TRAP(err, GetIMEIFromThePhoneL()); + } + + // init + CImImap4Settings* imap4Set = new(ELeave) CImImap4Settings; + CleanupStack::PushL(imap4Set); + CImPop3Settings* pop3Set = new(ELeave) CImPop3Settings; + CleanupStack::PushL(pop3Set); + CImSmtpSettings* smtpSet = new(ELeave) CImSmtpSettings; + CleanupStack::PushL(smtpSet); + CImIAPPreferences* outgoingIAPSet = CImIAPPreferences::NewLC(); + CImIAPPreferences* incomingIAPSet = CImIAPPreferences::NewLC(); + CEmailAccounts* account = CEmailAccounts::NewLC(); + + // Get SMTP settings: + PopulateSmtpSettingsL(*account, *smtpSet, *outgoingIAPSet, *parameters); + + // appending mailbox type to array to be able to use + // correct type when deleting mailboxes + iEntryIds.Append( parameters->iMailboxType ); + + if (parameters->iMailboxType == EMailboxIMAP4) + { + // Get IMAP settings: + PopulateImapSettingsL(*account, *imap4Set, *incomingIAPSet, *parameters); + TImapAccount imapAccountId = account->CreateImapAccountL(parameters->iMailboxName->Des(), *imap4Set, *incomingIAPSet, EFalse); + TSmtpAccount smtpAccountId = account->CreateSmtpAccountL(imapAccountId, *smtpSet, *outgoingIAPSet, EFalse); + account->SetDefaultSmtpAccountL(smtpAccountId); + + iEntryIds.Append( imapAccountId.iImapAccountId ); + iEntryIds.Append( imapAccountId.iImapService ); + iEntryIds.Append( imapAccountId.iSmtpService ); + iEntryIds.Append( smtpAccountId.iSmtpAccountId ); + iEntryIds.Append( smtpAccountId.iSmtpService ); + iEntryIds.Append( smtpAccountId.iRelatedService ); + + StoreIMEIToEntryL( imapAccountId.iImapService ); + StoreIMEIToEntryL( smtpAccountId.iSmtpService ); + } + else + { + // Get POP settings: + PopulatePopSettingsL(*account, *pop3Set, *incomingIAPSet, *parameters); + TPopAccount popAccountId = account->CreatePopAccountL(parameters->iMailboxName->Des(), *pop3Set, *incomingIAPSet, EFalse); + TSmtpAccount smtpAccountId = account->CreateSmtpAccountL(popAccountId, *smtpSet, *outgoingIAPSet, EFalse); + account->SetDefaultSmtpAccountL(smtpAccountId); + + iEntryIds.Append( popAccountId.iPopAccountId ); + iEntryIds.Append( popAccountId.iPopService ); + iEntryIds.Append( popAccountId.iSmtpService ); + iEntryIds.Append( smtpAccountId.iSmtpAccountId ); + iEntryIds.Append( smtpAccountId.iSmtpService ); + iEntryIds.Append( smtpAccountId.iRelatedService ); + + StoreIMEIToEntryL( popAccountId.iPopService ); + StoreIMEIToEntryL( smtpAccountId.iSmtpService ); + } + CleanupStack::PopAndDestroy(6); //imap4Set, pop3Set, smtpSet, outgoingIAPSet, incomingIAPSet, account + + return err; + } + +void CCreatorMailboxes::PopulateImapSettingsL( + CEmailAccounts& aEmailAccount, + CImImap4Settings& aImapSettings, + CImIAPPreferences& aIApSettings, + const CMailboxesParameters& aParameters ) + { + // Get default settings first: + aEmailAccount.PopulateDefaultImapSettingsL(aImapSettings, aIApSettings); + + TImIAPChoice iapChoice; + iapChoice.iIAP = 0; + if( aParameters.iIncomingConnectionMethod == 0 || + aParameters.iIncomingConnectionMethod->Des().Length() == 0 ) + { + TRAP_IGNORE( iapChoice.iIAP = iEngine->AccessPointNameToIdL( KInternet )); + } + else + { + TRAP_IGNORE( iapChoice.iIAP = iEngine->AccessPointNameToIdL( aParameters.iIncomingConnectionMethod->Des())); + } + iapChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt; + aIApSettings.AddIAPL(iapChoice); + + TBuf8<256> buf8; + if( aParameters.iIncomingLoginName && aParameters.iIncomingLoginName->Length() > 0 ) + buf8.Copy(aParameters.iIncomingLoginName->Des()); + else + buf8.Copy(iEngine->RandomString(CCreatorEngine::EFirstName)); + aImapSettings.SetLoginNameL(buf8); //8 + + if( aParameters.iIncomingPassword && aParameters.iIncomingPassword->Length() > 0 ) + buf8.Copy(aParameters.iIncomingPassword->Des()); + else + buf8.Copy(iEngine->RandomString(CCreatorEngine::EFirstName)); + aImapSettings.SetPasswordL(buf8); //8 + + if( aParameters.iIncomingFolderPath && aParameters.iIncomingFolderPath->Length() > 0 ) + { + buf8.Copy(aParameters.iIncomingFolderPath->Des()); + aImapSettings.SetFolderPathL(buf8); + } + + if( aParameters.iPathSeparator && aParameters.iPathSeparator->Length() > 0 ) + aImapSettings.SetPathSeparator(aParameters.iIncomingFolderPath->Des()[0]); + + aImapSettings.SetDisconnectedUserMode(aParameters.iDisconnectedUserMode); + aImapSettings.SetSynchronise(aParameters.iSyncType); + aImapSettings.SetSubscribe(aParameters.iSubscribeType); + aImapSettings.SetAutoSendOnConnect(aParameters.iAutoSendOnConnect); + + if(aParameters.iMaxEmailSize != KUndef ) + aImapSettings.SetMaxEmailSize(aParameters.iMaxEmailSize); + + aImapSettings.SetDeleteEmailsWhenDisconnecting(aParameters.iDeleteEmailsAtDisconnect); + aImapSettings.SetAcknowledgeReceipts(aParameters.iAcknowledgeReceipts); + + if(aParameters.iGetEmailOptions == CMailboxesParameters::EGetBodyText ) + aImapSettings.SetGetMailOptions(EGetImap4EmailBodyText); + else if(aParameters.iGetEmailOptions == CMailboxesParameters::EGetBodyTextAndAttachments ) + aImapSettings.SetGetMailOptions(EGetImap4EmailBodyTextAndAttachments); + else if(aParameters.iGetEmailOptions == CMailboxesParameters::EGetAttachments ) + aImapSettings.SetGetMailOptions(EGetImap4EmailAttachments); + else if(aParameters.iGetEmailOptions == CMailboxesParameters::EGetBodyAlternativeText ) + aImapSettings.SetGetMailOptions(EGetImap4EmailBodyAlternativeText); + else + aImapSettings.SetGetMailOptions(EGetImap4EmailHeaders); // Default + + if( aParameters.iInboxSyncLimit != KUndef ) + aImapSettings.SetInboxSynchronisationLimit(aParameters.iInboxSyncLimit); + + if( aParameters.iMailboxSyncLimit != KUndef ) + aImapSettings.SetMailboxSynchronisationLimit(aParameters.iMailboxSyncLimit); + + aImapSettings.SetUpdatingSeenFlags(aParameters.iMarkSeenInSync); + + if( aParameters.iSyncRate != KUndef ) + aImapSettings.SetSyncRateL(aParameters.iSyncRate); + + if( aParameters.iAttachmentFetchSize != KUndef ) + aImapSettings.SetFetchSizeL(aParameters.iAttachmentFetchSize); + + aImapSettings.SetImapIdle(aParameters.iImapIdleCommand); + if( aParameters.iImapIdleTimeout != KUndef ) + aImapSettings.SetImapIdleTimeoutL(aParameters.iImapIdleTimeout); + + if( aParameters.iBodyTextSizeLimit != KUndef ) + aImapSettings.SetBodyTextSizeLimitL(aParameters.iBodyTextSizeLimit); + + if( aParameters.iAttachmentSizeLimit != KUndef ) + aImapSettings.SetAttachmentSizeLimitL(aParameters.iAttachmentSizeLimit); + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + aImapSettings.SetUseExpunge(aParameters.iEnableExpungeMode); +#endif + + if(aParameters.iIncomingServerName && aParameters.iIncomingServerName->Length() > 0 ) + aImapSettings.SetServerAddressL(aParameters.iIncomingServerName->Des()); + else + aImapSettings.SetServerAddressL(KDefaultIncomingServer); + + if( aParameters.iIncomingPort != KUndef ) + aImapSettings.SetPort(aParameters.iIncomingPort); + + aImapSettings.SetSecureSockets(aParameters.iIncomingSecureSockets); + aImapSettings.SetSSLWrapper(aParameters.iIncomingSSLWrapper); + } + +void CCreatorMailboxes::PopulatePopSettingsL( + CEmailAccounts& aEmailAccount, + CImPop3Settings& aPopSettings, + CImIAPPreferences& aIApSettings, + const CMailboxesParameters& aParameters ) + { + aEmailAccount.PopulateDefaultPopSettingsL(aPopSettings, aIApSettings); + + TImIAPChoice iapChoice; + iapChoice.iIAP = 0; + if( aParameters.iIncomingConnectionMethod == 0 || + aParameters.iIncomingConnectionMethod->Des().Length() == 0 ) + { + TRAP_IGNORE( iapChoice.iIAP = iEngine->AccessPointNameToIdL( KInternet )); + } + else + { + TRAP_IGNORE( iapChoice.iIAP = iEngine->AccessPointNameToIdL( aParameters.iIncomingConnectionMethod->Des() )); + } + iapChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt; + aIApSettings.AddIAPL(iapChoice); + + TBuf8<256> buf8; + if( aParameters.iIncomingLoginName && aParameters.iIncomingLoginName->Length() > 0 ) + buf8.Copy(aParameters.iIncomingLoginName->Des()); + else + buf8.Copy(iEngine->RandomString(CCreatorEngine::EFirstName)); + aPopSettings.SetLoginNameL(buf8); //8 + + if( aParameters.iIncomingPassword && aParameters.iIncomingPassword->Length() > 0 ) + buf8.Copy(aParameters.iIncomingPassword->Des()); + else + buf8.Copy(iEngine->RandomString(CCreatorEngine::EFirstName)); + aPopSettings.SetPasswordL(buf8); //8 + + aPopSettings.SetAutoSendOnConnect( aParameters.iAutoSendOnConnect ); + aPopSettings.SetApop( aParameters.iUseApop ); + aPopSettings.SetDisconnectedUserMode( aParameters.iDisconnectedUserMode ); + aPopSettings.SetDeleteEmailsWhenDisconnecting( aParameters.iDeleteEmailsAtDisconnect ); + aPopSettings.SetAcknowledgeReceipts( aParameters.iAcknowledgeReceipts ); + + if( aParameters.iMaxEmailSize != KUndef ) + aPopSettings.SetMaxEmailSize(aParameters.iMaxEmailSize); + + if(aParameters.iGetEmailOptions != CMailboxesParameters::EGetHeaders && + aParameters.iGetEmailOptions != CMailboxesParameters::EUndef ) + { + aPopSettings.SetGetMailOptions(EGetPop3EmailMessages); + aPopSettings.SetPopulationLimitL( -1 ); // -1 = body and attachment + } + else + { + aPopSettings.SetGetMailOptions(EGetPop3EmailHeaders); // Default + aPopSettings.SetPopulationLimitL( -2 ); // -2 = headers only + } + + if( aParameters.iInboxSyncLimit != KUndef ) + { + aPopSettings.SetInboxSynchronisationLimit(aParameters.iInboxSyncLimit); + } + + if(aParameters.iIncomingServerName && aParameters.iIncomingServerName->Length() > 0 ) + aPopSettings.SetServerAddressL(aParameters.iIncomingServerName->Des()); + else + aPopSettings.SetServerAddressL(KDefaultIncomingServer); + + if( aParameters.iIncomingPort != KUndef ) + aPopSettings.SetPort(aParameters.iIncomingPort); + + aPopSettings.SetSecureSockets(aParameters.iIncomingSecureSockets); + aPopSettings.SetSSLWrapper(aParameters.iIncomingSSLWrapper); + } + +void CCreatorMailboxes::PopulateSmtpSettingsL( + CEmailAccounts& aEmailAccount, + CImSmtpSettings& aSmtpSettings, + CImIAPPreferences& aIApSettings, + const CMailboxesParameters& aParameters ) + { + // Get default settings first: + aEmailAccount.PopulateDefaultSmtpSettingsL(aSmtpSettings, aIApSettings); + TImIAPChoice iapChoice; + iapChoice.iIAP = 0; + if( aParameters.iOutgoingConnectionMethod == 0 || + aParameters.iOutgoingConnectionMethod->Des().Length() == 0 ) + { + TRAP_IGNORE( iapChoice.iIAP = iEngine->AccessPointNameToIdL( KInternet )); + } + else + { + TRAP_IGNORE( iapChoice.iIAP = iEngine->AccessPointNameToIdL( aParameters.iOutgoingConnectionMethod->Des() )); + } + iapChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt; + aIApSettings.AddIAPL(iapChoice); + + // set SMTP preferences + if( aParameters.iOwnEmailAlias && aParameters.iOwnEmailAlias->Length() > 0 ) + aSmtpSettings.SetEmailAliasL(aParameters.iOwnEmailAlias->Des()); + + if( aParameters.iOwnEmailAddress && aParameters.iOwnEmailAddress->Length() > 0 ) + aSmtpSettings.SetEmailAddressL(aParameters.iOwnEmailAddress->Des()); + + if( aParameters.iReplyToAddress && aParameters.iReplyToAddress->Length() > 0 ) + aSmtpSettings.SetReplyToAddressL(aParameters.iReplyToAddress->Des()); + + if( aParameters.iReceiptAddress && aParameters.iReceiptAddress->Length() > 0 ) + aSmtpSettings.SetReceiptAddressL(aParameters.iReceiptAddress->Des()); + + aSmtpSettings.SetBodyEncoding(EMsgOutboxMIME); + aSmtpSettings.SetAddVCardToEmail(aParameters.iAddVCard); + aSmtpSettings.SetAddSignatureToEmail(aParameters.iIncludeSignature); + aSmtpSettings.SetRequestReceipts(aParameters.iRequestReceipts); + aSmtpSettings.SetSendCopyToSelf(aParameters.iSendCopyToSelf); + aSmtpSettings.SetSendMessageOption(aParameters.iSendOption); + + TBuf8<256> buf8; + if( aParameters.iOutgoingLoginName && aParameters.iOutgoingLoginName->Length() > 0 ) + { + buf8.Copy(aParameters.iOutgoingLoginName->Des()); + aSmtpSettings.SetLoginNameL(buf8); //8 + } + + if( aParameters.iOutgoingPassword && aParameters.iOutgoingPassword->Length() > 0) + { + buf8.Copy(aParameters.iOutgoingPassword->Des()); + aSmtpSettings.SetPasswordL(buf8); //8 + } + + aSmtpSettings.SetSMTPAuth(aParameters.iSmtpAuth); + if( aParameters.iToCCIncludeLimit != KUndef ) + aSmtpSettings.SetToCcIncludeLimitL(aParameters.iToCCIncludeLimit); + + if( aParameters.iOutgoingServerName && aParameters.iOutgoingServerName->Length() > 0 ) + aSmtpSettings.SetServerAddressL(aParameters.iOutgoingServerName->Des()); + else + aSmtpSettings.SetServerAddressL(KDefaultOutgoingServer); + + if( aParameters.iOutgoingPort != KUndef ) + aSmtpSettings.SetPort(aParameters.iOutgoingPort); + + aSmtpSettings.SetSecureSockets(aParameters.iOutgoingSecureSockets); + aSmtpSettings.SetSSLWrapper(aParameters.iOutgoingSSLWrapper); + } + +//---------------------------------------------------------------------------- + +void CCreatorMailboxes::StoreIMEIToEntryL(const TMsvId aMailboxId) + { + LOGSTRING("Creator: CCreatorMailboxes::StoreIMEIToEntryL"); + + CMsvSession* session = CMsvSession::OpenSyncL(*this); + CleanupStack::PushL(session); + + CMsvEntry* centry = session->GetEntryL(aMailboxId); + CleanupStack::PushL(centry); + + TMsvEntry tentry = centry->Entry(); + tentry.iDescription.Set(iIMEI); + centry->ChangeL(tentry); + + CleanupStack::PopAndDestroy(2); // centry, session + } + +//---------------------------------------------------------------------------- + +void CCreatorMailboxes::GetIMEIFromThePhoneL() + { + LOGSTRING("Creator: CCreatorMailboxes::GetIMEIFromThePhoneL"); + +#ifndef __WINS__ + + RTelServer telServer; + User::LeaveIfError( telServer.Connect() ); + CleanupClosePushL(telServer); + + TInt numPhones = 0; + User::LeaveIfError( telServer.EnumeratePhones( numPhones ) ); + if ( numPhones < 1 ) + { + User::Leave( KErrNotFound ); + } + RTelServer::TPhoneInfo info; + User::LeaveIfError( telServer.GetPhoneInfo( 0, info ) ); + RMobilePhone mobilePhone; + User::LeaveIfError( mobilePhone.Open( telServer, info.iName ) ); + CleanupClosePushL( mobilePhone ); + + //mobilePhone.Initialise(); + TUint32 identityCaps; + User::LeaveIfError( mobilePhone.GetIdentityCaps( identityCaps ) ); + + if ( identityCaps & RMobilePhone::KCapsGetSerialNumber ) + { + TRequestStatus status; + RMobilePhone::TMobilePhoneIdentityV1 mobilePhoneIdentity; + + mobilePhone.GetPhoneId( status, mobilePhoneIdentity ); + + User::WaitForRequest( status ); + User::LeaveIfError( status.Int() ); + + iIMEI.Copy( mobilePhoneIdentity.iSerialNumber ); + } + else + { + User::Leave( KErrNotSupported ); + } + + CleanupStack::PopAndDestroy( &mobilePhone ); + CleanupStack::PopAndDestroy( &telServer ); + +#else + + // use fixed IMEI for emulator + _LIT( KIMAEmulatorImei, "123456789012345" ); + iIMEI.Copy( KIMAEmulatorImei ); + +#endif // __WINS__ + + } + +//---------------------------------------------------------------------------- + +void CCreatorMailboxes::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) // from MMsvSessionObserver + { + } + +//---------------------------------------------------------------------------- +void CCreatorMailboxes::DeleteAllL() + { + LOGSTRING("Creator: CCreatorMailboxes::DeleteAllL"); + + CEmailAccounts* accountMgr = CEmailAccounts::NewLC(); + + // Delete pop accounts + RArray popAccountsToDelete; + CleanupClosePushL( popAccountsToDelete ); + accountMgr->GetPopAccountsL( popAccountsToDelete ); + for ( TInt i = 0; i < popAccountsToDelete.Count(); i++ ) + { + accountMgr->DeletePopAccountL( popAccountsToDelete[i] ); + } + CleanupStack::PopAndDestroy( &popAccountsToDelete ); + + // Delete imap accounts + RArray imapAccountsToDelete; + CleanupClosePushL( imapAccountsToDelete ); + accountMgr->GetImapAccountsL( imapAccountsToDelete ); + for ( TInt i = 0; i < imapAccountsToDelete.Count(); i++ ) + { + accountMgr->DeleteImapAccountL( imapAccountsToDelete[i] ); + } + CleanupStack::PopAndDestroy( &imapAccountsToDelete ); + + // Delete smtp accounts + RArray smtpAccountsToDelete; + CleanupClosePushL( smtpAccountsToDelete ); + accountMgr->GetSmtpAccountsL( smtpAccountsToDelete ); + for ( TInt i = 0; i < smtpAccountsToDelete.Count(); i++ ) + { + accountMgr->DeleteSmtpAccountL( smtpAccountsToDelete[i] ); + } + CleanupStack::PopAndDestroy( &smtpAccountsToDelete ); + + iEntryIds.Reset(); + + // all entries deleted, remove the Mailbox related registry + iEngine->RemoveStoreL( KUidDictionaryUidMailbox ); + + CleanupStack::PopAndDestroy( accountMgr ); + } + +//---------------------------------------------------------------------------- +void CCreatorMailboxes::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorMailboxes::DeleteAllCreatedByCreatorL"); + + iEntryIds.Reset(); + CEmailAccounts* accountMgr = CEmailAccounts::NewLC(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidMailbox ); + + TInt i(0); + while ( i < iEntryIds.Count() && iEntryIds.Count() > 6 ) + { + // there should be at least 7 items in the array: + // one for mailbox type + // 3 for imap OR pop ids + // 3 for smtp ids + + // delete entries + + TInt type = iEntryIds[i++]; // TMailboxType + if ( type == EMailboxPOP3 ) + { + TPopAccount popAccount; + popAccount.iPopAccountId = iEntryIds[i++]; + popAccount.iPopService = iEntryIds[i++]; + popAccount.iSmtpService = iEntryIds[i++]; + TRAP_IGNORE( accountMgr->DeletePopAccountL( popAccount ) ); + } + else if ( type == EMailboxIMAP4 ) + { + TImapAccount imapAccount; + imapAccount.iImapAccountId = iEntryIds[i++]; + imapAccount.iImapService = iEntryIds[i++]; + imapAccount.iImapService = iEntryIds[i++]; + TRAP_IGNORE( accountMgr->DeleteImapAccountL( imapAccount ) ); + } + else + { + // ignore unknown mailbox types + i +=3; + } + + // There should be one smtp service for each pop and imap service + TSmtpAccount smtpAccount; + smtpAccount.iSmtpAccountId = iEntryIds[i++]; + smtpAccount.iSmtpService = iEntryIds[i++]; + smtpAccount.iRelatedService = iEntryIds[i++]; + TRAP_IGNORE( accountMgr->DeleteSmtpAccountL( smtpAccount ) ); + } + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the mailbox related registry + iEngine->RemoveStoreL( KUidDictionaryUidMailbox ); + + CleanupStack::PopAndDestroy( accountMgr ); + } +//---------------------------------------------------------------------------- + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_mailboxelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_mailboxelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,495 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_mailboxelement.h" +#include "creator_traces.h" +#include "creator_mailbox.h" + +using namespace creatormailbox; + +/* + * + */ +CCreatorMailboxElement* CCreatorMailboxElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorMailboxElement* self = new (ELeave) CCreatorMailboxElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorMailboxElement::CCreatorMailboxElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } + +TBool CCreatorMailboxElement::SetIntegerParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* param, TBool aSetRandom ) + { + _LIT( KAll, "all"); + + if( aElemName == Kincomingport ) + { + if( aSetRandom ) + param->iIncomingPort = iEngine->RandomNumber(25, 500); + else + param->iIncomingPort = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kattachmentsizelimit ) + { + if( aSetRandom ) + param->iAttachmentSizeLimit = iEngine->RandomNumber(1, KMaxTInt); + else + param->iAttachmentSizeLimit = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kbodytextsizelimit ) + { + if( aSetRandom ) + param->iBodyTextSizeLimit = iEngine->RandomNumber(1, KMaxTInt); + else + param->iBodyTextSizeLimit = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kattachmentfetchsize ) + { + if( aSetRandom ) + param->iAttachmentFetchSize = iEngine->RandomNumber(1, 40960); + else + param->iAttachmentFetchSize = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kimapidletimeout ) + { + if( aSetRandom ) + param->iImapIdleTimeout = iEngine->RandomNumber(10, 2000); + else + param->iImapIdleTimeout = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kmaxemailsize ) + { + if( aSetRandom ) + param->iMaxEmailSize = iEngine->RandomNumber(1024, KMaxTInt); + else + param->iMaxEmailSize = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Ksyncrate ) + { + if( aSetRandom ) + param->iSyncRate = iEngine->RandomNumber(10, 500); + else + param->iSyncRate = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kinboxsynclimit ) + { + if( aSetRandom ) + param->iInboxSyncLimit = iEngine->RandomNumber(-1, 256); + else if( CompareIgnoreCase(aElemContent, KAll) == 0 ) + param->iInboxSyncLimit = -1; + else + param->iInboxSyncLimit = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Kmailboxsynclimit ) + { + if( aSetRandom ) + param->iMailboxSyncLimit = iEngine->RandomNumber(-1, 256); + else if( CompareIgnoreCase(aElemContent, KAll) == 0 ) + param->iMailboxSyncLimit = -1; + else + param->iMailboxSyncLimit = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Koutgoingport ) + { + if( aSetRandom ) + param->iOutgoingPort = KDefaultSmtpPort; + else + param->iOutgoingPort = ConvertStrToIntL(aElemContent); + } + else if( aElemName == Ktoccincludelimit ) + { + if( aSetRandom ) + param->iToCCIncludeLimit = iEngine->RandomNumber(0, 30); + else + param->iToCCIncludeLimit = ConvertStrToIntL(aElemContent); + } + else + return EFalse; + + return ETrue; + } + +TBool CCreatorMailboxElement::GetBooleanValueL(const TDesC& aElemContent, TBool aSetRandom) + { + if( aSetRandom ) + return iEngine->RandomNumber(0,1) == 1; + + return ConvertStrToBooleanL(aElemContent); + } + +TBool CCreatorMailboxElement::SetBooleanParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* param, TBool aSetRandom ) + { + TBool val = GetBooleanValueL(aElemContent, aSetRandom); + if( aElemName == Kincomingsslwrapper ) + param->iIncomingSSLWrapper = val; + else if( aElemName == Kincomingsecuresockets ) + param->iIncomingSecureSockets = val; + else if( aElemName == Kacknowledgereceipts ) + param->iAcknowledgeReceipts = val; + else if( aElemName == Kautosendonconnect ) + param->iAutoSendOnConnect = val; + else if( aElemName == Kdeletemailsatdisconnect ) + param->iDeleteEmailsAtDisconnect = val; + else if( aElemName == Kimapidlecommand ) + param->iImapIdleCommand = val; + else if( aElemName == Kmarkseeninsync ) + param->iMarkSeenInSync = val; + else if( aElemName == Kenableexpungemode ) + param->iEnableExpungeMode = val; + else if( aElemName == Kuseapopsecurelogin ) + param->iUseApop = val; + else if( aElemName == Kdisconnectedusermode ) + param->iDisconnectedUserMode = val; + else if( aElemName == Koutgoingsslwrapper ) + param->iOutgoingSSLWrapper = val; + else if( aElemName == Koutgoingsecuresockets ) + param->iOutgoingSecureSockets = val; + else if( aElemName == Kincludesignature ) + param->iIncludeSignature = val; + else if( aElemName == Kaddvcard ) + param->iAddVCard = val; + else if( aElemName == Krequestreceipts ) + param->iRequestReceipts = val; + else if( aElemName == Ksmtpauth ) + param->iSmtpAuth = val; + else + return EFalse; + + return ETrue; + } + +TBool CCreatorMailboxElement::SetTextParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* param, TBool aSetRandom ) + { + _LIT(KIncomingSrvPrefix, "mail."); + _LIT(KOutgoingSrvPrefix, "smtp."); + _LIT(KSrvPostfix, ".com"); + _LIT(KDefaultConnMethod, "internet"); + + if( aElemName == Kname ) + { + if( aSetRandom ) + { + TPtrC company(iEngine->RandomString(CCreatorEngine::ECompany)); + SetContentToTextParamL(param->iMailboxName, company); + } + else + SetContentToTextParamL(param->iMailboxName, aElemContent); + } + else if( aElemName == Kincomingloginname ) + { + if( aSetRandom ) + { + TPtrC random(iEngine->RandomString(CCreatorEngine::EFirstName)); + SetContentToTextParamL(param->iIncomingLoginName, random); + param->iIncomingLoginName->Des().LowerCase(); + } + else + SetContentToTextParamL(param->iIncomingLoginName, aElemContent); + } + else if( aElemName == Kincomingpassword ) + { + if( aSetRandom ) + { + TPtrC random(iEngine->RandomString(CCreatorEngine::EFirstName)); + SetContentToTextParamL(param->iIncomingPassword, random); + param->iIncomingPassword->Des().LowerCase(); + } + else + SetContentToTextParamL(param->iIncomingPassword, aElemContent); + } + else if( aElemName == Kincomingservername ) + { + if( aSetRandom ) + { + TPtrC random(iEngine->RandomString(CCreatorEngine::ECompany)); + HBufC* srvName = HBufC::NewLC(KIncomingSrvPrefix().Length()+random.Length()+KSrvPostfix().Length()); + srvName->Des().Copy(KIncomingSrvPrefix); + srvName->Des().Append(random); + srvName->Des().Append(KSrvPostfix); + SetContentToTextParamL(param->iIncomingServerName, srvName->Des()); + CleanupStack::PopAndDestroy(); // srvName + } + else + SetContentToTextParamL(param->iIncomingServerName, aElemContent); + } + else if( aElemName == Kincomingconnectionmethod ) + { + if( aSetRandom ) + SetContentToTextParamL(param->iIncomingConnectionMethod, KDefaultConnMethod); + else + SetContentToTextParamL(param->iIncomingConnectionMethod, aElemContent); + } + else if( aElemName == Kincomingfolderpath ) + SetContentToTextParamL(param->iIncomingFolderPath, aElemContent); + else if( aElemName == Kpathseparator ) + SetContentToTextParamL(param->iPathSeparator, aElemContent); + else if( aElemName == Koutgoingloginname ) + { + if( aSetRandom ) + { + TPtrC random(iEngine->RandomString(CCreatorEngine::EFirstName)); + SetContentToTextParamL(param->iOutgoingLoginName, random); + param->iOutgoingLoginName->Des().LowerCase(); + } + else + SetContentToTextParamL(param->iOutgoingLoginName, aElemContent); + } + else if( aElemName == Koutgoingpassword ) + { + if( aSetRandom ) + { + TPtrC random(iEngine->RandomString(CCreatorEngine::EFirstName)); + SetContentToTextParamL(param->iOutgoingPassword, random); + param->iOutgoingPassword->Des().LowerCase(); + } + else + SetContentToTextParamL(param->iOutgoingPassword, aElemContent); + } + else if( aElemName == Koutgoingservername ) + { + if( aSetRandom ) + { + TPtrC random(iEngine->RandomString(CCreatorEngine::ECompany)); + HBufC* srvName = HBufC::NewLC(KOutgoingSrvPrefix().Length()+random.Length()+KSrvPostfix().Length()); + srvName->Des().Copy(KOutgoingSrvPrefix); + srvName->Des().Append(random); + srvName->Des().Append(KSrvPostfix); + SetContentToTextParamL(param->iOutgoingServerName, srvName->Des()); + CleanupStack::PopAndDestroy(); // srvName + } + else + SetContentToTextParamL(param->iOutgoingServerName, aElemContent); + } + else if( aElemName == Koutgoingconnectionmethod ) + { + if( aSetRandom ) + SetContentToTextParamL(param->iOutgoingConnectionMethod, KDefaultConnMethod); + else + SetContentToTextParamL(param->iOutgoingConnectionMethod, aElemContent); + } + else if( aElemName == Kownemail ) + { + if( aSetRandom ) + { + TDesC* email = iEngine->CreateEmailAddressLC(); + SetContentToTextParamL(param->iOwnEmailAddress, *email); + CleanupStack::PopAndDestroy(); // email + } + else + SetContentToTextParamL(param->iOwnEmailAddress, aElemContent); + } + else if( aElemName == Kemailalias ) + { + if( aSetRandom ) + { + _LIT(KSpace, " "); + TPtrC firstName(iEngine->RandomString(CCreatorEngine::EFirstName)); + TPtrC lastName(iEngine->RandomString(CCreatorEngine::ESurname)); + HBufC* alias = HBufC::NewLC(firstName.Length() + lastName.Length() + KSpace().Length()); + alias->Des().Copy(firstName); + alias->Des().Append(KSpace); + alias->Des().Append(lastName); + SetContentToTextParamL(param->iOwnEmailAlias, alias->Des()); + CleanupStack::PopAndDestroy(); // alias + } + else + SetContentToTextParamL(param->iOwnEmailAlias, aElemContent); + } + else if( aElemName == Kreceiptaddress ) + { + if( aSetRandom ) + { + TDesC* email = iEngine->CreateEmailAddressLC(); + SetContentToTextParamL(param->iReceiptAddress, *email); + CleanupStack::PopAndDestroy(); // email + } + else + SetContentToTextParamL(param->iReceiptAddress, aElemContent); + } + else if( aElemName == Kreplytoaddress ) + { + if( aSetRandom ) + { + TDesC* email = iEngine->CreateEmailAddressLC(); + SetContentToTextParamL(param->iReceiptAddress, *email); + CleanupStack::PopAndDestroy(); // email + } + else + SetContentToTextParamL(param->iReplyToAddress, aElemContent); + } + else + return EFalse; + + return ETrue; + } + +TBool CCreatorMailboxElement::SetEnumParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* param, TBool aSetRandom ) + { + // Get email options: + if( aElemName == Kgetemailoptions ) + { + if( aSetRandom ) + param->iGetEmailOptions = (CMailboxesParameters::TGetEmailOption) iEngine->RandomNumber( + CMailboxesParameters::EGetHeaders, + CMailboxesParameters::EGetEmailOptionLast-1); + else if( CompareIgnoreCase(aElemContent, Kgetheaders ) == 0 ) + param->iGetEmailOptions = CMailboxesParameters::EGetHeaders; + else if( CompareIgnoreCase(aElemContent, Kgetbodytext) == 0 ) + param->iGetEmailOptions = CMailboxesParameters::EGetBodyText; + else if( CompareIgnoreCase(aElemContent, Kgetbodytextandattachments) == 0 ) + param->iGetEmailOptions = CMailboxesParameters::EGetBodyTextAndAttachments; + else if( CompareIgnoreCase(aElemContent, Kgetattachments) == 0 ) + param->iGetEmailOptions = CMailboxesParameters::EGetAttachments; + else if( CompareIgnoreCase(aElemContent, Kgetbodyalternativetext) == 0 ) + param->iGetEmailOptions = CMailboxesParameters::EGetBodyAlternativeText; + else + param->iGetEmailOptions = CMailboxesParameters::EUndef; + } + + // Subscribe type: + else if( aElemName == Ksubscribetype ) + { + if( aSetRandom ) + param->iSubscribeType = (TFolderSubscribeType) iEngine->RandomNumber( EUpdateNeither, EUpdateBoth ); + else if( CompareIgnoreCase( aElemContent, Kupdatelocal) == 0 ) + param->iSubscribeType = EUpdateLocal; + else if( CompareIgnoreCase( aElemContent, Kupdateremote) == 0 ) + param->iSubscribeType = EUpdateRemote; + else if( CompareIgnoreCase( aElemContent, Kupdateboth) == 0 ) + param->iSubscribeType = EUpdateBoth; + else + param->iSubscribeType = EUpdateNeither; + } + + // Folder synchronization type: + else if( aElemName == Kfoldersynctype) + { + if( aSetRandom ) + param->iSyncType = (TFolderSyncType) iEngine->RandomNumber(EUseCombination, EUseRemote); + else if( CompareIgnoreCase( aElemContent, Kuselocal) == 0 ) + param->iSyncType = EUseLocal; + else if( CompareIgnoreCase( aElemContent, Kuseremote) == 0 ) + param->iSyncType = EUseRemote; + else + param->iSyncType = EUseCombination; + } + + // Send copy to self option: + else if( aElemName == Kcopytoself ) + { + if( aSetRandom ) + param->iSendCopyToSelf = (TImSMTPSendCopyToSelf) iEngine->RandomNumber(ESendNoCopy, ESendCopyAsBccRecipient); + else if( CompareIgnoreCase( aElemContent, Kto) == 0 ) + param->iSendCopyToSelf = ESendCopyAsToRecipient; + else if( CompareIgnoreCase( aElemContent, Kcc) == 0 ) + param->iSendCopyToSelf = ESendCopyAsCcRecipient; + else if( CompareIgnoreCase( aElemContent, Kbcc) == 0 ) + param->iSendCopyToSelf = ESendCopyAsBccRecipient; + else + param->iSendCopyToSelf = ESendNoCopy; + } + + // Send option: + else if( aElemName == Ksendoption ) + { + if( aSetRandom ) + param->iSendOption = (TImSMTPSendMessageOption) iEngine->RandomNumber(ESendMessageImmediately, ESendMessageOnRequest); + else if( CompareIgnoreCase( aElemContent, Konnextconnection) == 0 ) + param->iSendOption = ESendMessageOnNextConnection; + else if( CompareIgnoreCase( aElemContent, Konrequest) == 0 ) + param->iSendOption = ESendMessageOnRequest; + else + param->iSendOption = ESendMessageImmediately; + } + else + { + return EFalse; + } + return ETrue; + } + +void CCreatorMailboxElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + const CCreatorScriptAttribute* typeAttr = FindAttributeByName(KMailboxType); + TInt amount = 1; + if( amountAttr ) + { + amount = ConvertStrToIntL(amountAttr->Value()); + } + + TMailboxType mailboxType = EMailboxPOP3; + + if( typeAttr && CompareIgnoreCase(typeAttr->Value(), Kimap4) == 0 ) + { + mailboxType = EMailboxIMAP4; + } + + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create mailbox entries, the amount of entries is defined by amount: + for( TInt cI = 0; cI < amount; ++cI ) + { + CMailboxesParameters* param = new (ELeave) CMailboxesParameters; + CleanupStack::PushL(param); + + param->iMailboxType = mailboxType; + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( SetTextParamL(elemName, elemContent, param, useRandom ) == EFalse && + SetBooleanParamL(elemName, elemContent, param, useRandom ) == EFalse && + SetIntegerParamL(elemName, elemContent, param, useRandom ) == EFalse && + SetEnumParamL(elemName, elemContent, param, useRandom ) ) + { + LOGSTRING2("CCreatorMailboxElement::ExecuteCommandL: Unknown mailbox field: %S", &elemName); + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, param); + CleanupStack::Pop(); // param + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, 0, amount); + } + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_message.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_message.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,2225 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_message.h" +#include "creator_traces.h" +#include "creator_contactsetcache.h" +#include +#include + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#endif +#include // for CleanupResetAndDestroyPushL + + +//static const TInt KMessagesFieldLength = 1024; + +//_LIT(KCreatorMessagesPrefixName, "CR_"); +//_LIT(KCreatorMessagesPrefixFolderName, "CR_FLDR_"); + + +const TUid KUidBIOBusinessCardMsg = {0x10005531}; +_LIT(KEmpty, ""); + +//---------------------------------------------------------------------------- + +CMessagesParameters::CMessagesParameters() + { + LOGSTRING("Creator: CMessagesParameters::CMessagesParameters"); + + iSenderAddress = HBufC::New(128); + iRecipientAddress = HBufC::New(128); + iMessageSubject = HBufC::New(128); + iMessageBodyText = HBufC::New(10240); + TRAP_IGNORE(iAttachments = new(ELeave) CArrayFixFlat(64)); + iCreateAsUnread = ETrue; + } + +CMessagesParameters::~CMessagesParameters() + { + LOGSTRING("Creator: CMessagesParameters::~CMessagesParameters"); + + + delete iMessageBodyText; + delete iMessageSubject; + delete iRecipientAddress; + delete iSenderAddress; + delete iAttachments; + iAttachmentPaths.ResetAndDestroy(); + iAttachmentPaths.Close(); + iRecipientAddressArray.ResetAndDestroy(); + iRecipientAddressArray.Close(); + iRecipientLinkIds.Close(); + iSenderLinkIds.Close(); + } + +//---------------------------------------------------------------------------- + +CCreatorMessages* CCreatorMessages::NewL(CCreatorEngine* aEngine) + { + CCreatorMessages* self = CCreatorMessages::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorMessages* CCreatorMessages::NewLC(CCreatorEngine* aEngine) + { + CCreatorMessages* self = new (ELeave) CCreatorMessages; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorMessages::CCreatorMessages() +: +iSession(0) + { + } + +void CCreatorMessages::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorMessages::ConstructL"); + iEngine = aEngine; + + TRAP_IGNORE(iAttachments = new(ELeave) CArrayFixFlat(64)); + iWaiter = CAsyncWaiter::NewL(); + } + +CCreatorMessages::~CCreatorMessages() + { + LOGSTRING("Creator: CCreatorMessages::~CCreatorMessages"); + + if ( iEngine && iEntryIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iEntryIds, KUidDictionaryUidMessages ) ); + } + iEntryIds.Reset(); + iEntryIds.Close(); + + delete iParameters; + delete iWaiter; + delete iTmpPhoneNumber; + delete iTmpEmail; + delete iAttachments; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + delete iExistingContacts; + if( iContactManager ) + iContactManager->ContactStoresL().CloseAll(*this); + delete iContactManager; + delete iTempContact; +#endif + iRecipientArray.ResetAndDestroy(); + iRecipientArray.Close(); + iSenderArray.ResetAndDestroy(); + iSenderArray.Close(); + delete iSession; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorMessages::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorMessages::AskDataFromUserL"); + + if ( aCommand == ECmdDeleteMessages ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all messages?") ); + } + else if ( aCommand == ECmdDeleteCreatorMessages ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all messages created with Creator?") ); + } + + if (iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?"))) + { + + // message type query + CAknListQueryDialog* dlg1 = new(ELeave) CAknListQueryDialog( (TInt*) &iMessageType ); + if (dlg1->ExecuteLD(R_MESSAGE_TYPE_QUERY)) + { + TInt folderTypeQueryResource(R_FOLDER_TYPE_QUERY); + + /* + if (iMessageType == EEmail) + folderTypeQueryResource = R_FOLDER_TYPE_WITH_MAILBOX_QUERY; + */ + + // folder query + CAknListQueryDialog* dlg2 = new(ELeave) CAknListQueryDialog( (TInt*) &iFolderType ); + if (dlg2->ExecuteLD(folderTypeQueryResource)) + { + /* + if (iFolderType == EMailbox) + { + // array to hold mailbox names + CDesCArray* names = new (ELeave) CDesCArrayFlat(16); + CleanupStack::PushL(names); + + CMsvSession* session = CMsvSession::OpenSyncL(*this); + CleanupStack::PushL(session); + + // generate list of mailboxes + CMsvEntrySelection* entrySelection = MsvUiServiceUtilities::GetListOfAccountsWithMTML(*session, KUidMsgTypeSMTP, ETrue); + CleanupStack::PushL(entrySelection); + + TBool doReturn(EFalse); + + if (entrySelection->Count() == 0) + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("No mailboxes found")); + + doReturn = ETrue; + } + else + { + // get mailbox names + for (TInt i=0; iCount(); i++) + { + CMsvEntry* centry = session->GetEntryL(entrySelection->At(i)); + CleanupStack::PushL(centry); + + TMsvEntry tentry = centry->Entry(); + names->AppendL(tentry.iDetails); + CleanupStack::PopAndDestroy(); //centry + } + + // show query + TInt index(0); + CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&index); + dlg->PrepareLC(R_MAILBOX_SELECTION_QUERY); + dlg->SetItemTextArray(names); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + + if(dlg->RunLD()) + { + iUserSelectedMailbox = entrySelection->At(index); + + doReturn = EFalse; + } + else + { + doReturn = ETrue; + } + + } + + CleanupStack::PopAndDestroy(3); // names, session, entrySelection + + if (doReturn) + return EFalse; + } + */ + + // query create as unread + CAknListQueryDialog* dlg3 = new(ELeave) CAknListQueryDialog( (TInt*) &iCreateAsUnread ); + if (dlg3->ExecuteLD(R_UNREAD_QUERY)) + { + + // query number of characters in msg body + switch (iMessageType) + { + case ESMS: + case EMMS: + case EEmail: + { + iDefinedMessageLength = 100; + if (iEngine->EntriesQueryDialogL(iDefinedMessageLength, _L("Amount of characters in message body?"), ETrue)) + { + ; + } + else + return EFalse; + + break; + } + case EAMS: + { + iDefinedMessageLength = 0; + break; + } + default: break; + } + + // query attachments + iAttachments->Reset(); + + switch (iMessageType) + { + case EMMS: + case EEmail: + { + CAknListQueryDialog* dlg4 = new(ELeave) CAknListQueryDialog( iAttachments ); + if (dlg4->ExecuteLD(R_ATTACHMENT_MULTI_SELECTION_QUERY)) + { + // "none" is selected + if (iAttachments->At(0) == 0) + iAttachments->Reset(); + else // otherwise fix indexes + { + for (TInt i=0; iCount(); i++) + iAttachments->At(i)--; // decrease value by one + + } + } + else + return EFalse; + + break; + } + case EAMS: + { + iAttachments->AppendL( TInt(0) ); + + CAknListQueryDialog* dlg5 = new(ELeave) CAknListQueryDialog( &iAttachments->At(0) ); + if (dlg5->ExecuteLD(R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY)) + { + ; + } + else + return EFalse; + + break; + } + + case EIrMessage: + case EBTMessage: + { + iAttachments->AppendL( TInt(0) ); + + CAknListQueryDialog* dlg5 = new(ELeave) CAknListQueryDialog( &iAttachments->At(0) ); + if (dlg5->ExecuteLD(R_ATTACHMENT_SINGLE_SELECTION_QUERY)) + { + ; + } + else + return EFalse; + + break; + } + default: break; + } + + return ETrue; // all queries accepted + + } + else + return EFalse; + } + else + return EFalse; + } + else + return EFalse; + } + else + return EFalse; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateRandomMessageEntryL(TInt aCommand) + { + LOGSTRING2("Creator: CCreatorMessages::CreateRandomMessageEntryL - Command: %d", aCommand); + + TInt err = KErrNone; + + iDefinedMessageLength = iEngine->RandomNumber(100, 300); + + + switch (aCommand) + { + case ECmdCreateRandomEntrySMSInbox: { iMessageType=ESMS; iFolderType=EInbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntrySMSDrafts: { iMessageType=ESMS; iFolderType=EDrafts; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntrySMSOutbox: { iMessageType=ESMS; iFolderType=EOutbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntrySMSSent: { iMessageType=ESMS; iFolderType=ESent; err=CreateMessageEntryL(NULL); break;} + + case ECmdCreateRandomEntryMMSInbox: { iMessageType=EMMS; iFolderType=EInbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryMMSDrafts: { iMessageType=EMMS; iFolderType=EDrafts; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryMMSOutbox: { iMessageType=EMMS; iFolderType=EOutbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryMMSSent: { iMessageType=EMMS; iFolderType=ESent; err=CreateMessageEntryL(NULL); break;} + + case ECmdCreateRandomEntryEmailInbox: { iMessageType=EEmail; iFolderType=EInbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryEmailDrafts: { iMessageType=EEmail; iFolderType=EDrafts; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryEmailOutbox: { iMessageType=EEmail; iFolderType=EOutbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryEmailSent: { iMessageType=EEmail; iFolderType=ESent; err=CreateMessageEntryL(NULL); break;} + + case ECmdCreateRandomEntryBIOInbox: { iMessageType=ESmartMessage; iFolderType=EInbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryBIODrafts: { iMessageType=ESmartMessage; iFolderType=EDrafts; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryBIOOutbox: { iMessageType=ESmartMessage; iFolderType=EOutbox; err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryBIOSent: { iMessageType=ESmartMessage; iFolderType=ESent; err=CreateMessageEntryL(NULL); break;} + + case ECmdCreateRandomEntryIRInbox: { iMessageType=EIrMessage; iFolderType=EInbox; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryIRDrafts: { iMessageType=EIrMessage; iFolderType=EDrafts; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryIROutbox: { iMessageType=EIrMessage; iFolderType=EOutbox; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryIRSent: { iMessageType=EIrMessage; iFolderType=ESent; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + + case ECmdCreateRandomEntryBTInbox: { iMessageType=EBTMessage; iFolderType=EInbox; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryBTDrafts: { iMessageType=EBTMessage; iFolderType=EDrafts; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryBTOutbox: { iMessageType=EBTMessage; iFolderType=EOutbox; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryBTSent: { iMessageType=EBTMessage; iFolderType=ESent; iAttachments->Reset(); iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); err=CreateMessageEntryL(NULL); break;} + + case ECmdCreateRandomEntryAMSInbox: { iMessageType=EAMS; iFolderType=EInbox; iAttachments->Reset(); iAttachments->AppendL( CCreatorEngine::EMP3_250kB); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryAMSDrafts: { iMessageType=EAMS; iFolderType=EDrafts; iAttachments->Reset(); iAttachments->AppendL( CCreatorEngine::EMP3_250kB); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryAMSOutbox: { iMessageType=EAMS; iFolderType=EOutbox; iAttachments->Reset(); iAttachments->AppendL( CCreatorEngine::EMP3_250kB); err=CreateMessageEntryL(NULL); break;} + case ECmdCreateRandomEntryAMSSent: { iMessageType=EAMS; iFolderType=ESent; iAttachments->Reset(); iAttachments->AppendL( CCreatorEngine::EMP3_250kB); err=CreateMessageEntryL(NULL); break;} + + default: { User::Panic(_L("MessageCommand"), 901); break;} + } + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateMessageEntryL(CMessagesParameters *aParameters, TBool /*aTakeUserGivenParameters*/) + { + LOGSTRING("Creator: CCreatorMessages::CreateMessageEntryL"); + + delete iParameters; + iParameters = 0; + + CMessagesParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CMessagesParameters; + parameters = iParameters; + // check if values from ui needed + //if (aTakeUserGivenParameters) + // { + parameters->iMessageType = iMessageType; + parameters->iFolderType = iFolderType; + parameters->iDefinedMessageLength = iDefinedMessageLength; + parameters->iCreateAsUnread = iCreateAsUnread; + + for (TInt i=0; iCount(); i++) + parameters->iAttachments->AppendL(iAttachments->At(i)); + // } + //else + // { + // message length + // parameters->iDefinedMessageLength = iEngine->RandomNumber(100, 300); + // } + + if (parameters->iMessageType == EEmail) + { + parameters->iSenderAddress->Des().Copy( iEngine->RandomString(CCreatorEngine::EFirstName) ); + parameters->iSenderAddress->Des().Append( _L("@") ); + parameters->iSenderAddress->Des().Append( iEngine->RandomString(CCreatorEngine::ECompany) ); + parameters->iSenderAddress->Des().Append( _L(".com") ); + + parameters->iRecipientAddress->Des().Copy( iEngine->RandomString(CCreatorEngine::EFirstName) ); + parameters->iRecipientAddress->Des().Append( _L("@") ); + parameters->iRecipientAddress->Des().Append( iEngine->RandomString(CCreatorEngine::ECompany) ); + parameters->iRecipientAddress->Des().Append( _L(".net") ); + } + else if (parameters->iMessageType == EIrMessage || parameters->iMessageType == EBTMessage) + { + parameters->iSenderAddress->Des().Copy( iEngine->RandomString(CCreatorEngine::EFirstName) ); + parameters->iRecipientAddress->Des().Copy( iEngine->RandomString(CCreatorEngine::EFirstName) ); + } + else + { + parameters->iSenderAddress->Des().Copy( iEngine->RandomString(CCreatorEngine::EPhoneNumber) ); + parameters->iRecipientAddress->Des().Copy( iEngine->RandomString(CCreatorEngine::EPhoneNumber) ); + } + + // subject + parameters->iMessageSubject->Des() = iEngine->RandomString(CCreatorEngine::EMessageSubject); + + // message body + parameters->iMessageBodyText->Des().Copy(_L("")); + TPtrC randText = iEngine->RandomString(CCreatorEngine::EMessageText); + for (TInt i=0; iiDefinedMessageLength / randText.Length() +1; i++) + { + parameters->iMessageBodyText->Des().Append( randText ); + parameters->iMessageBodyText->Des().Append( _L(" ") ); + } + parameters->iMessageBodyText->Des() = parameters->iMessageBodyText->Des().Left(parameters->iDefinedMessageLength); + + // BIO message type (from bitsids.h) // TO-DO: add support for all BIO message types... + parameters->iBIOMessageType = KUidBIOBusinessCardMsg; + } + + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + + // Get number of existing senders and recipients: + for( TInt i = 0; i < parameters->iRecipientLinkIds.Count(); ++i ) + { + + TLinkIdParam recipientId = parameters->iRecipientLinkIds[i]; + // Is maximum number limited: + if(recipientId.iLinkAmount == KUndef || + recipientId.iLinkAmount >= ContactLinkCache::Instance()->ContactSet(recipientId.iLinkId).NumberOfExistingContacts() ) + { + parameters->iNumberOfExistingRecipients += ContactLinkCache::Instance()->ContactSet(recipientId.iLinkId).NumberOfExistingContacts(); + } + else + { + parameters->iNumberOfExistingRecipients += recipientId.iLinkAmount; + } + } + for( TInt i = 0; i < parameters->iSenderLinkIds.Count(); ++i ) + { + TLinkIdParam senderId = parameters->iSenderLinkIds[i]; + // Is maximum number limited: + if( senderId.iLinkAmount == KUndef || + senderId.iLinkAmount >= ContactLinkCache::Instance()->ContactSet(senderId.iLinkId).NumberOfExistingContacts()) + { + parameters->iNumberOfExistingSenders += ContactLinkCache::Instance()->ContactSet(senderId.iLinkId).NumberOfExistingContacts(); + } + else + { + parameters->iNumberOfExistingSenders += senderId.iLinkAmount; + } + } + +#endif + + TInt err = KErrNone; + + switch (parameters->iMessageType) + { + case ESMS: { err = CreateSMSEntryL(*parameters); break; } + case EMMS: { err = CreateMMSEntryL(*parameters); break; } + case EAMS: { err = CreateAMSEntryL(*parameters); break; } + case EEmail: { err = CreateEmailEntryL(*parameters); break; } + case ESmartMessage: { err = CreateSmartMessageEntryL(*parameters); break; } + case EIrMessage: { err = CreateObexEntryL( TUid::Uid(KUidMsgTypeIrTInt32), *parameters ); break; } + case EBTMessage: { err = CreateObexEntryL( TUid::Uid(KUidMsgTypeBtTInt32), *parameters ); break; } + default: { User::Panic(_L("MsgType"), 851); break;} + + } + + iSenderArray.ResetAndDestroy(); + iRecipientArray.ResetAndDestroy(); + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateSMSEntryL(const CMessagesParameters& parameters) + { + LOGSTRING("Creator: CCreatorMessages::CreateSMSEntryL"); + + TInt err = KErrNone; + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(registry); + + // get the client mtm and return if it isn't supported in the system + CSmsClientMtm* clientMtm = NULL; + TRAP(err, clientMtm = static_cast(registry->NewMtmL(KUidMsgTypeSMS))); + if (err || !clientMtm) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("SMS: Message type module not found")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + CleanupStack::PushL(clientMtm); + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + // get default service + TMsvId defaultServiceId = 0; + TRAP(err, defaultServiceId = clientMtm->DefaultServiceL()); + if (err) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("SMS: Define a SMS centre first")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + + // set folder type + switch (parameters.iFolderType) + { + case EInbox: { msvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); break; } + case EDrafts: { msvEntry->SetEntryL(KMsvDraftEntryId); break; } + case EOutbox: { msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); break; } + case ESent: { msvEntry->SetEntryL(KMsvSentEntryId); break; } + default: { User::Panic(_L("Folder Type"), 871); break; } + } + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + clientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + clientMtm->CreateMessageL(defaultServiceId); + + // set the from field to sms header + if (parameters.iFolderType == EInbox) + { + CSmsHeader& smsHeader = clientMtm->SmsHeader(); + + if( parameters.iSenderAddress ) + { + smsHeader.SetFromAddressL( parameters.iSenderAddress->Des() ); + } + else + { + smsHeader.SetFromAddressL(KEmpty); + } + } + + // set body + clientMtm->Body().Reset(); + clientMtm->Body().InsertL(0, parameters.iMessageBodyText->Des()); + + // get the entry of the message + TMsvEntry messageEntry = clientMtm->Entry().Entry(); + + // set the details field + if (parameters.iFolderType == EInbox) + { + SetSenderToEntryDetails(messageEntry, parameters, EFalse); + } + else + { + SetRecipientToEntryDetails(messageEntry, parameters, EFalse); + // Add all recipients to clientMtm + // iRecipientArray is up-to-date so don't call AddRecipientsL here + for( TInt i = 0; i < iRecipientArray.Count(); i++ ) + { + clientMtm->AddAddresseeL( iRecipientArray[i]->Des() ); + } + } + + // set the sending state for outbox message + // to avoid SMSMtmUI:15 panic in messages application + if (parameters.iFolderType == EOutbox ) + { + messageEntry.SetSendingState( KMsvSendStateWaiting ); + } + + // set the description field same as the first part of the message body + messageEntry.iDescription.Set( parameters.iMessageBodyText->Des().Left(KSmsDescriptionLength) ); + + // save the changes done above + clientMtm->Entry().ChangeL(messageEntry); + + // save the message + clientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(EFalse); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + + if (parameters.iCreateAsUnread) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + clientMtm->Entry().ChangeL(messageEntry); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( messageEntry.Id() ); + + CleanupStack::PopAndDestroy(2); //registry, clientMtm + + return err; + + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateMMSEntryL(const CMessagesParameters& parameters) + { + LOGSTRING("Creator: CCreatorMessages::CreateMMSEntryL"); + + TInt err = KErrNone; + + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(registry); + + // get the client mtm and return if it isn't supported in the system + CMmsClientMtm* clientMtm = NULL; + TRAP(err, clientMtm = static_cast(registry->NewMtmL(KUidMsgTypeMultimedia))); + if (err || !clientMtm) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("MMS: Message type module not found")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + CleanupStack::PushL(clientMtm); + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + // get default service + TMsvId defaultServiceId = 0; + TRAP(err, defaultServiceId = clientMtm->DefaultServiceL()); + if (err) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("MMS: Define MMS settings first")); + CleanupStack::PopAndDestroy(4); + User::Leave(KErrNotFound); + } + + // set folder type + switch (parameters.iFolderType) + { + case EInbox: { msvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); break; } + case EDrafts: { msvEntry->SetEntryL(KMsvDraftEntryId); break; } + case EOutbox: { msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); break; } + case ESent: { msvEntry->SetEntryL(KMsvSentEntryId); break; } + default: { User::Panic(_L("Folder Type"), 871); break; } + } + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + clientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + clientMtm->CreateMessageL(defaultServiceId); + + // set subject + clientMtm->SetSubjectL( parameters.iMessageSubject->Des() ); + + // set some mms defaults + clientMtm->SetMessageClass(EMmsClassPersonal); + clientMtm->SetExpiryInterval(86400); + clientMtm->SetDeliveryTimeInterval(3600); + clientMtm->SetMessagePriority(EMmsPriorityLow); + clientMtm->SetSenderVisibility(EMmsMaximumSenderVisibility); + clientMtm->SetDeliveryReport(EMmsDeliveryReportYes); + clientMtm->SetReadReply(EMmsReadReplyYes); + + // set the sender / addressee field + if (parameters.iFolderType == EInbox) + { + AddMtmSenderL(*clientMtm, parameters, EFalse); + } + + // Add all recipients to clientMtm + AddRecipientsL( *clientMtm, parameters, EFalse ); + + // get an access to the message store + CMsvStore* store = msvEntry->EditStoreL(); + CleanupStack::PushL(store); + + + // set body as an attachment + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL(mimeHeaders); + mimeHeaders->SetContentTypeL( _L8("text") ); + mimeHeaders->SetContentSubTypeL( _L8("plain") ); + mimeHeaders->SetMimeCharset( KMmsUtf8 ); + mimeHeaders->SetSuggestedFilenameL( _L("body.txt") ); + + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + CleanupStack::PushL(attachmentInfo); + attachmentInfo->SetAttachmentNameL( _L("body.txt") ); + attachmentInfo->SetMimeTypeL( _L8("text/plain") ); + mimeHeaders->StoreL( *attachmentInfo ); + + RFile textFile; + + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + attachMan.CreateAttachmentL(_L("body.txt"), textFile, attachmentInfo, waiter->iStatus ); + CleanupStack::Pop(); // waiter + CleanupStack::Pop(); // attachmentInfo + CleanupStack::PushL(waiter); + waiter->StartAndWait(); + CleanupStack::PopAndDestroy(waiter); + + HBufC8* tempBuf = HBufC8::NewLC( parameters.iMessageBodyText->Des().Length() ); + tempBuf->Des().Copy( parameters.iMessageBodyText->Des() ); + textFile.Write( tempBuf->Des() ); + textFile.Close(); + CleanupStack::PopAndDestroy(); //tempBuf + + CleanupStack::PopAndDestroy(); //mimeHeaders + + + // get the entry of the message + TMsvEntry messageEntry = clientMtm->Entry().Entry(); + + // set the details field + if (parameters.iFolderType == EInbox) + { + SetSenderToEntryDetails(messageEntry, parameters, EFalse); + } + else + { + SetRecipientToEntryDetails(messageEntry, parameters, EFalse); + } + + // set the description field same as the message subject + messageEntry.iDescription.Set( parameters.iMessageSubject->Des().Left(KSmsDescriptionLength) ); + + // save the changes done above + clientMtm->Entry().ChangeL(messageEntry); + + + // save the attachments + HandleAttachementsL(parameters, store, err ); +// for (TInt i=0; iCount(); i++) +// { +// TFileName sourceFileName = iEngine->TestDataPathL( (CCreatorEngine::TTestDataPath) parameters.iAttachments->At(i) ); +// +// TParse parser; +// parser.Set(sourceFileName, NULL, NULL); +// TFileName shortFileName = parser.NameAndExt(); +// +// // get the mime type +// RApaLsSession ls; +// User::LeaveIfError(ls.Connect()); +// CleanupClosePushL(ls); +// TUid appUid; +// TDataType dataType; +// ls.AppForDocument(sourceFileName, appUid, dataType); +// CleanupStack::PopAndDestroy(); //ls +// TPtrC8 mimeType = dataType.Des8(); +// +// // attachment settings +// MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); +// CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred +// attachmentInfo->SetAttachmentNameL( shortFileName ); +// attachmentInfo->SetMimeTypeL( mimeType ); +// +// // save +// CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); +// +// TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus )); +// if (err == KErrNone) +// waiter->StartAndWait(); +// else +// LOGSTRING2("Creator: CCreatorMessages::CreateMMSEntryL failed to attach %S", &sourceFileName); +// +// CleanupStack::PopAndDestroy(waiter); +// } + + // save the changes made to the message store + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + + // save the message + clientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(ETrue); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + if (parameters.iCreateAsUnread) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + + if (parameters.iFolderType == EDrafts) + messageEntry.SetReadOnly(EFalse); + else + messageEntry.SetReadOnly(ETrue); + + messageEntry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated; + + clientMtm->Entry().ChangeL(messageEntry); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( messageEntry.Id() ); + + CleanupStack::PopAndDestroy(2); // registry, clientMtm + + + return err; + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::HandleAttachementsL(const CMessagesParameters& parameters, CMsvStore* store, TInt err ) + { + // save the attachments (added with id's) + for (TInt i=0; iCount(); i++) + { + TFileName sourceFileName = iEngine->TestDataPathL( (CCreatorEngine::TTestDataPath) parameters.iAttachments->At(i) ); + HandleAttachementL(store, err, sourceFileName ); + + } + //Adding attachmentpaths + for (TInt i=0; iDes()); + HandleAttachementL(store, err, sourceFileName ); + } + } +//---------------------------------------------------------------------------- + +void CCreatorMessages::HandleAttachementL(CMsvStore* store, TInt err, TFileName& sourceFileName ) + { + TParse parser; + parser.Set(sourceFileName, NULL, NULL); + TFileName shortFileName = parser.NameAndExt(); + + // get the mime type + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + TUid appUid; + TDataType dataType; + ls.AppForDocument(sourceFileName, appUid, dataType); + CleanupStack::PopAndDestroy(); //ls + TPtrC8 mimeType = dataType.Des8(); + + // attachment settings + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + CleanupStack::PushL(attachmentInfo); + attachmentInfo->SetAttachmentNameL( shortFileName ); + attachmentInfo->SetMimeTypeL( mimeType ); + + if ( mimeType == _L8("text/plain") ) + { + // CMsvMimeHeaders needs to be stored in case of text file + CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); + CleanupStack::PushL(mimeHeaders); + mimeHeaders->SetContentTypeL( _L8("text") ); + mimeHeaders->SetContentSubTypeL( _L8("plain") ); + mimeHeaders->SetMimeCharset( KMmsUtf8 ); + mimeHeaders->StoreL( *attachmentInfo ); + CleanupStack::PopAndDestroy( mimeHeaders ); + } + + // save + + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus )); + if (err == KErrNone) + { + waiter->StartAndWait(); + CleanupStack::PopAndDestroy(waiter); + CleanupStack::Pop(); // attachmentInfo, the ownership is transferred + } + else + { + CleanupStack::PopAndDestroy(waiter); + CleanupStack::PopAndDestroy(); // attachmentInfo, ownership is not transferred (leave occurs) + LOGSTRING2("Creator: CCreatorMessages::HandleAttachementsL failed to attach %S", &sourceFileName); + } + } + //---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateAMSEntryL(const CMessagesParameters& parameters) + { + LOGSTRING("Creator: CCreatorMessages::CreateAMSEntryL"); + + TInt err = KErrNone; + + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(registry); + + // get the client mtm and return if it isn't supported in the system + CMmsClientMtm* clientMtm = NULL; + TRAP(err, clientMtm = static_cast(registry->NewMtmL(KUidMsgTypeMultimedia))); + if (err || !clientMtm) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("MMS: Message type module not found")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + CleanupStack::PushL(clientMtm); + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + // get default service + TMsvId defaultServiceId = 0; + TRAP(err, defaultServiceId = clientMtm->DefaultServiceL()); + if (err) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("MMS: Define MMS settings first")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + + // set folder type + switch (parameters.iFolderType) + { + case EInbox: { msvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); break; } + case EDrafts: { msvEntry->SetEntryL(KMsvDraftEntryId); break; } + case EOutbox: { msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); break; } + case ESent: { msvEntry->SetEntryL(KMsvSentEntryId); break; } + default: { User::Panic(_L("Folder Type"), 871); break; } + } + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + clientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + clientMtm->CreateMessageL(defaultServiceId); + + // set subject + clientMtm->SetSubjectL(parameters.iMessageSubject->Des() ); + + // set some mms defaults + clientMtm->SetMessageClass(EMmsClassPersonal); + clientMtm->SetExpiryInterval(86400); + clientMtm->SetDeliveryTimeInterval(3600); + clientMtm->SetMessagePriority(EMmsPriorityLow); + clientMtm->SetSenderVisibility(EMmsMaximumSenderVisibility); + clientMtm->SetDeliveryReport(EMmsDeliveryReportYes); + clientMtm->SetReadReply(EMmsReadReplyYes); + + // set the sender / addressee field + if (parameters.iFolderType == EInbox) + { + AddMtmSenderL(*clientMtm, parameters, EFalse); + } + + // Add all recipients to clientMtm + AddRecipientsL( *clientMtm, parameters, EFalse ); + + + // get an access to the message store + CMsvStore* store = msvEntry->EditStoreL(); + CleanupStack::PushL(store); + + // get the entry of the message + TMsvEntry messageEntry = clientMtm->Entry().Entry(); + + // set the details field + if (parameters.iFolderType == EInbox) + { + SetSenderToEntryDetails(messageEntry, parameters, EFalse); + } + else + { + SetRecipientToEntryDetails(messageEntry, parameters, EFalse); + } + + // set the description field same as the message subject + messageEntry.iDescription.Set( parameters.iMessageSubject->Des().Left(KSmsDescriptionLength) ); + messageEntry.iBioType = KUidMsgSubTypeMmsAudioMsg.iUid; + + // save the changes done above + clientMtm->Entry().ChangeL(messageEntry); + + + TFileName sourceFileName = iEngine->TestDataPathL( CCreatorEngine::EAMR_20kB ); + TParse parser; + parser.Set(sourceFileName, NULL, NULL); + TFileName shortFileName = parser.NameAndExt(); + + // get the mime type + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + TUid appUid; + TDataType dataType; + ls.AppForDocument(sourceFileName, appUid, dataType); + CleanupStack::PopAndDestroy(); //ls + TPtrC8 mimeType = dataType.Des8(); + + // attachment settings + MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); + CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred + attachmentInfo->SetAttachmentNameL( shortFileName ); + attachmentInfo->SetMimeTypeL( mimeType ); + + // save + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + + TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus )); + if (err == KErrNone) + waiter->StartAndWait(); + else + LOGSTRING2("Creator: CCreatorMessages::CreateAMSEntryL failed to attach %S", &sourceFileName); + + CleanupStack::PopAndDestroy(waiter); + + // save the changes made to the message store + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + + // save the message + clientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(ETrue); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + if (parameters.iCreateAsUnread) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + + if (parameters.iFolderType == EDrafts) + messageEntry.SetReadOnly(EFalse); + else + messageEntry.SetReadOnly(ETrue); + + messageEntry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated; + + clientMtm->Entry().ChangeL(messageEntry); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( messageEntry.Id() ); + + CleanupStack::PopAndDestroy(2); // registry, clientMtm + + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateEmailEntryL(const CMessagesParameters& parameters) + { + LOGSTRING("Creator: CCreatorMessages::CreateEmailEntryL"); + + TInt err = KErrNone; + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(registry); + + // get the client mtm and return if it isn't supported in the system + CSmtpClientMtm* clientMtm = NULL; + TRAP(err, clientMtm = static_cast(registry->NewMtmL(KUidMsgTypeSMTP))); + + if (err || !clientMtm) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Email: Message type module not found")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + CleanupStack::PushL(clientMtm); + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + // get default service + TMsvId defaultServiceId(0); + TRAP(err, defaultServiceId = clientMtm->DefaultServiceL()); + if (err) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Email: Define a mailbox first")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + + // set folder type + switch (parameters.iFolderType) + { + case EInbox: { msvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); break; } + case EDrafts: { msvEntry->SetEntryL(KMsvDraftEntryId); break; } + case EOutbox: { msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); break; } + case ESent: { msvEntry->SetEntryL(KMsvSentEntryId); break; } + case EMailbox: { msvEntry->SetEntryL(iUserSelectedMailbox); break; } + default: { User::Panic(_L("Folder Type"), 871); break; } + } + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + clientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + clientMtm->CreateMessageL(defaultServiceId); + + // set subject + clientMtm->SetSubjectL( parameters.iMessageSubject->Des() ); + + // set body + clientMtm->Body().Reset(); + clientMtm->Body().InsertL(0, parameters.iMessageBodyText->Des()); + + // get the entry of the message + TMsvEntry messageEntry = clientMtm->Entry().Entry(); + + // set the address fields + if (parameters.iFolderType == EInbox) + { + AddSenderToMtmAddresseeL(*clientMtm, parameters, ETrue ); + SetSenderToEntryDetails(messageEntry, parameters, ETrue); + messageEntry.iMtm = KUidMsgTypeIMAP4; // or any other than KUidMsgTypeSMTP to display 'from' field instead of 'to' field + } + else + { + // Add all recipients to clientMtm + AddRecipientsL( *clientMtm, parameters, ETrue ); + SetRecipientToEntryDetails(messageEntry, parameters, EFalse); + } + + // set the description field same as the message subject + messageEntry.iDescription.Set( parameters.iMessageSubject->Des().Left(KSmsDescriptionLength) ); + + // save the changes done above + clientMtm->Entry().ChangeL(messageEntry); + + // get an access to the message store + CMsvStore* store = msvEntry->EditStoreL(); + CleanupStack::PushL(store); + + // save the attachments + HandleAttachementsL(parameters, store, err); +// for (TInt i=0; iCount(); i++) +// { +// TFileName sourceFileName = iEngine->TestDataPathL( (CCreatorEngine::TTestDataPath) parameters.iAttachments->At(i) ); +// +// TParse parser; +// parser.Set(sourceFileName, NULL, NULL); +// TFileName shortFileName = parser.NameAndExt(); +// +// // get the mime type +// RApaLsSession ls; +// User::LeaveIfError(ls.Connect()); +// CleanupClosePushL(ls); +// TUid appUid; +// TDataType dataType; +// ls.AppForDocument(sourceFileName, appUid, dataType); +// CleanupStack::PopAndDestroy(); //ls +// TPtrC8 mimeType = dataType.Des8(); +// +// // attachment settings +// MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); +// CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred +// attachmentInfo->SetAttachmentNameL( shortFileName ); +// attachmentInfo->SetMimeTypeL( mimeType ); +// +// // save +// CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); +// +// TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus )); +// if (err == KErrNone) +// waiter->StartAndWait(); +// else +// LOGSTRING2("Creator: CCreatorMessages::CreateEmailEntryL failed to attach %S", &sourceFileName); +// +// CleanupStack::PopAndDestroy(waiter); +// } + + // save the changes made to the message store + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + // save the message + clientMtm->SaveMessageL(); + + // final fine tuning + TMsvEmailEntry temailEntry = static_cast(messageEntry); + temailEntry.SetMessageFolderType(EFolderTypeUnknown); + temailEntry.SetDisconnectedOperation(ENoDisconnectedOperations); + temailEntry.SetEncrypted(EFalse); + temailEntry.SetSigned(EFalse); + temailEntry.SetVCard(EFalse); + temailEntry.SetVCalendar(EFalse); + temailEntry.SetReceipt(EFalse); + temailEntry.SetMHTMLEmail(EFalse); + temailEntry.SetBodyTextComplete(ETrue); + + if (parameters.iAttachments->Count() > 0) + temailEntry.SetAttachment(ETrue); + else + temailEntry.SetAttachment(EFalse); + + temailEntry.iDate.HomeTime(); + temailEntry.SetVisible(ETrue); + temailEntry.SetInPreparation(EFalse); + if (parameters.iCreateAsUnread) + { + temailEntry.SetUnread(ETrue); + temailEntry.SetNew(ETrue); + } + else + { + temailEntry.SetUnread(EFalse); + temailEntry.SetNew(EFalse); + } + temailEntry.SetComplete(ETrue); + temailEntry.iServiceId = defaultServiceId; + temailEntry.iRelatedId = 0; + + clientMtm->Entry().ChangeL(temailEntry); + + // reset email headers + CImHeader* header = CImHeader::NewLC(); + CMsvStore* msvStore = msvEntry->EditStoreL(); + CleanupStack::PushL(msvStore); + header->RestoreL(*msvStore); + header->SetSubjectL( parameters.iMessageSubject->Des() ); + if( iSenderArray.Count() == 0 ) + { + GetSendersL(iSenderArray, parameters, ETrue, 1 ); + } + + if( iSenderArray.Count() > 0 ) + { + header->SetFromL(iSenderArray[0]->Des()); + } + else + { + header->SetFromL( parameters.iSenderAddress->Des() ); + } + if( parameters.iRecipientAddress->Length() > 0 ) + { + header->SetReceiptAddressL( parameters.iRecipientAddress->Des() ); + } + else if( parameters.iRecipientAddressArray.Count() > 0 ) + { + header->SetReceiptAddressL( parameters.iRecipientAddressArray[0]->Des()); + } + + header->StoreL( *msvStore ); + msvStore->CommitL(); + CleanupStack::PopAndDestroy(2); // msvStore, header + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( messageEntry.Id() ); + + CleanupStack::PopAndDestroy(2); // registry, clientMtm + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateSmartMessageEntryL(const CMessagesParameters& parameters) + { + LOGSTRING("Creator: CCreatorMessages::CreateSmartMessageEntryL"); + + TInt err = KErrNone; + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(registry); + + // get the client mtm and return if it isn't supported in the system + CSmsClientMtm* clientMtm = NULL; + TRAP(err, clientMtm = static_cast(registry->NewMtmL(KUidMsgTypeSMS))); + if (err || !clientMtm) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("BIO: Message type module not found")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + CleanupStack::PushL(clientMtm); + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + // get default service + TMsvId defaultServiceId = 0; + TRAP(err, defaultServiceId = clientMtm->DefaultServiceL()); + if (err) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("SMS: Define a SMS centre first")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + + // set folder type + switch (parameters.iFolderType) + { + case EInbox: { msvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); break; } + case EDrafts: { msvEntry->SetEntryL(KMsvDraftEntryId); break; } + case EOutbox: { msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); break; } + case ESent: { msvEntry->SetEntryL(KMsvSentEntryId); break; } + default: { User::Panic(_L("Folder Type"), 871); break; } + } + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + clientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + clientMtm->CreateMessageL(defaultServiceId); + + // set the from field to sms header + if (parameters.iFolderType == EInbox) + { + CSmsHeader& smsHeader = clientMtm->SmsHeader(); + + if( parameters.iSenderAddress ) + { + smsHeader.SetFromAddressL( parameters.iSenderAddress->Des() ); + } + else + { + smsHeader.SetFromAddressL(KEmpty); + } + } + + // set body, the BIO message itself + clientMtm->Body().Reset(); + clientMtm->Body().InsertL(0, _L("Business Card\nTester Mike\nThe Company Ltd.\nSoftware Engineer\ntel +358 66 1234567\n")); + + // get the entry of the message + TMsvEntry messageEntry = clientMtm->Entry().Entry(); + + // TO-DO: Add support for all BIO messages, currently just insert a business card message ... : + // set the message type + // parameters.iBIOMessageType ... + clientMtm->BioTypeChangedL(KUidBIOBusinessCardMsg); + messageEntry.iBioType = KUidBIOBusinessCardMsg.iUid; + + // set the details field + if (parameters.iFolderType == EInbox) + { + SetSenderToEntryDetails(messageEntry, parameters, EFalse); + } + else + { + SetRecipientToEntryDetails(messageEntry, parameters, EFalse); + } + + // set the subject line + messageEntry.iDescription.Set( parameters.iMessageSubject->Des().Left(KSmsDescriptionLength) ); + + // set correct MTM type + messageEntry.iMtm= KUidBIOMessageTypeMtm; + + // save the changes done above + clientMtm->Entry().ChangeL(messageEntry); + + // save the message + clientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.SetAttachment(EFalse); + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + if (parameters.iCreateAsUnread) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + messageEntry.SetComplete(ETrue); + messageEntry.iServiceId = defaultServiceId; + messageEntry.iRelatedId = 0; + clientMtm->Entry().ChangeL(messageEntry); + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( messageEntry.Id() ); + + CleanupStack::PopAndDestroy(2); // registry, clientMtm + + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorMessages::CreateObexEntryL(TUid aMtm, const CMessagesParameters& parameters) + { + LOGSTRING("Creator: CCreatorMessages::CreateObexEntryL"); + + TInt err = KErrNone; + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(registry); + + // get the client mtm and return if it isn't supported in the system + CObexClientMtm* clientMtm = NULL; + TRAP(err, clientMtm = static_cast(registry->NewMtmL(aMtm))); + if (err || !clientMtm) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Obex: Message type module not found")); + CleanupStack::PopAndDestroy(2); + User::Leave(KErrNotFound); + } + CleanupStack::PushL(clientMtm); + + // create a new object to access an existing entry + CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); + CleanupStack::PushL(msvEntry); + + // define default service + TMsvId defaultServiceId = 0; + + // set folder type + switch (parameters.iFolderType) + { + case EInbox: { msvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId); break; } + case EDrafts: { msvEntry->SetEntryL(KMsvDraftEntryId); break; } + case EOutbox: { msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); break; } + case ESent: { msvEntry->SetEntryL(KMsvSentEntryId); break; } + default: { User::Panic(_L("Folder Type"), 871); break; } + } + + // mtm takes ownership of entry context + CleanupStack::Pop(msvEntry); + clientMtm->SetCurrentEntryL(msvEntry); + + // create a new message + clientMtm->CreateMessageL(defaultServiceId); + + // get the entry of the message + TMsvEntry messageEntry = clientMtm->Entry().Entry(); + + // set subject + clientMtm->SetSubjectL( parameters.iMessageSubject->Des() ); + messageEntry.iDescription.Set( parameters.iMessageSubject->Des().Left(KSmsDescriptionLength) ); + + // set body, must be empty for obex messages + clientMtm->Body().Reset(); + + // set the details field and + if (parameters.iFolderType == EInbox) + { + SetSenderToEntryDetails(messageEntry, parameters, EFalse); + } + else + { + SetRecipientToEntryDetails(messageEntry, parameters, EFalse); + } + + // set mtm + messageEntry.iMtm = aMtm; + messageEntry.iType = KUidMsvMessageEntry; + messageEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + + // save the changes done above + clientMtm->Entry().ChangeL(messageEntry); + + // save the message + clientMtm->SaveMessageL(); + + // final fine tuning + messageEntry.iDate.HomeTime(); + messageEntry.SetVisible(ETrue); + messageEntry.SetInPreparation(EFalse); + if (parameters.iCreateAsUnread) + { + messageEntry.SetUnread(ETrue); + messageEntry.SetNew(ETrue); + } + else + { + messageEntry.SetUnread(EFalse); + messageEntry.SetNew(EFalse); + } + messageEntry.SetComplete(ETrue); + clientMtm->Entry().ChangeL(messageEntry); + + // save the attachment + if (parameters.iAttachments->Count() >= 1) + { + // create a new entry for the attachment + TMsvEntry attachTEntry; + attachTEntry.iType = KUidMsvAttachmentEntry; + attachTEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + attachTEntry.iMtm = KUidMsgTypeBt; //save as bt message + + msvEntry->CreateL(attachTEntry); + + CMsvEntry* attachEntry = iSession->GetEntryL(attachTEntry.Id()); + clientMtm->SetCurrentEntryL(attachEntry); + + // get source file + TFileName sourceFileName = iEngine->TestDataPathL( (CCreatorEngine::TTestDataPath) parameters.iAttachments->At(0) ); + + // get the mime type + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + TUid appUid; + TDataType mimeType; + ls.AppForDocument(sourceFileName, appUid, mimeType); + CleanupStack::PopAndDestroy(); //ls + + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + + // add an attachment to the current message entry + TRAP(err, clientMtm->AddAttachmentL( sourceFileName, mimeType.Des8(), 0, waiter->iStatus )); + if (err == KErrNone) + waiter->StartAndWait(); + else + LOGSTRING2("Creator: CCreatorMessages::CreateObexEntryL failed to attach %S", &sourceFileName); + + CleanupStack::PopAndDestroy(waiter); + } + + // id has been generated, store it for being able to delete + // only entries created with Creator + iEntryIds.Append( messageEntry.Id() ); + + CleanupStack::PopAndDestroy(2); // registry, clientMtm + + + return err; + } + +//---------------------------------------------------------------------------- + +void CCreatorMessages::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) // from MMsvSessionObserver + { + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::SetSenderToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress) + { + // Only one sender allowed: + if( iSenderArray.Count() == 0 ) + { + GetSendersL(iSenderArray, aParameters, aUseEmailAddress, 1 ); + } + if( iSenderArray.Count() > 0 ) + { + aMsgEntry.iDetails.Set( iSenderArray[0]->Des() ); + } + else + { + aMsgEntry.iDetails.Set(KEmpty); + } + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::SetRecipientToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress) + { + // Only one sender allowed: + GetAllRecipientsL(iRecipientArray, aParameters, aUseEmailAddress); + if( iRecipientArray.Count() > 0 ) + { + const TDesC& temp = iRecipientArray[0]->Des(); + aMsgEntry.iDetails.Set( temp ); + } + else + { + aMsgEntry.iDetails.Set(KEmpty); + } + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::AddSenderToMtmAddresseeL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress ) + { + // Only one sender allowed: + if( iSenderArray.Count() == 0 ) + { + GetSendersL(iSenderArray, aParameters, aUseEmailAddress, 1 ); + } + + for( TInt i = 0; i < iSenderArray.Count(); ++i ) + { + aMtm.AddAddresseeL( iSenderArray[i]->Des() ); + } + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::AddMtmSenderL(CMmsClientMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress ) + { + // Only one sender allowed: + if( iSenderArray.Count() == 0 ) + { + GetSendersL(iSenderArray, aParameters, aUseEmailAddress, 1 ); + } + + if( iSenderArray.Count() > 0 ) + { + aMtm.SetSenderL( iSenderArray[0]->Des() ); + } + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::GetSendersL(RPointerArray& aSenderArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress, TInt aMaxNum ) + { + TInt counter = 0; + + if( counter < aMaxNum || aMaxNum == KUndef ) + { + if( aParameters.iSenderAddress && aParameters.iSenderAddress->Length() > 0 ) + { + HBufC* temp = HBufC::NewL(aParameters.iSenderAddress->Length()); + CleanupStack::PushL(temp); + temp->Des().Copy(aParameters.iSenderAddress->Des()); + aSenderArray.AppendL( temp ); + CleanupStack::Pop(); // temp + ++counter; + } + } + + if( counter < aMaxNum || aMaxNum == KUndef ) + { + RPointerArray tempArray; + CleanupResetAndDestroyPushL( tempArray ); + GetLinkedAddressesL(tempArray, aParameters.iSenderLinkIds, aUseEmailAddress, aParameters.iNumberOfExistingSenders); + for( TInt i = 0; i < tempArray.Count() && (counter < aMaxNum || aMaxNum == KUndef); ++i ) + { + HBufC* temp = tempArray[i]->AllocLC(); + aSenderArray.AppendL(temp); + CleanupStack::Pop(); // temp + ++counter; + } + CleanupStack::PopAndDestroy(); // tempArray + } + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::AddRecipientsL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress ) + { + GetAllRecipientsL(iRecipientArray, aParameters, aUseEmailAddress); + for( TInt i = 0; i < iRecipientArray.Count(); ++i ) + { + aMtm.AddAddresseeL( iRecipientArray[i]->Des() ); + } + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::GetAllRecipientsL(RPointerArray& aRecipientArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress ) + { + + // If iRecipientAddress is given, add it to the array: + if( aParameters.iRecipientAddress && aParameters.iRecipientAddress->Length() > 0 ) + { + HBufC* temp = HBufC::NewL(aParameters.iRecipientAddress->Length()); + CleanupStack::PushL(temp); + temp->Des().Copy(aParameters.iRecipientAddress->Des()); + aRecipientArray.AppendL( temp ); + CleanupStack::Pop(); // temp + } + + // Add all recipients listed in iRecipientAddressArray: + for( TInt i = 0; i < aParameters.iRecipientAddressArray.Count(); ++i ) + { + HBufC* temp = HBufC::NewL(aParameters.iRecipientAddressArray[i]->Length()); + CleanupStack::PushL(temp); + temp->Des().Copy(aParameters.iRecipientAddressArray[i]->Des()); + aRecipientArray.AppendL( temp ); + CleanupStack::Pop(); // temp + } + + // Get all linked addresses. + GetLinkedAddressesL(aRecipientArray, aParameters.iRecipientLinkIds, aUseEmailAddress, aParameters.iNumberOfExistingRecipients); + } + +/* + * Get all linked addresses. This method gets addresses that are linked with contact-set id and + * existing addresses from the contact database, if required. + */ +void CCreatorMessages::GetLinkedAddressesL( + RPointerArray& aAddressArray, + const RArray& aLinkIds, + TBool aUseEmailAddress, + TInt aNumOfExistingAddresses ) + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + + if( aNumOfExistingAddresses > 0 || aLinkIds.Count() > 0 ) + { + // First create contact manager: + if( iContactManager == 0) + { + CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC(); + uriArray->AppendL( TVPbkContactStoreUriPtr(VPbkContactStoreUris::DefaultCntDbUri())); + iContactManager = CVPbkContactManager::NewL( *uriArray, &CCoeEnv::Static()->FsSession()); + CleanupStack::PopAndDestroy(uriArray); + + + // Then open the stores: + + MVPbkContactStoreList& storeList = iContactManager->ContactStoresL(); + storeList.OpenAllL(*this); + iWaiter->StartAndWait(); + _LIT(dbUri, "cntdb://c:contacts.cdb"); + TVPbkContactStoreUriPtr uri(dbUri); + iStore = storeList.Find(uri); + } + // Existing attendees: + if( aNumOfExistingAddresses > 0 ) + { + if( iStore ) + { + const MVPbkFieldTypeList& fieldList = iStore->StoreProperties().SupportedFields(); + + // get contacts, results will be set to iExistingContacts + MVPbkContactOperationBase* operation = iContactManager->FindL(_L(""), fieldList , *this); + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait();//Making asynchronous FindL to synchronous + CleanupStack::Pop(operation); + delete operation; + } + if( iExistingContacts ) + { + // Loop the links pointing to the existing contacts: + TInt addedContacts = 0; + for( TInt i = 0; i < iExistingContacts->Count() && addedContacts < aNumOfExistingAddresses; ++i ) + { + // Get the address of the actual contact based on the contact link. Results are stored in + // iTmpEmail and iTmpPhoneNumber + MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( iExistingContacts->At(i), *this ); + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait(); // Making asynchronous RetrieveContactL to synchronous + CleanupStack::Pop(); // operation + delete operation; + operation = 0; + HandleSingleContactResultL(); + if( aUseEmailAddress && iTmpEmail && iTmpEmail->Length() > 0 ) + { + HBufC* temp = HBufC::NewL(iTmpEmail->Length()); + CleanupStack::PushL(temp); + temp->Des().Copy(iTmpEmail->Des()); + aAddressArray.AppendL(temp); + CleanupStack::Pop(); // temp + delete iTmpEmail; + iTmpEmail = 0; // The pointer is owned by the aAddressArray now. + ++addedContacts; + } + else if( !aUseEmailAddress && iTmpPhoneNumber && iTmpPhoneNumber->Length() > 0 ) + { + HBufC* temp = HBufC::NewL(iTmpPhoneNumber->Length()); + CleanupStack::PushL(temp); + temp->Des().Copy(iTmpPhoneNumber->Des()); + aAddressArray.AppendL(temp); + CleanupStack::Pop(); // temp + delete iTmpPhoneNumber; + iTmpPhoneNumber = 0; // The pointer is owned by the aAddressArray now. + ++addedContacts; + } + } + } + } + } + } + + // Loop linked contact-set ids: + for( TInt i = 0; i < aLinkIds.Count(); ++i ) + { + TLinkIdParam id = aLinkIds[i]; + // Get all contact links in the contact-set... + RPointerArray& links = ContactLinkCache::Instance()->ContactLinks(id.iLinkId); + // ... and loop the links: + TInt addedContacts = 0; + for( TInt j = 0; j < links.Count() && (id.iLinkAmount < 0 || addedContacts < id.iLinkAmount); ++j ) + { + // Again retrieve contact based on the contact link. Results are stored in + // iTmpEmail and iTmpPhoneNumber: + MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( *(links[j]), *this ); + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait(); // Making asynchronous RetrieveContactL to synchronous + CleanupStack::Pop(operation); + delete operation; + operation = 0; + HandleSingleContactResultL(); + if( aUseEmailAddress && iTmpEmail && iTmpEmail->Length() > 0 ) + { + aAddressArray.AppendL(iTmpEmail); + iTmpEmail = 0; // The pointer is owned by the aAddressArray now. + ++addedContacts; + } + else if( !aUseEmailAddress && iTmpPhoneNumber && iTmpPhoneNumber->Length() > 0 ) + { + aAddressArray.AppendL(iTmpPhoneNumber); + iTmpPhoneNumber = 0; // The pointer is owned by the aAddressArray now. + ++addedContacts; + } + } + } + } + + //if( iContactManager ) + // iContactManager->ContactStoresL().CloseAll(*this); + } +#endif +} + +//---------------------------------------------------------------------------- +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorMessages::VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& /*aOperation*/, + MVPbkStoreContact* aContact ) + { + LOGSTRING("Creator: CCreatorMessages::VPbkSingleContactOperationComplete" ); + iWaiter->Cancel(); + delete iTempContact; + iTempContact = aContact; + } + +void CCreatorMessages::HandleSingleContactResultL() + { + if( iTempContact ) + { + TPtrC phoneNumber; + TPtrC email; + + // Put contact's name to temporary member: + delete iTmpPhoneNumber; + iTmpPhoneNumber = 0; + delete iTmpEmail; + iTmpEmail = 0; + + TBool phFound = EFalse; + TBool emailFound = EFalse; + + MVPbkStoreContactFieldCollection& fields = iTempContact->Fields(); + TInt fieldCount = fields.FieldCount(); + for (TInt i = 0; i < fieldCount; ++i) + { + MVPbkStoreContactField& field = fields.FieldAt(i); + MVPbkContactFieldData& fieldData = field.FieldData(); + const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); + + if( fieldType ) + { + // Find phone number and email: + TInt fieldId( fieldType->FieldTypeResId() ); + + TVPbkFieldStorageType dataType = fieldData.DataType(); + if( dataType == EVPbkFieldStorageTypeText) + { + MVPbkContactFieldTextData& textData = MVPbkContactFieldTextData::Cast(fieldData); + if( !phFound && + (fieldId == R_VPBK_FIELD_TYPE_LANDPHONEGEN || + fieldId == R_VPBK_FIELD_TYPE_LANDPHONEHOME || + fieldId == R_VPBK_FIELD_TYPE_LANDPHONEWORK || + fieldId == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN || + fieldId == R_VPBK_FIELD_TYPE_MOBILEPHONEHOME || + fieldId == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK )) + { + phoneNumber.Set(textData.Text()); + phFound = ETrue; + } + else if( !emailFound && + (fieldId == R_VPBK_FIELD_TYPE_EMAILGEN || + fieldId == R_VPBK_FIELD_TYPE_EMAILHOME || + fieldId == R_VPBK_FIELD_TYPE_EMAILWORK )) + { + email.Set(textData.Text()); + emailFound = ETrue; + } + + if( phFound && emailFound ) + break; // No need to loop more fields. + } + } + } + if( phoneNumber.Length() > 0 ) + { + delete iTmpPhoneNumber; + iTmpPhoneNumber = 0; + iTmpPhoneNumber = HBufC::NewL(phoneNumber.Length()); + iTmpPhoneNumber->Des().Copy(phoneNumber); + } + if( email.Length() > 0 ) + { + delete iTmpEmail; + iTmpEmail = 0; + iTmpEmail = HBufC::NewL(email.Length()); + iTmpEmail->Des().Copy(email); + } + delete iTempContact; + iTempContact = 0; + } + } + +void CCreatorMessages::VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& /*aOperation*/, + TInt aError ) + { + LOGSTRING2("Creator: CCreatorMessages::VPbkSingleContactOperationFailed - Error: %d", aError ); + iWaiter->Cancel(); + } + +void CCreatorMessages::OpenComplete() + { + LOGSTRING("Creator: CCreatorMessages::OpenComplete()"); + iWaiter->Cancel(); + } + +void CCreatorMessages::StoreReady(MVPbkContactStore& /*aContactStore*/) + { + LOGSTRING("Creator: CCreatorMessages::StoreReady()"); + iWaiter->Cancel(); + } + +void CCreatorMessages::StoreUnavailable(MVPbkContactStore& /*aContactStore*/, + TInt /*aReason*/) + { + LOGSTRING("Creator: CCreatorMessages::StoreUnavailable()"); + iWaiter->Cancel(); + } + + +void CCreatorMessages::HandleStoreEventL( + MVPbkContactStore& /*aContactStore*/, + TVPbkContactStoreEvent /*aStoreEvent*/) + { + LOGSTRING("Creator: CCreatorMessages::HandleStoreEventL()"); + iWaiter->Cancel(); + } + +void CCreatorMessages::FindCompleteL( MVPbkContactLinkArray* aResults ) + { + LOGSTRING("Creator: CCreatorMessages::FindCompleteL()"); + iWaiter->Cancel(); + delete iExistingContacts; + iExistingContacts = aResults; + } + +void CCreatorMessages::FindFailed( TInt aError ) + { + LOGSTRING2("Creator: CCreatorMessages:FindFailed() - Error: %d", aError); + iWaiter->Cancel(); + delete iExistingContacts; + iExistingContacts = 0; + } +#endif + + +//---------------------------------------------------------------------------- +void CCreatorMessages::DeleteAllL() + { + LOGSTRING("Creator: CCreatorMessages::DeleteAllL"); + DeleteAllMessagesL( EFalse ); + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::DeleteAllMessagesL( TBool aOnlyCreatedWithCreator ) + { + LOGSTRING("Creator: CCreatorMessages::DeleteAllMessagesL"); + TInt err( KErrNone ); + + // init + if( iSession == 0 ) + { + iSession = CMsvSession::OpenSyncL(*this); + } + + CClientMtmRegistry* registry = CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL( registry ); + + // get the client mtm and return if it isn't supported in the system + CSmsClientMtm* clientMtm( NULL ); + TRAP( err, clientMtm = static_cast( registry->NewMtmL( KUidMsgTypeSMS ) ) ); + if ( err || !clientMtm ) + { + CAknErrorNote* note = new (ELeave) CAknErrorNote(); + note->ExecuteLD( _L( "SMS: Message type module not found" ) ); + CleanupStack::PopAndDestroy( 2 ); + User::Leave( KErrNotFound ); + } + CleanupStack::PushL( clientMtm ); + + TRAP_IGNORE( DeleteAllFromFolderL( KMsvGlobalInBoxIndexEntryId, iSession, clientMtm, aOnlyCreatedWithCreator ) ); + TRAP_IGNORE( DeleteAllFromFolderL( KMsvDraftEntryId, iSession, clientMtm, aOnlyCreatedWithCreator ) ); + TRAP_IGNORE( DeleteAllFromFolderL( KMsvGlobalOutBoxIndexEntryId, iSession, clientMtm, aOnlyCreatedWithCreator ) ); + TRAP_IGNORE( DeleteAllFromFolderL( KMsvSentEntryId, iSession, clientMtm, aOnlyCreatedWithCreator ) ); + + // reset must be done here, because iEntryIds is stored in destructor + iEntryIds.Reset(); + + // all entries deleted, remove the Messages related registry + iEngine->RemoveStoreL( KUidDictionaryUidMessages ); + + CleanupStack::PopAndDestroy( clientMtm ); + CleanupStack::PopAndDestroy( registry ); + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::DeleteAllFromFolderL( const TMsvId aContext, + CMsvSession* aSession, + CSmsClientMtm* aClientMtm, + TBool aOnlyCreatedWithCreator ) + { + LOGSTRING("Creator: CCreatorMessages::DeleteAllFromFolderL"); + + TMsvSelectionOrdering sort; + sort.SetShowInvisibleEntries( ETrue ); + + CMsvEntry* inboxContext = CMsvEntry::NewL( *aSession, aContext, sort ); + CleanupStack::PushL( inboxContext ); + + CMsvEntrySelection* entries = inboxContext->ChildrenL(); + CleanupStack::PushL( entries ); + + TInt msgCount = entries->Count(); + for ( TInt i = 0; i < entries->Count(); i++) + { + TMsvId entryID = entries->At(i); + aClientMtm->SwitchCurrentEntryL( entryID ); + + if ( !aOnlyCreatedWithCreator || iEntryIds.Find( entryID ) != KErrNotFound ) + { + CMsvEntry* entry = aSession->GetEntryL( (*entries)[i] ); + CleanupStack::PushL( entry ); + + entry->DeleteL( entries->At(i) ); + CleanupStack::PopAndDestroy( entry ); + } + } + + CleanupStack::PopAndDestroy( entries ); + CleanupStack::PopAndDestroy( inboxContext ); + } + +//---------------------------------------------------------------------------- +void CCreatorMessages::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorMessages::DeleteAllCreatedByCreatorL"); + + iEntryIds.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntryIds, KUidDictionaryUidMessages ); + + // delete them + DeleteAllMessagesL( ETrue ); + } + +CRecipientInfo::CRecipientInfo() + { + + } + +CRecipientInfo::~CRecipientInfo() + { + delete iPhoneNumber; + delete iEmailAddress; + } + +void CRecipientInfo::SetPhoneNumber(HBufC* aPhone) + { + delete iPhoneNumber; + iPhoneNumber = aPhone; + } + +void CRecipientInfo::SetEmailAddress(HBufC* aEmail) + { + delete iEmailAddress; + iEmailAddress = aEmail; + } + +const HBufC* CRecipientInfo::PhoneNumber() const + { + return iPhoneNumber; + } + +const HBufC* CRecipientInfo::EmailAddress() const + { + return iEmailAddress; + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_messageelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_messageelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,474 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_messageelement.h" +#include "creator_traces.h" +#include "creator_message.h" + +using namespace creatormsg; + +/* + * + */ +CCreatorMessageElement* CCreatorMessageElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorMessageElement* self = new (ELeave) CCreatorMessageElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorMessageElement::CCreatorMessageElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } +/* + * Sets message type + */ +void CCreatorMessageElement::SetMessageTypeL(CMessagesParameters& aParameters, const TDesC& aMsgTypeStr ) const + { + if( CompareIgnoreCase(aMsgTypeStr, KSms) == 0 ) + { + aParameters.iMessageType = ESMS; + } + else if( CompareIgnoreCase(aMsgTypeStr, KMms) == 0 ) + { + aParameters.iMessageType = EMMS; + } + else if( CompareIgnoreCase(aMsgTypeStr, KAms) == 0 ) + { + aParameters.iMessageType = EAMS; + } + else if( CompareIgnoreCase(aMsgTypeStr, KEmail) == 0 ) + { + aParameters.iMessageType = EEmail; + } + else if( CompareIgnoreCase(aMsgTypeStr, KSmart) == 0 ) + { + aParameters.iMessageType = ESmartMessage; + } + else if( CompareIgnoreCase(aMsgTypeStr, KIr) == 0 ) + { + aParameters.iMessageType = EIrMessage; + } + else if( CompareIgnoreCase(aMsgTypeStr, KBt) == 0 ) + { + aParameters.iMessageType = EBTMessage; + } + else + { + LOGSTRING2("ERROR in CCreatorMessageElement::SetMessageTypeL: Unknown message type: %S", &aMsgTypeStr); + User::Leave(KErrGeneral); + } + } +/* + * Returns maximum length of the body text, when randomlength=max is used. + */ +TInt CCreatorMessageElement::GetMaxBodyLength( const TDesC& aMsgType ) const + { + TInt len = 0; + if( CompareIgnoreCase(aMsgType, KSms) == 0 ) + { + len = 160; + } + else if( CompareIgnoreCase(aMsgType, KMms) == 0 ) + { + len = 160; + } + else if( CompareIgnoreCase(aMsgType, KEmail) == 0 ) + { + len = 1024; + } + else + { + len = KUndef; + } + return len; + } +/* + * Returns random body text length + */ +TInt CCreatorMessageElement::GetRandomBodyLengthL(const TDesC& aRandomLenStr, const TDesC& aMsgType ) const + { + TInt len = 0; + if( aRandomLenStr == KMax ) + { + len = GetMaxBodyLength(aMsgType); + } + else if( aRandomLenStr == KDefault ) + { + len = KUndef; + } + else + { + len = ConvertStrToIntL(aRandomLenStr); + } + return len; + } + +/* + * Creates random message address (To/From) + * Returns phone number for SMS, MMS, AMS and Smart messages. + * Email address for others + */ +HBufC* CCreatorMessageElement::CreateMessageAddressLC(const TDesC& msgType) + { + HBufC* toAddr; + if( CompareIgnoreCase(msgType, KSms) == 0 || + CompareIgnoreCase(msgType, KMms) == 0 || + CompareIgnoreCase(msgType, KAms) == 0 || + CompareIgnoreCase(msgType, KSmart) == 0) + { + TPtrC temp = iEngine->RandomString(CCreatorEngine::EPhoneNumber); + toAddr = HBufC::NewL(temp.Length()); + CleanupStack::PushL(toAddr); + toAddr->Des().Copy(temp); + } + else + { + toAddr = iEngine->CreateEmailAddressLC(); + } + return toAddr; + } + +/* + * + */ +void CCreatorMessageElement::ExecuteCommandL() + { + LOGSTRING("Creator: CCreatorMessageElement::ExecuteCommandL"); + + // Find out the message type: + const CCreatorScriptAttribute* msgTypeAttr = this->FindAttributeByName(KType); + TPtrC msgType; + if( msgTypeAttr ) + { + msgType.Set(msgTypeAttr->Value()); + } + else + { + LOGSTRING("ERROR in CCreatorMessageElement::ExecuteCommandL: Type attribute is missing."); + User::Leave(KErrGeneral); // type is required attribute + } + + // Find out the amount of calendar entries: + const CCreatorScriptAttribute* msgAmountAttr = this->FindAttributeByName(KAmount); + TInt msgAmount = 1; + if( msgAmountAttr ) + { + msgAmount = ConvertStrToIntL(msgAmountAttr->Value()); + } + + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements (i.e the message field elements) + const RPointerArray& fields = fieldsElement->SubElements(); + + // Create message entries, the amount of entries is defined by msgAmount: + for( TInt cI = 0; cI < msgAmount; ++cI ) + { + CMessagesParameters* param = new (ELeave) CMessagesParameters; + CleanupStack::PushL(param); + + // Message type: + if( msgTypeAttr ) + { + SetMessageTypeL(*param, msgTypeAttr->Value()); + } + + // Loop all the message field elements: + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const RPointerArray& contactReferences = field->SubElements(); + const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName(KRandomLength); + const CCreatorScriptAttribute* amountAttr = field->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* increaseAttr = field->FindAttributeByName(KIncrease); + TBool increase( EFalse ); + if ( increaseAttr ) + { + increase = ConvertStrToBooleanL( increaseAttr->Value() ); + } + TInt fieldAmount = 1; + if( amountAttr ) + { + fieldAmount = ConvertStrToIntL(amountAttr->Value()); + } + + if( elemName == KTo ) + { + // Recipient ('to'-field) + for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex ) + { + if( (randomAttr || elemContent.Length() == 0 ) && contactReferences.Count() == 0 ) + { + // Random content + HBufC* toAddr = CreateMessageAddressLC(msgType); + if( toAddr ) + { + param->iRecipientAddressArray.AppendL(toAddr); + CleanupStack::Pop(); // toAddr + } + } + else + { + if( elemContent.Length() > 0 && contactReferences.Count() == 0) + { + // Explicit recipient given + HBufC* recipient = HBufC::NewL( elemContent.Length() + 3 ); + CleanupStack::PushL(recipient); + if ( increase ) + { + IncreasePhoneNumL( elemContent, cI, recipient ); + } + else + { + recipient->Des().Copy(elemContent); + } + param->iRecipientAddressArray.AppendL(recipient); + CleanupStack::Pop(); // recipient + } + else + { + // Recipients specified with contact-set-references (if any) + for( TInt csI = 0; csI < contactReferences.Count(); ++csI ) + { + CCreatorScriptElement* contactSetRef = contactReferences[csI]; + AppendContactSetReferenceL(*contactSetRef, param->iRecipientLinkIds); + } + } + } + } + } + else if( elemName == KFrom ) + { + // Sender ('from'-field) + // Amount attribute for sender is ignored, because there can be only one sender + delete param->iSenderAddress; + param->iSenderAddress = 0; + if( (randomAttr || elemContent.Length() == 0 ) && contactReferences.Count() == 0 ) + { + // Get random address + param->iSenderAddress = CreateMessageAddressLC(msgType); + CleanupStack::Pop(); // param->iSenderAddress + } + else + { + if( elemContent.Length() > 0 && contactReferences.Count() == 0) + { + // Explicit sender address given + param->iSenderAddress = HBufC::NewL(elemContent.Length()); + if ( increase ) + { + IncreasePhoneNumL( elemContent, cI, param->iSenderAddress ); + } + else + { + param->iSenderAddress->Des().Copy(elemContent); + } + } + else + { + // Senders specified with contact-set-references (if any) + for( TInt csI = 0; csI < contactReferences.Count(); ++csI ) + { + CCreatorScriptElement* contactSetRef = contactReferences[csI]; + AppendContactSetReferenceL(*contactSetRef, param->iSenderLinkIds); + } + } + } + } + else if( elemName == KFolder ) + { + // Folder type + if( CompareIgnoreCase(elemContent, KSent) == 0 ) + { + param->iFolderType = ESent; + } + else if( CompareIgnoreCase(elemContent, KInbox) == 0 ) + { + param->iFolderType = EInbox; + } + else if( CompareIgnoreCase(elemContent, KOutbox) == 0 ) + { + param->iFolderType = EOutbox; + } + else if( CompareIgnoreCase(elemContent, KDraft) == 0 ) + { + param->iFolderType = EDrafts; + } + } + else if( elemName == KSubject ) + { + // Message subject + delete param->iMessageSubject; + param->iMessageSubject = 0; + + if( randomAttr || elemContent.Length() == 0 ) + { + // Random data should be used + TPtrC temp = iEngine->RandomString(CCreatorEngine::EMessageSubject); + param->iMessageSubject = HBufC::NewL(temp.Length()); + param->iMessageSubject->Des().Copy(temp); + } + else + { + param->iMessageSubject = HBufC::NewL(elemContent.Length()); + param->iMessageSubject->Des().Copy(elemContent); + } + } + else if( elemName == KText ) + { + // Body text + delete param->iMessageBodyText; + param->iMessageBodyText = 0; + + if( randomAttr || elemContent.Length() == 0 ) + { + // Put random text: + if( randomAttr && randomAttr->Value() != KDefault ) + { + // Get the random length + TInt len = GetRandomBodyLengthL(randomAttr->Value(), msgTypeAttr->Value()); + if( len != KUndef ) + { + param->iMessageBodyText = iEngine->CreateRandomStringLC(len); + CleanupStack::Pop(); // param->iMessageBodyText + } + } + else + { + // Use default random data + TPtrC temp = iEngine->RandomString(CCreatorEngine::EMessageText); + param->iMessageBodyText = HBufC::NewL(temp.Length()); + param->iMessageBodyText->Des().Copy(temp); + } + } + else + { + param->iMessageBodyText = HBufC::NewL(elemContent.Length()); + param->iMessageBodyText->Des().Copy(elemContent); + } + } + else if( elemName == KAttachmentId ) + { + // Attachment file id + for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex ) + { + if( randomAttr || elemContent.Length() == 0) + { + //When type is AMS, attachement will be audio + if(param->iMessageType == EAMS) + { + param->iAttachments->AppendL(CCreatorEngine::EMP3_250kB); + } + //Otherwise attachement can be any file + else + { + //EJPEG_25kB is first (0) in the enum and LAST_FILE_ID is last in the enum, so real last item id is one before LAST_FILE_ID + param->iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); + } + } + else + { + //When user has been set attechment by it self, we trust user selection (not validating value, e.g. if message is SMS and there is attachement) + TInt id = iEngine->GetAttachmentIdL(elemContent); + if( id != KUndef ) + { + param->iAttachments->AppendL( id ); + } + } + } + } + // Attachment file path handling + //E.g. C:\data\others\DOC-20kB.doc + else if( elemName == KAttachmentPath ) + { + // Attachment file id + for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex ) + { + //Path is random, getting one of the files (not even using path attribute, but id with random) + if( randomAttr || elemContent.Length() == 0) + { + //EJPEG_25kB is first (0) in the enum and LAST_FILE_ID is last in the enum, so real last item id is one before LAST_FILE_ID + param->iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID -1) ); + } + //Otherwise adding attachement path as it is to paths. + else + { + //Adding Attachement file path + HBufC* elemData = elemContent.AllocLC(); + param->iAttachmentPaths.AppendL( elemData ); + CleanupStack::Pop(elemData); + } + } + } + else if ( elemName == KStatus ) + { + if( CompareIgnoreCase( elemContent, KNew ) == 0 ) + { + param->iCreateAsUnread = ETrue; + } + else if( CompareIgnoreCase( elemContent, KRead ) == 0 ) + { + param->iCreateAsUnread = EFalse; + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMessagesViaScript, param); + CleanupStack::Pop(); // param + } + } + else + { + for( TInt i = 0; i < msgAmount; ++i ) + { + TInt randMsg = 0; + if( msgType == KSms ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntrySMSInbox, ECmdCreateRandomEntrySMSSent); + else if( msgType == KMms ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryMMSInbox, ECmdCreateRandomEntryMMSSent); + else if( msgType == KAms ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryAMSInbox, ECmdCreateRandomEntryAMSSent); + else if( msgType == KEmail ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryEmailInbox, ECmdCreateRandomEntryEmailSent); + else if( msgType == KSmart ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryBIOInbox, ECmdCreateRandomEntryBIOSent); + else if( msgType == KBt ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryBTInbox, ECmdCreateRandomEntryBTSent); + else if( msgType == KIr ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryIRInbox, ECmdCreateRandomEntryIRSent); + + if( randMsg > 0 ) + { + iEngine->AppendToCommandArrayL(randMsg, 0, 1); + } + } + } + } + +// End of file diff -r 000000000000 -r d6fe6244b863 creator/src/creator_model.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_model.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,2554 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 //For Math + +#include "creator_model.h" +#include "creator_traces.h" +#include "creator_factory.h" +#include "creator_scriptparser.h" +#include "creator_appui.h" +#include "creator_app.h" // KUidCreatorApp +#include "creator_file.h" +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + #include "creator_contactsetcache.h" +#endif + +#include +#include +#include +#include + +_LIT(KTempPathDrive, "d"); +_LIT(KTempPath, ":\\Creator\\"); +_LIT(KSavingText, "Saving"); +_LIT(KDeletingText, "Deleting"); +const TInt KRegisterDrive = EDriveC; +_LIT(KRegisterFileName, "creator_created_items.dat"); + + +// --------------------------------------------------------------------------- + +CCreatorEngine* CCreatorEngine::NewL(CCreatorAppUi* aAppUi) + { + LOGSTRING("Creator: CCreatorEngine::NewL"); + CCreatorEngine* self = new(ELeave) CCreatorEngine; + CleanupStack::PushL(self); + self->ConstructL(aAppUi); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- + +CCreatorEngine::CCreatorEngine() +: +CActive(0) +{} + +// --------------------------------------------------------------------------- + +void CCreatorEngine::ConstructL(CCreatorAppUi* aAppUi) + { + LOGSTRING("Creator: CCreatorEngine::ConstructL"); + + iEnv = CEikonEnv::Static(); + User::LeaveIfError(iTimer.CreateLocal()); + + iAppUi = aAppUi; + + // these are needed by the random data generator + TTime now; + now.HomeTime(); + iSeed=now.Int64(); + + iTempPath = HBufC::NewL(KTempPathDrive().Length() + KTempPath().Length()); + iTempPath->Des().Copy(KTempPathDrive); + iTempPath->Des().Append(KTempPath); + + GetRandomDataFromFileL(KNullDesC); + + CActiveScheduler::Add(this); + + } + +// --------------------------------------------------------------------------- + +CCreatorEngine::~CCreatorEngine() + { + LOGSTRING("Creator: CCreatorEngine::~CCreatorEngine"); + + Cancel(); + + for( TInt i = 0; i < iStringArrays.Count(); ++i ) + { + delete iStringArrays[i].iArrayPtr; + } + iStringArrays.Close(); + iAllocatedFilePaths.ResetAndDestroy(); + iAllocatedFilePaths.Close(); + iTimer.Close(); + + delete iPictureFileArray; + delete iSoundFileArray; + delete iTempPath; + delete iFrameImageData; + delete iEncoder; + delete iScaler; + delete iDecoder; + delete iScaledBitmap; + delete iBitmap; + delete iBitmapData; + } + +void CCreatorEngine::CopyFileL(const TFileName& aSourceFile, const TFileName& aTargetFile, TBool aOverwrite ) + { + if( !aOverwrite && ConeUtils::FileExists(aTargetFile)) + { + // File already exists + return; + } + + // Make sure that the path exists. Creates the directory if it does not exist already: + ConeUtils::EnsurePathExistsL(aTargetFile); + User::LeaveIfError(BaflUtils::CopyFile(CEikonEnv::Static()->FsSession(), aSourceFile, aTargetFile)); + } +// --------------------------------------------------------------------------- + +void CCreatorEngine::ExecuteFirstCommandL(const TDesC& aText) + { + LOGSTRING("Creator: CCreatorEngine::ExecuteFirstCommand"); + + // init the progress bar + iProgressDialog = new(ELeave)CAknProgressDialog((reinterpret_cast(&iProgressDialog)), ETrue); + iProgressDialog->SetCallback(this); + iProgressDialog->PrepareLC(R_PROGRESS_NOTE); + iProgressDialog->SetCurrentLabelL( EAknCtNote, aText ); + iProgressInfo = iProgressDialog->GetProgressInfoL(); + iProgressInfo->SetFinalValue( CommandArrayCount() ); + iProgressDialog->RunLD(); + iProgressDialog->MakeVisible( ETrue ); + + iFailedCommands = 0; + + // starts executing commands + ExecuteCommand(); + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::ExecuteCommand() + { + LOGSTRING("Creator: CCreatorEngine::ExecuteCommand"); + + // make sure the engine isn't active, should never happen + __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("IsActive"), 500)); + + // execute a command after a very short delay (75ms) + iTimer.After(iStatus, 75); + SetActive(); + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::RunL() + { + LOGSTRING("Creator: CCreatorEngine::RunL"); + LOGSTRING2("Creator: CCreatorEngine::RunL iCommandId=%d", iCommandArray->At(iCurrentEntry).iCommandId); + + if ( iUserCancelled ) return; + + if (!iCommandArray->At(iCurrentEntry).iParameters) + { + LOGSTRING("Creator: CCreatorEngine::RunL - iParameters==NULL !"); + } + + // launch a command + + TCreatorIds cmd = (TCreatorIds)iCommandArray->At(iCurrentEntry).iCommandId; + switch( cmd ) + { + case ECmdCreateBrowserBookmarkEntries: { iBrowser->CreateBookmarkEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + case ECmdCreateBrowserBookmarkFolderEntries: { iBrowser->CreateBookmarkFolderEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + case ECmdCreateBrowserSavedPageEntries: { iBrowser->CreateSavedDeckEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + case ECmdCreateBrowserSavedPageFolderEntries: { iBrowser->CreateSavedDeckFolderEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + + case ECmdCreateCalendarEntryAppointments: { iCalendar->CreateAppointmentEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdCreateCalendarEntryEvents: { iCalendar->CreateEventEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdCreateCalendarEntryAnniversaries: { iCalendar->CreateAnniversaryEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdCreateCalendarEntryToDos: { iCalendar->CreateTodoEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdCreateCalendarEntryReminders: { iCalendar->CreateReminderEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + + + case ECmdCreatePhoneBookEntryContacts: { iPhonebook->CreateContactEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdCreatePhoneBookEntryGroups: { iPhonebook->CreateGroupEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdCreatePhoneBookEntrySubscribedContacts: { iPhonebook->CreateSubscribedContactEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + + case ECmdCreateMiscEntryNotes: { iNotepad->CreateNoteEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + + case ECmdCreateLogEntryMissedCalls: { iLogs->CreateMissedCallEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + case ECmdCreateLogEntryReceivedCalls: { iLogs->CreateReceivedCallEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + case ECmdCreateLogEntryDialledNumbers: { iLogs->CreateDialledNumberEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + + case ECmdCreateMiscEntryAccessPoints: { iAccessPoints->CreateConnectionSettingsEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break; + case ECmdDeleteIAPs: { iAccessPoints->DeleteAllL(); } break; + case ECmdDeleteCreatorIAPs: { iAccessPoints->DeleteAllCreatedByCreatorL(); } break; + + case ECmdCreateMiscEntryLandmarks: { iLandmarks->CreateLandmarkEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + + case ECmdCreateMessagingEntryMailboxes: { iMailboxes->CreateMailboxEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + + #ifdef __PRESENCE + case ECmdCreateMiscEntryIMPSServers: { iIMPS->CreateIMPSServerEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + #endif + + case ECmdCreateMessagingEntryMessages: { iMessages->CreateMessageEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters), ETrue); } break; + case ECmdCreateMessagingEntryMessagesViaScript: { iMessages->CreateMessageEntryL(reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters)); } break; + + case ECmdCreateRandomEntrySMSInbox: + case ECmdCreateRandomEntrySMSDrafts: + case ECmdCreateRandomEntrySMSOutbox: + case ECmdCreateRandomEntrySMSSent: + case ECmdCreateRandomEntryMMSInbox: + case ECmdCreateRandomEntryMMSDrafts: + case ECmdCreateRandomEntryMMSOutbox: + case ECmdCreateRandomEntryMMSSent: + case ECmdCreateRandomEntryAMSInbox: + case ECmdCreateRandomEntryAMSDrafts: + case ECmdCreateRandomEntryAMSOutbox: + case ECmdCreateRandomEntryAMSSent: + case ECmdCreateRandomEntryEmailInbox: + case ECmdCreateRandomEntryEmailDrafts: + case ECmdCreateRandomEntryEmailOutbox: + case ECmdCreateRandomEntryEmailSent: + case ECmdCreateRandomEntryBIOInbox: + case ECmdCreateRandomEntryBIODrafts: + case ECmdCreateRandomEntryBIOOutbox: + case ECmdCreateRandomEntryBIOSent: + case ECmdCreateRandomEntryIRInbox: + case ECmdCreateRandomEntryIRDrafts: + case ECmdCreateRandomEntryIROutbox: + case ECmdCreateRandomEntryIRSent: + case ECmdCreateRandomEntryBTInbox: + case ECmdCreateRandomEntryBTDrafts: + case ECmdCreateRandomEntryBTOutbox: + case ECmdCreateRandomEntryBTSent: + { iMessages->CreateRandomMessageEntryL(iCommandArray->At(iCurrentEntry).iCommandId); } break; + + case ECmdCreateFileEntryEmptyFolder: + case ECmdCreateFileEntry3GPP_70kB: + case ECmdCreateFileEntryAAC_100kB: + case ECmdCreateFileEntryAMR_20kB: + case ECmdCreateFileEntryBMP_25kB: + case ECmdCreateFileEntryDeck_1kB: + case ECmdCreateFileEntryDOC_20kB: + case ECmdCreateFileEntryGIF_2kB: + case ECmdCreateFileEntryHTML_20kB: + case ECmdCreateFileEntryJAD_1kB: + case ECmdCreateFileEntryJAR_10kB: + case ECmdCreateFileEntryJP2_65kB: + case ECmdCreateFileEntryJPEG_200kB: + case ECmdCreateFileEntryJPEG_25kB: + case ECmdCreateFileEntryJPEG_500kB: + case ECmdCreateFileEntryMIDI_10kB: + case ECmdCreateFileEntryMP3_250kB: + case ECmdCreateFileEntryMP4_200kB: + case ECmdCreateFileEntryMXMF_40kB: + case ECmdCreateFileEntryPNG_15kB: + case ECmdCreateFileEntryPPT_40kB: + case ECmdCreateFileEntryRAM_1kB: + case ECmdCreateFileEntryRM_95kB: + case ECmdCreateFileEntryRNG_1kB: + case ECmdCreateFileEntrySVG_15kB: + case ECmdCreateFileEntrySWF_15kB: + case ECmdCreateFileEntryTIF_25kB: + case ECmdCreateFileEntryTXT_10kB: + case ECmdCreateFileEntryTXT_70kB: + case ECmdCreateFileEntryVCF_1kB: + case ECmdCreateFileEntryVCS_1kB: + case ECmdCreateFileEntryWAV_20kB: + case ECmdCreateFileEntryXLS_15kB: + case ECmdCreateFileEntrySISX_10kB: + case ECmdCreateFileEntryWMA_50kB: + case ECmdCreateFileEntryWMV_200kB: + { iFiles->CreateFileEntryL( reinterpret_cast(iCommandArray->At(iCurrentEntry).iParameters), iCommandArray->At(iCurrentEntry).iCommandId ); } break; + case ECmdDeleteContacts: + { + iPhonebook->DeleteAllL(); + break; + } + case ECmdDeleteContactGroups: + { + iPhonebook->DeleteAllGroupsL(); + break; + } + case ECmdDeleteCreatorContacts: + { + iPhonebook->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteCreatorContactGroups: + { + iPhonebook->DeleteAllGroupsCreatedByCreatorL(); + break; + } + case ECmdDeleteCalendarEntries: + { + iCalendar->DeleteAllL(); + break; + } + case ECmdDeleteCreatorCalendarEntries: + { + iCalendar->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteLogs: + { + iLogs->DeleteAllL(); + break; + } + case ECmdDeleteCreatorLogs: + { + iLogs->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteMessages: + { + iMessages->DeleteAllL(); + break; + } + case ECmdDeleteCreatorMessages: + { + iMessages->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteLandmarks: + { + iLandmarks->DeleteAllL(); + break; + } + case ECmdDeleteCreatorLandmarks: + { + iLandmarks->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteMailboxes: + { + iMailboxes->DeleteAllL(); + break; + } + case ECmdDeleteCreatorMailboxes: + { + iMailboxes->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteNotes: + { + iNotepad->DeleteAllL(); + break; + } + case ECmdDeleteIMPSs: + { + iIMPS->DeleteAllL(); + break; + } + case ECmdDeleteCreatorIMPSs: + { + iIMPS->DeleteAllCreatedByCreatorL(); + break; + } + case ECmdDeleteBrowserBookmarks: + { + iBrowser->DeleteAllBookmarksL(); + break; + } + case ECmdDeleteCreatorBrowserBookmarks: + { + iBrowser->DeleteAllBookmarksCreatedByCreatorL(); + break; + } + case ECmdDeleteBrowserBookmarkFolders: + { + iBrowser->DeleteAllBookmarkFoldersL(); + break; + } + case ECmdDeleteCreatorBrowserBookmarkFolders: + { + iBrowser->DeleteAllBookmarkFoldersCreatedByCreatorL(); + break; + } + case ECmdDeleteBrowserSavedPages: + { + iBrowser->DeleteAllSavedPagesL(); + break; + } + case ECmdDeleteCreatorBrowserSavedPages: + { + iBrowser->DeleteAllSavedPagesCreatedByCreatorL(); + break; + } + case ECmdDeleteBrowserSavedPageFolders: + { + iBrowser->DeleteAllSavedPageFoldersL(); + break; + } + case ECmdDeleteCreatorBrowserSavedPageFolders: + { + iBrowser->DeleteAllSavedPageFoldersCreatedByCreatorL(); + break; + } + case ECmdDeleteCreatorFiles: + { + iFiles->DeleteAllCreatedByCreatorL(); + break; + } + default: + User::Panic (_L("ExecuteOptionsMenuCommandL"), 205); + break; + } + + TRAP_IGNORE( CheckForMoreCommandsL() ); + + } + +CDesCArrayFlat* CCreatorEngine::PictureFilesL() + { + if( iPictureFileArray == 0 ) + { + _LIT(KImageFile, "JPEG*.jpg"); + _LIT(KImageFileDir, "C:\\Data\\"); + _LIT(KImageFileDir2, "Z:\\Data\\"); + iPictureFileArray = new (ELeave) CDesCArrayFlat(8); + TInt err = CreatorFileUtils::FindFilesRecursiveL(iPictureFileArray, KImageFile, KImageFileDir); + if( iPictureFileArray->Count() == 0 ) + { + err = CreatorFileUtils::FindFilesRecursiveL(iPictureFileArray, KImageFile, KImageFileDir2); + } + } + return iPictureFileArray; + } + +CDesCArrayFlat* CCreatorEngine::SoundFilesL() + { + if( iSoundFileArray == 0 ) + { + _LIT(KSoundFile, "*.aac"); + _LIT(KSoundFileDir, "Z:\\data\\Sounds\\"); + iSoundFileArray = new (ELeave) CDesCArrayFlat(8); + TInt err = CreatorFileUtils::FindFilesRecursiveL(iSoundFileArray, KSoundFile, KSoundFileDir); + } + return iSoundFileArray; + } +// --------------------------------------------------------------------------- + +TInt CCreatorEngine::RunError(TInt aError) + { + LOGSTRING2("Creator: CCreatorEngine::RunError %d", aError); + + iFailedCommands++; + + _LIT(KMessage, "Command error %d"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, aError); + iEnv->InfoMsg(noteMsg); + + TRAP_IGNORE( CheckForMoreCommandsL() ); + + return KErrNone; + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::CheckForMoreCommandsL() + { + LOGSTRING("Creator: CCreatorEngine::CheckForMoreCommandsL"); + if ( iUserCancelled ) return; + // update the progress bar + iProgressInfo->IncrementAndDraw(1); + + // check if we have more commands to be executed + if (iCurrentEntry >= CommandArrayCount() - 1) + { + LOGSTRING("Creator: CCreatorEngine::CheckForMoreCommandsL all done"); + + // all done, free resources and show a note + ShutDownEnginesL(); + + iProgressDialog->ProcessFinishedL(); + + if (iFailedCommands == 0) + { + _LIT(KMessage, "Done"); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(KMessage); + } + else + { + _LIT(KMessage, "Done, %d commands failed"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, iFailedCommands); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(noteMsg); + } + + iAppUi->RunScriptDone(); + + } + else + { + // maintain requests + iCurrentEntry++; + + LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry); + + ExecuteCommand(); + } + } + +// --------------------------------------------------------------------------- + +// This callback function is called when cancel button of the progress bar was pressed +void CCreatorEngine::DialogDismissedL(TInt aButtonId) + { + LOGSTRING("Creator: CCreatorEngine::DialogDismissedL"); + + // check if cancel button was pressed + if (aButtonId == EAknSoftkeyCancel) + { + iUserCancelled = ETrue; + // cancel the active object, command executer + Cancel(); + + // delete parameters from the command array, otherwise there might be memory leaks + for (TInt i=iCurrentEntry; iAt(i).iParameters ) + delete iCommandArray->At(i).iParameters; + iCommandArray->At(i).iParameters = NULL; + } + + if ( iPhonebook && iPhonebook->IsActive() ) + { + // virtual phonebook is known to require asynchronous + // cancelling of operation + iPhonebook->CancelOperation(); + } + else if ( iDecoder ) + { + iDecoder->Cancel(); + // CancelComplete() will be called from GenerateSourceImageFileL + } + else if ( iScaler ) + { + iScaler->Cancel(); + // CancelComplete() will be called from GenerateSourceImageFileL + } + else if ( iEncoder ) + { + iEncoder->Cancel(); + // CancelComplete() will be called from GenerateSourceImageFileL + } + else + { + // free resources and show a note + ShutDownEnginesL(); + + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("Cancelled")); + } + } + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::StartEnginesL() + { + LOGSTRING("Creator: CCreatorEngine::StartEnginesL"); + + // reset user cancel flag + iUserCancelled = EFalse; + + // start from the beginning + iCurrentEntry = 0; + + // we'll retrieve a correct number for this later + iEntriesToBeCreated = 0; + + // init the command array + __ASSERT_ALWAYS(!iCommandArray, User::Panic(_L("iCommandArray"), 701)); + iCommandArray = new(ELeave) CCommandArray(10000); + + // init all modules here + TInt err(KErrNone); + TRAP(err, iBrowser = CCreatorBrowser::NewL(this)); + TRAP(err, iCalendar = CCreatorInterimCalendar::NewL(this)); + TRAP(err, iPhonebook = (CCreatorPhonebookBase*)TCreatorFactory::CreatePhoneBookL(this)); + TRAP(err, iNotepad = CCreatorNotepad::NewL(this)); + TRAP(err, iLogs = CCreatorLogs::NewL(this)); + TRAP(err, iAccessPoints = (CCreatorConnectionSettingsBase*)TCreatorFactory::CreateConnectionSettingsL(this)); + TRAP(err, iMailboxes = CCreatorMailboxes::NewL(this)); + TRAP(err, iFiles = CCreatorFiles::NewL(this)); + TRAP(err, iMessages = CCreatorMessages::NewL(this)); + TRAP(err, iLandmarks = CCreatorLandmarks::NewL(this)); + + #ifdef __PRESENCE + TRAP(err, iIMPS = CCreatorIMPS::NewL(this)); + #endif + + + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + // Initialize contact-set cache: + ContactLinkCache::InitializeL(); +#endif + // ... + // ... + // ... + + } +// --------------------------------------------------------------------------- + +void CCreatorEngine::ShutDownEnginesL() + { + LOGSTRING("Creator: CCreatorEngine::ShutDownEnginesL"); + + + // delete all modules here and free resources which aren't anymore needed + + + #ifdef __PRESENCE + delete iIMPS; + iIMPS = NULL; + #endif + + delete iMessages; + iMessages = NULL; + delete iFiles; + iFiles = NULL; + delete iMailboxes; + iMailboxes = NULL; + delete iAccessPoints; + iAccessPoints = NULL; + delete iLogs; + iLogs = NULL; + delete iNotepad; + iNotepad = NULL; + delete iPhonebook; + iPhonebook = NULL; + delete iCalendar; + iCalendar = NULL; + delete iBrowser; + iBrowser = NULL; + delete iLandmarks; + iLandmarks = NULL; + + // ... + // ... + // ... + + + // now delete the command array + delete iCommandArray; + iCommandArray = NULL; + + + iParameterArray.ResetAndDestroy(); + iParameterArray.Close(); + + + // clear temp drive + CFileMan* fileMan = CFileMan::NewL( iEnv->FsSession() ); + CleanupStack::PushL( fileMan ); + fileMan->RmDir( iTempPath->Des() ); + CleanupStack::PopAndDestroy(); //fileMan + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + // Cleanup the contact-set cache: + ContactLinkCache::DestroyL(); +#endif + + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::DoCancel() + { + LOGSTRING("Creator: CCreatorEngine::DoCancel"); + + iTimer.Cancel(); + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::RunScriptL() + { + LOGSTRING("Creator: CCreatorEngine::RunScriptL"); + + // startup modules (also inits the command array): + StartEnginesL(); + + // use the command parser module to init the command array from a script file + CCommandParser* commandParser = CCommandParser::NewLC(this); + RFile scriptFile; + TBool ret = commandParser->OpenScriptL(scriptFile); + CleanupClosePushL(scriptFile); + if( ret ) + { + // wait dialog + CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); + waitDialog->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL ); + TInt dialogId = waitDialog->ShowNoteL( EAknGlobalWaitNote, _L("Parsing") ); + + TInt parseErr( KErrNone ); + TRAPD( parserErr, + CCreatorScriptParser* scriptParser = CCreatorScriptParser::NewLC(this); + scriptParser->ParseL(scriptFile); + parseErr = scriptParser->GetError(); + CleanupStack::PopAndDestroy( scriptParser ); + ); + waitDialog->CancelNoteL( dialogId ); + CleanupStack::PopAndDestroy( waitDialog ); + User::LeaveIfError( parserErr ); + + if(parseErr != KErrNone) + { + // show error note + CAknErrorNote* note = new (ELeave) CAknErrorNote; + _LIT(KErrMsg, "Parser error: %d"); + TBuf<32> msgBuf; + msgBuf.Format(KErrMsg, parseErr); + note->ExecuteLD(msgBuf); + CleanupStack::PopAndDestroy(); //commandParser + ShutDownEnginesL(); + return; + } + } + CleanupStack::PopAndDestroy( &scriptFile ); + CleanupStack::PopAndDestroy( commandParser ); + + // start executing commands if commands in the command array + if (CommandArrayCount() > 0) + { + ExecuteFirstCommandL( KSavingText ); + } + else + { + ShutDownEnginesL(); + } + + } +/* +void CCreatorEngine::RunScriptL() + { + LOGSTRING("Creator: CCreatorEngine::RunScriptL"); + + // startup modules (also inits the command array): + StartEnginesL(); + + // use the command parser module to init the command array from a script file + CCommandParser* commandParser = CCommandParser::NewLC(this); + commandParser->OpenScriptL(); + + CleanupStack::PopAndDestroy(); //commandExecuter + + // start executing commands if commands in the command array + if (CommandArrayCount() > 0) + { + ExecuteFirstCommandL(KSavingText); + } + else + { + ShutDownEnginesL(); + } + + } + +*/ + +// --------------------------------------------------------------------------- + +TInt CCreatorEngine::RunScriptL(const TDesC& aScriptFile) + { + LOGSTRING("Creator: CCreatorEngine::RunScriptL"); + + // startup modules (also inits the command array): + StartEnginesL(); + + RFile scriptFile; + if (scriptFile.Open(CEikonEnv::Static()->FsSession(), aScriptFile, EFileRead) != KErrNone) + { + ShutDownEnginesL(); + return KErrNotFound; // file error + } + + CleanupClosePushL(scriptFile); + CCreatorScriptParser* scriptParser = CCreatorScriptParser::NewLC(this); + scriptParser->ParseL(scriptFile); + TInt err = scriptParser->GetError(); + CleanupStack::PopAndDestroy(); //scriptParser + CleanupStack::Pop(); // scriptFile + scriptFile.Close(); + + if (err != KErrNone) + { + ShutDownEnginesL(); + return KErrCorrupt; // parser error + } + + // start executing commands if commands in the command array + if (CommandArrayCount() > 0) + { + ExecuteFirstCommandL( KSavingText ); + return KErrNone; // executing commands is started + } + else + { + ShutDownEnginesL(); + return KErrCompletion; // nothing to do + } + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::ExecuteOptionsMenuCommandL(TInt aCommand) + { + LOGSTRING("Creator: CCreatorEngine::ExecuteOptionsMenuCommandL"); + + // startup modules (also inits the command array): + StartEnginesL(); + + // set the home module + switch(aCommand) + { + case ECmdCreateBrowserBookmarkEntries: + case ECmdCreateBrowserBookmarkFolderEntries: + case ECmdCreateBrowserSavedPageEntries: + case ECmdCreateBrowserSavedPageFolderEntries: + case ECmdDeleteBrowserBookmarks: + case ECmdDeleteBrowserBookmarkFolders: + case ECmdDeleteBrowserSavedPages: + case ECmdDeleteBrowserSavedPageFolders: + case ECmdDeleteCreatorBrowserBookmarks: + case ECmdDeleteCreatorBrowserBookmarkFolders: + case ECmdDeleteCreatorBrowserSavedPages: + case ECmdDeleteCreatorBrowserSavedPageFolders: + { + iUsedOptionsMenuModule = iBrowser; + } + break; + + case ECmdCreateCalendarEntryAppointments: + case ECmdCreateCalendarEntryEvents: + case ECmdCreateCalendarEntryAnniversaries: + case ECmdCreateCalendarEntryToDos: + case ECmdCreateCalendarEntryReminders: + case ECmdDeleteCalendarEntries: + case ECmdDeleteCreatorCalendarEntries: + { + iUsedOptionsMenuModule = iCalendar; + } + break; + + case ECmdCreatePhoneBookEntryContacts: + case ECmdCreatePhoneBookEntryGroups: + case ECmdCreatePhoneBookEntrySubscribedContacts: + case ECmdDeleteContacts: + case ECmdDeleteCreatorContacts: + case ECmdDeleteContactGroups: + case ECmdDeleteCreatorContactGroups: + { + iUsedOptionsMenuModule = iPhonebook; + } + break; + + case ECmdCreateMiscEntryNotes: + case ECmdDeleteNotes: + { + iUsedOptionsMenuModule = iNotepad; + } + break; + + case ECmdCreateLogEntryMissedCalls: + case ECmdCreateLogEntryReceivedCalls: + case ECmdCreateLogEntryDialledNumbers: + case ECmdDeleteLogs: + case ECmdDeleteCreatorLogs: + { + iUsedOptionsMenuModule = iLogs; + } + break; + + case ECmdCreateMiscEntryAccessPoints: + case ECmdDeleteIAPs: + case ECmdDeleteCreatorIAPs: + { + iUsedOptionsMenuModule = iAccessPoints; + } + break; + + case ECmdCreateMessagingEntryMailboxes: + case ECmdDeleteMailboxes: + case ECmdDeleteCreatorMailboxes: + { + iUsedOptionsMenuModule = iMailboxes; + } + break; + + #ifdef __PRESENCE + case ECmdCreateMiscEntryIMPSServers: + case ECmdDeleteIMPSs: + case ECmdDeleteCreatorIMPSs: + { + iUsedOptionsMenuModule = iIMPS; + } + break; + #endif + + case ECmdCreateFileEntryEmptyFolder: + case ECmdCreateFileEntry3GPP_70kB: + case ECmdCreateFileEntryAAC_100kB: + case ECmdCreateFileEntryAMR_20kB: + case ECmdCreateFileEntryBMP_25kB: + case ECmdCreateFileEntryDeck_1kB: + case ECmdCreateFileEntryDOC_20kB: + case ECmdCreateFileEntryGIF_2kB: + case ECmdCreateFileEntryHTML_20kB: + case ECmdCreateFileEntryJAD_1kB: + case ECmdCreateFileEntryJAR_10kB: + case ECmdCreateFileEntryJP2_65kB: + case ECmdCreateFileEntryJPEG_200kB: + case ECmdCreateFileEntryJPEG_25kB: + case ECmdCreateFileEntryJPEG_500kB: + case ECmdCreateFileEntryMIDI_10kB: + case ECmdCreateFileEntryMP3_250kB: + case ECmdCreateFileEntryMP4_200kB: + case ECmdCreateFileEntryMXMF_40kB: + case ECmdCreateFileEntryPNG_15kB: + case ECmdCreateFileEntryPPT_40kB: + case ECmdCreateFileEntryRAM_1kB: + case ECmdCreateFileEntryRM_95kB: + case ECmdCreateFileEntryRNG_1kB: + case ECmdCreateFileEntrySVG_15kB: + case ECmdCreateFileEntrySWF_15kB: + case ECmdCreateFileEntryTIF_25kB: + case ECmdCreateFileEntryTXT_10kB: + case ECmdCreateFileEntryTXT_70kB: + case ECmdCreateFileEntryVCF_1kB: + case ECmdCreateFileEntryVCS_1kB: + case ECmdCreateFileEntryWAV_20kB: + case ECmdCreateFileEntryXLS_15kB: + case ECmdCreateFileEntrySISX_10kB: + case ECmdCreateFileEntryWMA_50kB: + case ECmdCreateFileEntryWMV_200kB: + case ECmdDeleteCreatorFiles: + + { + iUsedOptionsMenuModule = iFiles; + } + break; + + + case ECmdCreateMessagingEntryMessages: + case ECmdDeleteMessages: + case ECmdDeleteCreatorMessages: + { + iUsedOptionsMenuModule = iMessages; + } + break; + + case ECmdCreateMiscEntryLandmarks: + case ECmdDeleteLandmarks: + case ECmdDeleteCreatorLandmarks: + { + iUsedOptionsMenuModule = iLandmarks; + } + break; + case ECmdDeleteAllEntries: + case ECmdDeleteAllCreatorEntries: + { + break; + } + default: + User::Panic (_L("ExecuteOptionsMenuCommandL"), 201); + break; + } + + + //If it's a delete command, asking do you really want to delete + if( IsDeleteCommand( aCommand ) ) + { + if ( aCommand == ECmdDeleteAllEntries ) + { + if ( YesNoQueryDialogL( _L("Delete all entries?") ) ) + { + AppendToCommandArrayL( ECmdDeleteContacts, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteContactGroups, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCalendarEntries, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteBrowserBookmarks, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteBrowserBookmarkFolders, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteBrowserSavedPages, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteBrowserSavedPageFolders, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteLogs, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteMessages, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteIAPs, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteIMPSs, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteNotes, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteLandmarks, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorFiles, NULL, 1 ); + + // started exucuting delete commands + ExecuteFirstCommandL( KDeletingText ); + } + else + { + // cancelled, free resources + ShutDownEnginesL(); + } + } + else if ( aCommand == ECmdDeleteAllCreatorEntries ) + { + if ( YesNoQueryDialogL( _L("Delete all entries created with Creator?") ) ) + { + AppendToCommandArrayL( ECmdDeleteCreatorContacts, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorContactGroups, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorCalendarEntries, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorBrowserBookmarks, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorBrowserBookmarkFolders, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorBrowserSavedPages, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorBrowserSavedPageFolders, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorFiles, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorLogs, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorMessages, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorIAPs, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorIMPSs, NULL, 1 ); + AppendToCommandArrayL( ECmdDeleteCreatorLandmarks, NULL, 1 ); + + // started exucuting delete commands + ExecuteFirstCommandL( KDeletingText ); + } + else + { + // cancelled, free resources + ShutDownEnginesL(); + } + } + else if ( iUsedOptionsMenuModule->AskDataFromUserL( aCommand, iEntriesToBeCreated ) ) + { + // add this command to command array + AppendToCommandArrayL( aCommand, NULL, 1 ); + + // started exucuting commands + ExecuteFirstCommandL( KDeletingText ); + } + else + { + // cancelled, free resources + ShutDownEnginesL(); + } + } + + // ask user data, if query accepted start processing... + else if (iUsedOptionsMenuModule->AskDataFromUserL(aCommand, iEntriesToBeCreated)) + { + // add this command to command array + AppendToCommandArrayL(aCommand, NULL, iEntriesToBeCreated); + + // started exucuting commands + ExecuteFirstCommandL( KSavingText ); + } + else + { + // cancelled, free resources + ShutDownEnginesL(); + } + } + + + +TBool CCreatorEngine::IsDeleteCommand(TInt aCommand) + { + LOGSTRING("Creator: CCreatorEngine::IsDeleteCommand"); + + switch(aCommand) + { + //Add supported delete command here + case ECmdDeleteAllEntries: + case ECmdDeleteAllCreatorEntries: + case ECmdDeleteEntries: + case ECmdDeleteContacts: + case ECmdDeleteCreatorContacts: + case ECmdDeleteContactGroups: + case ECmdDeleteCreatorContactGroups: + case ECmdDeleteCalendarEntries: + case ECmdDeleteCreatorCalendarEntries: + case ECmdDeleteBrowserBookmarks: + case ECmdDeleteCreatorBrowserBookmarks: + case ECmdDeleteBrowserBookmarkFolders: + case ECmdDeleteCreatorBrowserBookmarkFolders: + case ECmdDeleteBrowserSavedPages: + case ECmdDeleteCreatorBrowserSavedPages: + case ECmdDeleteBrowserSavedPageFolders: + case ECmdDeleteCreatorBrowserSavedPageFolders: + case ECmdDeleteCreatorFiles: + case ECmdDeleteLogs: + case ECmdDeleteCreatorLogs: + case ECmdDeleteMessages: + case ECmdDeleteCreatorMessages: + case ECmdDeleteMailboxes: + case ECmdDeleteCreatorMailboxes: + case ECmdDeleteIAPs: + case ECmdDeleteCreatorIAPs: + case ECmdDeleteIMPSs: + case ECmdDeleteCreatorIMPSs: + case ECmdDeleteNotes: + case ECmdDeleteLandmarks: + case ECmdDeleteCreatorLandmarks: + { + return ETrue; + } + default: + { + return EFalse; + } + } + + } + +// --------------------------------------------------------------------------- + +TBool CCreatorEngine::GetRandomDataFilenameL(TDes& aFilename) + { + CCommandParser* commandParser = CCommandParser::NewLC(this); + TBool ret = commandParser->GetRandomDataFilenameL(aFilename); + CleanupStack::PopAndDestroy(commandParser); + return ret; + } + +// --------------------------------------------------------------------------- + +TBool CCreatorEngine::GetRandomDataFromFileL(const TDesC& aFilename) + { + // wait dialog + CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); + waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_CANCEL); + TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Reading random data")); + + for (TInt i = 0; i < iStringArrays.Count(); ++i) + { + delete iStringArrays[i].iArrayPtr; + } + iStringArrays.Reset(); + + TBool errorDetected = EFalse; + + // NOTE: These must be exactly in same order as in enumeration: + + if (ReadRandomDataL(EFirstName, R_DATA_FIRSTNAMES, aFilename, CCreatorRandomDataParser::EFirstName) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ESurname, R_DATA_SURNAMES, aFilename, CCreatorRandomDataParser::ESurname) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ECompany, R_DATA_COMPANIES, aFilename, CCreatorRandomDataParser::ECompany) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EAddress, R_DATA_ADDRESSES, aFilename, CCreatorRandomDataParser::EAddress) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EJobTitle, R_DATA_JOBTITLES, aFilename, CCreatorRandomDataParser::EJobTitle) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EPhoneNumber, R_DATA_PHONENUMBERS, aFilename, CCreatorRandomDataParser::EPhoneNumber) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EGroupName, R_DATA_GROUPNAMES, aFilename, CCreatorRandomDataParser::EGroupName) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EMeetingReason, R_DATA_MEETINGREASONS, aFilename, CCreatorRandomDataParser::EMeetingReason) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EMeetingPlace, R_DATA_MEETINGPLACES, aFilename, CCreatorRandomDataParser::EMeetingPlace) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EMemoText, R_DATA_MEMOS, aFilename, CCreatorRandomDataParser::EMemoText) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EAnniversaryReason, R_DATA_ANNIVERSARIES, aFilename, CCreatorRandomDataParser::EAnniversaryReason) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EToDoText, R_DATA_TODOS, aFilename, CCreatorRandomDataParser::EToDoText) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EReminderText, R_DATA_REMINDERS, aFilename, CCreatorRandomDataParser::EReminderText) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EMessageSubject, R_DATA_MESSAGESUBJECTS, aFilename, CCreatorRandomDataParser::EMessageSubject) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EMessageText, R_DATA_MESSAGETEXTS, aFilename, CCreatorRandomDataParser::EMessageText) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ECity, R_DATA_CITIES, aFilename, CCreatorRandomDataParser::ECity) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ECountry, R_DATA_COUNTRIES, aFilename, CCreatorRandomDataParser::ECountry) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EPostcode, R_DATA_POSTCODES, aFilename, CCreatorRandomDataParser::EPostcode) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EState, R_DATA_STATES, aFilename, CCreatorRandomDataParser::EState) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EPobox, R_DATA_POBOXES, aFilename, CCreatorRandomDataParser::EPobox) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(EPrefix, R_DATA_PREFIXES, aFilename, CCreatorRandomDataParser::EPrefix) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ESuffix, R_DATA_SUFFIXES, aFilename, CCreatorRandomDataParser::ESuffix) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ELandmarkName, R_DATA_LANDMARK_NAMES, aFilename, CCreatorRandomDataParser::ELandmarkName) != KErrNone) + { + errorDetected = ETrue; + } + if (ReadRandomDataL(ELandmarkDescription, R_DATA_LANDMARK_DESCRIPTIONS, aFilename, CCreatorRandomDataParser::ELandmarkDescription) != KErrNone) + { + errorDetected = ETrue; + } + + // remove the wait dialog + waitDialog->CancelNoteL(dialogId); + CleanupStack::PopAndDestroy(waitDialog); + + if (errorDetected) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Error in reading random data.")); + } + + return !errorDetected; + } + +// --------------------------------------------------------------------------- + +TInt CCreatorEngine::ReadRandomDataL(const TRandomStringType aRandomStringType, + const TInt aResourceId, + const TDesC& aFilename, + const CCreatorRandomDataParser::TRandomDataType aRandomDataType) + { + TInt error = KErrNone; + if (aFilename == KNullDesC) + { + iStringArrays.AppendL(TStringArrayPtr(aRandomStringType, iEnv->ReadDesCArrayResourceL(aResourceId))); + } + else + { + CCreatorRandomDataParser* dataParser = CCreatorRandomDataParser::NewLC(); + CDesCArrayFlat* array = NULL; + + TRAP(error, array = dataParser->ParseL(aFilename, aRandomDataType)); + if (error == KErrNone) + { + error = dataParser->GetError(); + } + if ((error == KErrNone) && (array->MdcaCount() > 0)) + { + iStringArrays.AppendL(TStringArrayPtr(aRandomStringType, array)); + } + else + { + if (array) + { + array->Reset(); + delete array; + } + iStringArrays.AppendL(TStringArrayPtr(aRandomStringType, iEnv->ReadDesCArrayResourceL(aResourceId))); + } + CleanupStack::PopAndDestroy(dataParser); + } + return error; + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorEngine::AppendToCommandArrayL"); + iParameterArray.AppendL(aParameters); + + for (TInt i=0; iAppendL( TCommand(aCommand, aParameters) ); + } + +// --------------------------------------------------------------------------- + +TInt CCreatorEngine::CommandArrayCount() + { + TInt count(0); + + if (iCommandArray) + count = iCommandArray->Count(); + + LOGSTRING2("Creator: CCreatorEngine::CommandArrayCount returns %d", count); + + return count; + } + +// --------------------------------------------------------------------------- + +//returs fileid by its name, eg. 1 in +TInt CCreatorEngine::GetAttachmentIdL( const TDesC& aAttachmentIdStr ) const + { + TInt mapCount = sizeof(FileMap) / sizeof(FileMapping); + + for( TInt i = 0; i < mapCount; ++i ) + { + if( FileMap[i].FileName() == aAttachmentIdStr ) + return FileMap[i].FileId(); + } + LOGSTRING2("CCreatorEngine::GetAttachmentIdL: Unknown attachment file id: %s", &aAttachmentIdStr); + User::Leave(KErrGeneral); + return KErrNotFound; // Not reached, but disables a compiler warning + } + +// --------------------------------------------------------------------------- + +// returns a random string from the resource files +TPtrC CCreatorEngine::TestDataPathL (enum TTestDataPath aTestDataPath ) + { + LOGSTRING("Creator: CCreatorEngine::TestDataPathL"); + + TFileName filePath; + + switch (aTestDataPath ) + { + case ESavedDeck_1kB: + { + filePath.Copy (_L("Deck-1kB.saveddeck") ); + } + break; + + case EJPEG_25kB: + { + filePath.Copy (_L("JPEG-25kB.jpg") ); + } + break; + + case EJPEG_200kB: + { + filePath.Copy (_L("JPEG-200kB.jpg") ); + } + break; + + case EJPEG_500kB: + { + filePath.Copy (_L("JPEG-500kB.jpg") ); + } + break; + + case EPNG_15kB: + { + filePath.Copy (_L("PNG-15kB.png") ); + } + break; + + case EGIF_2kB: + { + filePath.Copy (_L("GIF-2kB.gif") ); + } + break; + + case ERNG_1kB: + { + filePath.Copy (_L("RNG-1kB.rng") ); + } + break; + + case EMIDI_10kB: + { + filePath.Copy (_L("MIDI-10kB.mid") ); + } + break; + + case EWAVE_20kB: + { + filePath.Copy (_L("WAV-20kB.wav") ); + } + break; + + case EAMR_20kB: + { + filePath.Copy (_L("AMR-20kB.amr") ); + } + break; + + case EExcel_15kB: + { + filePath.Copy (_L("XLS-15kB.xls") ); + } + break; + + case EWord_20kB: + { + filePath.Copy (_L("DOC-20kB.doc") ); + } + break; + + case EPowerPoint_40kB: + { + filePath.Copy (_L("PPT-40kB.ppt") ); + } + break; + + case EText_10kB: + { + filePath.Copy (_L("TXT-10kB.txt") ); + } + break; + + case EText_70kB: + { + filePath.Copy (_L("TXT-70kB.txt") ); + } + break; + + case E3GPP_70kB: + { + filePath.Copy (_L("3GPP-70kB.3gpp") ); + } + break; + + case EMP3_250kB: + { + filePath.Copy (_L("MP3-250kB.mp3") ); + } + break; + + case EAAC_100kB: + { + filePath.Copy (_L("AAC-100kB.aac") ); + } + break; + + case ERM_95kB: + { + filePath.Copy (_L("RM-95kB.rm") ); + } + break; + + case EBMP_25kB: + { + filePath.Copy (_L("BMP-25kB.bmp") ); + } + break; + case EHTML_20kB: + { + filePath.Copy (_L("HTML-20kB.html") ); + } + break; + case EJAD_1kB: + { + filePath.Copy (_L("JAD-1kB.jad") ); + } + break; + case EJAR_10kB: + { + filePath.Copy (_L("JAR-10kB.jar") ); + } + break; + case EJP2_65kB: + { + filePath.Copy (_L("JP2-65kB.jp2") ); + } + break; + case EMP4_200kB: + { + filePath.Copy (_L("MP4-200kB.mp4") ); + } + break; + case EMXMF_40kB: + { + filePath.Copy (_L("MXMF-40kB.mxmf") ); + } + break; + case ERAM_1kB: + { + filePath.Copy (_L("RAM-1kB.ram") ); + } + break; + case ESVG_15kB: + { + filePath.Copy (_L("SVG-15kB.svg") ); + } + break; + case ESWF_15kB: + { + filePath.Copy (_L("SWF-15kB.swf") ); + } + break; + case ETIF_25kB: + { + filePath.Copy (_L("TIF-25kB.tif") ); + } + break; + case EVCF_1kB: + { + filePath.Copy (_L("VCF-1kB.vcf") ); + } + break; + case EVCS_1kB: + { + filePath.Copy (_L("VCS-1kB.vcs") ); + } + break; + case ESISX_10kB: + { + filePath.Copy (_L("SISX-10kB.sisx") ); + } + break; + case EWMA_50kB: + { + filePath.Copy (_L("WMA-50kB.wma") ); + } + break; + case EWMV_200kB: + { + filePath.Copy (_L("WMV-200kB.wmv") ); + } + break; + + default: + User::Panic (_L("Test data"), 401 ); + break; + } + + TFileName fullTargetPath; + fullTargetPath.Copy( iTempPath->Des() ); + fullTargetPath.Append( filePath ); + if (ConeUtils::FileExists(fullTargetPath)) + { + // No need to copy, if the file already exists. + LOGSTRING2("Creator: CCreatorEngine::TestDataPathL %S already exists", &fullTargetPath); + return fullTargetPath; + } + + // Define the path where the testdata can be retrieved + // get the data from the private directory in secure platform + TFileName fullAppPath = iEnv->EikAppUi()->Application()->AppFullName(); + TChar driveLetter = fullAppPath[0]; + TInt driveNumber; + + iEnv->FsSession().CharToDrive(driveLetter, driveNumber); + iEnv->FsSession().SetSessionToPrivate( driveNumber ); // "\\private\\20011383\\" + + + // check the file exists + if (!ConeUtils::FileExists(filePath)) + { + LOGSTRING2("Creator: CCreatorEngine::TestDataPathL %S not found", &filePath); + + TInt generatingError( KErrNone ); + + // The file could be on C drive + iEnv->FsSession().SetSessionToPrivate( KRegisterDrive ); + + if ( !ConeUtils::FileExists( filePath ) ) + { + // The file is not on C drive, see if we can generate it + + // Make sure that the private path of this app in c-drive exists + iEnv->FsSession().CreatePrivatePath( KRegisterDrive ); + + TFileName privatePath; + iEnv->FsSession().PrivatePath( privatePath ); + privatePath.Append( filePath ); + TChar privateDriveChar; + iEnv->FsSession().DriveToChar( KRegisterDrive, privateDriveChar ); + TFileName fullPrivatePath; // full path of a file to be generated + fullPrivatePath.Append( privateDriveChar ); + fullPrivatePath.Append( ':' ); + fullPrivatePath.Append( privatePath ); + + switch ( aTestDataPath ) + { + case EJPEG_25kB: + case EJPEG_200kB: + case EJPEG_500kB: + case EBMP_25kB: + case EGIF_2kB: + { + TRAP( generatingError, GenerateSourceImageFileL( aTestDataPath, fullPrivatePath ) ); + // GenerateSourceImageFileL calls TestDataPathL -> private session points to z + // change it back to KRegisterDrive, because generated source file is there + // and we need to copy it at the end of this function. + iEnv->FsSession().SetSessionToPrivate( KRegisterDrive ); + break; + } + case EText_10kB: + { + TRAP( generatingError, GenereteSourceTextFileL( fullPrivatePath, 10000 ) ); + // GenerateSourceImageFileL calls TestDataPathL -> private session points to z + // change it back to KRegisterDrive, because generated source file is there + // and we need to copy it at the end of this function. + iEnv->FsSession().SetSessionToPrivate( KRegisterDrive ); + break; + } + case EText_70kB: + { + TRAP( generatingError, GenereteSourceTextFileL( fullPrivatePath, 70000 ) ); + break; + } + default: + { + generatingError = KErrNotSupported; + break; + } + } + } + + if ( iUserCancelled ) + { + LOGSTRING("Creator: CCreatorEngine::TestDataPathL iUserCancelled" ); + User::Leave( KErrCancel ); + } + + if ( generatingError ) + { + // Generating the file failed + + // cancel the dialog + iProgressDialog->ProcessFinishedL(); + DialogDismissedL(EAknSoftkeyBack); + + // show error note + CAknErrorNote* note = new (ELeave) CAknErrorNote; + note->ExecuteLD(_L("Test data missing")); + + User::Leave(KErrPathNotFound); + } + } + + // now copy the data to D-drive to make the file public + iEnv->FsSession().MkDirAll( iTempPath->Des() ); + TInt copyErr = BaflUtils::CopyFile(iEnv->FsSession(), filePath, fullTargetPath); + LOGSTRING4("Creator: CCreatorEngine::TestDataPathL copy %S to %S returns=%d", &filePath, &fullTargetPath, copyErr); + + // make sure that the file won't have a read only attribute + TEntry fileEntry; + iEnv->FsSession().Entry(fullTargetPath, fileEntry); + iEnv->FsSession().SetEntry(fullTargetPath, fileEntry.iModified, NULL, KEntryAttReadOnly); + + filePath = fullTargetPath; // change the reference to the temp path + return filePath; + } + +// --------------------------------------------------------------------------- + +// a generic query which can be used by the modules +TBool CCreatorEngine::EntriesQueryDialogL(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero) + { + LOGSTRING("Creator: CCreatorEngine::EntriesQueryDialogL"); + + CAknNumberQueryDialog* dialog = CAknNumberQueryDialog::NewL(aNumberOfEntries, CAknQueryDialog::ENoTone); + dialog->SetMinimumAndMaximum (1, 99999); + + if(dialog->ExecuteLD(R_ENTRY_QUERY, aPrompt)) + { + if (aAcceptsZero) + { + if (aNumberOfEntries>=0) + return ETrue; + else + return EFalse; + } + else + { + if (aNumberOfEntries>0) + return ETrue; + else + return EFalse; + } + } + else + return EFalse; // cancelled + + + } + +// --------------------------------------------------------------------------- + +// a generic query which can be used by the modules +TBool CCreatorEngine::TimeQueryDialogL(TTime& aTime, TInt aResourceId) + { + LOGSTRING("Creator: CCreatorEngine::TimeQueryDialogL"); + + CAknTimeQueryDialog* dialog = CAknTimeQueryDialog::NewL(aTime, CAknQueryDialog::ENoTone); + return dialog->ExecuteLD(aResourceId); + } + +// --------------------------------------------------------------------------- + +// a generic YES NO query which can be used by the modules +TBool CCreatorEngine::YesNoQueryDialogL(const TDesC& aPrompt) + { + LOGSTRING("Creator: CCreatorEngine::YesNoQueryDialogL"); + + CAknQueryDialog* dialog = CAknQueryDialog::NewL( ); + + TInt yes = dialog->ExecuteLD(R_YES_NO_DIALOG, aPrompt); + + return (TBool)yes; + + } + +// --------------------------------------------------------------------------- + + + +// a method to return a default Internet Access Point +TUint32 CCreatorEngine::GetDefaultIAPL() + { + LOGSTRING("Creator: CCreatorEngine::GetDefaultIAPL"); + + TUint32 lIAPid = 1; // Default value + + CCommsDatabase* cDatabase = CCommsDatabase::NewL(); + CleanupStack::PushL(cDatabase); + + CCommsDbTableView* tableView = cDatabase->OpenTableLC(TPtrC(IAP)); + + TInt errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TUint32 iValue; + tableView->ReadUintL(TPtrC(COMMDB_ID),iValue); + lIAPid = iValue; + } + + CleanupStack::PopAndDestroy(2); // cDatabase,tableView + + return lIAPid; + } + +// --------------------------------------------------------------------------- + +TUint32 CCreatorEngine::AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound ) + { + LOGSTRING("Creator: CCreatorEngine::AccessPointNameToIdL"); + // Accespoint impl moved from engine to accespoint implementations for supporting 3.0-3.1 and 3.2-> + return iAccessPoints->AccessPointNameToIdL(aAPName, aAnyIfNotFound ); + } + +static CCreatorEngine::TTestDataPath SoundFiles[] = { + CCreatorEngine::EMIDI_10kB, + CCreatorEngine::EWAVE_20kB, + CCreatorEngine::EMP3_250kB, + CCreatorEngine::EAAC_100kB + }; + +static CCreatorEngine::TTestDataPath PictureFiles[] = + { + CCreatorEngine::EJPEG_25kB, + CCreatorEngine::EJPEG_200kB, + CCreatorEngine::EJPEG_500kB, + CCreatorEngine::EPNG_15kB, + CCreatorEngine::EGIF_2kB + }; + +TPtrC CCreatorEngine::CreateSoundFileL(TTestDataPath aId) +{ + TPtrC tempPath(TestDataPathL(aId)); + // Copy file to permanent location: + TParse parser; + parser.Set(tempPath, NULL, NULL); + TPtrC fileName(parser.NameAndExt()); + HBufC* fullTargetPath = HBufC::NewLC( KMaxFileName ); + fullTargetPath->Des().Copy( PathInfo::PhoneMemoryRootPath() ); + fullTargetPath->Des().Append( PathInfo::DigitalSoundsPath() ); + + fullTargetPath->Des().Append(fileName); + CopyFileL(tempPath, *fullTargetPath); + iAllocatedFilePaths.AppendL(fullTargetPath); + CleanupStack::Pop(); // fullTargetPath + return fullTargetPath->Des(); +} +TPtrC CCreatorEngine::CreateRandomSoundFileL() +{ + TInt numOfFiles = sizeof(SoundFiles) / sizeof(TTestDataPath); + return CreateSoundFileL(SoundFiles[RandomNumber(0, numOfFiles-1)]); +} +TPtrC CCreatorEngine::RandomSoundFileL() +{ + TInt numOfFiles = sizeof(SoundFiles) / sizeof(TTestDataPath); + return TestDataPathL(SoundFiles[RandomNumber(0, numOfFiles-1)]); +} + +TPtrC CCreatorEngine::RandomPictureFileL() +{ + TInt numOfFiles = sizeof(PictureFiles) / sizeof(TTestDataPath); + return TestDataPathL(PictureFiles[RandomNumber(0, numOfFiles-1)]); +} +// --------------------------------------------------------------------------- + +// returns a random string from the resource files +TPtrC CCreatorEngine::RandomString(enum TRandomStringType aRandomStringType) + { + LOGSTRING("Creator: CCreatorEngine::RandomString"); + + // Let's see if the array is OK and the string arrays are in correct order: + if( ((TInt) aRandomStringType) < iStringArrays.Count() && + iStringArrays[aRandomStringType].iStringType == aRandomStringType) + { + TInt rand = (TInt) (iStringArrays[aRandomStringType].iArrayPtr->Count() * Math::FRand(iSeed)); + return (*iStringArrays[aRandomStringType].iArrayPtr)[rand]; + } + + // Now let's loop the arrays and try to find one with the type: + for( TInt i = 0; i < iStringArrays.Count(); ++i ) + { + if( iStringArrays[i].iStringType == aRandomStringType ) + { + TInt rand = (TInt) (iStringArrays[i].iArrayPtr->Count() * Math::FRand(iSeed)); + return (*iStringArrays[i].iArrayPtr)[rand]; + } + } + + User::Panic (_L("Random string"), 402); + return NULL; + } + +// --------------------------------------------------------------------------- + +// returns a random number +TInt CCreatorEngine::RandomNumber(TInt aRange) + { + LOGSTRING2("Creator: CCreatorEngine::RandomNumber aRange=%d", aRange); + + return (TInt) (aRange*Math::FRand(iSeed)); + } + +// --------------------------------------------------------------------------- + +// returns a random number +TInt CCreatorEngine::RandomNumber(TInt aMin, TInt aMax) + { + LOGSTRING3("Creator: CCreatorEngine::RandomNumber aMin=%d aMax=%d", aMin, aMax); + + TInt range = (aMax > aMin ? aMax - aMin : aMin - aMax) + 1; + TInt random = (TInt) (range*Math::FRand(iSeed)); + + random = (random % range) + aMin; + + if (random > aMax) + random = aMax; + else if (random < aMin) + random = aMin; + + return random; + } + +TTime CCreatorEngine::RandomTime(TTime baseTime, TRandomDateType type, TInt aMinHours, TInt aMaxHours, TInt aMinMinutes, TInt aMaxMinutes ) + { + TInt randomHours = RandomNumber(aMinHours, aMaxHours); + TInt randomMinutes = RandomNumber(aMinMinutes, aMaxMinutes); + + switch( type ) + { + case EDatePast: + return (baseTime - TTimeIntervalHours(randomHours)) - TTimeIntervalMinutes(randomMinutes); + case EDateFuture: + return (baseTime + TTimeIntervalHours(randomHours)) + TTimeIntervalMinutes(randomMinutes); + default: + break; + } + return baseTime; + } + +TTime CCreatorEngine::RandomDate(TTime baseTime, TRandomDateType type, TInt aMinDays, TInt aMaxDays) + { + TInt random = RandomNumber(aMinDays, aMaxDays); + + switch( type ) + { + case EDatePast: + return baseTime - TTimeIntervalDays(random); + case EDateFuture: + return baseTime + TTimeIntervalDays(random); + default: + break; + } + + return baseTime; + } + +TTime CCreatorEngine::RandomDate(TRandomDateType type, TInt aMinDays, TInt aMaxDays) + { + TTime time; + // Set to current time: + time.HomeTime(); + return RandomDate(time, type, aMinDays, aMaxDays); + } + +HBufC* CCreatorEngine::CreateEmailAddressLC() + { + _LIT(KCountry, "com"); + return CreateEmailAddressLC(RandomString(EFirstName), RandomString(ESurname), RandomString(ECompany), KCountry); + } + +HBufC* CCreatorEngine::CreateHTTPUrlLC() + { + _LIT(KProtocol, "http://"); + _LIT(KPrefix, "www"); + _LIT(KCountry, "com"); + return CreateUrlLC(KProtocol, KPrefix, RandomString(ECompany), KCountry); + } + +HBufC* CCreatorEngine::CreateRandomStringLC(TInt aStrLen) + { + TInt minAscii = 65; + TInt maxAscii = 90; + HBufC* str = HBufC::NewL(aStrLen); + CleanupStack::PushL(str); + for( TInt i = 0; i < aStrLen; ++i ) + { + TInt random = RandomNumber(minAscii, maxAscii); + TChar randomChar = TChar((TUint) random); + str->Des().Append(randomChar); + } + return str; + } + +HBufC* CCreatorEngine::CreateEmailAddressLC( + const TDesC& firstname, + const TDesC& lastname, + const TDesC& domain, + const TDesC& country ) const + { + HBufC* email = HBufC::New(firstname.Length() + lastname.Length() + domain.Length() + country.Length() + 3); + CleanupStack::PushL(email); + _LIT(KEmailAddr, "%S.%S@%S.%S"); + email->Des().Format(KEmailAddr, &firstname, &lastname, &domain, &country); + return email; + } + +HBufC* CCreatorEngine::CreateUrlLC( + const TDesC& protocol, + const TDesC& prefix, + const TDesC& domain, + const TDesC& country) const + { + HBufC* url = HBufC::New(protocol.Size() + prefix.Size() + domain.Size() + country.Size() + 2); + CleanupStack::PushL(url); + _LIT(KUrl, "%S%S.%S.%S"); + url->Des().Format(KUrl, &protocol, &prefix, &domain, &country); + return url; + } +// --------------------------------------------------------------------------- + +void CCreatorEngine::SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath) + { + aPath.Copy( PathInfo::PhoneMemoryRootPath() ); + switch (aCommand) + { + case ECmdCreateFileEntryJPEG_25kB: + case ECmdCreateFileEntryJPEG_200kB: + case ECmdCreateFileEntryJPEG_500kB: + case ECmdCreateFileEntryPNG_15kB: + case ECmdCreateFileEntryGIF_2kB: + case ECmdCreateFileEntryBMP_25kB: + case ECmdCreateFileEntrySVG_15kB: + case ECmdCreateFileEntryTIF_25kB: + case ECmdCreateFileEntryJP2_65kB: + + { aPath.Append( PathInfo::ImagesPath() ); break; } + + case ECmdCreateFileEntryRNG_1kB: + { aPath.Append( PathInfo::SimpleSoundsPath() ); break; } + + case ECmdCreateFileEntryMIDI_10kB: + case ECmdCreateFileEntryWAV_20kB: + case ECmdCreateFileEntryAMR_20kB: + case ECmdCreateFileEntryMP3_250kB: + case ECmdCreateFileEntryAAC_100kB: + case ECmdCreateFileEntryWMA_50kB: + { aPath.Append( PathInfo::DigitalSoundsPath() ); break; } + + case ECmdCreateFileEntry3GPP_70kB: + case ECmdCreateFileEntryRM_95kB: + case ECmdCreateFileEntryMP4_200kB: + case ECmdCreateFileEntryWMV_200kB: + + { aPath.Append( PathInfo::VideosPath() ); break; } + + case ECmdCreateFileEntryEmptyFolder: + { aPath.Append( _L("MyFolder\\") ); break; } + + default: + { aPath.Append( PathInfo::OthersPath() ); break; } + + } + } + + +// --------------------------------------------------------------------------- + +void CCreatorEngine::CancelComplete() + { + LOGSTRING("Creator: CCreatorEngine::CancelComplete"); + // free resources and show a note + TRAP_IGNORE( ShutDownEnginesL() ); + + TRAP_IGNORE( + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("Cancelled")); + ); + } + +// --------------------------------------------------------------------------- + +TCommand::TCommand(TInt aCommandId, CCreatorModuleBaseParameters* aParameters) + { + iCommandId = aCommandId; + iParameters = aParameters; + } + +// --------------------------------------------------------------------------- + +TCommand::~TCommand() + { + } + +// --------------------------------------------------------------------------- + +CAsyncWaiter* CAsyncWaiter::NewL(TInt aPriority) + { + CAsyncWaiter* self = new(ELeave) CAsyncWaiter(aPriority); + return self; + } + +CAsyncWaiter* CAsyncWaiter::NewLC(TInt aPriority) + { + CAsyncWaiter* self = new(ELeave) CAsyncWaiter(aPriority); + CleanupStack::PushL(self); + return self; + } + +CAsyncWaiter::CAsyncWaiter(TInt aPriority) : CActive(aPriority) + { + CActiveScheduler::Add(this); + } + +CAsyncWaiter::~CAsyncWaiter() + { + Cancel(); + } + +void CAsyncWaiter::StartAndWait() + { + LOGSTRING("Creator: CAsyncWaiter::StartAndWait"); + + iStatus = KRequestPending; + SetActive(); + iWait.Start(); + } + +TInt CAsyncWaiter::Result() const + { + return iError; + } + +void CAsyncWaiter::RunL() + { + LOGSTRING("Creator: CAsyncWaiter::RunL"); + + iError = iStatus.Int(); + CAknEnv::StopSchedulerWaitWithBusyMessage( iWait ); + } + +void CAsyncWaiter::DoCancel() + { + LOGSTRING("Creator: CAsyncWaiter::DoCancel"); + + iError = KErrCancel; + if( iStatus == KRequestPending ) + { + TRequestStatus* s=&iStatus; + User::RequestComplete( s, KErrCancel ); + } + + CAknEnv::StopSchedulerWaitWithBusyMessage( iWait ); + } + +FileMapping::FileMapping( const TDesC& aAttName, TInt aAttId, TInt aCommandId ) + : + iFileName(aAttName), + iFileId(aAttId), + iCommandId(aCommandId) + {} + + const TDesC& FileMapping::FileName() const + { + return iFileName; + } + + TInt FileMapping::FileId() const + { + return iFileId; + } + + TInt FileMapping::CommandId() const + { + return iCommandId; + } + +// --------------------------------------------------------------------------- +CDictionaryFileStore* CCreatorEngine::FileStoreLC() + { + LOGSTRING("Creator: CCreatorEngine::FileStoreLC"); + CDictionaryFileStore* store; + + // make sure that the private path of this app in c-drive exists + CEikonEnv::Static()->FsSession().CreatePrivatePath( KRegisterDrive ); // c:\\private\\20011383\\ + + // handle register always in the private directory + User::LeaveIfError( CEikonEnv::Static()->FsSession().SetSessionToPrivate( KRegisterDrive ) ); + store = CDictionaryFileStore::OpenLC( CEikonEnv::Static()->FsSession(), KRegisterFileName, KUidCreatorApp ); + return store; + } + +// --------------------------------------------------------------------------- +void CCreatorEngine::ReadEntryIdsFromStoreL( RArray& aEntryIds, const TUid aModuleUid ) + { + LOGSTRING("Creator: CCreatorEngine::ReadEntryIdsFromStoreL"); + CDictionaryFileStore* store = FileStoreLC(); + User::LeaveIfNull( store ); + if ( store->IsPresentL( aModuleUid ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, aModuleUid ); + TFileName fullPath; + TInt err( KErrNone ); + TInt id( KErrNotFound ); + while ( !err ) + { + TRAP( err, id = in.ReadInt32L() ); // will leave with KErrEof + if ( !err ) + { + aEntryIds.Append( id ); + } + } + CleanupStack::PopAndDestroy( &in ); + } + CleanupStack::PopAndDestroy( store ); + } + +// --------------------------------------------------------------------------- +void CCreatorEngine::WriteEntryIdsToStoreL( RArray& aEntryIds, const TUid aModuleUid ) + { + LOGSTRING("Creator: CCreatorEngine::WriteEntryIdsToStoreL"); + CDictionaryFileStore* store = FileStoreLC(); + User::LeaveIfNull( store ); + + // backup previous ids from store + // otherwise they would be overwritten when calling out.WriteL + RArray previousIds; + CleanupClosePushL( previousIds ); + + if ( store->IsPresentL( aModuleUid ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, aModuleUid ); + TInt err( KErrNone ); + TInt id( KErrNotFound ); + while ( !err ) + { + TRAP( err, id = in.ReadInt32L() ); // will leave with KErrEof + if ( !err ) + { + previousIds.Append( id ); + } + } + CleanupStack::PopAndDestroy( &in ); + } + + RDictionaryWriteStream out; + out.AssignLC( *store, aModuleUid ); + + // restore previous ids to store + for ( TInt i = 0; i < previousIds.Count(); i++ ) + { + out.WriteInt32L( previousIds[i] ); + } + + // write new ids to store + for ( TInt i = 0; i < aEntryIds.Count(); i++ ) + { + out.WriteInt32L( aEntryIds[i] ); + } + + out.CommitL(); + CleanupStack::PopAndDestroy( &out ); + + store->CommitL(); + CleanupStack::PopAndDestroy( &previousIds ); + CleanupStack::PopAndDestroy( store ); + } + +// --------------------------------------------------------------------------- +void CCreatorEngine::ReadEntryIdsFromStoreL( RArray& aEntryIds, const TUid aModuleUid ) + { + LOGSTRING("Creator: CCreatorEngine::ReadEntryIdsFromStoreL"); + CDictionaryFileStore* store = FileStoreLC(); + User::LeaveIfNull( store ); + if ( store->IsPresentL( aModuleUid ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, aModuleUid ); + TFileName fullPath; + TInt err( KErrNone ); + TUint32 id( KErrNone ); + while ( !err ) + { + TRAP( err, id = in.ReadUint32L() ); // will leave with KErrEof + if ( !err ) + { + aEntryIds.Append( id ); + } + } + CleanupStack::PopAndDestroy( &in ); + } + CleanupStack::PopAndDestroy( store ); + } + +// --------------------------------------------------------------------------- +void CCreatorEngine::WriteEntryIdsToStoreL( RArray& aEntryIds, const TUid aModuleUid ) + { + LOGSTRING("Creator: CCreatorEngine::WriteEntryIdsToStoreL"); + CDictionaryFileStore* store = FileStoreLC(); + User::LeaveIfNull( store ); + + // backup previous ids from store + // otherwise they would be overwritten when calling out.WriteL + RArray previousIds; + CleanupClosePushL( previousIds ); + + if ( store->IsPresentL( aModuleUid ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, aModuleUid ); + TInt err( KErrNone ); + TUint32 id( KErrNone ); + while ( !err ) + { + TRAP( err, id = in.ReadUint32L() ); // will leave with KErrEof + if ( !err ) + { + previousIds.Append( id ); + } + } + CleanupStack::PopAndDestroy( &in ); + } + + RDictionaryWriteStream out; + out.AssignLC( *store, aModuleUid ); + + // restore previous ids to store + for ( TInt i = 0; i < previousIds.Count(); i++ ) + { + out.WriteUint32L( previousIds[i] ); + } + + // write new ids to store + for ( TInt i = 0; i < aEntryIds.Count(); i++ ) + { + out.WriteUint32L( aEntryIds[i] ); + } + + out.CommitL(); + CleanupStack::PopAndDestroy( &out ); + + store->CommitL(); + CleanupStack::PopAndDestroy( &previousIds ); + CleanupStack::PopAndDestroy( store ); + } + +// --------------------------------------------------------------------------- +void CCreatorEngine::RemoveStoreL( const TUid aModuleUid ) + { + LOGSTRING("Creator: CCreatorEngine::RemoveStoreL"); + CDictionaryFileStore* store = FileStoreLC(); + User::LeaveIfNull( store ); + if ( store->IsPresentL( aModuleUid ) ) + { + // entries of this module should be deleted by now, + // remove the Creator internal registry for this module + store->Remove( aModuleUid ); + store->CommitL(); + } + CleanupStack::PopAndDestroy( store ); + } + +//---------------------------------------------------------------------------- +void CCreatorEngine::GenerateSourceImageFileL( + const CCreatorEngine::TTestDataPath aFileType, + const TDesC& aFileName ) + { + LOGSTRING("Creator: CCreatorEngine::GenerateSourceImageFileL"); + + // Peek file size + RFile file; + TInt fileSize( 0 ); + // Using png file as the source file + TFileName fileName = TestDataPathL( CCreatorEngine::EPNG_15kB ); + User::LeaveIfError( file.Open( iEnv->FsSession(), + fileName, + EFileRead | EFileShareAny ) ); + CleanupClosePushL( file ); + User::LeaveIfError( file.Size( fileSize ) ); + CleanupStack::PopAndDestroy( &file ); + + // Using heap variables, because bitmaps + // may reserve large amount of memory. + + // Read data from the file + RFileReadStream ws; + User::LeaveIfError( ws.Open( iEnv->FsSession(), + fileName, + EFileStream | EFileRead | EFileShareAny ) ); + CleanupClosePushL( ws ); + delete iBitmapData; + iBitmapData = NULL; + iBitmapData = HBufC8::NewL( fileSize ); + TPtr8 dataPtr = iBitmapData->Des(); + ws.ReadL( dataPtr, fileSize ); + CleanupStack::PopAndDestroy( &ws ); + + // Create decoder for the data + delete iDecoder; + iDecoder = NULL; + iDecoder = CImageDecoder::DataNewL( iEnv->FsSession(), dataPtr ); + iFrameinfo = iDecoder->FrameInfo(); + + // Create bitmap handle for the source image + iBitmap = new (ELeave) CFbsBitmap(); + User::LeaveIfError( iBitmap->Create( iFrameinfo.iFrameCoordsInPixels.Size(), EColor16M ) ); + + // Convert the data from the file into bitmap format (inmemory) + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + iDecoder->Convert( &waiter->iStatus, *iBitmap ); + waiter->StartAndWait(); + delete iDecoder; + iDecoder = NULL; + delete iBitmapData; + iBitmapData = NULL; + if ( iUserCancelled ) + { + CancelComplete(); + User::Leave( KErrCancel ); + } + User::LeaveIfError( waiter->Result() ); + + // Define the target dimensions and image quality + // so that the generated file size will match required size. + // Quality and scaling factors are defined experimentally. + delete iScaler; + iScaler = NULL; + iScaler = CBitmapScaler::NewL(); + iScaledBitmap = new (ELeave) CFbsBitmap(); + // use original size as base + TSize scaledSize( iFrameinfo.iFrameCoordsInPixels.Size() ); + delete iFrameImageData; + iFrameImageData = NULL; + iFrameImageData = CFrameImageData::NewL(); + TBuf8<64> mimeType; + TJpegImageData* jpegImageData( NULL ); + TBmpImageData* bmpImageData( NULL ); + switch ( aFileType ) + { + case CCreatorEngine::EJPEG_25kB: + // QualityFactor = 93 and size factor = 2 -> 25kB jpeg file + mimeType.Copy( _L8("image/jpeg") ); + jpegImageData = new (ELeave) TJpegImageData; + // Set some format specific data + jpegImageData->iSampleScheme = TJpegImageData::EColor444; + jpegImageData->iQualityFactor = 93; // 0..100 + // ownership passed to iFrameImageData after AppendImageData + User::LeaveIfError( iFrameImageData->AppendImageData( jpegImageData ) ); + scaledSize.iHeight *= 2; + scaledSize.iWidth *= 2; + break; + case CCreatorEngine::EJPEG_200kB: + { + mimeType.Copy( _L8("image/jpeg") ); + jpegImageData = new (ELeave) TJpegImageData; + // Set some format specific data + jpegImageData->iSampleScheme = TJpegImageData::EColor444; +#ifdef __WINS__ + // QualityFactor = 95 and size factor = 7 -> 196kB jpeg file + jpegImageData->iQualityFactor = 95; // 0..100 + scaledSize.iHeight *= 7; + scaledSize.iWidth *= 7; +#else + // In hw the image compression seems to work + // more efficiently. Need to set greater values. + jpegImageData->iQualityFactor = 100; // 0..100 + scaledSize.iHeight *= 7; + scaledSize.iWidth *= 7; + // 100, 7, 7 -> 213kB +#endif + // ownership passed to iFrameImageData after AppendImageData + User::LeaveIfError( iFrameImageData->AppendImageData( jpegImageData ) ); + break; + } + case CCreatorEngine::EJPEG_500kB: + { + mimeType.Copy( _L8("image/jpeg") ); + jpegImageData = new (ELeave) TJpegImageData; + // Set some format specific data + jpegImageData->iSampleScheme = TJpegImageData::EColor444; +#ifdef __WINS__ + // QualityFactor = 99 and size factor = 8 -> 514kB jpeg file + jpegImageData->iQualityFactor = 99; // 0..100 + scaledSize.iHeight *= 8; + scaledSize.iWidth *= 8; +#else + // In hw the image compression seems to work + // more efficiently. Need to set greater values. + jpegImageData->iQualityFactor = 100; // 0..100 + scaledSize.iHeight *= 13; + scaledSize.iWidth *= 13; + // 100, 13, 13 -> 535kB +#endif + // ownership passed to iFrameImageData after AppendImageData + User::LeaveIfError( iFrameImageData->AppendImageData( jpegImageData ) ); + break; + } + case CCreatorEngine::EBMP_25kB: + { + // bit depyh 8 and 11/10 size factor -> 25kB bmp + mimeType.Copy( _L8("image/bmp") ); + bmpImageData = new (ELeave) TBmpImageData; + bmpImageData->iBitsPerPixel = 8; + // ownership passed to iFrameImageData after AppendImageData + User::LeaveIfError( iFrameImageData->AppendImageData( bmpImageData ) ); + scaledSize.iHeight *= 11; + scaledSize.iWidth *= 11; + scaledSize.iHeight /= 10; + scaledSize.iWidth /= 10; + break; + } + case CCreatorEngine::EGIF_2kB: + { + // size factor 1/2 -> 2560B gif + mimeType.Copy( _L8("image/gif") ); + // GIF encoder is not configurable, only the size matters here + scaledSize.iHeight /= 2; + scaledSize.iWidth /= 2; + break; + } + default: break; + } + + // Scale to reach target size + User::LeaveIfError( iScaledBitmap->Create( scaledSize, EColor16M ) ); + iScaler->Scale( &waiter->iStatus, *iBitmap, *iScaledBitmap ); + waiter->StartAndWait(); + delete iBitmap; + iBitmap = NULL; + delete iScaler; + iScaler = NULL; + if ( iUserCancelled ) + { + CancelComplete(); + User::Leave( KErrCancel ); + } + User::LeaveIfError( waiter->Result() ); + + // Encode to target format + delete iEncoder; + iEncoder = NULL; + // Creating CImageEncoder opens the target file + iEncoder = CImageEncoder::FileNewL( iEnv->FsSession(), aFileName, mimeType ); + + // Do the conversion to target format, this will write to the file + iEncoder->Convert( &waiter->iStatus, *iScaledBitmap, iFrameImageData ); + waiter->StartAndWait(); + delete iEncoder; + iEncoder = NULL; + delete iFrameImageData; + iFrameImageData = NULL; + delete iScaledBitmap; + iScaledBitmap = NULL; + if ( iUserCancelled ) + { + CancelComplete(); + User::Leave( KErrCancel ); + } + User::LeaveIfError( waiter->Result() ); + CleanupStack::PopAndDestroy( waiter ); + } + +//---------------------------------------------------------------------------- +void CCreatorEngine::GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize ) + { + LOGSTRING("Creator: CCreatorEngine::GenereteSourceTextFileL"); + RFile txtFile; + _LIT8( KTestContent, "Testing... "); + _LIT8( KTestContentCRLF, "\r\n"); + txtFile.Create( iEnv->FsSession(), + aFileName, + EFileStreamText | EFileWrite | EFileShareAny ); + CleanupClosePushL( txtFile ); + for ( TInt i = 1; i*KTestContent().Length() < aSize; i++ ) + { + User::LeaveIfError( txtFile.Write( KTestContent ) ); + if ( !( i % 10 ) ) // linefeed for every 10th + { + User::LeaveIfError( txtFile.Write( KTestContentCRLF ) ); + } + } + CleanupStack::PopAndDestroy( &txtFile ); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_note.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_note.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,179 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_note.h" +#include "creator_traces.h" + +const TInt KCreatorDiskSpaceNeededForSingleDeletion( 8192 ); +_LIT( KCreatorNotepadFile, "c:Notepad.dat" ); + +// @see \s60\app\organizer\notepad\notepad1\LibSrc\NpdCoreModel.cpp KSecureUid.Name() +_LIT( KCreatorNotepadFormat, "SECURE[101F8878]" ); +_LIT( KCreatorNotepadDeleteAllSQL, "DELETE FROM Table1"); + +//---------------------------------------------------------------------------- + +CNotepadParameters::CNotepadParameters() + { + LOGSTRING("Creator: CNotepadParameters::CNotepadParameters"); + + iNoteText = HBufC::New(KNotepadFieldLength); + } + +CNotepadParameters::~CNotepadParameters() + { + LOGSTRING("Creator: CNotepadParameters::~CNotepadParameters"); + + delete iNoteText; + } + +//---------------------------------------------------------------------------- + +CCreatorNotepad* CCreatorNotepad::NewL(CCreatorEngine* aEngine) + { + CCreatorNotepad* self = CCreatorNotepad::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorNotepad* CCreatorNotepad::NewLC(CCreatorEngine* aEngine) + { + CCreatorNotepad* self = new (ELeave) CCreatorNotepad; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorNotepad::CCreatorNotepad() : iFs ( CEikonEnv::Static()->FsSession() ) + { + } + +void CCreatorNotepad::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorNotepad::ConstructL"); + + iEngine = aEngine; + + iNotepadApi = CNotepadApi::NewL(); + } + +CCreatorNotepad::~CCreatorNotepad() + { + LOGSTRING("Creator: CCreatorNotepad::~CCreatorNotepad"); + + delete iNotepadApi; + + if (iParameters) + delete iParameters; + } + +//---------------------------------------------------------------------------- + +TBool CCreatorNotepad::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorNotepad::AskDataFromUserL"); + + if ( aCommand == ECmdDeleteNotes ) + { + return iEngine->YesNoQueryDialogL( _L("Delete all Notes?") ); + } + + // By Creator not supported because + // note id is not available via Notepad API + + return iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?")); + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorNotepad::CreateNoteEntryL(CNotepadParameters *aParameters) + { + LOGSTRING("Creator: CCreatorNotepad::CreateNoteEntryL"); + + // clear any existing parameter definations + delete iParameters; + iParameters = NULL; + + CNotepadParameters* parameters = aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CNotepadParameters; + parameters = iParameters; + parameters->iNoteText->Des() = iEngine->RandomString(CCreatorEngine::EMessageText); + } + + TInt err = KErrNone; + + iNotepadApi->AddContentL(parameters->iNoteText->Des()); + + return err; + } + +//---------------------------------------------------------------------------- +void CCreatorNotepad::DeleteAllL() + { + LOGSTRING("Creator: CCreatorNotepad::DeleteAllL"); + // Open Notes db + RDbs dbs; + User::LeaveIfError( dbs.Connect() ); + CleanupClosePushL( dbs ); + RDbNamedDatabase db; + TInt openErr( db.Open( dbs, KCreatorNotepadFile, KCreatorNotepadFormat ) ); + CleanupClosePushL( db ); + + if ( openErr && openErr != KErrNotFound ) + { + User::Leave( openErr ); + } + + // do not leave if openErr == KErrNotFound, + // it means there is no notes (file) created -> no need to delete + + if ( openErr != KErrNotFound ) + { + TInt retval = iFs.ReserveDriveSpace( KDefaultDrive, KCreatorDiskSpaceNeededForSingleDeletion ); + if ( retval == KErrNone ) + { + retval = iFs.GetReserveAccess( KDefaultDrive ); + } + + // Delete all Notes. Ignore rowCount returnvalue + db.Execute( KCreatorNotepadDeleteAllSQL ); + + User::LeaveIfError( db.Compact() ); + + if ( retval == KErrNone ) + { + retval = iFs.ReleaseReserveAccess( KDefaultDrive ); + } + } + + CleanupStack::PopAndDestroy( &db ); + CleanupStack::PopAndDestroy( &dbs ); + } + +//---------------------------------------------------------------------------- +void CCreatorNotepad::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorNotepad::DeleteAllCreatedByCreatorL"); + // Not supported because note id is not available via Notepad API + User::Leave( KErrNotSupported ); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_noteelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_noteelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,107 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_noteelement.h" +#include "creator_traces.h" +#include "creator_note.h" + +using namespace creatornote; + +/* + * + */ +CCreatorNoteElement* CCreatorNoteElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext ) + { + CCreatorNoteElement* self = new (ELeave) CCreatorNoteElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(self); + return self; + } +/* + * + */ +CCreatorNoteElement::CCreatorNoteElement(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsCommandElement = ETrue; + } + +void CCreatorNoteElement::ExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt noteAmount = 1; + if( amountAttr ) + { + noteAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create note entries, the amount of entries is defined by noteAmount: + for( TInt cI = 0; cI < noteAmount; ++cI ) + { + CNotepadParameters* param = new (ELeave) CNotepadParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useMax = EFalse; + if( randomAttr && randomAttr->Value() == KMax ) + { + useMax = ETrue; + } + + if( elemName == KText ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + if( useMax ) + { + TDesC* temp = iEngine->CreateRandomStringLC(KNotepadFieldLength); + SetContentToTextParamL(param->iNoteText, *temp); + CleanupStack::PopAndDestroy(); // temp + } + else + { + SetContentToTextParamL(param->iNoteText, iEngine->RandomString(CCreatorEngine::EMessageText)); + } + } + else + { + SetContentToTextParamL(param->iNoteText, elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryNotes, param); + CleanupStack::Pop(); // param + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryNotes, 0, noteAmount); + } + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_phonebook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_phonebook.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,514 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_phonebook.h" +#include "creator_traces.h" + +#include + +//---------------------------------------------------------------------------- + +CPhonebookParameters::CPhonebookParameters() + { + LOGSTRING("Creator: CPhonebookParameters::CPhonebookParameters"); + + iContactFirstName = HBufC::New(KPhonebookFieldLength); + iContactLastName = HBufC::New(KPhonebookFieldLength); + iContactCompanyName = HBufC::New(KPhonebookFieldLength); + iContactJobTitle = HBufC::New(KPhonebookFieldLength); + iContactPostalAddress = HBufC::New(KPhonebookFieldLength); + iWvUserId = HBufC::New(KPhonebookFieldLength); + iRingingtone = HBufC::New(KPhonebookFieldLength); + iThumbnailImage = HBufC::New(KPhonebookFieldLength); + iContactPhoneNumberGeneral = HBufC::New(KPhonebookFieldLength); + iContactURL = HBufC::New(KPhonebookFieldLength); + iContactEmailAddress = HBufC::New(KPhonebookFieldLength); + iGroupName = HBufC::New(KPhonebookFieldLength); + } + +CPhonebookParameters::~CPhonebookParameters() + { + LOGSTRING("Creator: CPhonebookParameters::~CPhonebookParameters"); + + delete iGroupName; + delete iContactEmailAddress; + delete iContactURL; + delete iContactPhoneNumberGeneral; + delete iThumbnailImage; + delete iRingingtone; + delete iWvUserId; + delete iContactPostalAddress; + delete iContactJobTitle; + delete iContactCompanyName; + delete iContactLastName; + delete iContactFirstName; + } +void CPhonebookParameters::ParseL (CCommandParser* parser, TParseParams /*aCase = 0*/) + { + parser->StrParserL (iContactFirstName, '|'); + parser->StrParserL (iContactLastName, '|'); + parser->StrParserL (iContactCompanyName, '|'); + parser->StrParserL (iContactJobTitle, '|'); + parser->StrParserL (iContactPostalAddress, '|'); + parser->StrParserL (iContactPhoneNumberGeneral, '|'); + parser->StrParserL (iContactURL, '|'); + parser->StrParserL (iContactEmailAddress, '|'); + parser->StrParserL (iWvUserId, '|'); + parser->StrParserL (iRingingtone, '|'); + parser->StrParserL (iThumbnailImage, ';'); + } +//---------------------------------------------------------------------------- + +CCreatorPhonebook* CCreatorPhonebook::NewL(CCreatorEngine* aEngine) + { + CCreatorPhonebook* self = CCreatorPhonebook::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorPhonebook* CCreatorPhonebook::NewLC(CCreatorEngine* aEngine) + { + CCreatorPhonebook* self = new (ELeave) CCreatorPhonebook; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorPhonebook::CCreatorPhonebook() + { + } + +void CCreatorPhonebook::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorPhonebook::ConstructL"); + + iEngine = aEngine; + iContactDBEngine = CPbkContactEngine::NewL(); + iOpCounter = 0; + SetDefaultParameters(); + } + +CCreatorPhonebook::~CCreatorPhonebook() + { + LOGSTRING("Creator: CCreatorPhonebook::~CCreatorPhonebook"); + + if ( iEngine && iContactIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iContactIds, KUidDictionaryUidContacts ) ); + } + iContactIds.Reset(); + iContactIds.Close(); + + if ( iEngine && iGroupIds.Count() ) + { + TRAP_IGNORE( iEngine->WriteEntryIdsToStoreL( iGroupIds, KUidDictionaryUidContactGroups ) ); + } + iGroupIds.Reset(); + iGroupIds.Close(); + + iEntriesToDelete.Reset(); + iEntriesToDelete.Close(); + + CompactPbkDatabase( ETrue ); + + delete iContactDBEngine; + + if (iParameters) + delete iParameters; + } + +//---------------------------------------------------------------------------- +TInt CCreatorPhonebook::CreateContactEntryL(CCreatorModuleBaseParameters *aParameters) + { + LOGSTRING("Creator: CCreatorPhonebook::CreateContactEntryL"); + + delete iParameters; + iParameters = 0; + + CPhonebookParameters* parameters = (CPhonebookParameters*) aParameters; + + // random data needed if no predefined data available + if (!parameters) + { + iParameters = new(ELeave) CPhonebookParameters; + + iParameters->iNumberOfPhoneNumberFields = iNumberOfPhoneNumberFields; + iParameters->iNumberOfURLFields = iNumberOfURLFields; + iParameters->iNumberOfEmailAddressFields = iNumberOfEmailAddressFields; + + iParameters->iNumberOfPhoneNumberFields = iNumberOfPhoneNumberFields; + iParameters->iNumberOfURLFields = iNumberOfURLFields; + iParameters->iNumberOfEmailAddressFields = iNumberOfEmailAddressFields; + + iParameters->iContactFirstName->Des() = iEngine->RandomString(CCreatorEngine::EFirstName); + iParameters->iContactLastName->Des() = iEngine->RandomString(CCreatorEngine::ESurname); + iParameters->iContactCompanyName->Des() = iEngine->RandomString(CCreatorEngine::ECompany); + iParameters->iContactJobTitle->Des() = iEngine->RandomString(CCreatorEngine::EJobTitle); + iParameters->iContactPostalAddress->Des() = iEngine->RandomString(CCreatorEngine::EAddress); + + iParameters->iWvUserId->Des().Copy(_L("wv:")); + iParameters->iWvUserId->Des().Append(iParameters->iContactFirstName->Des()); + + // TO-DO..... + //iParameters->iRingingtone->Des() = KNullDesC; + //iParameters->iThumbnailImage->Des() = KNullDesC; + + iParameters->iContactPhoneNumberGeneral->Des() = iEngine->RandomString(CCreatorEngine::EPhoneNumber); + + iParameters->iContactURL->Des().Copy( _L("http://www.") ); + iParameters->iContactURL->Des().Append( iParameters->iContactCompanyName->Des() ); + iParameters->iContactURL->Des().Append( _L(".com/") ); + + iParameters->iContactEmailAddress->Des().Copy( iParameters->iContactFirstName->Des() ); + iParameters->iContactEmailAddress->Des().Append( _L("@") ); + iParameters->iContactEmailAddress->Des().Append( iParameters->iContactCompanyName->Des() ); + iParameters->iContactEmailAddress->Des().Append( _L(".com") ); + + } + else + { + iParameters = parameters; + } + + TInt err = KErrNone; + + // create a new contact item based on the default template + CPbkContactItem* newContact = iContactDBEngine->CreateEmptyContactL(); + CleanupStack::PushL(newContact); + + AddFieldToContactItemL (*newContact, EPbkFieldIdFirstName, iParameters->iContactFirstName->Des()); + AddFieldToContactItemL (*newContact, EPbkFieldIdLastName, iParameters->iContactLastName->Des()); + AddFieldToContactItemL (*newContact, EPbkFieldIdCompanyName, iParameters->iContactCompanyName->Des()); + AddFieldToContactItemL (*newContact, EPbkFieldIdJobTitle, iParameters->iContactJobTitle->Des()); + AddFieldToContactItemL (*newContact, EPbkFieldIdPostalAddress, iParameters->iContactPostalAddress->Des()); + + AddFieldToContactItemL (*newContact, EPbkFieldIdWVID, iParameters->iWvUserId->Des()); + AddFieldToContactItemL (*newContact, EPbkFieldIdPersonalRingingToneIndication, iParameters->iRingingtone->Des()); + AddFieldToContactItemL (*newContact, EPbkFieldIdThumbnailImage, iParameters->iThumbnailImage->Des()); + + for (TInt i=0; iiNumberOfPhoneNumberFields; i++) + { + if (i%6 == 0) + AddFieldToContactItemL (*newContact, EPbkFieldIdPhoneNumberGeneral, iParameters->iContactPhoneNumberGeneral->Des()); + else if (i%6 == 1) + AddFieldToContactItemL (*newContact, EPbkFieldIdPhoneNumberMobile, iParameters->iContactPhoneNumberGeneral->Des()); + else if (i%6 == 2) + AddFieldToContactItemL (*newContact, EPbkFieldIdFaxNumber, iParameters->iContactPhoneNumberGeneral->Des()); + else if (i%6 == 3) + AddFieldToContactItemL (*newContact, EPbkFieldIdPagerNumber, iParameters->iContactPhoneNumberGeneral->Des()); + else if (i%6 == 4) + AddFieldToContactItemL (*newContact, EPbkFieldIdPhoneNumberHome, iParameters->iContactPhoneNumberGeneral->Des()); + else + AddFieldToContactItemL (*newContact, EPbkFieldIdPhoneNumberWork, iParameters->iContactPhoneNumberGeneral->Des()); + } + + for (TInt j=0; jiNumberOfURLFields; j++) + AddFieldToContactItemL (*newContact, EPbkFieldIdURL, iParameters->iContactURL->Des()); + + for (TInt k=0; kiNumberOfEmailAddressFields; k++) + AddFieldToContactItemL (*newContact, EPbkFieldIdEmailAddress, iParameters->iContactEmailAddress->Des()); + + + // add the contact item to the database + iContactDBEngine->AddNewContactL(*newContact); + + // id has been generated, store it for being able to delete + // entries created only with Creator + iContactIds.Append( newContact->Id() ); + + CleanupStack::PopAndDestroy(); // newContact + + CompactPbkDatabase(); + + return err; + } + +//---------------------------------------------------------------------------- + +TInt CCreatorPhonebook::CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters) + { + LOGSTRING("Creator: CCreatorPhonebook::CreateGroupEntryL"); + + // clear any existing parameter definations + if (iParameters) + { + delete iParameters; + iParameters = NULL; + } + + // random data needed if no predefined data available + if (!aParameters) + { + iParameters = new(ELeave) CPhonebookParameters; + + iParameters->iContactsInGroup = iContactsInGroup; + + iParameters->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) ); + iParameters->iGroupName->Des().Append( _L(" #") ); + iParameters->iGroupName->Des().AppendNum( iEngine->RandomNumber(1000, 9999) ); + } + else + { + // otherwise replace the parameters object + iParameters = (CPhonebookParameters*) aParameters; + } + + TInt err(KErrNone); + + // create contact iterator + CPbkContactIter* contactIter = iContactDBEngine->CreateContactIteratorLC(); + + // create contact id array + CContactIdArray* contactIdArray = CContactIdArray::NewLC(); + + // get all contacts + TBool getFirstContact(ETrue); + TContactItemId contactId; + + for (;;) + { + if (getFirstContact) + { + // get first contact + contactId = contactIter->FirstL(); + getFirstContact = EFalse; + } + else + { + // get next contact + contactId = contactIter->NextL(); + } + + // check if valid contact id received + if (contactId == KNullContactId) + { + // no more contacts, so break + break; + } + else + { + // append to array + contactIdArray->AddL(contactId); + } + } + + // create a new contact group + CContactGroup* newGroup = iContactDBEngine->CreateContactGroupL( iParameters->iGroupName->Des() ); + CleanupStack::PushL(newGroup); + + // define amounts of contacts to be added to the group + TInt amountOfContactsToBeAdded; + if (iParameters->iContactsInGroup == KCreateRandomAmountOfGroups) + amountOfContactsToBeAdded = iEngine->RandomNumber(30); + else + amountOfContactsToBeAdded = iParameters->iContactsInGroup; + + + // a simple way to randomise order of contacts in the array + if (iEngine->RandomNumber(1, 2) == 1) + contactIdArray->ReverseOrder(); + + // assign contacts from the array to the group if any contacts available + if (contactIdArray->Count() > 0) + { + // get random start number which defines from which position to start adding contacts + TInt arrayPosCounter = iEngine->RandomNumber(contactIdArray->Count()-1); + TInt addedContacsCounter(0); + + for (TInt y=0; yAddContactToGroupL((*contactIdArray)[arrayPosCounter], newGroup->Id()); + addedContacsCounter++; + arrayPosCounter++; + + // no need to add more contacts than actually available + if (addedContacsCounter >= contactIdArray->Count()) + break; + + // if limit reached, start from the beginning + if (arrayPosCounter >= contactIdArray->Count()) + arrayPosCounter = 0; + } + } + + // id has been generated, store it for being able to delete + // entries created only with Creator + iGroupIds.Append( newGroup->Id() ); + + CleanupStack::PopAndDestroy(3); // newGroup, contactIdArray, contactIter + + CompactPbkDatabase(); + + return err; + } + + +//---------------------------------------------------------------------------- + +TInt CCreatorPhonebook::CreateSubscribedContactEntryL(CCreatorModuleBaseParameters* /*aParameters*/) + { + LOGSTRING("Creator: CCreatorPhonebook::CreateSubscribedContactEntryL"); + + return KErrNotSupported; + } + +//---------------------------------------------------------------------------- + +void CCreatorPhonebook::AddFieldToContactItemL(CPbkContactItem& aItem, TPbkFieldId aFieldId, const TDesC& aFieldText) + { + //LOGSTRING("Creator: CCreatorPhonebook::AddFieldToContactItemL"); + + CPbkFieldInfo* fieldInfo = iContactDBEngine->FieldsInfo().Find( aFieldId ); + if( fieldInfo ) // field was found + { + // add the field and value to contact + TPbkContactItemField* itemField = aItem.AddOrReturnUnusedFieldL( *fieldInfo ); + + if( itemField && aFieldText.Length() > 0 ) // add text also + { + if( itemField->ItemField().StorageType() == KStorageTypeText ) + { + CContactTextField* textField = itemField->ItemField().TextStorage(); + + // clip the text if it doesn't fit to the field + textField->SetTextL( aFieldText.Left( fieldInfo->MaxLength() ) ); + } + } + } + } + +//---------------------------------------------------------------------------- + +void CCreatorPhonebook::CompactPbkDatabase(TBool aCompressImmediately) + { + LOGSTRING("Creator: CCreatorPhonebook::CompactPbkDatabase"); + + iOpCounter++; + + // compress the database immediately or after each 100th operation + if (aCompressImmediately || iOpCounter%100 == 0) + { + CContactDatabase& db = iContactDBEngine->Database(); + + if (db.CompressRequired()) + { + LOGSTRING("Creator: CCreatorPhonebook::CompactPbkDatabase - Compacting..."); + TRAP_IGNORE( db.CompactL() ); + } + } + } +//---------------------------------------------------------------------------- +void CCreatorPhonebook::DeleteAllL() + { + LOGSTRING("Creator: CCreatorPhonebook::DeleteAllL"); + DeleteAllItemsL( KUidDictionaryUidContacts ); + iContactIds.Reset(); + } + +//---------------------------------------------------------------------------- +void CCreatorPhonebook::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorPhonebook::DeleteAllCreatedByCreatorL"); + DeleteItemsCreatedWithCreatorL( KUidDictionaryUidContacts ); + iContactIds.Reset(); + } + +//---------------------------------------------------------------------------- +void CCreatorPhonebook::DeleteAllGroupsL() + { + LOGSTRING("Creator: CCreatorPhonebook::DeleteAllGroupsL"); + DeleteAllItemsL( KUidDictionaryUidContactGroups ); + iGroupIds.Reset(); + } + +//---------------------------------------------------------------------------- +void CCreatorPhonebook::DeleteAllGroupsCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorPhonebook::DeleteAllGroupsCreatedByCreatorL"); + DeleteItemsCreatedWithCreatorL( KUidDictionaryUidContactGroups ); + iGroupIds.Reset(); + } + +//---------------------------------------------------------------------------- +void CCreatorPhonebook::DeleteAllItemsL( TUid aStoreUid ) + { + LOGSTRING("Creator: CCreatorPhonebook::DeleteItemsL"); + __ASSERT_ALWAYS( aStoreUid == KUidDictionaryUidContacts || + aStoreUid == KUidDictionaryUidContactGroups, + User::Panic( _L("CCreatorPb"), KErrArgument ) ); + + CContactIdArray* allContacts = iContactDBEngine->FindLC( _L("") ); + + CPbkContactItem* item; + TInt i(0); + // remove that type of item ids from the array + // that we don't want to delete + while( allContacts && i < allContacts->Count() ) + { + item = iContactDBEngine->ReadContactL( (*allContacts)[i] ); + if ( ( aStoreUid == KUidDictionaryUidContactGroups ) == + ( item->Type() != KUidContactGroup ) ) + { + allContacts->Remove( i ); + } + else + { + i++; + } + delete item; + item = NULL; + } + iContactDBEngine->DeleteContactsL( *allContacts ); + CleanupStack::PopAndDestroy( allContacts ); + + // contacts deleted, remove the store + CDictionaryFileStore* store = iEngine->FileStoreLC(); + if ( store ) + { + store->Remove( aStoreUid ); + store->CommitL(); + } + CleanupStack::PopAndDestroy( store ); + } + +//---------------------------------------------------------------------------- +void CCreatorPhonebook::DeleteItemsCreatedWithCreatorL( TUid aStoreUid ) + { + LOGSTRING("Creator: CCreatorPhonebook::DeleteItemsCreatedWithCreatorL"); + __ASSERT_ALWAYS( aStoreUid == KUidDictionaryUidContacts || + aStoreUid == KUidDictionaryUidContactGroups, + User::Panic( _L("CCreatorPb"), KErrArgument ) ); + + iEntriesToDelete.Reset(); + + // fetch ids of entries created by Creator + iEngine->ReadEntryIdsFromStoreL( iEntriesToDelete, aStoreUid ); + + // delete entries + for ( TInt i = 0; i < iEntriesToDelete.Count(); i++ ) + { + TRAP_IGNORE( iContactDBEngine->DeleteContactL( iEntriesToDelete[i] ) ); + } + + iEntriesToDelete.Reset(); + + // all entries deleted, remove the Logs related registry + iEngine->RemoveStoreL( aStoreUid ); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_phonebookbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_phonebookbase.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,119 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_phonebookbase.h" +#include "creator_model.h" +#include "creator_traces.h" + +TBool CCreatorPhonebookBase::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorPhonebook::AskDataFromUserL"); + + if( aCommand == ECmdDeleteContacts ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all contacts?") ); + } + if( aCommand == ECmdDeleteCreatorContacts ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all contacts created with Creator?") ); + } + if( aCommand == ECmdDeleteContactGroups ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all contact groups?") ); + } + if( aCommand == ECmdDeleteCreatorContactGroups ) + { + return iEngine->YesNoQueryDialogL(_L("Delete all contact groups created with Creator?") ); + } + // display queries + if (iEngine->EntriesQueryDialogL(aNumberOfEntries, _L("How many entries to create?"))) // ask number of entries to create + { + if (aCommand == ECmdCreatePhoneBookEntryContacts) + { + TInt index = 0; + CAknListQueryDialog* dlg1 = new(ELeave) CAknListQueryDialog(&index); + if (dlg1->ExecuteLD(R_CONTACT_CREATION_TYPE_QUERY)) + { + if (index == 0) //first item + { + iDefaultFieldsSelected = ETrue; + return ETrue; + } + else // detailed mode selected + { + iDefaultFieldsSelected = EFalse; + if (iEngine->EntriesQueryDialogL(iNumberOfPhoneNumberFields, _L("Amount of phone number fields in one contact?"), ETrue)) + { + if (iEngine->EntriesQueryDialogL(iNumberOfURLFields, _L("Amount of URL fields in one contact?"), ETrue)) + { + if (iEngine->EntriesQueryDialogL(iNumberOfEmailAddressFields, _L("Amount of email fields in one contact?"), ETrue)) + { + return ETrue; + } + else + return EFalse; + } + else + return EFalse; + } + else + return EFalse; + } + } + else + return EFalse; + } + else if (aCommand == ECmdCreatePhoneBookEntryGroups) + { + TInt index = 0; + CAknListQueryDialog* dlg1 = new(ELeave) CAknListQueryDialog(&index); + if (dlg1->ExecuteLD(R_GROUP_CREATION_TYPE_QUERY)) + { + if (index == 0) //first item + { + iContactsInGroup = KCreateRandomAmountOfGroups; + return ETrue; + } + else + { + if (iEngine->EntriesQueryDialogL(iContactsInGroup, _L("Amount of contacts in one group?"), ETrue)) + { + return ETrue; + } + else + return EFalse; + } + } + else + return EFalse; + } + else + return ETrue; + } + else + return EFalse; + } + +void CCreatorPhonebookBase::SetDefaultParameters() + { + iNumberOfPhoneNumberFields = 1; + iNumberOfURLFields = 0; + iNumberOfEmailAddressFields = 0; + iContactsInGroup = 50; + iDefaultFieldsSelected = EFalse; + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_randomdataparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_randomdataparser.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,324 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +#include +#include "creator_randomdataparser.h" +#include "creator_traces.h" + +// XML element names +_LIT(KRootElement, "creatordata"); +_LIT(KFirstName, "firstname"); +_LIT(KSurname, "surname"); +_LIT(KCompany, "company"); +_LIT(KAddress, "address"); +_LIT(KJobTitle, "jobtitle"); +_LIT(KPhoneNumber, "phonenumber"); +_LIT(KGroupName, "groupname"); +_LIT(KMeetingReason, "meetingreason"); +_LIT(KMeetingPlace, "meetingplace"); +_LIT(KMemoText, "memo"); +_LIT(KAnniversaryReason, "anniversary"); +_LIT(KToDoText, "todo"); +_LIT(KReminderText, "reminder"); +_LIT(KMessageSubject, "messagesubject"); +_LIT(KMessageText, "messagetext"); +_LIT(KCity, "city"); +_LIT(KCountry, "country"); +_LIT(KPostcode, "postcode"); +_LIT(KState, "state"); +_LIT(KPobox, "pobox"); +_LIT(KPrefix, "prefix"); +_LIT(KSuffix, "suffix"); +_LIT(KLandmarkName, "landmarkname"); +_LIT(KLandmarkDescription, "landmarkdescription"); + +using namespace Xml; + +CCreatorRandomDataParser::CCreatorRandomDataParser() + { + } + +void CCreatorRandomDataParser::ConstructL() + { + LOGSTRING("Creator: CCreatorRandomDataParser::ConstructL"); + iElementNameArray = new (ELeave) CDesCArrayFlat(32); + iElementNameArray->InsertL(EFirstName, KFirstName); + iElementNameArray->InsertL(ESurname, KSurname); + iElementNameArray->InsertL(ECompany, KCompany); + iElementNameArray->InsertL(EAddress, KAddress); + iElementNameArray->InsertL(EJobTitle, KJobTitle); + iElementNameArray->InsertL(EPhoneNumber, KPhoneNumber); + iElementNameArray->InsertL(EGroupName, KGroupName); + iElementNameArray->InsertL(EMeetingReason, KMeetingReason); + iElementNameArray->InsertL(EMeetingPlace, KMeetingPlace); + iElementNameArray->InsertL(EMemoText, KMemoText); + iElementNameArray->InsertL(EAnniversaryReason, KAnniversaryReason); + iElementNameArray->InsertL(EToDoText, KToDoText); + iElementNameArray->InsertL(EReminderText, KReminderText); + iElementNameArray->InsertL(EMessageSubject, KMessageSubject); + iElementNameArray->InsertL(EMessageText, KMessageText); + iElementNameArray->InsertL(ECity, KCity); + iElementNameArray->InsertL(ECountry, KCountry); + iElementNameArray->InsertL(EPostcode, KPostcode); + iElementNameArray->InsertL(EState, KState); + iElementNameArray->InsertL(EPobox, KPobox); + iElementNameArray->InsertL(EPrefix, KPrefix); + iElementNameArray->InsertL(ESuffix, KSuffix); + iElementNameArray->InsertL(ELandmarkName, KLandmarkName); + iElementNameArray->InsertL(ELandmarkDescription, KLandmarkDescription); + iContentData = HBufC::NewL(16); + iResultArray = new (ELeave) CDesCArrayFlat(16); + } + +CCreatorRandomDataParser* CCreatorRandomDataParser::NewL() + { + LOGSTRING("Creator: CCreatorRandomDataParser::NewL"); + CCreatorRandomDataParser* self = CCreatorRandomDataParser::NewLC(); + CleanupStack::Pop(); + return self; + } + +CCreatorRandomDataParser* CCreatorRandomDataParser::NewLC() + { + LOGSTRING("Creator: CCreatorRandomDataParser::NewLC"); + CCreatorRandomDataParser* self = new (ELeave) CCreatorRandomDataParser; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CCreatorRandomDataParser::~CCreatorRandomDataParser() + { + delete iParser; + delete iResultArray; + delete iContentData; + delete iElementNameArray; + } + +void CCreatorRandomDataParser::GetTextFileMode(RFile& aFile, TInt& aFileSize) + { + LOGSTRING("Creator: CCreatorRandomDataParser::GetTextFileMode"); + iScriptTextFormat = EFormatANSIASCII; + + // if we are working with text files, check the type first + TBuf8<4> BOM; + + // first check for UTF-16 + if (aFileSize >= 2 && aFile.Read(0, BOM, 2) == KErrNone) + { + if (BOM.Length()==2 && BOM[0]==0xFF && BOM[1]==0xFE) + { + iScriptTextFormat = EFormatUTF16LE; + aFileSize -= 2; + return; + } + else if (BOM.Length()==2 && BOM[0]==0xFE && BOM[1]==0xFF) + { + iScriptTextFormat = EFormatUTF16BE; + aFileSize -= 2; + return; + } + } + // then check for UTF-8 + if (aFileSize >= 3 && aFile.Read(0, BOM, 3) == KErrNone) + { + if (BOM.Length()==3 && BOM[0]==0xEF && BOM[1]==0xBB && BOM[2]==0xBF) + { + iScriptTextFormat = EFormatUTF8; + aFileSize -= 3; + return; + } + } + + // none of those, seek back to beginning + TInt pos(0); + aFile.Seek(ESeekStart, pos); + } + + + +CDesCArrayFlat* CCreatorRandomDataParser::ParseL(const TDesC& aFileName, const TRandomDataType aDataType) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::ParseL: %S", &aFileName); + + iDataType = aDataType; + + // Create and start XML-parser + if( iParser == 0) + { + _LIT8(KXmlMimeType, "text/xml"); + iParser = CParser::NewL(KXmlMimeType, *this); + } + + RFs filesession; + CleanupClosePushL(filesession); + User::LeaveIfError( filesession.Connect() ); + + iResultArray->Reset(); + + Xml::ParseL(*iParser, filesession, aFileName); + + CleanupStack::PopAndDestroy(&filesession); // filesession + + CDesCArrayFlat* tempArray = new (ELeave) CDesCArrayFlat(8); + CleanupStack::PushL(tempArray); + for (TInt i = 0; i < iResultArray->MdcaCount(); i++) + { + tempArray->AppendL(iResultArray->MdcaPoint(i)); + } + CleanupStack::Pop(tempArray); + return tempArray; + } + +void CCreatorRandomDataParser::OnStartDocumentL(const Xml::RDocumentParameters& /*aDocParam*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnStartDocumentL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + iInsideRootElement = EFalse; + iContentParsingActive = EFalse; + } + +void CCreatorRandomDataParser::OnEndDocumentL(TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnEndDocumentL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorRandomDataParser::OnStartPrefixMappingL(const RString& /*aPrefix*/, + const RString& /*aUri*/, + TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnStartPrefixMappingL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorRandomDataParser::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnEndPrefixMappingL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorRandomDataParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnIgnorableWhiteSpaceL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorRandomDataParser::OnSkippedEntityL(const RString& /*aName*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnSkippedEntityL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorRandomDataParser::OnProcessingInstructionL(const TDesC8& /*aTarget*/, + const TDesC8& /*aData*/, + TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnProcessingInstructionL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorRandomDataParser::OnError(TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnError: %d", aErrorCode); + + iLastError = aErrorCode; + } + +TAny* CCreatorRandomDataParser::GetExtendedInterface(const TInt32 aUid) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::GetExtendedInterface (UID: %d)", aUid); + return this; + } + +void CCreatorRandomDataParser::OnStartElementL(const Xml::RTagInfo& aElement, + const Xml::RAttributeArray& /*aAttributes*/, + TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnStartElementL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + + const TDesC8& elementName8 = aElement.LocalName().DesC(); + HBufC* elementName16 = Convert8BitTo16BitLC(elementName8); + if (iInsideRootElement || (elementName16->Des() == KRootElement)) + { + iInsideRootElement = ETrue; + } + if (iInsideRootElement && (elementName16->Des() == iElementNameArray->MdcaPoint(iDataType))) + { + iContentParsingActive = ETrue; + iContentData->Des().Zero(); + } + CleanupStack::PopAndDestroy(elementName16); + } + +void CCreatorRandomDataParser::OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnEndElementL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + + const TDesC8& elementName8 = aElement.LocalName().DesC(); + HBufC* elementName16 = Convert8BitTo16BitLC(elementName8); + if (!iInsideRootElement || (elementName16->Des() == KRootElement)) + { + iInsideRootElement = EFalse; + } + CleanupStack::PopAndDestroy(elementName16); + + if (iContentParsingActive) + { + if (iContentData->Des().Length() > 0) + { + iResultArray->AppendL(*iContentData); + } + iContentParsingActive = EFalse; + } + } + +void CCreatorRandomDataParser::OnContentL(const TDesC8& aBytes, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorRandomDataParser::OnContentL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + + if (iContentParsingActive) + { + HBufC* data16 = Convert8BitTo16BitLC(aBytes); + TInt newLen = iContentData->Des().Length() + data16->Des().Length(); + iContentData = iContentData->ReAllocL(newLen); + iContentData->Des().Append(*data16); + CleanupStack::PopAndDestroy(data16); + } + } + +HBufC16* CCreatorRandomDataParser::Convert8BitTo16BitLC(const TDesC8& aInput) + { + LOGSTRING("Creator: CCreatorRandomDataParser::Convert8BitTo16BitLC"); + HBufC16* output = NULL; + + output = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aInput); + + CleanupStack::PushL(output); + return output; + } + +TInt CCreatorRandomDataParser::GetError() const + { + return iLastError; + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_scriptelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_scriptelement.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,721 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_traces.h" +#include "creator_scriptelement.h" +#include +#include +#include // KMaxTelNumberSize + +using namespace Xml; + +CCreatorScriptElementCache* CCreatorScriptElementCache::NewL() +{ + CCreatorScriptElementCache* self = new (ELeave) CCreatorScriptElementCache; + CleanupStack::PushL(self); + + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +CCreatorScriptElementCache::CCreatorScriptElementCache() + { + + } + +void CCreatorScriptElementCache::ConstructL() + { + + } + +CCreatorScriptElementCache::~CCreatorScriptElementCache() + { + iElementCache.Reset(); + iElementCache.Close(); + } + +void CCreatorScriptElementCache::RemoveElements() + { + iElementCache.Reset(); + } + + +void CCreatorScriptElementCache::AddElementL(CCreatorScriptElement* aElement) + { + iElementCache.AppendL(aElement); + } + +/** + * + */ +CCreatorScriptAttribute* CCreatorScriptAttribute::NewLC(const TDesC& aName, const TDesC& aValue) + { + CCreatorScriptAttribute* self = new(ELeave) CCreatorScriptAttribute(); + CleanupStack::PushL(self); + self->ConstructL(aName, aValue); + return self; + } + +CCreatorScriptAttribute* CCreatorScriptAttribute::NewL(const TDesC& aName, const TDesC& aValue) + { + CCreatorScriptAttribute* self = CCreatorScriptAttribute::NewLC(aName, aValue); + CleanupStack::Pop(); // self + return self; + } + +CCreatorScriptAttribute::~CCreatorScriptAttribute() + { + delete iName; + delete iValue; + } + +TPtrC CCreatorScriptAttribute::Name() const + { + return iName->Des(); + } + +void CCreatorScriptAttribute::SetNameL(const TDesC& aName) + { + if( iName ) + { + delete iName; + iName = 0; + } + iName = HBufC::NewL(aName.Length()); + iName->Des() = aName; + } + +TPtrC CCreatorScriptAttribute::Value() const + { + return iValue->Des(); + } + +void CCreatorScriptAttribute::SetValueL(const TDesC& aValue) + { + if( iValue ) + { + delete iValue; + iValue = 0; + } + iValue = HBufC::NewL(aValue.Length()); + iValue->Des() = aValue; + } + +CCreatorScriptAttribute::CCreatorScriptAttribute() + { + } + +void CCreatorScriptAttribute::ConstructL(const TDesC& aName, const TDesC& aValue) + { + SetNameL(aName); + SetValueL(aValue); + } + +/** + * CCreatorScriptElement + */ + +CCreatorScriptElement* CCreatorScriptElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + CCreatorScriptElement* self = new (ELeave) CCreatorScriptElement(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } + +CCreatorScriptElement::~CCreatorScriptElement() + { + LOGSTRING("Creator: CCreatorScriptElement::~CCreatorScriptElement"); + iSubElements.ResetAndDestroy(); + iAttributes.ResetAndDestroy(); + iSubElements.Close(); + iAttributes.Close(); + iParameters.Reset(); + iParameters.Close(); + delete iName; + delete iContent; + delete iContext; + } + +RPointerArray const& CCreatorScriptElement::SubElements() const + { + return iSubElements; + } + +RPointerArray& CCreatorScriptElement::SubElements() + { + return iSubElements; + } + +CCreatorScriptElement* CCreatorScriptElement::SubElement(TInt aIndex) + { + return iSubElements[aIndex]; + } + +CCreatorScriptElement* CCreatorScriptElement::FindSubElement(const TDesC& aName) + { + for( TInt i = 0; i < iSubElements.Count(); ++i ) + { + if( iSubElements[i]->Name() == aName ) + { + return iSubElements[i]; + } + } + return 0; + } + +void CCreatorScriptElement::RemoveSubElements() + { + iSubElements.ResetAndDestroy(); + } + +void CCreatorScriptElement::RemoveSubElementL(TInt aIndex) + { + if( aIndex < iSubElements.Count()) + { + delete iSubElements[aIndex]; + iSubElements.Remove(aIndex); + } + else + { + User::Leave(KErrArgument); + } + } + +void CCreatorScriptElement::AddSubElementL(CCreatorScriptElement* aElem, TInt aIndex ) + { + if( aIndex == -1 || aIndex == iSubElements.Count() ) + { + iSubElements.AppendL(aElem); + } + else if( aIndex < iSubElements.Count()) + { + iSubElements.Insert(aElem, aIndex); + } + else + { + User::Leave(KErrArgument); + } + } + +RPointerArray const& CCreatorScriptElement::Attributes() const + { + return iAttributes; + } + + + CCreatorScriptAttribute* CCreatorScriptElement::Attribute(TInt aIndex) + { + return iAttributes[aIndex]; + } + +void CCreatorScriptElement::RemoveAttributes() + { + iAttributes.ResetAndDestroy(); + } + + +void CCreatorScriptElement::RemoveAttributeL(TInt aIndex) + { + if( aIndex < iAttributes.Count()) + { + delete iAttributes[aIndex]; + iAttributes.Remove(aIndex); + } + else + { + User::Leave(KErrArgument); + } + } + +void CCreatorScriptElement::AddAttributeL(CCreatorScriptAttribute* aAttribute, TInt aIndex ) + { + if( aIndex == -1 || aIndex == iAttributes.Count() ) + { + iAttributes.AppendL(aAttribute); + } + else if( aIndex < iAttributes.Count()) + { + iAttributes.Insert(aAttribute, aIndex); + } + else + { + User::Leave(KErrArgument); + } + } + +TPtrC CCreatorScriptElement::Name() const + { + if( iName ) + return iName->Des(); + return TPtrC(); + } + +void CCreatorScriptElement::SetNameL(const TDesC& aName) + { + if( iName ) + { + delete iName; + iName = 0; + } + iName = HBufC::NewL(aName.Length()); + iName->Des() = aName; + } + + +TPtrC CCreatorScriptElement::Content() const + { + if (iContent) + return iContent->Des(); + return TPtrC(); + } + +void CCreatorScriptElement::SetContentL(const TDesC& aContent) + { + if( iContent ) + { + delete iContent; + iContent = 0; + } + iContent = HBufC::NewL(aContent.Length()); + iContent->Des() = aContent; + } + +void CCreatorScriptElement::AppendContentL(const TDesC& aContent) + { + if( iContent == 0 ) + { + SetContentL(aContent); + return; + } + + iContent = iContent->ReAllocL(iContent->Length() + aContent.Length() ); + + TPtr ptr(iContent->Des()); + ptr += aContent; + } + +TPtrC CCreatorScriptElement::Context() const + { + if( iContext ) + return iContext->Des(); + return TPtrC(); + } + +void CCreatorScriptElement::SetContextL(const TDesC& aContext) + { + if( iContext ) + { + delete iContext; + iContext = 0; + } + iContext = HBufC::NewL(aContext.Length()); + iContext->Des() = aContext; + } + +const CCreatorScriptAttribute* CCreatorScriptElement::FindAttributeByName(const TDesC& aName) const + { + for( TInt i = 0; i < iAttributes.Count(); ++i ) + { + CCreatorScriptAttribute* attr = iAttributes[i]; + if( attr->Name() == aName ) + { + return attr; + } + } + return 0; + } + +CCreatorScriptAttribute* CCreatorScriptElement::FindAttributeByName(const TDesC& aName) + { + for( TInt i = 0; i < iAttributes.Count(); ++i ) + { + CCreatorScriptAttribute* attr = iAttributes[i]; + if( attr->Name() == aName ) + { + return attr; + } + } + return 0; + } + +TBool CCreatorScriptElement::IsCacheNeeded() + { + _LIT(KIDAttrName, "id"); + const CCreatorScriptAttribute* attr = FindAttributeByName(KIDAttrName); + return attr != 0; + } + +void CCreatorScriptElement::AddToCacheL(CCreatorScriptElementCache& aCache) + { + aCache.AddElementL(this); + } + +RPointerArray& CCreatorScriptElement::CommandParameters() + { + return iParameters; + } + +const RPointerArray& CCreatorScriptElement::CommandParameters() const + { + return iParameters; + } + +void CCreatorScriptElement::AddToCacheL() + { + } + +TBool CCreatorScriptElement::IsCommandElement() const + { + return iIsCommandElement; + } + +void CCreatorScriptElement::ExecuteCommandL() + { + + } + +TBool CCreatorScriptElement::IsRoot() const + { + _LIT(KRootName, "creatorscript"); + if(iName->Des() == KRootName) + return ETrue; + return EFalse; + } + +CCreatorScriptElement::CCreatorScriptElement(CCreatorEngine* aEngine) +: +iIsCommandElement(EFalse), +iIsRoot(EFalse), +iEngine(aEngine) + {} + +void CCreatorScriptElement::ConstructL(const TDesC& aName, const TDesC& aContext) + { + SetNameL(aName); + SetContextL(aContext); + } + +TBool CCreatorScriptElement::IsSubElementSupported(const CCreatorScriptElement& /*aElem*/) const + { + return ETrue; + } + +TBool CCreatorScriptElement::ConvertStrToBooleanL(const TDesC& aStr) const + { + TBool boolVal = EFalse; + _LIT(KYes, "yes"); + _LIT(KTrue, "true"); + if( CompareIgnoreCase(aStr, KYes) == 0 || + CompareIgnoreCase(aStr, KTrue) == 0 ) + { + boolVal = ETrue; + } + return boolVal; + } + +TInt CCreatorScriptElement::ConvertStrToIntL(const TDesC& aStr) const + { + TInt intVal = 0; + TLex lex(aStr); + TInt errorCode=lex.Val(intVal); + User::LeaveIfError(errorCode); + return intVal; + } + +TUint CCreatorScriptElement::ConvertStrToUintL(const TDesC& aStr) const + { + TUint uintVal = 0; + TLex lex(aStr); + TInt errorCode=lex.Val(uintVal); + User::LeaveIfError(errorCode); + return uintVal; + } +void CCreatorScriptElement::ConvertStrToReal64L(const TDesC& aStr, TReal64& aVal) const + { + TLex lex(aStr); + TInt errorCode=lex.Val(aVal); + User::LeaveIfError(errorCode); + } + +void CCreatorScriptElement::ConvertStrToReal32L(const TDesC& aStr, TReal32& aVal) const + { + TLex lex(aStr); + TInt errorCode=lex.Val(aVal); + User::LeaveIfError(errorCode); + } + +MCreatorRandomDataField::TRandomLengthType CCreatorScriptElement::ResolveRandomDataTypeL(const CCreatorScriptAttribute& aAttr, TInt& aRandomLen) const + { + TPtrC attrVal = aAttr.Value(); + if(attrVal == KMax ) + return MCreatorRandomDataField::ERandomLengthMax; + if(attrVal == KDefault) + return MCreatorRandomDataField::ERandomLengthDefault; + + // Let's see if the value is numeric: + TInt val = 0; + TLex lex(attrVal); + TInt errorCode=lex.Val(val); + if( errorCode == KErrNone ) + { + aRandomLen = val; + return MCreatorRandomDataField::ERandomLengthExplicit; + } + return MCreatorRandomDataField::ERandomLengthUndefined; + } + +void CCreatorScriptElement::AppendContactSetReferenceL( + const CCreatorScriptElement& aContactSetRefElem, + RArray& aLinkArray ) const + { + const TDesC& eName = aContactSetRefElem.Name(); + if( eName != KContactSetRef ) + return; + + const CCreatorScriptAttribute* linkIdAttr = aContactSetRefElem.FindAttributeByName(KId); + if( linkIdAttr ) + { + TInt linkId = ConvertStrToIntL(linkIdAttr->Value()); + if( linkId > 0 ) + { + TLinkIdParam linkParams; + // Add contact-set-reference id to links + linkParams.iLinkId = linkId; + linkParams.iLinkAmount = KUndef; // undefined + // Resolve maxamount: + const CCreatorScriptAttribute* maxAmount = aContactSetRefElem.FindAttributeByName(KMaxAmount); + if( maxAmount ) + { + TInt maxAmountVal = ConvertStrToIntL(maxAmount->Value()); + if( maxAmountVal > 0 ) + { + linkParams.iLinkAmount = maxAmountVal; + } + } + aLinkArray.AppendL(linkParams); + } + } + } + +TTime CCreatorScriptElement::ConvertToDateTimeL(const TDesC& aDtStr) const + { + _LIT(KDateFieldSeparator, "-"); + _LIT(KTimeFieldSeparator, ":"); + _LIT(KDateTimeSeparator, "T"); + _LIT(KTimeSuffix, "."); + _LIT(KDateSuffix, ":"); + // Format date-time string: + HBufC* formatted = HBufC::NewLC(aDtStr.Length()); + formatted->Des().Copy(aDtStr); + + TBool hasTimePart = EFalse; + TBool hasDateTimeSeparator = EFalse; + TInt pos = 0; + + // Date and month numbering starts from 0 in Symbian, so first + // we need to decrease the date and month by one. Script format is following: + // yyyy-mm-ddThh:mm:ss + // Remove also date field separators ('-') + while( (pos = formatted->Find(KDateFieldSeparator)) != KErrNotFound ) + { + // decrease month or date by one + + // First char. Can be zero also: + TInt newValue = 0; + const TPtrC& char1 = formatted->Des().Mid(pos+1).Left(1); + newValue = 10 * ConvertStrToIntL(char1); + // Next char: + const TPtrC& char2 = formatted->Des().Mid(pos+2).Left(1); + newValue += ConvertStrToIntL(char2); + + if( newValue > 0 ) + { + --newValue; + } + + _LIT(KTemp, "%d"); + HBufC* formatBuf = KTemp().AllocLC(); + HBufC* buf = 0; + if( newValue < 10 ) + buf = HBufC::NewLC(1); + else + buf = HBufC::NewLC(2); + + TPtr temp(buf->Des()); + temp.Format(*formatBuf, newValue); + if( newValue < 10 ) + { + formatted->Des()[pos+1] = TChar('0'); + formatted->Des()[pos+2] = buf->Des()[0]; + } + else + { + formatted->Des()[pos+1] = buf->Des()[0]; + formatted->Des()[pos+2] = buf->Des()[1]; + } + // Finally, delete the '-' separator: + formatted->Des().Delete(pos, 1); + CleanupStack::PopAndDestroy(2); + } + + while( (pos = formatted->Find(KTimeFieldSeparator)) != KErrNotFound ) + { + formatted->Des().Delete(pos, 1); + hasTimePart = ETrue; + } + + // Replace 'T' with ':': + if( (pos = formatted->Find(KDateTimeSeparator)) != KErrNotFound ) + { + formatted->Des().Replace(pos, 1, KDateSuffix); + hasDateTimeSeparator = ETrue; + } + + if( hasTimePart ) + formatted->Des().Append(KTimeSuffix); + else if( !hasDateTimeSeparator ) + formatted->Des().Append(KDateSuffix); + + + TTime ret; + ret.Set(*formatted); + CleanupStack::PopAndDestroy(); // formatted + return ret; + } + +TInt CCreatorScriptElement::CompareIgnoreCase(const TDesC& aStr1, const TDesC& aStr2 ) const + { + // Get default collation method: + TCollationMethod defaultCollationMethod = *Mem::CollationMethodByIndex(0); + + // Add ignore case flag: + defaultCollationMethod.iFlags |= TCollationMethod::EFoldCase; + + return aStr1.CompareF(aStr2); + } + +void CCreatorScriptElement::SetContentToTextParamL(HBufC*& aPtr, const TDesC& aContent ) + { + delete aPtr; + aPtr = 0; + aPtr = HBufC::NewL(aContent.Length()); + aPtr->Des().Copy(aContent); + } + +/** + * Increases phonenumber by aDelta. + */ +void CCreatorScriptElement::IncreasePhoneNumL( const TDesC& aOriginal, TInt aDelta, HBufC* aIncreased ) const + { + LOGSTRING("Creator: CCreatorMessageElement::IncreasePhoneNumL"); + __ASSERT_ALWAYS( aDelta >= 0, User::Panic( _L("IncreasePhoneNumL"), KErrArgument ) ); + + // special cases, that are handled: + // +9 -> +9, +10, +11... + // +3584098#99 -> +3584098#99, +3584098#100, +3584098#101... + // # -> #0, #1, #2... + // 123# -> 123#0, 123#1, 123#2... + // 099 -> 099, 100, 101... + + // find out if there are any special characters, like # p or *, in the original number + TInt startIndex( aOriginal.Length() -1 ); + while ( startIndex >= 0 && + aOriginal[startIndex] >= '0' && + aOriginal[startIndex] <= '9' ) + { + startIndex--; + } + startIndex++; + + // append original head that may contain any non number characters + aIncreased->Des().Append( aOriginal.Left( startIndex ) ); + + TBuf tailBuf; + if ( aOriginal.Length() > startIndex ) + { + tailBuf.Copy( aOriginal.Right( aOriginal.Length() -startIndex ) ); + } + + // parse the tail part of the original number + TInt64 intVal = 0; + if ( aOriginal.Length() > startIndex ) + { + TLex lex( tailBuf ); + User::LeaveIfError( lex.Val( intVal ) ); // this loses leading zeros + } + + // increase + intVal += aDelta; + + // restore leading zeros to tail, if any + TBuf resultTailNoZeros; + resultTailNoZeros.AppendNum( intVal ); + TInt tailLeadingZerosToRestore = tailBuf.Length() - resultTailNoZeros.Length(); + for ( TInt i = 0; i < tailLeadingZerosToRestore; i++ ) + { + aIncreased->Des().AppendNum( 0 ); + } + + // and finally, append the increased value as tail part of the result + aIncreased->Des().Append( resultTailNoZeros ); + } + +CCreatorScriptRoot* CCreatorScriptRoot::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + CCreatorScriptRoot* self = new (ELeave) CCreatorScriptRoot(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorScriptRoot::CCreatorScriptRoot(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { + iIsRoot=ETrue; + } + + +CCreatorCalendarElementBase* CCreatorCalendarElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + CCreatorCalendarElementBase* self = new (ELeave) CCreatorCalendarElementBase(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorCalendarElementBase::CCreatorCalendarElementBase(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { } + +CCreatorMessageElementBase* CCreatorMessageElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) + { + CCreatorMessageElementBase* self = new (ELeave) CCreatorMessageElementBase(aEngine); + CleanupStack::PushL(self); + self->ConstructL(aName, aContext); + CleanupStack::Pop(); + return self; + } +CCreatorMessageElementBase::CCreatorMessageElementBase(CCreatorEngine* aEngine) +: +CCreatorScriptElement(aEngine) + { } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_scriptelementfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_scriptelementfactory.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,112 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_traces.h" +#include "creator_scriptelementfactory.h" +#include "creator_contactelement.h" +#include "creator_calendarelement.h" +#include "creator_messageelement.h" +#include "creator_fileelement.h" +#include "creator_browserelement.h" +#include "creator_logelement.h" +#include "creator_noteelement.h" +#include "creator_impselement.h" +#include "creator_landmarkelement.h" +#include "creator_mailboxelement.h" +#include "creator_connectionmethodelement.h" + +CCreatorScriptElement* TCreatorScriptElementFactory::CreateElementL(CCreatorEngine* aEngine, const TDesC& aElementName, const TDesC& aContext ) + { + LOGSTRING2("TCreatorScriptElementFactory::CreateElementL: %S", &aElementName); + + if( aContext.Length() >= KFields().Length() && + aContext.Right(KFields().Length()) == KFields) + { + // This is a field element under 'fields'. + return CCreatorScriptElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorcontact::KContact ) + { + return CCreatorContactElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorcontact::KContactSet) + { + return CCreatorContactSetElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorcontact::KContactGroup ) + { + return CCreatorContactGroupElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == KFields) + { + return CCreatorScriptElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == KScript ) + { + return CCreatorScriptRoot::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorcalendar::KCalendar ) + { + return CCreatorCalendarElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatormsg::KMessage ) + { + return CCreatorMessageElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorfile::KFile ) + { + return CCreatorFileElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorbrowser::KBookmark || + aElementName == creatorbrowser::KBookmarkFolder || + aElementName == creatorbrowser::KSavedPage || + aElementName == creatorbrowser::KSavedPageFolder ) + { + return CCreatorBrowserElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorlog::KLog ) + { + return CCreatorLogElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatornote::KNote ) + { + return CCreatorNoteElement::NewL(aEngine, aElementName, aContext); + } + #ifdef __PRESENCE + else if( aElementName == creatorimps::KImpsServer ) + { + return CCreatorImpsServerElement::NewL(aEngine, aElementName, aContext); + } + #endif // __PRESENCE + else if( aElementName == creatorlandmark::KLandmark ) + { + return CCreatorLandmarkElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatormailbox::Kmailbox ) + { + return CCreatorMailboxElement::NewL(aEngine, aElementName, aContext); + } + else if( aElementName == creatorconnectionmethod::KCm ) + { + return CCreatorConnectionMethodElement::NewL(aEngine, aElementName, aContext); + } + else + { + return CCreatorScriptElement::NewL(aEngine, aElementName, aContext); + } + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_scriptentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_scriptentry.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,728 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_model.h" +#include "creator_traces.h" +#include "creator_factory.h" + +#include +#include + + +#include + + +const TInt KReadBufSize = 8192; + +// Creator random data file filter +_LIT(KRandomDataFileFilter, "*.creatordataxml"); + +// --------------------------------------------------------------------------- + + +CCommandParser* CCommandParser::NewL(CCreatorEngine* aEngine) + { + CCommandParser* self = CCommandParser::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCommandParser* CCommandParser::NewLC(CCreatorEngine* aEngine) + { + CCommandParser* self = new (ELeave) CCommandParser; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCommandParser::CCommandParser() + { + } + +void CCommandParser::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCommandParser::ConstructL"); + + iEngine = aEngine; + + iReadBuf = HBufC8::NewL(KReadBufSize); + } + +CCommandParser::~CCommandParser() + { + LOGSTRING("Creator: CCommandParser::~CCommandParser"); + + if (iSearchArray) + delete iSearchArray; + + if (iReadBuf) + delete iReadBuf; + } + + +// --------------------------------------------------------------------------- +//#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCommandParser::OpenScriptL() {} +TBool CCommandParser::OpenScriptL(RFile& aScriptFile) + { + LOGSTRING("Creator: CCommandParser::OpenScriptL"); + TBool ret = EFalse; + + // init the search array + iSearchArray = new(ELeave) CDesCArrayFlat(500); + + // wait dialog + CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); + waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_CANCEL); + TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Searching")); + + + // search all the .creator files from the phone + TInt err; + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\system\\apps\\Creator\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\data\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\data\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\documents\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\documents\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\creator\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\creator\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\scripts\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\scripts\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\temp\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\temp\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\system\\temp\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\system\\temp\\"))); + + TRAP(err, FindFiles(_L("*.creatorxml"), _L("\\private\\20011383\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\private\\20011383\\"))); + + TRAP(err, FindFilesRecursiveL(_L("*.creatorxml"), _L("\\private\\1000484b\\"))); + + + // remove the wait dialog + waitDialog->CancelNoteL(dialogId); + CleanupStack::PopAndDestroy(); //waitDialog; + + + if ( iSearchArray->MdcaCount() > 0) + { + // create a file name array based on the iSearchArray + CDesCArray* fileNameArray = new(ELeave) CDesCArrayFlat(iSearchArray->MdcaCount()); + CleanupStack::PushL(fileNameArray); + + for (TInt i=0; iMdcaCount(); i++) + { + + TParse filename; // file name parser + filename.Set(iSearchArray->MdcaPoint(i), NULL, NULL); + + if ( filename.Drive()[0] == 'e' || filename.Drive()[0] == 'E') // MMC + { + TFileName nameMMC; + nameMMC.Append(filename.Name()); + nameMMC.Append(_L("\t0")); // MMC icon + fileNameArray->AppendL(nameMMC); + } + else + { + fileNameArray->AppendL(filename.Name()); + } + } + CleanupStack::Pop(fileNameArray); + + + // create a popup list + CAknSinglePopupMenuStyleListBox* listBox = new(ELeave) CAknSinglePopupMenuStyleListBox; + CleanupStack::PushL(listBox); + CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow ); + CleanupStack::PushL(popupList); + popupList->SetTitleL(_L("Select script")); + listBox->ConstructL( popupList, EAknListBoxSelectionList|EAknListBoxLoopScrolling ); + listBox->CreateScrollBarFrameL( ETrue ); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + listBox->Model()->SetItemTextArray( fileNameArray ); + listBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); // !!! + listBox->HandleItemAdditionL(); + + + // define MMC icon + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + _LIT( KFLDMemoryCardUiBitmapFile, "z:aknmemorycardui.mbm" ); + CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 ); + listBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray ); + + TParse* fp = new(ELeave) TParse(); + fp->Set(KFLDMemoryCardUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL); + TFileName resourceFileName( fp->FullName() ); + delete fp; + + CGulIcon* icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnIndiMmcAdd, + resourceFileName, + EMbmAknmemorycarduiQgn_indi_mmc_add, + EMbmAknmemorycarduiQgn_indi_mmc_add_mask ); + CleanupStack::PushL( icon ); + iconArray->AppendL( icon ); + CleanupStack::Pop( icon ); + + + // execute dialog + TBool result = popupList->ExecuteLD(); + CleanupStack::Pop(); // popupList + + if ( result ) + { + // open the file for reading + //RFile file; + TRAPD(err, aScriptFile.Open(CEikonEnv::Static()->FsSession(), iSearchArray->MdcaPoint(listBox->CurrentItemIndex()), EFileRead)); + if( err != KErrNone) + { + aScriptFile.Close(); + User::Leave(err); + } + ret = ETrue; + } + CleanupStack::PopAndDestroy(); //listBox + } + else // no scripts found from the search paths + { + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("No scripts found")); + } + + delete iSearchArray; + iSearchArray = NULL; + return ret; + } +/* +#else +// --------------------------------------------------------------------------- +void CCommandParser::OpenScriptL() + { + LOGSTRING("Creator: CCommandParser::OpenScriptL"); + + // init the search array + iSearchArray = new(ELeave) CDesCArrayFlat(500); + + // wait dialog + CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); + waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_CANCEL); + TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Searching")); + + + // search all the .creator files from the phone + TInt err; + TRAP(err, FindFiles(_L("*.creator"), _L("\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\system\\apps\\Creator\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\data\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\data\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\documents\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\documents\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\creator\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\creator\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\scripts\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\scripts\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\temp\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\temp\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\system\\temp\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\system\\temp\\"))); + + TRAP(err, FindFiles(_L("*.creator"), _L("\\private\\101FA751\\"))); + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\private\\101FA751\\"))); + + TRAP(err, FindFilesRecursiveL(_L("*.creator"), _L("\\private\\1000484b\\"))); + + + // remove the wait dialog + waitDialog->CancelNoteL(dialogId); + CleanupStack::PopAndDestroy(); //waitDialog; + + + if ( iSearchArray->MdcaCount() > 0) + { + // create a file name array based on the iSearchArray + CDesCArray* fileNameArray = new(ELeave) CDesCArrayFlat(iSearchArray->MdcaCount()); + CleanupStack::PushL(fileNameArray); + + for (TInt i=0; iMdcaCount(); i++) + { + + TParse filename; // file name parser + filename.Set(iSearchArray->MdcaPoint(i), NULL, NULL); + + if ( filename.Drive()[0] == 'e' || filename.Drive()[0] == 'E') // MMC + { + TFileName nameMMC; + nameMMC.Append(filename.Name()); + nameMMC.Append(_L("\t0")); // MMC icon + fileNameArray->AppendL(nameMMC); + } + else + { + fileNameArray->AppendL(filename.Name()); + } + } + CleanupStack::Pop(fileNameArray); + + + // create a popup list + CAknSinglePopupMenuStyleListBox* listBox = new(ELeave) CAknSinglePopupMenuStyleListBox; + CleanupStack::PushL(listBox); + CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow ); + CleanupStack::PushL(popupList); + popupList->SetTitleL(_L("Select script")); + listBox->ConstructL( popupList, EAknListBoxSelectionList|EAknListBoxLoopScrolling ); + listBox->CreateScrollBarFrameL( ETrue ); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + listBox->Model()->SetItemTextArray( fileNameArray ); + listBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); // !!! + listBox->HandleItemAdditionL(); + + + // define MMC icon + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + _LIT( KFLDMemoryCardUiBitmapFile, "z:aknmemorycardui.mbm" ); + CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 ); + listBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray ); + + TParse* fp = new(ELeave) TParse(); + fp->Set(KFLDMemoryCardUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL); + TFileName resourceFileName( fp->FullName() ); + delete fp; + + CGulIcon* icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnIndiMmcAdd, + resourceFileName, + EMbmAknmemorycarduiQgn_indi_mmc_add, + EMbmAknmemorycarduiQgn_indi_mmc_add_mask ); + CleanupStack::PushL( icon ); + iconArray->AppendL( icon ); + CleanupStack::Pop( icon ); + + + // execute dialog + TBool result = popupList->ExecuteLD(); + CleanupStack::Pop(); // popupList + + if ( result ) + { + // open the file for reading + RFile file; + User::LeaveIfError(file.Open(CEikonEnv::Static()->FsSession(), iSearchArray->MdcaPoint(listBox->CurrentItemIndex()), EFileRead)); + while (ReadLineFromFileL(file) == KErrNone) + { + iReadBuf->Des().Trim(); // delete leading and trailing white space + + if (iReadBuf->Length() < 5) // command too short, ignoring... + { + //CEikonEnv::Static()->InfoMsg(_L("Corrupted line")); + } + + // check it's a valid line: first char is A-Z and the line ends to ';' + else if (iReadBuf->Des()[0] >= 'A' && iReadBuf->Des()[0] <= 'Z' && iReadBuf->Des()[iReadBuf->Length()-1] == ';') + { + // this line is valid -> parse the command + ParseCommandFromDescriptorL(); + } + else + { + //CEikonEnv::Static()->InfoMsg(_L("Not a valid line")); + } + + } + + file.Close(); + + // show a note if there were no valid commands in the script + if (iEngine->CommandArrayCount() == 0) + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("No valid commands in this script")); + } + + } + + CleanupStack::PopAndDestroy(); //listBox + } + + else // no scripts found from the search paths + { + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("No scripts found")); + } + + + delete iSearchArray; + iSearchArray = NULL; + + } +#endif +*/ + +TBool CCommandParser::GetRandomDataFilenameL(TDes& aFilename) + { + LOGSTRING("Creator: CCommandParser::GetRandomDataFilenameL"); + TBool ret = EFalse; + + // init the search array + if (iSearchArray) + { + delete iSearchArray; + iSearchArray = NULL; + } + iSearchArray = new(ELeave) CDesCArrayFlat(500); + + // wait dialog + CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); + waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_CANCEL); + TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Searching")); + + + // search all the creator random data files from the phone + TInt err; + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\system\\apps\\Creator\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\data\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\data\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\documents\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\documents\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\creator\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\creator\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\scripts\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\scripts\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\temp\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\temp\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\system\\temp\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\system\\temp\\"))); + + TRAP(err, FindFiles(KRandomDataFileFilter, _L("\\private\\20011383\\"))); + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\private\\20011383\\"))); + + TRAP(err, FindFilesRecursiveL(KRandomDataFileFilter, _L("\\private\\1000484b\\"))); + + + // remove the wait dialog + waitDialog->CancelNoteL(dialogId); + CleanupStack::PopAndDestroy(); //waitDialog; + + + if (iSearchArray->MdcaCount() > 0) + { + // create a file name array based on the iSearchArray + CDesCArray* fileNameArray = new(ELeave) CDesCArrayFlat(iSearchArray->MdcaCount() + 1); + CleanupStack::PushL(fileNameArray); + + for (TInt i=0; iMdcaCount(); i++) + { + + TParse filename; // file name parser + filename.Set(iSearchArray->MdcaPoint(i), NULL, NULL); + + if ( filename.Drive()[0] == 'e' || filename.Drive()[0] == 'E') // MMC + { + TFileName nameMMC; + nameMMC.Append(filename.Name()); + nameMMC.Append(_L("\t0")); // MMC icon + fileNameArray->AppendL(nameMMC); + } + else + { + fileNameArray->AppendL(filename.Name()); + } + } + + // add "default" (resource file) to list + fileNameArray->AppendL(_L("Default")); + + CleanupStack::Pop(fileNameArray); + + + // create a popup list + CAknSinglePopupMenuStyleListBox* listBox = new(ELeave) CAknSinglePopupMenuStyleListBox; + CleanupStack::PushL(listBox); + CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow ); + CleanupStack::PushL(popupList); + popupList->SetTitleL(_L("Select random data file")); + listBox->ConstructL( popupList, EAknListBoxSelectionList|EAknListBoxLoopScrolling ); + listBox->CreateScrollBarFrameL( ETrue ); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + listBox->Model()->SetItemTextArray( fileNameArray ); + listBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); // !!! + listBox->HandleItemAdditionL(); + + + // define MMC icon + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + _LIT( KFLDMemoryCardUiBitmapFile, "z:aknmemorycardui.mbm" ); + CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 ); + listBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray ); + + TParse* fp = new(ELeave) TParse(); + fp->Set(KFLDMemoryCardUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL); + TFileName resourceFileName( fp->FullName() ); + delete fp; + + CGulIcon* icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnIndiMmcAdd, + resourceFileName, + EMbmAknmemorycarduiQgn_indi_mmc_add, + EMbmAknmemorycarduiQgn_indi_mmc_add_mask ); + CleanupStack::PushL( icon ); + iconArray->AppendL( icon ); + CleanupStack::Pop( icon ); + + + // execute dialog + TBool result = popupList->ExecuteLD(); + CleanupStack::Pop(); // popupList + + if ( result ) + { + if (listBox->CurrentItemIndex() == (fileNameArray->Count() - 1)) + { + // "default" (resource file) selected + aFilename.Copy(KNullDesC); + } + else + { + // xml file selected + aFilename.Copy(iSearchArray->MdcaPoint(listBox->CurrentItemIndex())); + } + ret = ETrue; + } + CleanupStack::PopAndDestroy(); //listBox + } + else // no random data files found from the search paths + { + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("No random data files found")); + } + + delete iSearchArray; + iSearchArray = NULL; + return ret; + } + +TInt CCommandParser::FindFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath) + { + return CreatorFileUtils::FindFilesRecursiveL(iSearchArray, aFileName, aPath); + } +TInt CreatorFileUtils::FindFilesRecursiveL(CDesCArrayFlat* aFileArray, const TDesC& aFileName, const TDesC& aPath) + { + TInt err = KErrNone; + CDirScan* scan = CDirScan::NewLC(CEikonEnv::Static()->FsSession()); + scan->SetScanDataL(aPath, KEntryAttDir, ESortNone); + CDir* dirEntries = NULL; + + for(;;) + { + TRAP(err, scan->NextL(dirEntries)); + if (!dirEntries || (err!=KErrNone)) + break; + + for (TInt i=0; iCount(); i++) + { + TFileName path(scan->FullPath()); + path.Append((*dirEntries)[i].iName); + path.Append(_L("\\")); + FindFiles(aFileArray, aFileName, path); + } + delete(dirEntries); + } + + CleanupStack::PopAndDestroy(scan); + return err; + } + +TInt CreatorFileUtils::FindFiles(CDesCArrayFlat* aFileArray, const TDesC& aFileName, const TDesC& aPath) + { + TFindFile fileFinder(CEikonEnv::Static()->FsSession()); + CDir* fileList; + TInt err = fileFinder.FindWildByDir(aFileName, aPath, fileList); + + while (err == KErrNone) + { + for (TInt i=0; iCount(); i++) + { + TParse fullentry; + fullentry.Set((*fileList)[i].iName, &fileFinder.File(), NULL); + + TRAP(err, aFileArray->AppendL(fullentry.FullName())); + } + + delete fileList; + err = fileFinder.FindWild(fileList); + } + return err; + } +// --------------------------------------------------------------------------- + +TInt CCommandParser::FindFiles(const TDesC& aFileName, const TDesC& aPath) + { + return CreatorFileUtils::FindFiles(iSearchArray, aFileName, aPath); + } + +// --------------------------------------------------------------------------- + +TInt CCommandParser::ReadLineFromFileL(RFile& aInputFile) + { + LOGSTRING("Creator: CCommandParser::ReadLineFromFile"); + + _LIT8(KImcvCRLF, "\r\n"); + + TInt err = KErrNone; + + // Read into the buffer + HBufC8* tempLine = HBufC8::NewLC(KReadBufSize); + TPtr8 buffer = tempLine->Des(); + + // clear the targer + iReadBuf->Des().Copy(_L("")); + + // Get the current file position + TInt filePos = 0; + aInputFile.Seek(ESeekCurrent, filePos); + + // Read the buffer + err = aInputFile.Read(buffer); + + //end of file? + TInt s = buffer.Length(); + if ( s == 0) + err = KErrEof; + + if (err == KErrNone) + { + // Copy to the lfcr and then set the file pointer to the point after that + TInt pos = buffer.Find(KImcvCRLF); + if ( pos != -1) + { + iReadBuf->Des().Justify(buffer, pos, ELeft, ' '); + filePos += (pos+2); + + // Set the file pointer back to after the lfcr + aInputFile.Seek(ESeekStart, filePos); + } + // Else fill the whole buffer + else + { + iReadBuf->Des().Copy(buffer); + } + } + + CleanupStack::PopAndDestroy(); // tempLine + return err; + } + +// --------------------------------------------------------------------------- + +void CCommandParser::StrParserL(HBufC*& aDestinationBuf, TUint aToken) + { + // store old position + iParserOldPosition = iParserPosition; + + // make sure we are not reading outside of buffer + if (iParserPosition >= iReadBuf->Length() - 1) + return; + + // read until asked token + do + { + iParserPosition++; + } + while (iReadBuf->Des()[iParserPosition] != aToken && iParserPosition < iReadBuf->Des().Length()-1); + + // calculate length of the destination buffer + TInt bufferLength = iParserPosition-iParserOldPosition-1; + + // reset the destination buffer + if (aDestinationBuf) + { + delete aDestinationBuf; + aDestinationBuf = NULL; + } + + // allocate memory for the destination buffer + aDestinationBuf = HBufC::NewL(bufferLength); + + // copy data from the read buffer to the destination buffer + aDestinationBuf->Des().Copy(iReadBuf->Des().Mid(iParserOldPosition+1, bufferLength)); + } + +// --------------------------------------------------------------------------- + +void CCommandParser::StrParserL(HBufC8*& aDestinationBuf, TUint aToken) + { + // store old position + iParserOldPosition = iParserPosition; + + // make sure we are not reading outside of buffer + if (iParserPosition >= iReadBuf->Length() - 1) + return; + + // read until asked token + do + { + iParserPosition++; + } + while (iReadBuf->Des()[iParserPosition] != aToken && iParserPosition < iReadBuf->Des().Length()-1); + + // calculate length of the destination buffer + TInt bufferLength = iParserPosition-iParserOldPosition-1; + + // reset the destination buffer + if (aDestinationBuf) + { + delete aDestinationBuf; + aDestinationBuf = NULL; + } + + // allocate memory for the destination buffer + aDestinationBuf = HBufC8::NewL(bufferLength); + + // copy data from the read buffer to the destination buffer + aDestinationBuf->Des().Copy(iReadBuf->Des().Mid(iParserOldPosition+1, bufferLength)); + } + +//---------------------------------------------------------------------------- + +void CCommandParser::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) // from MMsvSessionObserver + { + } + +//---------------------------------------------------------------------------- + diff -r 000000000000 -r d6fe6244b863 creator/src/creator_scriptparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_scriptparser.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,393 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +#include +#include "creator_scriptparser.h" +#include "creator_scriptelementfactory.h" +#include "creator_traces.h" + +using namespace Xml; + +CCreatorScriptParser::CCreatorScriptParser() +: iDefaultElement(TCreatorScriptElementInfo(TCreatorScriptElementInfo::EStatusUndefined, 0)) + { + } +void CCreatorScriptParser::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorScriptParser::ConstructL"); + iEngine = aEngine; + } + +CCreatorScriptParser* CCreatorScriptParser::NewL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorScriptParser::NewL"); + CCreatorScriptParser* self = CCreatorScriptParser::NewLC(aEngine); + CleanupStack::Pop(); + return self; + } +CCreatorScriptParser* CCreatorScriptParser::NewLC(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorScriptParser::NewLC"); + CCreatorScriptParser* self = new (ELeave) CCreatorScriptParser; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorScriptParser::~CCreatorScriptParser() + { + delete iParser; + if( iElementStack.Count() > 0 ) + { + delete iElementStack[0].iElement; + } + iElementStack.Reset(); + iElementStack.Close(); + } + +void CCreatorScriptParser::GetTextFileMode(RFile& aFile, TInt& aFileSize) + { + LOGSTRING("Creator: CCreatorScriptParser::GetTextFileMode"); + iScriptTextFormat = EFormatANSIASCII; + + // if we are working with text files, check the type first + TBuf8<4> BOM; + + // first check for UTF-16 + if (aFileSize >= 2 && aFile.Read(0, BOM, 2) == KErrNone) + { + if (BOM.Length()==2 && BOM[0]==0xFF && BOM[1]==0xFE) + { + iScriptTextFormat = EFormatUTF16LE; + aFileSize -= 2; + return; + } + else if (BOM.Length()==2 && BOM[0]==0xFE && BOM[1]==0xFF) + { + iScriptTextFormat = EFormatUTF16BE; + aFileSize -= 2; + return; + } + } + // then check for UTF-8 + if (aFileSize >= 3 && aFile.Read(0, BOM, 3) == KErrNone) + { + if (BOM.Length()==3 && BOM[0]==0xEF && BOM[1]==0xBB && BOM[2]==0xBF) + { + iScriptTextFormat = EFormatUTF8; + aFileSize -= 3; + return; + } + } + + // none of those, seek back to beginning + TInt pos(0); + aFile.Seek(ESeekStart, pos); + } + + + +void CCreatorScriptParser::ParseL(const TDesC& aFileName) + { + LOGSTRING2("Creator: CCreatorScriptParser::ParseL: %S", &aFileName); + // Create and start XML-parser + if( iParser == 0) + { + _LIT8(KXmlMimeType, "text/xml"); + iParser = CParser::NewL(KXmlMimeType, *this); + } + + RFs filesession; + CleanupClosePushL(filesession); + User::LeaveIfError( filesession.Connect() ); + Xml::ParseL(*iParser, filesession, aFileName); + + CleanupStack::PopAndDestroy(&filesession); // filesession + } + +void CCreatorScriptParser::ParseL(RFile& aFile) + { + LOGSTRING("Creator: CCreatorScriptParser::ParseL"); + TInt filesize = 0; + aFile.Size(filesize); + GetTextFileMode(aFile, filesize); + // Create and start XML-parser + if( iParser == 0) + { + _LIT8(KXmlMimeType, "text/xml"); + iParser = CParser::NewL(KXmlMimeType, *this); + } + Xml::ParseL(*iParser, aFile); + } + +void CCreatorScriptParser::OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnStartDocumentL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + const TDesC8& charSet = aDocParam.CharacterSetName().DesC(); + } + +void CCreatorScriptParser::OnEndDocumentL(TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnEndDocumentL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorScriptParser::OnStartPrefixMappingL( const RString& /*aPrefix*/, + const RString& /*aUri*/, + TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnStartPrefixMappingL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } + +void CCreatorScriptParser::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnEndPrefixMappingL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } +void CCreatorScriptParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnIgnorableWhiteSpaceL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } +void CCreatorScriptParser::OnSkippedEntityL(const RString& /*aName*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnSkippedEntityL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } +void CCreatorScriptParser::OnProcessingInstructionL( const TDesC8& /*aTarget*/, + const TDesC8& /*aData*/, + TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnProcessingInstructionL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + } +void CCreatorScriptParser::OnError(TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnError: %d", aErrorCode); + + iLastError = aErrorCode; + + // Delete all elements from the stack: + while(iElementStack.Count() > 0 ) + { + TCreatorScriptElementInfo previousElem = LastElementInfo(); + delete previousElem.iElement; + previousElem.iElement = 0; + iElementStack.Remove(iElementStack.Count()-1); + } + } +TAny* CCreatorScriptParser::GetExtendedInterface(const TInt32 aUid) + { + LOGSTRING2("Creator: CCreatorScriptParser::GetExtendedInterface (UID: %d)", aUid); + return this; + } + +const TCreatorScriptElementInfo& CCreatorScriptParser::LastElementInfo() const +{ + LOGSTRING("Creator: CCreatorScriptParser::LastElementInfo"); + if(iElementStack.Count() > 0) + { + return iElementStack[iElementStack.Count()-1]; + } + return iDefaultElement; +} + +/** + * Create an element and add attributes to it. + */ +void CCreatorScriptParser::OnStartElementL( const RTagInfo& aElement, + const RAttributeArray& aAttributes, + TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnStartElementL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + const TDesC8& elementName8 = aElement.LocalName().DesC(); + HBufC* elementName16 = Convert8BitTo16BitLC(elementName8); + + const TCreatorScriptElementInfo& context = LastElementInfo(); + + CCreatorScriptElement* element = 0; + if( context.iElement ) + { + HBufC* fullContext = HBufC::NewL( + context.iElement->Context().Length() + + context.iElement->Name().Length() + + 2); + CleanupStack::PushL(fullContext); + if(context.iElement->Context() != KNullDesC && + context.iElement->Context().Length() > 0 ) + { + fullContext->Des().Copy(context.iElement->Context()); + _LIT(KContextSeparator, "::"); + fullContext->Des().Append(TPtrC(KContextSeparator)); + } + const TDesC& parentName = context.iElement->Name(); + if(parentName.Length() > 0 ) + { + fullContext->Des().Append(parentName); + } + element = TCreatorScriptElementFactory::CreateElementL( iEngine, + elementName16->Des(), + fullContext->Des()); + CleanupStack::PopAndDestroy(fullContext); // fullContext + } + else + { + element = TCreatorScriptElementFactory::CreateElementL(iEngine, elementName16->Des()); + } + + CleanupStack::PopAndDestroy(elementName16); + CleanupStack::PushL(element); + + if( element == 0 ) + { + // Add NULL pointer to stack. Otherwise the stack would go out of sync. in ::OnEndElement(). + TCreatorScriptElementInfo info(TCreatorScriptElementInfo::EStatusParsing, element); + iElementStack.AppendL(info); + CleanupStack::Pop(element); + return; + } + + // Add attributes to the element: + TInt attrCount = aAttributes.Count(); + for(TInt i = 0; i < attrCount; ++i) + { + const RAttribute& attribute = aAttributes[i]; + const RTagInfo& nameInfo = attribute.Attribute(); + const TDesC8& attrName8 = nameInfo.LocalName().DesC(); + const TDesC8& value8 = attribute.Value().DesC(); + // Convert data to 16 bit: + HBufC* attrName16 = Convert8BitTo16BitLC(attrName8); + HBufC* value16 = Convert8BitTo16BitLC(value8); + CCreatorScriptAttribute* scriptAttr = CCreatorScriptAttribute::NewLC(attrName16->Des(), value16->Des()); + element->AddAttributeL(scriptAttr); + CleanupStack::Pop(scriptAttr); + CleanupStack::PopAndDestroy(value16); + CleanupStack::PopAndDestroy(attrName16); + } + + // Save element to the stack: + TCreatorScriptElementInfo info(TCreatorScriptElementInfo::EStatusParsing, element); + iElementStack.AppendL(info); + CleanupStack::Pop(element); + } + +/** + * Executes the command if needed. Also caches the element for future use, if needed. + */ +void CCreatorScriptParser::OnEndElementL(const RTagInfo& /*aElement*/, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnEndElementL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + + if( iElementStack.Count() == 0 ) + { + return; + } + // Get element from the stack: + TCreatorScriptElementInfo elementInfo = LastElementInfo(); + + if( elementInfo.iElement == 0 ) + { + // Remove element from the stack: + iElementStack.Remove(iElementStack.Count()-1); + return; + } + + // Execute the command if this is a command element: + if( elementInfo.iElement->IsCommandElement() ) + { + elementInfo.iElement->ExecuteCommandL(); + } + + // Remove element from the stack: + iElementStack.Remove(iElementStack.Count()-1); + + // Get the previous element from the stack: + if( iElementStack.Count() > 0 ) + { + TCreatorScriptElementInfo previousElem = LastElementInfo(); + + if( previousElem.iElement->IsRoot() ) + { + // This element is not a sub-element (except of the root element, of course). + if( elementInfo.iElement->IsCacheNeeded() ) + { + // Add element to the cache, since it will be needed in future. + elementInfo.iElement->AddToCacheL(); + } + //else + // { + // Not needed anymore, so element can be deleted: + delete elementInfo.iElement; + elementInfo.iElement = 0; + // } + } + else + { + // There is a parent element (other than root), so we add this element + // as a sub-element fot it. + previousElem.iElement->AddSubElementL(elementInfo.iElement); + } + } + else + { + // Delete root element, which will delete recursively all sub-elements: + delete elementInfo.iElement; + elementInfo.iElement = 0; + } + } + +/** + * Add content to element. + */ +void CCreatorScriptParser::OnContentL(const TDesC8& aBytes, TInt aErrorCode) + { + LOGSTRING2("Creator: CCreatorScriptParser::OnContentL (Error code: %d)", aErrorCode); + User::LeaveIfError(aErrorCode); + if( iElementStack.Count() > 0 ) + { + HBufC* contentData = Convert8BitTo16BitLC(aBytes); + TCreatorScriptElementInfo elementInfo = iElementStack[iElementStack.Count()-1]; + if( elementInfo.iElement ) + { + elementInfo.iElement->AppendContentL(*contentData); + } + CleanupStack::PopAndDestroy(contentData); + } + } + +HBufC16* CCreatorScriptParser::Convert8BitTo16BitLC(const TDesC8& aInput) + { + LOGSTRING("Creator: CCreatorScriptParser::Convert8BitTo16BitLC"); + HBufC16* output = NULL; + + output = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aInput); + + CleanupStack::PushL(output); + return output; + } + +TInt CCreatorScriptParser::GetError() const +{ + return iLastError; +} diff -r 000000000000 -r d6fe6244b863 creator/src/creator_virtualphonebook.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_virtualphonebook.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1802 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_virtualphonebook.h" +#include "creator_traces.h" +#include "creator_contactsetcache.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +typedef struct { +TInt iFieldCode; +TInt iRandomType; +} FieldInfo; +static const TInt RND_TYPE_UNDEF = -99; +FieldInfo CreatorVPbkMiscTextFields[] = { + {R_VPBK_FIELD_TYPE_FIRSTNAME, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_FIRSTNAMEREADING, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_LASTNAME, (TInt) CCreatorEngine::ESurname}, + {R_VPBK_FIELD_TYPE_LASTNAMEREADING, (TInt) CCreatorEngine::ESurname}, + {R_VPBK_FIELD_TYPE_COMPANYNAME, (TInt) CCreatorEngine::ECompany}, + {R_VPBK_FIELD_TYPE_JOBTITLE, (TInt) CCreatorEngine::EJobTitle}, + {R_VPBK_FIELD_TYPE_PREFIX, (TInt) CCreatorEngine::EPrefix}, + {R_VPBK_FIELD_TYPE_SUFFIX, (TInt) CCreatorEngine::ESuffix}, + {R_VPBK_FIELD_TYPE_SECONDNAME, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_ADDRLABELGEN, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRPOGEN, (TInt) CCreatorEngine::EPobox}, + {R_VPBK_FIELD_TYPE_ADDREXTGEN, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRSTREETGEN, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRLOCALGEN, (TInt) CCreatorEngine::ECity}, + {R_VPBK_FIELD_TYPE_ADDRREGIONGEN, (TInt) CCreatorEngine::EState}, + {R_VPBK_FIELD_TYPE_ADDRPOSTCODEGEN, (TInt) CCreatorEngine::EPostcode}, + {R_VPBK_FIELD_TYPE_ADDRCOUNTRYGEN, (TInt) CCreatorEngine::ECountry}, + {R_VPBK_FIELD_TYPE_ADDRLABELHOME, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRPOHOME, (TInt) CCreatorEngine::EPobox}, + {R_VPBK_FIELD_TYPE_ADDREXTHOME, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRSTREETHOME, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRLOCALHOME, (TInt) CCreatorEngine::ECity}, + {R_VPBK_FIELD_TYPE_ADDRREGIONHOME, (TInt) CCreatorEngine::EState}, + {R_VPBK_FIELD_TYPE_ADDRPOSTCODEHOME, (TInt) CCreatorEngine::EPostcode}, + {R_VPBK_FIELD_TYPE_ADDRCOUNTRYHOME, (TInt) CCreatorEngine::ECountry}, + {R_VPBK_FIELD_TYPE_ADDRLABELWORK, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRPOWORK, (TInt) CCreatorEngine::EPobox}, + {R_VPBK_FIELD_TYPE_ADDREXTWORK, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRSTREETWORK, (TInt) CCreatorEngine::EAddress}, + {R_VPBK_FIELD_TYPE_ADDRLOCALWORK, (TInt) CCreatorEngine::ECity}, + {R_VPBK_FIELD_TYPE_ADDRREGIONWORK, (TInt) CCreatorEngine::EState}, + {R_VPBK_FIELD_TYPE_ADDRPOSTCODEWORK, (TInt) CCreatorEngine::EPostcode}, + {R_VPBK_FIELD_TYPE_ADDRCOUNTRYWORK, (TInt) CCreatorEngine::ECountry}, + {R_VPBK_FIELD_TYPE_POC, (TInt) CCreatorEngine::EPhoneNumber}, + {R_VPBK_FIELD_TYPE_SWIS, (TInt) CCreatorEngine::EPhoneNumber}, + {R_VPBK_FIELD_TYPE_SIP, (TInt) CCreatorEngine::EPhoneNumber}, + {R_VPBK_FIELD_TYPE_DTMFSTRING, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_NOTE,(TInt) CCreatorEngine::EMemoText}, + {R_VPBK_FIELD_TYPE_MIDDLENAME, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_DEPARTMENT, (TInt) CCreatorEngine::ECompany}, + {R_VPBK_FIELD_TYPE_ASSTNAME, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_SPOUSE, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_CHILDREN, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_SYNCCLASS, RND_TYPE_UNDEF}, + {R_VPBK_FIELD_TYPE_LOCPRIVACY, RND_TYPE_UNDEF}, + {R_VPBK_FIELD_TYPE_GENLABEL, (TInt) CCreatorEngine::EFirstName}, + {R_VPBK_FIELD_TYPE_WVADDRESS, (TInt) CCreatorEngine::EPhoneNumber}, + {R_VPBK_FIELD_TYPE_RINGTONE, RND_TYPE_UNDEF}, + {R_VPBK_FIELD_TYPE_THUMBNAILPIC, RND_TYPE_UNDEF}, + {R_VPBK_FIELD_TYPE_CALLEROBJTEXT, (TInt) CCreatorEngine::EFirstName} + }; + +TInt CreatorVPbkBinaryFields[] = { + R_VPBK_FIELD_TYPE_CALLEROBJIMG//, + //R_VPBK_FIELD_TYPE_THUMBNAILPATH + }; + +TInt CreatorVPbkDateTimeFields[] = { + R_VPBK_FIELD_TYPE_ANNIVERSARY + }; + +//---------------------------------------------------------------------------- +TInt CreatorVPbkPhoneNumberFields[] = + { + R_VPBK_FIELD_TYPE_LANDPHONEGEN, + R_VPBK_FIELD_TYPE_LANDPHONEHOME, + R_VPBK_FIELD_TYPE_LANDPHONEWORK, + R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, + R_VPBK_FIELD_TYPE_MOBILEPHONEHOME, + R_VPBK_FIELD_TYPE_MOBILEPHONEWORK, + R_VPBK_FIELD_TYPE_FAXNUMBERGEN, + R_VPBK_FIELD_TYPE_FAXNUMBERHOME, + R_VPBK_FIELD_TYPE_FAXNUMBERWORK, + R_VPBK_FIELD_TYPE_PAGERNUMBER, + R_VPBK_FIELD_TYPE_VIDEONUMBERGEN, + R_VPBK_FIELD_TYPE_VIDEONUMBERHOME, + R_VPBK_FIELD_TYPE_VIDEONUMBERWORK, + R_VPBK_FIELD_TYPE_VOIPGEN, + R_VPBK_FIELD_TYPE_VOIPHOME, + R_VPBK_FIELD_TYPE_VOIPWORK, + R_VPBK_FIELD_TYPE_ASSTPHONE, + R_VPBK_FIELD_TYPE_CARPHONE + }; + +TInt CreatorVPbkUrlFields[] = + { + R_VPBK_FIELD_TYPE_URLGEN, + R_VPBK_FIELD_TYPE_URLHOME, + R_VPBK_FIELD_TYPE_URLWORK + }; + +TInt CreatorVPbkEmailFields[] = + { + R_VPBK_FIELD_TYPE_EMAILGEN, + R_VPBK_FIELD_TYPE_EMAILHOME, + R_VPBK_FIELD_TYPE_EMAILWORK + }; + +//---------------------------------------------------------------------------- + +CVirtualPhonebookParameters::CVirtualPhonebookParameters() + { + LOGSTRING("Creator: CVirtualPhonebookParameters::CVirtualPhonebookParameters"); + iGroupName = HBufC::New(KPhonebookFieldLength); + } + +CVirtualPhonebookParameters::~CVirtualPhonebookParameters() + { + LOGSTRING("Creator: CVirtualPhonebookParameters::~CVirtualPhonebookParameters"); + + delete iGroupName; + iContactFields.ResetAndDestroy(); + iContactFields.Close(); + iLinkIds.Reset(); + iLinkIds.Close(); + } + +void CVirtualPhonebookParameters::ParseL(CCommandParser* /*parser*/, TParseParams /*aCase = 0*/) + { + } + +TInt CVirtualPhonebookParameters::ScriptLinkId() const + { + return iLinkId; + } + +void CVirtualPhonebookParameters::SetScriptLinkId(TInt aLinkId) + { + iLinkId = aLinkId; + } + +//---------------------------------------------------------------------------- + +CCreatorVirtualPhonebook* CCreatorVirtualPhonebook::NewL(CCreatorEngine* aEngine) + { + CCreatorVirtualPhonebook* self = CCreatorVirtualPhonebook::NewLC(aEngine); + CleanupStack::Pop(self); + return self; + } + +CCreatorVirtualPhonebook* CCreatorVirtualPhonebook::NewLC(CCreatorEngine* aEngine) + { + CCreatorVirtualPhonebook* self = new (ELeave) CCreatorVirtualPhonebook; + CleanupStack::PushL(self); + self->ConstructL(aEngine); + return self; + } + +CCreatorVirtualPhonebook::CCreatorVirtualPhonebook() + { + iAddAllFields = EFalse; + } + +void CCreatorVirtualPhonebook::ConstructL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::ConstructL"); + + iContactLinkArray = CVPbkContactLinkArray::NewL(); + iContactsToDelete = CVPbkContactLinkArray::NewL(); + iContactGroupsToDelete = CVPbkContactLinkArray::NewL(); + + iEngine = aEngine; + SetDefaultParameters(); + + // initialize virtual phonebook + CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC(); + uriArray->AppendL( TVPbkContactStoreUriPtr(VPbkContactStoreUris::DefaultCntDbUri())); + iContactManager = CVPbkContactManager::NewL( *uriArray, &CCoeEnv::Static()->FsSession()); + CleanupStack::PopAndDestroy(uriArray); + + //When the contact manager is created, the stores is opened + MVPbkContactStoreList& storeList = iContactManager->ContactStoresL(); + + iWaiter = CAsyncWaiter::NewL(); + + //MVPbkContactStoreListObserver must give as parameter + storeList.OpenAllL(*this); + // wait for OpenComplete() callback + iWaiter->StartAndWait(); + + _LIT(dbUri, "cntdb://c:contacts.cdb"); + const TVPbkContactStoreUriPtr uri = TVPbkContactStoreUriPtr(dbUri); + + iStore = storeList.Find(uri); + iOpCounter = 0; + } + +TBool CCreatorVirtualPhonebook::IsActive() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::IsActive"); + return iOperation != NULL; + } + +void CCreatorVirtualPhonebook::CancelOperation() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::CancelOperation"); + iCancelCbRequested = ETrue; + } + +CCreatorVirtualPhonebook::~CCreatorVirtualPhonebook() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::~CCreatorVirtualPhonebook"); + + // this is done only once per phonebook operation + if ( iContactsToDelete && iContactsToDelete->Count() ) + { + TRAP_IGNORE( StoreLinksForDeleteL( *iContactsToDelete, KUidDictionaryUidContacts ) ); + } + delete iContactsToDelete; + if ( iContactGroupsToDelete && iContactGroupsToDelete->Count() ) + { + TRAP_IGNORE( StoreLinksForDeleteL( *iContactGroupsToDelete, KUidDictionaryUidContactGroups ) ); + } + delete iContactGroupsToDelete; + + iPreviousDeleteLinks.ResetAndDestroy(); + + delete iOperation; + + TInt err = 0; + TRAP(err, CompactPbkDatabaseL( ETrue )); + + if(iContactResults) + { + delete iContactResults; + } + + delete iContactLinkArray; + delete iContactGroupsInStore; + + if(iContactManager) + { + TRAP(err, iContactManager->ContactStoresL().CloseAll(*this)); + delete iContactManager; + } + if(iWaiter) + { + delete iWaiter; + } + if (iParameters) + { + delete iParameters; + } + } + +//---------------------------------------------------------------------------- +TBool CCreatorVirtualPhonebook::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AskDataFromUserL"); + TBool ret = CCreatorPhonebookBase::AskDataFromUserL(aCommand, aNumberOfEntries); + + if(ret && aCommand == ECmdCreatePhoneBookEntryContacts && !iDefaultFieldsSelected) + { + iAddAllFields = iEngine->YesNoQueryDialogL(_L("Add all the other fields to contacts?")); + } + return ret; + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DeleteAllL() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllL"); + + // Delete all contacts, not contact groups + + //get field types + const MVPbkFieldTypeList& fieldList = iStore->StoreProperties().SupportedFields(); + + // get all contact links, results will be set to iContactResults + MVPbkContactOperationBase* operation = iContactManager->FindL( _L(""), fieldList , *this ); + if ( operation ) + { + iWaiter->StartAndWait(); //Making asynchronous FindL to synchronous + delete operation; + } + + while( iContactResults->Count() && + !iCancelCbRequested && + HasOtherThanGroupsL( iContactResults ) ) + { + // delete all found contacts + DeleteContactsL( iContactResults, EFalse ); + + if ( !iCancelCbRequested ) + { + // find next set of contacts to delete + MVPbkContactOperationBase* operation = iContactManager->FindL( _L(""), fieldList , *this ); + if ( operation ) + { + iWaiter->StartAndWait(); //Making asynchronous FindL to synchronous + delete operation; + } + } + } + + if ( iCancelCbRequested && iEngine ) + { + // User cancelled, must callback to finish terminatio sequence + iEngine->CancelComplete(); + } + else + { + // contacts deleted, remove the Creator internal contact registry + // (no callback required) + CDictionaryFileStore* store = iEngine->FileStoreLC(); + if ( store ) + { + store->Remove( KUidDictionaryUidContacts ); + store->CommitL(); + } + CleanupStack::PopAndDestroy( store ); + } + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DeleteAllCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllCreatedByCreatorL"); + DeleteItemsCreatedWithCreatorL( KUidDictionaryUidContacts ); + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DeleteAllGroupsL() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllGroupsL"); + User::LeaveIfNull( iStore ); + MVPbkContactLinkArray* groups = iStore->ContactGroupsLC(); + DeleteContactsL( groups, ETrue ); + CleanupStack::PopAndDestroy(); // cannot use groups as parameter + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DeleteAllGroupsCreatedByCreatorL() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllGroupsCreatedByCreatorL"); + DeleteItemsCreatedWithCreatorL( KUidDictionaryUidContactGroups ); + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DeleteContactsL( MVPbkContactLinkArray* aContacts, TBool aGroup ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteContactsL"); + const MVPbkContactLink* link( NULL ); + delete iOperation; + iOperation = NULL; + TInt i(0); + while ( aContacts && i < aContacts->Count() && !iCancelCbRequested ) + { + link = &aContacts->At( i++ ); + if ( aGroup == IsContactGroupL( *link ) ) + { + iOperation = iContactManager->RetrieveContactL( *link, *this ); + // see VPbkSingleContactOperationComplete + if ( iOperation ) + { + iWaiter->StartAndWait(); + delete iOperation; + iOperation = NULL; + } + } + link = NULL; + } + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DeleteItemsCreatedWithCreatorL( TUid aStoreUid ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteItemsCreatedWithCreatorL"); + __ASSERT_ALWAYS( aStoreUid == KUidDictionaryUidContacts || + aStoreUid == KUidDictionaryUidContactGroups, + User::Panic( _L("CCreatorVPb"), KErrArgument ) ); + CDictionaryFileStore* store = iEngine->FileStoreLC(); + User::LeaveIfNull( store ); + if ( store->IsPresentL( aStoreUid ) ) + { + TRAP_IGNORE( DoDeleteItemsCreatedWithCreatorL( aStoreUid, store ) ); + + if ( iCancelCbRequested && iEngine ) + { + iEngine->CancelComplete(); + } + else + { + // contacts deleted, remove the Creator internal contact registry + store->Remove( aStoreUid ); + store->CommitL(); + } + } + CleanupStack::PopAndDestroy( store ); + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::DoDeleteItemsCreatedWithCreatorL"); + RDictionaryReadStream in; + in.OpenLC( *aStore, aStoreUid ); + MVPbkContactLinkArray* contactsToDelete = NULL; + // fetch contact links from store + while ( ( contactsToDelete = iContactManager->CreateLinksLC( in ) ) != NULL && // will leave with KErrEof + !iCancelCbRequested ) + { + DeleteContactsL( contactsToDelete, aStoreUid == KUidDictionaryUidContactGroups ); + // PopAndDestroy for contactsToDelete causes E32USER-CBase:90 + // however there is no mem-leak even if not deleting contactsToDelete object + } + CleanupStack::PopAndDestroy(); // in + } + +//---------------------------------------------------------------------------- +TBool CCreatorVirtualPhonebook::HasOtherThanGroupsL( MVPbkContactLinkArray* aContacts ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::HasOtherThanGroupsL"); + TBool result( EFalse ); + TInt i(0); + while ( aContacts && i < aContacts->Count() && !iCancelCbRequested && !result ) + { + if ( !IsContactGroupL( aContacts->At( i++ ) ) ) + { + result = ETrue; + } + } + return result; + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& /*aOperation*/, + MVPbkStoreContact* aContact ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::VPbkSingleContactOperationComplete"); + + // This callback is currently used only for deleting a contact + // See DeleteContactsL + + TRAP_IGNORE( + aContact->PushL(); + aContact->DeleteL( *this ); + CleanupStack::PopAndDestroy( aContact ); + ); + } + +void CCreatorVirtualPhonebook::VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& /*aOperation*/, + TInt /*aError*/ ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::VPbkSingleContactOperationFailed"); + iWaiter->Cancel(); + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::StoreLinksForDeleteL( MVPbkContactLinkArray& aLinks, TUid aStoreUid ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::StoreLinksForDeleteL"); + CDictionaryFileStore* store = iEngine->FileStoreLC(); + User::LeaveIfNull( store ); + + // backup previous contact links from store + // otherwise they would be overwritten when calling out.WriteL + MVPbkContactLinkArray* previousLinks( NULL ); + if ( store->IsPresentL( aStoreUid ) ) + { + RDictionaryReadStream in; + in.OpenLC( *store, aStoreUid ); + TRAP_IGNORE( + while ( ( previousLinks = iContactManager->CreateLinksLC( in )) != NULL ) // will leave with KErrEof + { + CleanupStack::Pop(); // previousLinks + iPreviousDeleteLinks.Append( previousLinks ); + previousLinks = NULL; + } + ); + CleanupStack::PopAndDestroy(); // in + } + + RDictionaryWriteStream out; + out.AssignLC( *store, aStoreUid ); + + // restore previous links + for ( TInt i = 0; i < iPreviousDeleteLinks.Count(); i++ ) + { + out.WriteL( *iPreviousDeleteLinks[i]->PackLC() ); + CleanupStack::PopAndDestroy(); // PackLC + } + iPreviousDeleteLinks.ResetAndDestroy(); + + // write new links + out.WriteL( *aLinks.PackLC() ); + out.CommitL(); + CleanupStack::PopAndDestroy(); // aLinks.PackLC + CleanupStack::PopAndDestroy(); // out + + store->CommitL(); + CleanupStack::PopAndDestroy( store ); + } + +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC& aData) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC& aData)"); + if(iParameters == 0) + return; + CCreatorContactField* field = CCreatorContactField::NewL(aFieldType, aData); + CleanupStack::PushL(field); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(); + } + +void CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC8& aData) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC8& aData)"); + if(iParameters == 0) + return; + CCreatorContactField* field = CCreatorContactField::NewL(aFieldType, aData); + CleanupStack::PushL(field); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(); + } + +void CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TTime& aData) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TTime& aData)"); + if(iParameters == 0) + return; + CCreatorContactField* field = CCreatorContactField::NewL(aFieldType, aData); + CleanupStack::PushL(field); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(); + } + +//---------------------------------------------------------------------------- +TInt CCreatorVirtualPhonebook::iPhoneNumberFields[] = + { + R_VPBK_FIELD_TYPE_LANDPHONEGEN, + R_VPBK_FIELD_TYPE_LANDPHONEHOME, + R_VPBK_FIELD_TYPE_LANDPHONEWORK, + R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, + R_VPBK_FIELD_TYPE_MOBILEPHONEHOME, + R_VPBK_FIELD_TYPE_MOBILEPHONEWORK, + R_VPBK_FIELD_TYPE_FAXNUMBERGEN, + R_VPBK_FIELD_TYPE_FAXNUMBERHOME, + R_VPBK_FIELD_TYPE_FAXNUMBERWORK, + R_VPBK_FIELD_TYPE_PAGERNUMBER, + R_VPBK_FIELD_TYPE_VIDEONUMBERGEN, + R_VPBK_FIELD_TYPE_VIDEONUMBERHOME, + R_VPBK_FIELD_TYPE_VIDEONUMBERWORK, + R_VPBK_FIELD_TYPE_VOIPGEN, + R_VPBK_FIELD_TYPE_VOIPHOME, + R_VPBK_FIELD_TYPE_VOIPWORK, + R_VPBK_FIELD_TYPE_ASSTPHONE, + R_VPBK_FIELD_TYPE_CARPHONE + }; + +TInt CCreatorVirtualPhonebook::iUrlFields[] = + { + R_VPBK_FIELD_TYPE_URLGEN, + R_VPBK_FIELD_TYPE_URLHOME, + R_VPBK_FIELD_TYPE_URLWORK + }; + +TInt CCreatorVirtualPhonebook::iEmailFields[] = + { + R_VPBK_FIELD_TYPE_EMAILGEN, + R_VPBK_FIELD_TYPE_EMAILHOME, + R_VPBK_FIELD_TYPE_EMAILWORK + }; + +void CCreatorVirtualPhonebook::InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/) + { + LOGSTRING("Creator: CCreatorPhonebook::InitializeContactParamsL"); + iParameters = new (ELeave) CVirtualPhonebookParameters; + + iParameters->iNumberOfPhoneNumberFields = iNumberOfPhoneNumberFields; + iParameters->iNumberOfURLFields = iNumberOfURLFields; + iParameters->iNumberOfEmailAddressFields = iNumberOfEmailAddressFields; + + TPtrC firstname = iEngine->RandomString(CCreatorEngine::EFirstName); + TPtrC lastname = iEngine->RandomString(CCreatorEngine::ESurname); + + if( iAddAllFields ) + { + // Add text fields: + TInt textFieldCount = sizeof(CreatorVPbkMiscTextFields) / sizeof(FieldInfo); + for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex ) + { + CCreatorContactField* field = CCreatorContactField::NewL(CreatorVPbkMiscTextFields[tfIndex].iFieldCode, KNullDesC); + CleanupStack::PushL(field); + field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + + // Add binary fields: + TInt binFieldCount = sizeof(CreatorVPbkBinaryFields) / sizeof(TInt); + for( TInt bfIndex = 0; bfIndex < binFieldCount; ++bfIndex ) + { + CCreatorContactField* field = CCreatorContactField::NewL(CreatorVPbkBinaryFields[bfIndex], KNullDesC8); + CleanupStack::PushL(field); + field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + + // Add date-time fields: + TInt dtFieldCount = sizeof(CreatorVPbkDateTimeFields) / sizeof(TInt); + for( TInt dtIndex = 0; dtIndex < dtFieldCount; ++dtIndex ) + { + AddFieldToParamsL(CreatorVPbkDateTimeFields[dtIndex], iEngine->RandomDate(CCreatorEngine::EDateFuture)); + } + + AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJIMG, KNullDesC8); + AddFieldToParamsL(R_VPBK_FIELD_TYPE_THUMBNAILPIC, KNullDesC8); + AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJTEXT, firstname); + } + else + { + AddFieldToParamsL(R_VPBK_FIELD_TYPE_FIRSTNAME, firstname); + AddFieldToParamsL(R_VPBK_FIELD_TYPE_LASTNAME, lastname); + } + + // Phone numbers: + TInt arraySize = sizeof(iPhoneNumberFields)/sizeof(TInt); + TInt index = 0; + for (TInt i=0; iiNumberOfPhoneNumberFields; i++ ) + { + if( index >= arraySize ) + { + index = 0; + } + if( arraySize > 0 ) + { + CCreatorContactField* field = CCreatorContactField::NewL(iPhoneNumberFields[index], KNullDesC); + CleanupStack::PushL(field); + field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + ++index; + } + + + // URLs: + arraySize = sizeof(iUrlFields)/sizeof(TInt); + index = 0; + for( TInt i = 0; i < iParameters->iNumberOfURLFields; ++i) + { + if( index >= arraySize ) + { + index = 0; + } + if( arraySize > 0 ) + { + CCreatorContactField* field = CCreatorContactField::NewL(iUrlFields[index], KNullDesC); + CleanupStack::PushL(field); + field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + ++index; + } + + // EMail addresses: + arraySize = sizeof(iEmailFields)/sizeof(TInt); + index = 0; + for( TInt i = 0; i < iParameters->iNumberOfEmailAddressFields; ++i) + { + if( index >= arraySize ) + { + index = 0; + } + if( arraySize > 0 ) + { + CCreatorContactField* field = CCreatorContactField::NewL(iEmailFields[index], KNullDesC); + CleanupStack::PushL(field); + field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault); + iParameters->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + ++index; + } + } + +TInt CCreatorVirtualPhonebook::CreateContactEntryL(CCreatorModuleBaseParameters *aParameters) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateContactEntryL"); + + delete iParameters; + iParameters = 0; + CVirtualPhonebookParameters* parameters = 0; + + if( aParameters == 0 ) + { + InitializeContactParamsL(); + parameters = iParameters; + } + else + { + parameters = (CVirtualPhonebookParameters*) aParameters; + } + + TInt err = KErrNone; + + // create a new contact item + MVPbkStoreContact* newContact = iStore->CreateNewContactLC(); + for( TInt i = 0; i < parameters->iContactFields.Count(); ++i ) + { + CCreatorContactField* cField = parameters->iContactFields[i]; + if( cField ) + { + cField->AddToContactL(iEngine, *newContact, this); + } + } + + RArray contacts; + CleanupClosePushL( contacts ); + contacts.Append(newContact); + + delete iOperation; + iOperation = NULL; + iLastError = KErrNone; + iOperation = iContactManager->CommitContactsL( contacts.Array(), *this ); + if ( iOperation ) + { + iWaiter->StartAndWait();//Making asynchronous CommitContctsL to synchronous + delete iOperation; + iOperation = NULL; + } + User::LeaveIfError(iLastError); + + // store the link to contact, so that Creator is able to delete + // it when user requests deletion of contacts that are created by Creator + MVPbkContactLink* linkToContact = newContact->CreateLinkLC(); + if( linkToContact ) + { + iContactsToDelete->AppendL( linkToContact ); + CleanupStack::Pop(); // linkToContact + + // If this contact has a link id in script (i.e. belongs to a contact-set), we must cache the contact id: + if( parameters->ScriptLinkId() > 0 ) + { + RPointerArray& contactsets = ContactLinkCache::Instance()->ContactSets(); + TBool setFound(EFalse); + for(TInt i = 0; i < contactsets.Count(); ++i ) + { + if( contactsets[i]->LinkId() == parameters->ScriptLinkId()) + { + MVPbkContactLink* linkToContact = newContact->CreateLinkLC(); + if( linkToContact ) + { + contactsets[i]->AppendL(linkToContact); + iContactLinkArray->AppendL(linkToContact); + CleanupStack::Pop(); // linkToContact + } + setFound = ETrue; + break; + } + } + if( !setFound ) + { + LOGSTRING2("Error: Contact set id %d not found.", parameters->ScriptLinkId()); + } + } + } + + CleanupStack::Pop();//contacts + contacts.Close(); + CompactPbkDatabaseL(); + CleanupStack::PopAndDestroy();//newContact + if ( iCancelCbRequested && iEngine ) iEngine->CancelComplete(); + return err; + } + + +//---------------------------------------------------------------------------- + +void CCreatorVirtualPhonebook::AddImageToContactL(MVPbkStoreContact& aContact, TInt aFieldResId, const TDesC& aFileName) + { + LOGSTRING("Creator: CCreatorPhonebook::AddImageToContactL"); + CPbk2ImageManager* imageMgr = CPbk2ImageManager::NewL(*iContactManager); + CleanupStack::PushL(imageMgr); + const MVPbkFieldTypeList& fieldList = aContact.ParentStore().StoreProperties().SupportedFields(); + const MVPbkFieldType* fieldType = fieldList.Find(aFieldResId); + if( fieldType == 0 ) + { + return; + } + MPbk2ImageOperation* imageOp = 0; + TRAPD(err, imageOp = imageMgr->SetImageAsyncL(aContact, *fieldType, *this, aFileName)); + if( err == KErrNone) + { + if (imageOp) + { + CleanupDeletePushL( imageOp ); + iWaiter->StartAndWait(); // Making asynchronous SetImageAsyncL to synchronous + CleanupStack::Pop(imageOp); + delete imageOp; + } + } + else if(err != KErrNotSupported) + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(imageMgr); + } + +// Checks if the link is a group or not +TBool CCreatorVirtualPhonebook::IsContactGroupL(const MVPbkContactLink& aLink) + { + LOGSTRING("Creator: CCreatorPhonebook::IsContactGroupL"); + if( iStore ) + { + delete iContactGroupsInStore; + iContactGroupsInStore = 0; + // Save contact group links here + iContactGroupsInStore = iStore->ContactGroupsLC(); + CleanupStack::Pop(); + } + + if( iContactGroupsInStore ) + { + // Loop all the groups and check if any of them matches to the given link. + for( TInt i = 0; i < iContactGroupsInStore->Count(); ++i ) + { + if( (*iContactGroupsInStore)[i].IsSame(aLink) ) + return ETrue; + } + } + return EFalse; + } + +TInt CCreatorVirtualPhonebook::CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateGroupEntryL"); + delete iParameters; + iParameters = 0; + + CVirtualPhonebookParameters* parameters = (CVirtualPhonebookParameters*) aParameters; + + if( !parameters ) + { + iParameters = new (ELeave) CVirtualPhonebookParameters; + iParameters->iContactsInGroup = iContactsInGroup; + iParameters->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) ); + iParameters->iGroupName->Des().Append( _L(" #") ); + iParameters->iGroupName->Des().AppendNum( iEngine->RandomNumber(1000, 9999) ); + parameters = iParameters; + } + + TInt err = KErrNone; + + // create a new contact group + MVPbkContactGroup* newGroup = iStore->CreateNewContactGroupLC(); + + newGroup->SetGroupLabelL(parameters->iGroupName->Des()); + + // define amounts of contacts to be added to the group + TInt amountOfContactsToBeAdded = 0; + if (parameters->iContactsInGroup == KCreateRandomAmountOfGroups) + { + amountOfContactsToBeAdded = iEngine->RandomNumber(30); + } + else + { + amountOfContactsToBeAdded = parameters->iContactsInGroup; + } + + if( parameters->iLinkIds.Count() > 0 ) + { + for( TInt i = 0; i < parameters->iLinkIds.Count(); ++i ) + { + const CCreatorContactSet& set = ContactLinkCache::Instance()->ContactSet(parameters->iLinkIds[i].iLinkId); + + const RPointerArray& links = set.ContactLinks(); + TInt numberOfExplicitLinks = links.Count(); // Number of defined contacts in contact-set + TInt numberOfExistingContacts = set.NumberOfExistingContacts(); // Number of existing contacts in contact-set + TInt maxAmount = numberOfExplicitLinks + numberOfExistingContacts; + + if( parameters->iLinkIds[i].iLinkAmount > 0 ) + maxAmount = parameters->iLinkIds[i].iLinkAmount; // Max amount is limited + + TInt addedMembers = 0; + + for( TInt j = 0; j < links.Count() && addedMembers < maxAmount; ++j ) + { + MVPbkContactLink* link = links[j]; + if( link && IsContactGroupL(*link) == EFalse ) + { + TRAPD(err, newGroup->AddContactL(*link)); + if( err != KErrAlreadyExists ) + { + // Ignore "allready exists" -error + User::LeaveIfError(err); + ++addedMembers; + } + } + } + if( addedMembers < maxAmount ) + { + // Add existing contacts, withing the limits set by maxAmount: + amountOfContactsToBeAdded += maxAmount - addedMembers; + } + } + } + if( amountOfContactsToBeAdded > 0 ) + { + CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL(); + CleanupStack::PushL( viewDef ); + viewDef->SetType( EVPbkContactsView ); + MVPbkContactView* contactView = iStore->CreateViewLC( + *viewDef, + *this, + iStore->StoreProperties().SupportedFields() ); + iWaiter->StartAndWait();//Making asynchronous CreateViewLC to synchronous + + TInt cnt = 0; + // assign some random contacts to the group + for ( TInt y = 0; cnt < amountOfContactsToBeAdded && y < contactView->ContactCountL(); ++y ) + { + MVPbkContactLink* link = contactView->CreateLinkLC( y ); + if( link ) + { + TRAPD( err, newGroup->AddContactL( *link ) ); + CleanupStack::PopAndDestroy(); // link + if( err != KErrAlreadyExists ) + { + // Ignore "allready exists" -error + User::LeaveIfError( err ); + ++cnt; + } + } + } + CleanupStack::PopAndDestroy(); // contactView + CleanupStack::PopAndDestroy( viewDef ); + } + + newGroup->CommitL(*this); + iWaiter->StartAndWait(); //Making asynchronous CommitL to synchronous + + // store the link to contact, so that Creator is able to delete + // it when user requests deletion of contacts that were created with Creator + MVPbkContactLink* linkToContact = newGroup->CreateLinkLC(); + if( linkToContact ) + { + iContactGroupsToDelete->AppendL( linkToContact ); + CleanupStack::Pop(); // linkToContact + } + + CleanupStack::PopAndDestroy(); // newGroup + + CompactPbkDatabaseL(); + + return err; + + } + +//---------------------------------------------------------------------------- + +TInt CCreatorVirtualPhonebook::CreateSubscribedContactEntryL(CCreatorModuleBaseParameters* /*aParameters*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateSubscribedContactEntryL"); + + return KErrNotSupported; + } + +//---------------------------------------------------------------------------- + +void CCreatorVirtualPhonebook::AddFieldToContactItemL( + MVPbkStoreContact& newContact, TPbkFieldId aFieldId, const TDesC& aFieldText) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToContactItemL"); + + // Get field type object + const MVPbkFieldTypeList& fieldList = newContact.ParentStore().StoreProperties().SupportedFields(); + const MVPbkFieldType* fieldType = fieldList.Find(aFieldId); + if( fieldType == 0 ) + return; // field type is not supported + + // Create a new field + MVPbkStoreContactField* newField = newContact.CreateFieldLC(*fieldType); + if( !newField ) + { + User::Leave(KErrNotSupported); + } + + MVPbkContactFieldData& fieldData = newField->FieldData(); + + //data type must be text in this case + TVPbkFieldStorageType dataType = fieldData.DataType(); + + if(dataType == EVPbkFieldStorageTypeText) + { + //set text to field + MVPbkContactFieldTextData& tmpData = MVPbkContactFieldTextData::Cast(fieldData); + tmpData.SetTextL(aFieldText); + //set field to contact + newContact.AddFieldL(newField);//This object takes ownership of the field. + CleanupStack::Pop(newField); + } + else + { + User::Leave(KErrArgument); + } + + } + +//---------------------------------------------------------------------------- + +void CCreatorVirtualPhonebook::AddFieldToContactItemL( + MVPbkStoreContact& newContact, TPbkFieldId aFieldId, const TDesC8& aFieldText) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToContactItemL"); + + //get field types + const MVPbkFieldTypeList& fieldList = newContact.ParentStore().StoreProperties().SupportedFields(); + + //get wanted field type + const MVPbkFieldType* fieldType = fieldList.Find(aFieldId); + + //create a new field + MVPbkStoreContactField* newField = + newContact.CreateFieldLC(*fieldType); + //get field data + MVPbkContactFieldData& fieldData = newField->FieldData(); + + //data type must be text in this case + TVPbkFieldStorageType dataType = fieldData.DataType(); + + if(dataType == EVPbkFieldStorageTypeBinary){ + //set bindata to field + MVPbkContactFieldBinaryData& tmpData = MVPbkContactFieldBinaryData::Cast(fieldData); + tmpData.SetBinaryDataL(aFieldText); + //set field to contact + newContact.AddFieldL(newField);//This object takes ownership of the field. + CleanupStack::Pop(newField); + } + else + { + CleanupStack::PopAndDestroy(newField); + } + + } + +void CCreatorVirtualPhonebook::AddFieldToContactItemL( + MVPbkStoreContact& newContact, TPbkFieldId aFieldId, const TTime& aFieldText) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToContactItemL"); + //get field types + const MVPbkFieldTypeList& fieldList = newContact.ParentStore().StoreProperties().SupportedFields(); + + //get wanted field type + const MVPbkFieldType* fieldType = fieldList.Find(aFieldId); + + //create a new field + MVPbkStoreContactField* newField = newContact.CreateFieldLC(*fieldType); + //get field data + MVPbkContactFieldData& fieldData = newField->FieldData(); + + //data type must be datetime in this case + TVPbkFieldStorageType dataType = fieldData.DataType(); + + if(dataType == EVPbkFieldStorageTypeDateTime) + { + //set bindata to field + MVPbkContactFieldDateTimeData& tmpData = MVPbkContactFieldDateTimeData::Cast(fieldData); + tmpData.SetDateTime(aFieldText); + //set field to contact + newContact.AddFieldL(newField);//This object takes ownership of the field. + CleanupStack::Pop(newField); + } + else + { + CleanupStack::PopAndDestroy(newField); + } + } + +//---------------------------------------------------------------------------- + +void CCreatorVirtualPhonebook::CompactPbkDatabaseL(TBool aCompressImmediately) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::CompactPbkDatabase"); + + iOpCounter++; + + // compress the database immediately or after each 100th operation + if (aCompressImmediately || iOpCounter%100 == 0) + { + MVPbkContactOperationBase* operation= iContactManager->CompressStoresL(*this); + if (operation) + { + CleanupDeletePushL( operation ); + iWaiter->StartAndWait();//Making asynchronous CompressStoresL to synchronous + CleanupStack::Pop(operation); + delete operation; + } + } + } + +//---------------------------------------------------------------------------- +//Observer implementations for MVPbkContactStoreListObserver +//(and it's super class MVPbkContactStoreObserver) + +void CCreatorVirtualPhonebook::OpenComplete() + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::OpenComplete()"); + iWaiter->Cancel(); + } + +void CCreatorVirtualPhonebook::StoreReady(MVPbkContactStore& /*aContactStore*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::StoreReady()"); + } + + +void CCreatorVirtualPhonebook::StoreUnavailable(MVPbkContactStore& /*aContactStore*/, + TInt /*aReason*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::StoreUnavailable()"); + } + + +void CCreatorVirtualPhonebook::HandleStoreEventL( + MVPbkContactStore& /*aContactStore*/, + TVPbkContactStoreEvent /*aStoreEvent*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::HandleStoreEventL()"); + } + + + TAny* CCreatorVirtualPhonebook::ContactStoreObserverExtension( + TUid /*aExtensionUid*/) + + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactStoreObserverExtension()"); + return NULL; + } + + +//---------------------------------------------------------------------------- +//Observer implementation for MVPbkBatchOperationObserver + +void CCreatorVirtualPhonebook::StepComplete( + MVPbkContactOperationBase& /*aOperation*/, + TInt /*aStepSize*/ ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::StepComplete" ); + + } + + +TBool CCreatorVirtualPhonebook::StepFailed( + MVPbkContactOperationBase& /*aOperation*/, + TInt /*aStepSize*/, TInt aError ) +{ + LOGSTRING2("Creator: CCreatorVirtualPhonebook::StepFailed - Error: %d", aError ); + iLastError = aError; + iWaiter->Cancel(); + return EFalse; +} + + +void CCreatorVirtualPhonebook::OperationComplete( + MVPbkContactOperationBase& /*aOperation*/ ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::OperationComplete" ); + //Canceling waiter when operation is done. + iWaiter->Cancel(); + } + + +TAny* CCreatorVirtualPhonebook::BatchOperationObserverExtension( + TUid /*aExtensionUid*/ ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::BatchOperationObserverExtension" ); + return NULL; + } + +//---------------------------------------------------------------------------- +//Observer implementation for MVPbkContactFindObserver +void CCreatorVirtualPhonebook::FindCompleteL( MVPbkContactLinkArray* aResults ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::FindCompleteL" ); + if(iContactResults) + { + delete iContactResults; + iContactResults = NULL; + } + iContactResults = aResults; + iWaiter->Cancel(); + } + +void CCreatorVirtualPhonebook::FindFailed( TInt aError ) + { + LOGSTRING2("Creator: CCreatorVirtualPhonebook::FindFailed - Error: %d", aError ); + iLastError = aError; + iWaiter->Cancel(); + } + +TAny* CCreatorVirtualPhonebook::ContactFindObserverExtension( + TUid /*aExtensionUid*/ ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactFindObserverExtension" ); + return NULL; + } + + +//Observer implementation for MVPbkContactObserver +//---------------------------------------------------------------------------- + +void CCreatorVirtualPhonebook::ContactOperationCompleted(TContactOpResult aResult) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactOperationCompleted" ); + + TContactOp op = aResult.iOpCode; + switch ( op ) + { + case EContactCommit: + case EContactDelete: + { + iWaiter->Cancel(); + break; + } + case EContactLock: + default: break; + } + } + +void CCreatorVirtualPhonebook::ContactOperationFailed + (TContactOp /*aOpCode*/, TInt aErrorCode, TBool /*aErrorNotified*/) + { + LOGSTRING2("Creator: CCreatorVirtualPhonebook::ContactOperationFailed - Error: %d", aErrorCode ); + iLastError = aErrorCode; + iWaiter->Cancel(); + } + +TAny* CCreatorVirtualPhonebook::ContactObserverExtension(TUid /*aExtensionUid*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactObserverExtension" ); + return NULL; + } + +void CCreatorVirtualPhonebook::Pbk2ImageSetComplete(MPbk2ImageOperation& /*aOperation*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::Pbk2ImageSetComplete" ); + //Canceling waiter when operation is done. + iWaiter->Cancel(); + } + +void CCreatorVirtualPhonebook::Pbk2ImageSetFailed(MPbk2ImageOperation& /*aOperation*/, TInt /*aError*/) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::Pbk2ImageSetFailed" ); + //Canceling waiter when operation is done. + iWaiter->Cancel(); + } + + +//Observer implementation for MVPbkContactViewObserver +//---------------------------------------------------------------------------- +void CCreatorVirtualPhonebook::ContactViewReady( MVPbkContactViewBase& /*aView*/ ) + { + LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactViewReady" ); + iWaiter->Cancel(); + } + +void CCreatorVirtualPhonebook::ContactViewUnavailable( + MVPbkContactViewBase& /*aView*/ ) + { + iWaiter->Cancel(); + } + +void CCreatorVirtualPhonebook::ContactAddedToView( + MVPbkContactViewBase& /*aView*/, + TInt /*aIndex*/, + const MVPbkContactLink& /*aContactLink*/ ) + { + } + +void CCreatorVirtualPhonebook::ContactRemovedFromView( + MVPbkContactViewBase& /*aView*/, + TInt /*aIndex*/, + const MVPbkContactLink& /*aContactLink*/ ) + { + } + +void CCreatorVirtualPhonebook::ContactViewError( + MVPbkContactViewBase& /*aView*/, + TInt /*aError*/, + TBool /*aErrorNotified*/ ) + { + iWaiter->Cancel(); + } + +/** + * CCreatorContactFieldImpl Base class for contact field implementations + */ +class CCreatorContactFieldImpl : public CBase + { +public: + virtual ~CCreatorContactFieldImpl() {}; + + virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk); + virtual void SetRandomParametersL(CCreatorContactField::TRandomLengthType aRandomLenType = CCreatorContactField::ERandomLengthDefault, TInt aRandomLen = 0 ); + virtual void ParseL(CCommandParser* parser); + + virtual TInt FieldType(); +protected: + CCreatorContactFieldImpl(TInt aFieldType); + TInt iFieldType; + CCreatorContactField::TRandomLengthType iRandomLenType; + TInt iRandomLen; + }; + +void CCreatorContactFieldImpl::AddToContactL(CCreatorEngine* /*aEngine*/, MVPbkStoreContact& /*aContact*/, CCreatorVirtualPhonebook* /*aVPbk*/ ) + {} + +void CCreatorContactFieldImpl::SetRandomParametersL(CCreatorContactField::TRandomLengthType aRandomLenType, TInt aRandomLen ) + { + iRandomLenType = aRandomLenType; + iRandomLen = aRandomLen; + } + +void CCreatorContactFieldImpl::ParseL(CCommandParser* /*parser*/) + {} + +CCreatorContactFieldImpl::CCreatorContactFieldImpl(TInt aFieldType) + { + iFieldType = aFieldType; + } + +TInt CCreatorContactFieldImpl::FieldType() + { + return iFieldType; + } + + +/** + * CCreatorContactTextField Text field implementation + */ +class CCreatorContactTextField : public CCreatorContactFieldImpl + { + public: + static CCreatorContactTextField* NewL(TInt aFieldType, const TDesC& aData); + ~CCreatorContactTextField(); + virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk); + virtual void ParseL(CCommandParser* parser); + + protected: + virtual void SetDefaultRandomContentL(CCreatorEngine* aEngine); + virtual void SetExplicitRandomContentL(CCreatorEngine* aEngine, TInt aRandomLen); + + private: + CCreatorContactTextField(TInt aFieldType); + void ConstructL(const TDesC& aData); + HBufC* iPtr; + }; + +CCreatorContactTextField::CCreatorContactTextField(TInt aFieldType) +: CCreatorContactFieldImpl(aFieldType) + { } +CCreatorContactTextField::~CCreatorContactTextField() + { + delete iPtr; + } + void CCreatorContactTextField::AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk) + { + LOGSTRING("Creator: CCreatorContactTextField::AddToContactL"); + if( aVPbk == 0 ) + User::Leave(KErrArgument); + + if( iPtr == 0 || iPtr->Length() == 0) + { + switch( iRandomLenType ) + { + case CCreatorContactField::ERandomLengthDefault: + { + SetDefaultRandomContentL(aEngine); + break; + } + case CCreatorContactField::ERandomLengthMax: + { + const MVPbkFieldTypeList& fieldList = aContact.ParentStore().StoreProperties().SupportedFields(); + const MVPbkFieldType* fieldType = fieldList.Find(iFieldType); + if( fieldType == 0 ) + return; // field type is not supported + + // Create a new field + MVPbkStoreContactField* newField = aContact.CreateFieldLC(*fieldType); + if( !newField ) + { + User::Leave(KErrNotSupported); + } + + MVPbkContactFieldData& fieldData = newField->FieldData(); + //data type must be text in this case + TVPbkFieldStorageType dataType = fieldData.DataType(); + + if(dataType == EVPbkFieldStorageTypeText) + { + //set text to field + MVPbkContactFieldTextData& tmpData = MVPbkContactFieldTextData::Cast(fieldData); + iRandomLen = tmpData.MaxLength(); + if( iRandomLen == KVPbkUnlimitedFieldLength ) + iRandomLen = 128; + } + CleanupStack::PopAndDestroy(newField); + SetExplicitRandomContentL(aEngine, iRandomLen); + break; + } + case CCreatorContactField::ERandomLengthExplicit: + { + SetExplicitRandomContentL(aEngine, iRandomLen); + break; + } + default: + break; + } + } + if( iPtr ) + { + if( iFieldType == R_VPBK_FIELD_TYPE_THUMBNAILPIC ) + { + if( iPtr && iPtr->Length() > 0 ) + { + aVPbk->AddImageToContactL(aContact, iFieldType, iPtr->Des()); + } + } + //Thumbnail id handling + /*else if( iFieldType == FIELD_TYPE_THUMBNAILPIC_ID ) + { + if( iPtr && iPtr->Length() > 0 ) + { + TInt id = aEngine->GetAttachmentIdL(iPtr->Des()); + if( id != KUndef ) + { + //get picture path by id + TFileName sourceFileName = aEngine->TestDataPathL((CCreatorEngine::TTestDataPath)id);// (CCreatorEngine::TTestDataPath) parameters.iAttachments->At(i) + //set image to contact + aVPbk->AddImageToContactL(aContact, R_VPBK_FIELD_TYPE_THUMBNAILPIC, sourceFileName); + } + } + }*/ + else + { + if( iPtr && iPtr->Length() > 0 ) + { + aVPbk->AddFieldToContactItemL(aContact, iFieldType, iPtr->Des()); + } + } + } + } + + void CCreatorContactTextField::SetDefaultRandomContentL(CCreatorEngine* aEngine) + { + LOGSTRING("Creator: CCreatorContactTextField::SetDefaultRandomContentL"); + if( aEngine == 0 ) + return; + + if( iPtr ) + { + delete iPtr; + iPtr = 0; + } + TPtrC contentData; + + TInt textFieldCount = sizeof(CreatorVPbkMiscTextFields) / sizeof(FieldInfo); + TBool found = EFalse; + for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex ) + { + if( iFieldType == CreatorVPbkMiscTextFields[tfIndex].iFieldCode ) + { + found = ETrue; + if( CreatorVPbkMiscTextFields[tfIndex].iRandomType != RND_TYPE_UNDEF ) + { + contentData.Set(aEngine->RandomString((CCreatorEngine::TRandomStringType) CreatorVPbkMiscTextFields[tfIndex].iRandomType)); + } + else + { + switch( iFieldType ) + { + case R_VPBK_FIELD_TYPE_RINGTONE: + { + contentData.Set(aEngine->CreateRandomSoundFileL()); + break; + } + //Thumbnail (path) and thumbnailid handling with random is the same, only in script they have different handling + case R_VPBK_FIELD_TYPE_THUMBNAILPIC: + { + contentData.Set(aEngine->RandomPictureFileL()); + break; + } + case R_VPBK_FIELD_TYPE_SYNCCLASS: + case R_VPBK_FIELD_TYPE_LOCPRIVACY: + { + _LIT(KPublic, "Public"); + contentData.Set(KPublic); + break; + } + default: + break; + } + } + break; + } + } + + if( found == EFalse ) + { + TInt phNumFieldCount = sizeof(CreatorVPbkPhoneNumberFields) / sizeof(TInt); + for( TInt phIndex = 0; phIndex < phNumFieldCount; ++phIndex ) + { + if( iFieldType == CreatorVPbkPhoneNumberFields[phIndex] ) + { + contentData.Set(aEngine->RandomString(CCreatorEngine::EPhoneNumber)); + found = ETrue; + break; + } + } + } + + if( found == EFalse ) + { + TInt emailFieldCount = sizeof(CreatorVPbkEmailFields) / sizeof(TInt); + for( TInt eIndex = 0; eIndex < emailFieldCount; ++eIndex ) + { + if( iFieldType == CreatorVPbkEmailFields[eIndex] ) + { + iPtr = aEngine->CreateEmailAddressLC(); + CleanupStack::Pop(); + return; + } + } + } + iPtr = HBufC::NewL(contentData.Length()); + iPtr->Des().Copy(contentData); + } + + void CCreatorContactTextField::SetExplicitRandomContentL(CCreatorEngine* aEngine, TInt aRandomLen) + { + LOGSTRING("Creator: CCreatorContactTextField::SetExplicitRandomContentL"); + if( iPtr ) + { + delete iPtr; + iPtr = 0; + } + iPtr = aEngine->CreateRandomStringLC(aRandomLen); + CleanupStack::Pop(); // iPtr + } + + void CCreatorContactTextField::ParseL(CCommandParser* parser) + { + parser->StrParserL(iPtr, '|'); + } + + void CCreatorContactTextField::ConstructL(const TDesC& aData) + { + iPtr = HBufC::New(KPhonebookFieldLength); + iPtr->Des().Copy(aData); + } + + CCreatorContactTextField* CCreatorContactTextField::NewL(TInt aFieldType, const TDesC& aData) + { + CCreatorContactTextField* self = new (ELeave) CCreatorContactTextField(aFieldType); + CleanupStack::PushL(self); + self->ConstructL(aData); + CleanupStack::Pop(); + return self; + } + /** + * CCreatorContactBinaryField Binary field implementation + */ + class CCreatorContactBinaryField : public CCreatorContactFieldImpl + { +public: + static CCreatorContactBinaryField* NewL(TInt aFieldType, const TDesC8& aData); + ~CCreatorContactBinaryField(); + virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk); + virtual void ParseL(CCommandParser* parser); + virtual void SetDefaultRandomContentL(CCreatorEngine* aEngine); +private: + CCreatorContactBinaryField(TInt aFieldType); + void ConstructL(const TDesC8& aData); + HBufC8* iPtr; + }; + + CCreatorContactBinaryField::CCreatorContactBinaryField(TInt aFieldType) + : CCreatorContactFieldImpl(aFieldType) + { } + CCreatorContactBinaryField::~CCreatorContactBinaryField() + { + delete iPtr; + } + + void CCreatorContactBinaryField::ConstructL(const TDesC8& aData) + { + iPtr = HBufC8::New(KPhonebookFieldLength); + iPtr->Des() = aData; + } + + CCreatorContactBinaryField* CCreatorContactBinaryField::NewL(TInt aFieldType, const TDesC8& aData) + { + CCreatorContactBinaryField* self = new (ELeave) CCreatorContactBinaryField(aFieldType); + CleanupStack::PushL(self); + self->ConstructL(aData); + CleanupStack::Pop(); + return self; + } + +void CCreatorContactBinaryField::AddToContactL(CCreatorEngine* /*aEngine*/, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk) + { + LOGSTRING("Creator: CCreatorContactBinaryField::AddToContactL"); + if( aVPbk == 0 ) + User::Leave(KErrArgument); + if( iPtr ) + { + aVPbk->AddFieldToContactItemL(aContact, iFieldType, iPtr->Des()); + } + } +void CCreatorContactBinaryField::ParseL(CCommandParser* parser) + { + parser->StrParserL(iPtr, '&'); + } + +void CCreatorContactBinaryField::SetDefaultRandomContentL(CCreatorEngine* /*aEngine*/) + { + LOGSTRING("Creator: CCreatorContactBinaryField::SetDefaultRandomContentL"); + } + +/** + * CCreatorContactDateTimeField + */ +class CCreatorContactDateTimeField : public CCreatorContactFieldImpl + { +public: + static CCreatorContactDateTimeField* NewL(TInt aFieldType, const TTime& aData); + ~CCreatorContactDateTimeField(); + virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk); + virtual void ParseL(CCommandParser* parser); +private: +CCreatorContactDateTimeField(TInt aFieldType); + void ConstructL(const TTime& aData); + TTime iPtr; + }; + +CCreatorContactDateTimeField::CCreatorContactDateTimeField(TInt aFieldType) +: CCreatorContactFieldImpl(aFieldType) + { } +CCreatorContactDateTimeField::~CCreatorContactDateTimeField() + { + } + + void CCreatorContactDateTimeField::ConstructL(const TTime& aData) + { + iPtr = aData; + } + + CCreatorContactDateTimeField* CCreatorContactDateTimeField::NewL(TInt aFieldType, const TTime& aData) + { + CCreatorContactDateTimeField* self = new (ELeave) CCreatorContactDateTimeField(aFieldType); + CleanupStack::PushL(self); + self->ConstructL(aData); + CleanupStack::Pop(); + return self; + } + +void CCreatorContactDateTimeField::AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk) + { + LOGSTRING("Creator: CCreatorContactDateTimeField::AddToContactL"); + if( aVPbk == 0 ) + User::Leave(KErrArgument); + + //TTime undefTime(); + if( iPtr == Time::NullTTime() ) + { + iPtr = aEngine->RandomDate(CCreatorEngine::EDateFuture); + } + + aVPbk->AddFieldToContactItemL(aContact, iFieldType, iPtr); + } +void CCreatorContactDateTimeField::ParseL(CCommandParser* /*parser*/) + { + //parser->StrParserL(iPtr, '&'); + } + +/** + * CCreatorContactField Contact field API + */ +CCreatorContactField* CCreatorContactField::NewL(TInt aFieldType, const TDesC& aData) + { + CCreatorContactField* self = new (ELeave) CCreatorContactField(); + CleanupStack::PushL(self); + self->ConstructL(aFieldType, aData); + CleanupStack::Pop(); + return self; + } + +CCreatorContactField* CCreatorContactField::NewL(TInt aFieldType, const TDesC8& aData) + { + CCreatorContactField* self = new (ELeave) CCreatorContactField(); + CleanupStack::PushL(self); + self->ConstructL(aFieldType, aData); + CleanupStack::Pop(); + return self; + } + +CCreatorContactField* CCreatorContactField::NewL(TInt aFieldType, const TTime& aData) + { + CCreatorContactField* self = new (ELeave) CCreatorContactField(); + CleanupStack::PushL(self); + self->ConstructL(aFieldType, aData); + CleanupStack::Pop(); + return self; + } + +void CCreatorContactField::ConstructL(TInt aFieldType, const TDesC& aData) + { + pImpl = CCreatorContactTextField::NewL(aFieldType, aData); + } + +void CCreatorContactField::ConstructL(TInt aFieldType, const TDesC8& aData) + { + pImpl = CCreatorContactBinaryField::NewL(aFieldType, aData); + } + +void CCreatorContactField::ConstructL(TInt aFieldType, const TTime& aData) + { + pImpl = CCreatorContactDateTimeField::NewL(aFieldType, aData); + } + +CCreatorContactField::CCreatorContactField() + {} +CCreatorContactField::~CCreatorContactField() + { + delete pImpl; + } + +TInt CCreatorContactField::FieldType() + { + return pImpl->FieldType(); + } +void CCreatorContactField::AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk) + { + pImpl->AddToContactL(aEngine, aContact, aVPbk); + } +void CCreatorContactField::ParseL(CCommandParser* parser) + { + pImpl->ParseL(parser); + } + +void CCreatorContactField::SetRandomParametersL(TRandomLengthType aRandomLenType, TInt aRandomLen ) + { + pImpl->SetRandomParametersL(aRandomLenType, aRandomLen); + } diff -r 000000000000 -r d6fe6244b863 creator/src/creator_wepsecuritysettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/src/creator_wepsecuritysettings.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,144 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "creator_traces.h" +#include "creator_wepsecuritysettings.h" +#include +//#include +#include + +//#include +//#include +//#include + + + +//---------------------------------------------------------------------------- + +CCreatorWEPSecuritySettings* CCreatorWEPSecuritySettings::NewL() + { + CCreatorWEPSecuritySettings* self = CCreatorWEPSecuritySettings::NewLC(); + CleanupStack::Pop(self); + return self; + } + +CCreatorWEPSecuritySettings* CCreatorWEPSecuritySettings::NewLC() + { + CCreatorWEPSecuritySettings* self = new (ELeave) CCreatorWEPSecuritySettings; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CCreatorWEPSecuritySettings::CCreatorWEPSecuritySettings() + { + } + +void CCreatorWEPSecuritySettings::ConstructL() + { + LOGSTRING("Creator: CCreatorWEPSecuritySettings::ConstructL"); + } + +CCreatorWEPSecuritySettings::~CCreatorWEPSecuritySettings() + { + LOGSTRING("Creator: CCreatorWEPSecuritySettings::~CCreatorWEPSecuritySettings"); + + + } + + + +//---------------------------------------------------------------------------- + + + +// --------------------------------------------------------- +// CWEPSecuritySettingsImpl::SaveL +// --------------------------------------------------------- +// +void CCreatorWEPSecuritySettings::SaveL( TUint32 /*aIapId*/, + CCommsDatabase& /*aCommsDb*/ ) const + { + /* + // Data of the key + TBuf8 iKeyData[KMaxNumberofKeys]; + + CCommsDbTableView* wLanServiceTable; + + // Caller MUST initiate a transaction, WE WILL NOT. + + wLanServiceTable = aCommsDb.OpenViewMatchingUintLC( + TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), aIapId ); + TInt errorCode = wLanServiceTable->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + wLanServiceTable->UpdateRecord(); + } + else + { + TUint32 dummyUid( 0 ); //was KUidNone + User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) ); + + // Save link to LAN service + wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), aIapId ); + } + + // Save index of key in use + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_INDEX ), + ( TUint32& ) iKeyInUse ); + + // Save index of key in use + wLanServiceTable->WriteUintL( TPtrC( NU_WLAN_AUTHENTICATION_MODE ), + ( TUint32& ) iAuthentication ); + + // Save first WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY1 ), + iKeyData[KFirstKey] ); + + // Save second WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY2 ), + iKeyData[KSecondKey] ); + + // Save third WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY3 ), + iKeyData[KThirdKey] ); + + // Save fourth WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY4 ), + iKeyData[KFourthKey] ); + + // Save the format of the keys + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ), + ( TUint32& ) iKeyFormat[KFirstKey] ); + + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY2_FORMAT ), + ( TUint32& ) iKeyFormat[KSecondKey] ); + + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY3_FORMAT ), + ( TUint32& ) iKeyFormat[KThirdKey] ); + + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY4_FORMAT ), + ( TUint32& ) iKeyFormat[KFourthKey] ); + + wLanServiceTable->PutRecordChanges(); + + CleanupStack::PopAndDestroy( wLanServiceTable ); // wLanServiceTable + */ + } + diff -r 000000000000 -r d6fe6244b863 filebrowser/data/filebrowser.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/data/filebrowser.rss Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1599 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 MATT + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "FB.hrh" +#include +#include +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + #include // for r_filebrowser_toolbar_info_extension +#endif + + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + custom_app_info_extension = r_filebrowser_toolbar_info_extension; +#endif + } + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + +RESOURCE EIK_APP_INFO_EXT r_filebrowser_toolbar_info_extension + { + popup_toolbar = r_filebrowser_toolbar; + } + +RESOURCE AVKON_TOOLBAR r_filebrowser_toolbar + { + lines = 1; + flags = KAknToolbarFixed ; + + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EFileBrowserCmdFileBack; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + helptxt = "Up one level"; + bmpfile = APP_BITMAP_DIR"\\filebrowser_extraicons.mif"; + bmpid = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_folder_parent; + bmpmask = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_folder_parent_mask; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EFileBrowserCmdFileSearch; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + helptxt = "Open/Close filter view"; + bmpfile = APP_BITMAP_DIR"\\filebrowser_extraicons.mif"; + bmpid = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_find; + bmpmask = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_find_mask; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EFileBrowserCmdEditSelect; + control = AVKON_BUTTON + { + flags = KAknButtonReportOnLongPress; + states = + { + AVKON_BUTTON_STATE + { + helptxt = "Select/Unselect item"; + bmpfile = APP_BITMAP_DIR"\\filebrowser_extraicons.mif"; + bmpid = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_selection; + bmpmask = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_selection_mask; + }, + AVKON_BUTTON_STATE + { + helptxt = "Select/Unselect item"; + bmpfile = APP_BITMAP_DIR"\\filebrowser_extraicons.mif"; + bmpid = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_selection_active; + bmpmask = EMbmFilebrowser_extraiconsQgn_indi_tb_filebrowser_selection_active_mask; + } + }; + }; + } + }; + } +#endif + +//---------------------------------------------------- +// +// r_filebrowser_hotkeys +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_filebrowser_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + +//---------------------------------------------------- +// +// r_filebrowser_view_filelist +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_filebrowser_view_filelist + { + hotkeys=r_filebrowser_hotkeys; + menubar=r_filebrowser_menubar_view_filelist; + cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + +//---------------------------------------------------- +// +// r_filebrowser_menubar_view_filelist +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_filebrowser_menubar_view_filelist + { + titles= + { + MENU_TITLE { menu_pane=r_filebrowser_app_menu; txt="App"; }, + MENU_TITLE { menu_pane=r_filebrowser_view_filelist_menu; txt="View"; } + }; + } + +//---------------------------------------------------- +// +// r_filebrowser_view_filelist_menu +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_filebrowser_view_filelist_menu + { + items= + { + MENU_ITEM { command=EFileBrowserCmdFile; txt="File"; cascade=r_filebrowser_file_submenu; }, + MENU_ITEM { command=EFileBrowserCmdEdit; txt="Edit"; cascade=r_filebrowser_edit_submenu; }, + MENU_ITEM { command=EFileBrowserCmdView; txt="View"; cascade=r_filebrowser_view_submenu; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdmin; txt="Disk admin"; cascade=r_filebrowser_diskadmin_submenu; }, + MENU_ITEM { command=EFileBrowserCmdTools; txt="Tools"; cascade=r_filebrowser_tools_submenu; }, + MENU_ITEM { command=EFileBrowserCmdSettings; txt="Settings"; }, + MENU_ITEM { command=EFileBrowserCmdAbout; txt="About"; }, + MENU_ITEM { command=EAknCmdExit; txt="Exit"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_file_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileBack; txt="Back/Move up (<-)"; }, + MENU_ITEM { command=EFileBrowserCmdFileOpen; txt="Open"; cascade=r_filebrowser_file_open_submenu; }, + MENU_ITEM { command=EFileBrowserCmdFileOpenDrive; txt="Open drive (->)"; }, + MENU_ITEM { command=EFileBrowserCmdFileOpenDirectory; txt="Open directory (->)"; }, + MENU_ITEM { command=EFileBrowserCmdFileView; txt="View"; cascade=r_filebrowser_file_view_submenu; }, + MENU_ITEM { command=EFileBrowserCmdFileEdit; txt="Edit"; cascade=r_filebrowser_file_edit_submenu; }, + MENU_ITEM { command=EFileBrowserCmdFileSearch; txt="Search..."; }, + MENU_ITEM { command=EFileBrowserCmdFileSendTo; txt="Send to"; }, + MENU_ITEM { command=EFileBrowserCmdFileNew; txt="New"; cascade=r_filebrowser_file_new_submenu; }, + MENU_ITEM { command=EFileBrowserCmdFileDelete; txt="Delete"; }, + MENU_ITEM { command=EFileBrowserCmdFileRename; txt="Rename"; }, + MENU_ITEM { command=EFileBrowserCmdFileTouch; txt="Touch"; }, + MENU_ITEM { command=EFileBrowserCmdFileProperties; txt="Properties"; }, + MENU_ITEM { command=EFileBrowserCmdFileChecksums; txt="Checksums"; cascade=r_filebrowser_file_checksums_submenu; }, + MENU_ITEM { command=EFileBrowserCmdFileSetAttributes; txt="Set attributes..."; }, + MENU_ITEM { command=EFileBrowserCmdFileCompress; txt="Compress with GZip"; }, + MENU_ITEM { command=EFileBrowserCmdFileDecompress; txt="Decompress with GZip"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_file_open_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileOpenApparc; txt="AppArc"; }, + MENU_ITEM { command=EFileBrowserCmdFileOpenDocHandlerEmbed; txt="DocHandler embed"; }, + MENU_ITEM { command=EFileBrowserCmdFileOpenDocHandlerStandAlone; txt="DocHandler stand-alone"; }, + MENU_ITEM { command=EFileBrowserCmdFileOpenFileService; txt="Choose a file service..."; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_file_view_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileViewText; txt="As text"; }, + MENU_ITEM { command=EFileBrowserCmdFileViewHex; txt="As hex"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_file_edit_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileEditText; txt="As text"; }, + MENU_ITEM { command=EFileBrowserCmdFileEditHex; txt="As hex"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_file_new_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileNewFile; txt="File"; }, + MENU_ITEM { command=EFileBrowserCmdFileNewDirectory; txt="Directory"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_file_checksums_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileChecksumsMD5; txt="MD5"; }, + MENU_ITEM { command=EFileBrowserCmdFileChecksumsMD2; txt="MD2"; }, + MENU_ITEM { command=EFileBrowserCmdFileChecksumsSHA1; txt="SHA-1"; } + }; + } +RESOURCE MENU_PANE r_filebrowser_edit_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdSnapShot; txt="Snap shot to E:"; }, + MENU_ITEM { command=EFileBrowserCmdEditCut; txt="Cut"; }, + MENU_ITEM { command=EFileBrowserCmdEditCopy; txt="Copy"; }, + MENU_ITEM { command=EFileBrowserCmdEditPaste; txt="Paste"; }, + MENU_ITEM { command=EFileBrowserCmdEditCopyToFolder; txt="Copy to folder..."; }, + MENU_ITEM { command=EFileBrowserCmdEditMoveToFolder; txt="Move to folder..."; }, + MENU_ITEM { command=EFileBrowserCmdEditSelect; txt="Select"; }, + MENU_ITEM { command=EFileBrowserCmdEditUnselect; txt="Unselect"; }, + MENU_ITEM { command=EFileBrowserCmdEditSelectAll; txt="Select all"; }, + MENU_ITEM { command=EFileBrowserCmdEditUnselectAll; txt="Unselect all"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_view_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdViewSort; txt="Sort"; cascade=r_filebrowser_view_sort_submenu; }, + MENU_ITEM { command=EFileBrowserCmdViewOrder; txt="Order"; cascade=r_filebrowser_view_order_submenu; }, + MENU_ITEM { command=EFileBrowserCmdViewFilterEntries; txt="Filter entries"; }, + MENU_ITEM { command=EFileBrowserCmdViewRefresh; txt="Refresh"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_view_sort_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdViewSortByName; txt="By name"; flags = EEikMenuItemRadioStart | EEikMenuItemSymbolOn; }, + MENU_ITEM { command=EFileBrowserCmdViewSortByExtension; txt="By extension"; flags = EEikMenuItemRadioMiddle; }, + MENU_ITEM { command=EFileBrowserCmdViewSortByDate; txt="By date"; flags = EEikMenuItemRadioMiddle; }, + MENU_ITEM { command=EFileBrowserCmdViewSortBySize; txt="By size"; flags = EEikMenuItemRadioEnd; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_view_order_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdViewOrderAscending; txt="Ascending"; flags = EEikMenuItemRadioStart | EEikMenuItemSymbolOn; }, + MENU_ITEM { command=EFileBrowserCmdViewOrderDescending; txt="Descending"; flags = EEikMenuItemRadioEnd; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_diskadmin_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdDiskAdminSetDrivePassword; txt="Set drive password"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminUnlockDrive; txt="Unlock drive"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminClearDrivePassword; txt="Clear drive password"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminEraseDrivePassword; txt="Erase drive password"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminFormatDrive; txt="Format drive"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminQuickFormatDrive; txt="Quick format drive"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminCheckDisk; txt="Check disk"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminScanDrive; txt="Scan drive"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminSetDriveName; txt="Set drive name"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminSetDriveVolumeLabel; txt="Set drive volume label"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminEjectDrive; txt="Eject drive"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminDismountFileSystem; txt="Dismount drive"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminEraseMBR; txt="Erase MBR"; }, + MENU_ITEM { command=EFileBrowserCmdDiskAdminDrivePartition; txt="Partition drive"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_tools_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdToolsInstalledApps; txt="All apps to a text file"; }, + MENU_ITEM { command=EFileBrowserCmdToolsAllFiles; txt="All files to a text file"; }, + MENU_ITEM { command=EFileBrowserCmdToolsAvkonIconCache; txt="Avkon icon cache"; cascade=r_filebrowser_tools_avkoniconcache_submenu; }, + MENU_ITEM { command=EFileBrowserCmdToolsDisableExtErrors; txt="Disable extended errors"; }, + MENU_ITEM { command=EFileBrowserCmdToolsMsgStoreWalk; txt="Dump msg. store walk"; }, + MENU_ITEM { command=EFileBrowserCmdToolsEditDataTypes; txt="Edit data types"; }, + MENU_ITEM { command=EFileBrowserCmdToolsEnableExtErrors; txt="Enable extended errors"; }, + MENU_ITEM { command=EFileBrowserCmdToolsErrorSimulate; txt="Error simulate"; cascade=r_filebrowser_tools_errorsimulate_submenu; }, + MENU_ITEM { command=EFileBrowserCmdToolsLocalConnectivity; txt="Local connectivity"; cascade=r_filebrowser_tools_localconnectivity_submenu; }, + MENU_ITEM { command=EFileBrowserCmdToolsMsgAttachments; txt="Message attachments"; cascade=r_filebrowser_tools_msgattachments_submenu; }, + MENU_ITEM { command=EFileBrowserCmdToolsMemoryInfo; txt="Memory info"; }, + MENU_ITEM { command=EFileBrowserCmdToolsSecureBackup; txt="Secure backup"; cascade=r_filebrowser_tools_securebackup_submenu; }, + MENU_ITEM { command=EFileBrowserCmdToolsSetDebugMask; txt="Set debug mask"; }, + MENU_ITEM { command=EFileBrowserCmdToolsOpenFiles; txt="Show open files here"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_tools_avkoniconcache_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdToolsAvkonIconCacheEnable; txt="Enable"; }, + MENU_ITEM { command=EFileBrowserCmdToolsAvkonIconCacheDisable; txt="Clear and disable"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_tools_errorsimulate_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdToolsErrorSimulateLeave; txt="Leave"; }, + MENU_ITEM { command=EFileBrowserCmdToolsErrorSimulatePanic; txt="Panic"; }, + MENU_ITEM { command=EFileBrowserCmdToolsErrorSimulateException; txt="Exception"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_tools_localconnectivity_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdToolsLocalConnectivityActivateInfrared; txt="Activate infrared"; }, + MENU_ITEM { command=EFileBrowserCmdToolsLocalConnectivityLaunchBTUI; txt="Launch BT UI"; }, + MENU_ITEM { command=EFileBrowserCmdToolsLocalConnectivityLaunchUSBUI; txt="Launch USB UI"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_tools_msgattachments_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdToolsMsgAttachmentsInbox; txt="Inbox"; }, + MENU_ITEM { command=EFileBrowserCmdToolsMsgAttachmentsDrafts; txt="Drafts"; }, + MENU_ITEM { command=EFileBrowserCmdToolsMsgAttachmentsSentItems; txt="Sent items"; }, + MENU_ITEM { command=EFileBrowserCmdToolsMsgAttachmentsOutbox; txt="Outbox"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_tools_securebackup_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdToolsSecureBackupStartBackup; txt="Start backup"; }, + MENU_ITEM { command=EFileBrowserCmdToolsSecureBackupStartRestore; txt="Start restore"; }, + MENU_ITEM { command=EFileBrowserCmdToolsSecureBackupStop; txt="Stop"; } + }; + } + +//---------------------------------------------------- +// +// r_filebrowser_app_menu +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_filebrowser_app_menu + { + items= + { + }; + } + +//---------------------------------------------------- +// +// r_filebrowser_settings_dialog +// Dialog for setting list +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_filebrowser_settings_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = EAknCtSettingListBox; + id = EFileBrowserSettingItemList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + +//---------------------------------------------------- +// r_filebrowser_settings_menubar +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_filebrowser_settings_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_filebrowser_settings_menupane; + txt = " "; // dummy + } + }; + } + +RESOURCE MENU_PANE r_filebrowser_settings_menupane + { + items = + { + MENU_ITEM + { + command = EFileBrowserCmdSettingsChange; + txt = "Change"; + }, + MENU_ITEM + { + command = EFileBrowserCmdSettingsExit; + txt = "Exit"; + } + }; + } + +//---------------------------------------------------- +// r_filebrowser_fileviewer_dialog +//---------------------------------------------------- +// +RESOURCE DIALOG r_filebrowser_fileviewer_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = EFileViewerDialogControl; + id = EFileEditorDialogId; + } + }; + } + +//---------------------------------------------------- +// r_filebrowser_fileeditor_dialog +//---------------------------------------------------- +// +RESOURCE DIALOG r_filebrowser_fileeditor_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + } + +//---------------------------------------------------- +// r_filebrowser_fileviewer_menubar +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_filebrowser_fileviewer_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_filebrowser_fileviewer_menupane; + txt = " "; // dummy + } + }; + } + +RESOURCE MENU_PANE r_filebrowser_fileviewer_menupane + { + items = + { + MENU_ITEM { command = EFileBrowserCmdFileEditorViewAsText; txt = "View as text"; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorViewAsHex; txt = "View as hex"; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorExit; txt = "Exit"; } + }; + } + +//---------------------------------------------------- +// r_filebrowser_fileeditor_menubar +//---------------------------------------------------- +// + +RESOURCE MENU_BAR r_filebrowser_fileeditor_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_filebrowser_fileeditor_menupane; + txt = " "; // dummy + } + }; + } + +RESOURCE MENU_PANE r_filebrowser_fileeditor_menupane + { + items = + { + MENU_ITEM { command = EFileBrowserCmdFileEditorSave; txt = "Save"; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorSaveAs; txt = "Save as..."; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorSaveFormat; txt = "Save format"; cascade=r_filebrowser_fileeditor_saveformat_submenu; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorEditAsText; txt = "Edit as text"; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorEditAsHex; txt = "Edit as hex"; }, + MENU_ITEM { command = EFileBrowserCmdFileEditorExit; txt = "Exit"; } + }; + } + +RESOURCE MENU_PANE r_filebrowser_fileeditor_saveformat_submenu + { + items = + { + MENU_ITEM { command=EFileBrowserCmdFileEditorSaveFormatANSIASCII; txt="ANSI/ASCII"; flags = EEikMenuItemRadioStart | EEikMenuItemSymbolOn; }, + MENU_ITEM { command=EFileBrowserCmdFileEditorSaveFormatUTF8; txt="UTF-8"; flags = EEikMenuItemRadioMiddle; }, + MENU_ITEM { command=EFileBrowserCmdFileEditorSaveFormatUTF16LE; txt="UTF-16 LE"; flags = EEikMenuItemRadioMiddle; }, + MENU_ITEM { command=EFileBrowserCmdFileEditorSaveFormatUTF16BE; txt="UTF-16 BE"; flags = EEikMenuItemRadioEnd; } + }; + } + +//---------------------------------------------------- +// +// Setting item resources +// +//---------------------------------------------------- +// +RESOURCE POPUP_SETTING_LIST r_popup_setting_list_editor + { + } + + +// +// resources for display mode selection +// +RESOURCE TBUF r_displaymodeselection_setting_title + { + buf = "Display mode"; + } +RESOURCE AVKON_SETTING_PAGE r_displaymodeselection_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_displaymodeselection_setting_texts + { + setting_texts_resource = r_displaymodeselection_text_array; + } +RESOURCE ARRAY r_displaymodeselection_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=EDisplayModeFullScreen; text = "Full screen"; }, + AVKON_ENUMERATED_TEXT { value=EDisplayModeNormal; text = "Normal"; } + }; + } + + +// +// resources for file view mode selection +// +RESOURCE TBUF r_fileviewmodeselection_setting_title + { + buf = "File view"; + } +RESOURCE AVKON_SETTING_PAGE r_fileviewmodeselection_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_fileviewmodeselection_setting_texts + { + setting_texts_resource = r_fileviewmodeselection_text_array; + } +RESOURCE ARRAY r_fileviewmodeselection_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=EFileViewModeSimple; text = "Simple"; }, + AVKON_ENUMERATED_TEXT { value=EFileViewModeExtended; text = "Extended"; } + }; + } + + +// +// resources for binary selections +// +RESOURCE TBUF r_showsubdirectoryinfoselection_setting_title + { + buf = "Show subdirectory info"; + } +RESOURCE TBUF r_showassociatediconsselection_setting_title + { + buf = "Show associated icons"; + } +RESOURCE TBUF r_rememberlastpathselection_setting_title + { + buf = "Remember folder on exit"; + } +RESOURCE TBUF r_rememberfolderselection_setting_title + { + buf = "Remember last folder"; + } +RESOURCE TBUF r_enabletoolbar_setting_title + { + buf = "Show toolbar"; + } +RESOURCE TBUF r_supportnetworkdrivesselection_setting_title + { + buf = "Support net drives"; + } +RESOURCE TBUF r_bypassplatformsecurityselection_setting_title + { + buf = "Bypass plat. security"; + } +RESOURCE TBUF R_REMOVEFILELOCKSSELECTION_SETTING_TITLE + { + buf = "Unlock files via SB"; + } +RESOURCE TBUF R_IGNOREPROTECTIONATTSSELECTION_SETTING_TITLE + { + buf = "Ign. protection atts"; + } +RESOURCE TBUF R_REMOVEROMWRITEPROTECTIONSELECTION_SETTING_TITLE + { + buf = "No RO-att copy from Z:"; + } +RESOURCE AVKON_SETTING_PAGE r_binary_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_yesno_binaryselection_texts + { + setting_texts_resource = r_yesno_binaryselection_text_array; + } +RESOURCE ARRAY r_yesno_binaryselection_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=0; text = "No"; }, + AVKON_ENUMERATED_TEXT { value=1; text = "Yes"; } + }; + } + + +// --------------------------------------------------------- +// +// r_filebrowser_about_dialog +// About dialog - show version and copyright info etc. +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_filebrowser_about_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About FileBrowser"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + message = "Version 4.5.2 - 10th December 2009. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_general_confirmation_query +// +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_general_confirmation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_general_text_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_text_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + width = 256; + lines = 3; + maxlength = 256; + }; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_general_numeric_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_numeric_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = ENumberLayout; + control = AVKON_INTEGER_EDWIN + { + min = -999999; + max = 999999; + }; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_general_progress_note +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_progress_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = EFileBrowserProgressNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = "Processing"; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_general_wait_note +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_wait_note + { + flags = EAknWaitNoteFlags | EEikDialogFlagNotifyEsc; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EFileBrowserWaitNote; + control= AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_entry_overwrite_type_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_entry_overwrite_type_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_entry_overwrite_type_query_array; + }; + heading = "Overwrite?"; + }; + } + }; + } + +RESOURCE ARRAY r_entry_overwrite_type_query_array + { + items = + { + LBUF {txt = "Overwrite all"; }, + LBUF {txt = "Skip all existing"; }, + LBUF {txt = "Gen. unique filenames"; }, + LBUF {txt = "Query postfix"; } + }; + } + +// --------------------------------------------------------- +// +// r_app_selection_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_app_selection_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + }; + heading = "Choose app:"; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_copy_to_folder_selection_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_copy_to_folder_selection_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSingleGraphicPopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + }; + heading = "Copy To"; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_move_to_folder_selection_query +// +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_move_to_folder_selection_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSingleGraphicPopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + }; + heading = "Move To"; + }; + } + }; + } + +// --------------------------------------------------------- +// r_memoryinfo_dialog +// --------------------------------------------------------- +// +RESOURCE DIALOG r_memoryinfo_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "Memory info"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + message = "."; + }; + } + }; + } + +// --------------------------------------------------------- +// r_checksums_dialog +// --------------------------------------------------------- +// +RESOURCE DIALOG r_checksums_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "Checksums"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + message = "."; + }; + } + }; + } + +// --------------------------------------------------------- +// r_attribute_editor_form_dialog +// --------------------------------------------------------- +// +RESOURCE DIALOG r_attribute_editor_form_dialog + { + flags = EAknDialogGenericFullScreen; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + form = r_attribute_editor_form; + } + +RESOURCE FORM r_attribute_editor_form + { + flags = EEikFormEditModeOnly; + items = + { + DLG_LINE + { + type = EAknCtPopupFieldText; + prompt = "Archive"; + id = EFileBrowserAttributeEditorSetArchive; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD_TEXT + { + popupfield = POPUP_FIELD + { + width = 100; + }; + textarray = r_attribute_editor_attmode_textarray; + active = 0; + }; + }, + DLG_LINE + { + type = EAknCtPopupFieldText; + prompt = "Hidden"; + id = EFileBrowserAttributeEditorSetHidden; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD_TEXT + { + popupfield = POPUP_FIELD + { + width = 100; + }; + textarray = r_attribute_editor_attmode_textarray; + active = 0; + }; + }, + DLG_LINE + { + type = EAknCtPopupFieldText; + prompt = "Read only"; + id = EFileBrowserAttributeEditorSetReadOnly; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD_TEXT + { + popupfield = POPUP_FIELD + { + width = 100; + }; + textarray = r_attribute_editor_attmode_textarray; + active = 0; + }; + }, + DLG_LINE + { + type = EAknCtPopupFieldText; + prompt = "System"; + id = EFileBrowserAttributeEditorSetSystem; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD_TEXT + { + popupfield = POPUP_FIELD + { + width = 100; + }; + textarray = r_attribute_editor_attmode_textarray; + active = 0; + }; + }, + DLG_LINE + { + type = EAknCtPopupFieldText; + prompt = "Recurse"; + id = EFileBrowserAttributeEditorSetRecurse; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD_TEXT + { + popupfield = POPUP_FIELD + { + width = 100; + }; + textarray = r_attribute_editor_recurse_textarray; + active = 0; + }; + } + }; + } + +RESOURCE ARRAY r_attribute_editor_attmode_textarray + { + items = + { + LBUF { txt = "Skip"; }, + LBUF { txt = "On"; }, + LBUF { txt = "Off"; } + }; + } + +RESOURCE ARRAY r_attribute_editor_recurse_textarray + { + items = + { + LBUF { txt = "Recursive"; }, + LBUF { txt = "Non-recursive"; } + }; + } + +// --------------------------------------------------------- +// r_search_query_form_dialog +// --------------------------------------------------------- +// +RESOURCE DIALOG r_search_query_form_dialog + { + flags = EAknDialogGenericFullScreen; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + form = r_search_query_form; + } + +RESOURCE FORM r_search_query_form + { + flags = EEikFormEditModeOnly; + items = + { + DLG_LINE + { + type = EEikCtEdwin; + prompt = "Search dir"; + id = EFileBrowserSearchQuerySearchDir; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = EDWIN + { + width = 255; + maxlength = 255; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "Wildcards"; + id = EFileBrowserSearchQueryWildCards; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = EDWIN + { + width = 255; + maxlength = 255; + }; + }, + DLG_LINE + { + type = EEikCtEdwin; + prompt = "Has string"; + id = EFileBrowserSearchQueryTextInFile; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = EDWIN + { + width = 255; + maxlength = 255; + }; + }, + DLG_LINE + { + type = EAknCtPopupFieldText; + prompt = "Recurse"; + id = EFileBrowserSearchQueryRecurse; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = POPUP_FIELD_TEXT + { + popupfield = POPUP_FIELD + { + width = 100; + }; + textarray = r_search_query_recurse_textarray; + active = 0; + }; + }, + DLG_LINE + { + type = EEikCtNumberEditor; + prompt = "Min size"; + id = EFileBrowserSearchQueryMinSize; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = NUMBER_EDITOR + { + min = 0; + max = 999999999; + }; + }, + DLG_LINE + { + type = EEikCtNumberEditor; + prompt = "Max size"; + id = EFileBrowserSearchQueryMaxSize; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = NUMBER_EDITOR + { + min = 0; + max = 999999999; + }; + }, + DLG_LINE + { + type = EEikCtDateEditor; + prompt = "Min date"; + id = EFileBrowserSearchQueryMinDate; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = DATE_EDITOR + { + minDate = DATE { day = 0; month = 0; year = 1980; }; + maxDate = DATE { day = 30; month = 11; year = 2060; }; + }; + }, + DLG_LINE + { + type = EEikCtDateEditor; + prompt = "Max date"; + id = EFileBrowserSearchQueryMaxDate; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = DATE_EDITOR + { + minDate = DATE { day = 0; month = 0; year = 1980; }; + maxDate = DATE { day = 30; month = 11; year = 2060; }; + }; + } + }; + } + +RESOURCE ARRAY r_search_query_recurse_textarray + { + items = + { + LBUF { txt = "Non-recursive"; }, + LBUF { txt = "Recursive"; } + }; + } + +// --------------------------------------------------------- +// r_data_types_dialog +// --------------------------------------------------------- +// +RESOURCE DIALOG r_data_types_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = EAknCtSingleGraphicListBox; + id = EFileBrowserDataTypesList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + +//---------------------------------------------------- +// r_filebrowser_data_types_menubar +//---------------------------------------------------- +// + +RESOURCE MENU_BAR r_filebrowser_data_types_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_filebrowser_data_types_menupane; + txt = " "; // dummy + } + }; + } + +RESOURCE MENU_PANE r_filebrowser_data_types_menupane + { + items = + { + MENU_ITEM + { + command = EFileBrowserCmdDataTypesChangeMapping; + txt = "Change mapping"; + }, + MENU_ITEM + { + command = EFileBrowserCmdDataTypesSetDefaultMapping; + txt = "Set to default mapping"; + }, + MENU_ITEM + { + command = EFileBrowserCmdDataTypesRefresh; + txt = "Refresh"; + }, + MENU_ITEM + { + command = EFileBrowserCmdDataTypesExit; + txt = "Exit"; + } + }; + } + +// --------------------------------------------------------- +// r_data_type_priority_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_data_type_priority_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_data_type_priority_query_array; + }; + heading = "Select priority"; + }; + } + }; + } + +RESOURCE ARRAY r_data_type_priority_query_array + { + items = + { + LBUF {txt = "Maximum"; }, + LBUF {txt = "High"; }, + LBUF {txt = "Normal"; }, + LBUF {txt = "Low"; }, + LBUF {txt = "Last resort"; } + }; + } + +// --------------------------------------------------------- +// r_securebackup_state_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_securebackup_state_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_securebackup_state_query_array; + }; + heading = "Select state"; + }; + } + }; + } + +RESOURCE ARRAY r_securebackup_state_query_array + { + items = + { + LBUF {txt = "Full"; }, + LBUF {txt = "Partial"; } + }; + } + +// --------------------------------------------------------- +// r_securebackup_type_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_securebackup_type_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_securebackup_type_query_array; + }; + heading = "Select type"; + }; + } + }; + } + +RESOURCE ARRAY r_securebackup_type_query_array + { + items = + { + LBUF {txt = "Base (all data)"; }, + LBUF {txt = "Increment"; } + }; + } + +// --------------------------------------------------------- +// r_partition_amount_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_partition_amount_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_partition_amount_query_array; + }; + heading = "Partitions?"; + }; + } + }; + } + +RESOURCE ARRAY r_partition_amount_query_array + { + items = + { + LBUF {txt = "1"; }, + LBUF {txt = "2"; }, + LBUF {txt = "3"; }, + LBUF {txt = "4"; } + }; + } + +// --------------------------------------------------------- +// r_common_file_action_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_common_file_action_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_common_file_action_query_array; + }; + heading = ""; + }; + } + }; + } + +RESOURCE ARRAY r_common_file_action_query_array + { + items = + { + LBUF {txt = "View as text/hex"; }, + LBUF {txt = "Open w/ AppArc"; }, + LBUF {txt = "Open w/ DocH. embed"; } + }; + } + +// --------------------------------------------------------- +// +// RESOURCE LOCALISABLE_APP_INFO r_filebrowser_localisable_app_info +// +// --------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_filebrowser_localisable_app_info + { + short_caption = "FileBrowser"; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = "FileBrowser"; + + number_of_icons = 1; + + // Note for ROM-based apps it is recommended to add the drive letter + // icon_file = "z:"APP_BITMAP_DIR"\\myapp_aif.mif"; + icon_file = APP_BITMAP_DIR"\\filebrowser_aif.mif"; + }; + } diff -r 000000000000 -r d6fe6244b863 filebrowser/data/filebrowser_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/data/filebrowser_reg.rss Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,35 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +#include + + +UID2 KUidAppRegistrationResourceFile +UID3 0x102828D6 + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "FileBrowser"; + localisable_resource_file = APP_RESOURCE_DIR"\\FileBrowser"; + localisable_resource_id = R_FILEBROWSER_LOCALISABLE_APP_INFO; + group_name = "RnD Tools"; + } diff -r 000000000000 -r d6fe6244b863 filebrowser/envpatcher/EnvPatcher.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/envpatcher/EnvPatcher.pl Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,544 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Environment Patcher - Patches older S60 SDKs for supporting +# tricks in newer platforms +# + + +require v5.6.1; + +use File::Copy; +use strict; + +# check amount of commandline options is valid +if (@ARGV != 1) +{ + print "Usage: EnvPatcher \n"; + exit 1; +} + + +# get epocroot and convert, convert \ -> / +(my $epocroot = $ARGV[0]) =~ s{\\}{/}g; + +# remove any trailing forward slashes +$epocroot =~ s/\/$//; + + +# create variables for paths +my $e32toolsdir = $epocroot."/epoc32/tools"; +my $e32includedir = $epocroot."/epoc32/include"; +my $e32includeoemdir = $e32includedir."/oem"; +my $platformpathspath = $e32includedir."/platform_paths.hrh"; +my $domainplatformpathspath = $e32includedir."/domain/osextensions/platform_paths.hrh"; +my $mmppmpath = $e32toolsdir."/mmp.pm"; +my $pathutlpmpath = $e32toolsdir."/pathutl.pm"; +my $prepfilepmpath = $e32toolsdir."/prepfile.pm"; + +# variables for hacked content +my $dependshack = "\t\t\tif (/^DEPENDS\$/o) {\r\n\t\t\t\tnext LINE; # Ignore DEPENDS keyword, not needed by ABLD\r\n\t\t\t}\r\n"; +my $smpsafehack = "\t\tif (/^SMPSAFE\$/o) {\r\n\t\t\tnext LINE; # Ignore SMPSAFE keyword, not needed by older environments\r\n\t\t}\r\n"; +my $forwardslashhack = "\t\t# EnvPatcher forwardslash hack begins\r\n\t\t\$_=~s{/}{\\\\}g; # convert all forward slashes to backslashes\r\n\t\t# EnvPatcher forwardslash hack ends\r\n\r\n"; +my $coreibyexportsupport = "\r\n// Following definition is used for exporting tools and stubs IBY files to\r\n// Core image.\r\n#define CORE_IBY_EXPORT_PATH(path,exported) /epoc32/rom/include/##exported\r\n"; + + +# check epoc32\tools exists +unless (-d $e32toolsdir) +{ + print "$e32toolsdir not found, please check valid epocroot has been given!\n"; + exit 1; +} + +# check epoc32\include exists +unless (-d $e32includedir) +{ + print "$e32includedir not found, please check valid epocroot has been given!\n"; + exit 1; +} + + +# create epoc32\include\oem if it does not exist +unless (-d $e32includeoemdir) +{ + mkdir $e32includeoemdir or die; + print "Missing directory $e32includeoemdir created succesfully.\n"; +} + + +# check if epoc32\include\domain\osextensions\platform_paths.hrh exists +if (-e $domainplatformpathspath) +{ + # show an error if the file does not have any platform macros + unless (string_exists_in_file($domainplatformpathspath, "OS_LAYER_SYSTEMINCLUDE")) + { + print "ERROR: $domainplatformpathspath does not have SF macros.\n"; + print "Please check your environment, if you have S60 3.2 OEM or newer, please get the latest version!\n"; + exit 2; + } +} + + +# check if epoc32\include\platform_paths.hrh exists +if (-e $platformpathspath) +{ + print "$platformpathspath already exists, not checking it.\n"; +} +else +{ + # create the file missing file + create_default_platform_paths_hrh(); + print "Missing file $platformpathspath created succesfully.\n"; +} + + +# check if CORE_IBY_EXPORT_PATH macro exist in the platform_paths.hrh +unless (string_exists_in_file($platformpathspath, "CORE_IBY_EXPORT_PATH")) +{ + # read content of the platform_paths.hrh + my @filecontent = read_file_to_array($platformpathspath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # find the position where the include guards start (this should be a safe position) + foreach (@filecontent) + { + if ($_ =~ /#define PLATFORM_PATHS_HRH/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos+1, 0, $coreibyexportsupport); + + # write the modified array to the file + write_file_from_array($platformpathspath, @filecontent); + + print "Platform_paths.hrh updated to support CORE_IBY_EXPORT_PATH macro.\n"; + } + else + { + print "WARNING: $platformpathspath is corrupted or not supported!\n"; + } +} + + +# check if epoc32\tools\mmp.pm exists +if (-e $mmppmpath) +{ + # check if DEPENDS keyword already exists in the file + if (string_exists_in_file($mmppmpath, "DEPENDS")) + { + print "The SDK can already handle DEPENDS keyword in a MMP file.\n"; + } + else + { + # read content of the mmp.pm file + my @filecontent = read_file_to_array($mmppmpath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # loop through the array to find the correct place + foreach (@filecontent) + { + if ($_ =~ /Unrecognised Resource Keyword/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos-1, 0, $dependshack); + + # write the modified array to the file + write_file_from_array($mmppmpath, @filecontent); + + print "Mmp.pm patched with DEPENDS keyword hack.\n"; + } + else + { + print "ERROR: Unable to find correct place from $mmppmpath for patching!\n"; + print "Your SDK environment probably is not supported by this script!\n"; + exit(2); + } + } + + # check if SMPSAFE keyword already exists in the file + if (string_exists_in_file($mmppmpath, "SMPSAFE")) + { + print "The SDK can already handle SMPSAFE keyword in a MMP file.\n"; + } + else + { + # read content of the mmp.pm file + my @filecontent = read_file_to_array($mmppmpath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # loop through the array to find the correct place + foreach (@filecontent) + { + if ($_ =~ /Unrecognised Keyword/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos, 0, $smpsafehack); + + # write the modified array to the file + write_file_from_array($mmppmpath, @filecontent); + + print "Mmp.pm patched with SMPSAFE keyword hack.\n"; + } + else + { + print "ERROR: Unable to find correct place from $mmppmpath for patching!\n"; + print "Your SDK environment probably is not supported by this script!\n"; + exit(2); + } + } +} +else +{ + print "WARNING: $mmppmpath not found, this environment is not supported!\n"; +} + + +# check if epoc32\tools\pathutl.pm exists +if (-e $pathutlpmpath) +{ + # check if "sub Path_Norm" already exists in the pathutil.pm file + # if it does not exists, then we need to patch prepfile.pm + if (string_exists_in_file($pathutlpmpath, "sub Path_Norm")) + { + print "The SDK is non Symbian OS 9.1, no need to add forward slash hack.\n"; + } + else + { + # check if prepfile.pm has already been patched + if (string_exists_in_file($prepfilepmpath, "EnvPatcher forwardslash hack")) + { + print "The SDK has already been patched with forwardslash hack.\n"; + } + else + { + # read content of the prepfile.pm file + my @filecontent = read_file_to_array($prepfilepmpath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # loop through the array to find the correct place + foreach (@filecontent) + { + if ($_ =~ /# skip blank lines/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos+6, 0, $forwardslashhack); + + # write the modified array to the file + write_file_from_array($prepfilepmpath, @filecontent); + + print "Prepfile.pm patched with forward slash hack.\n"; + } + else + { + print "ERROR: Unable to find correct place from $prepfilepmpath for patching!\n"; + print "Your SDK environment probably is not supported by this script!\n"; + exit(2); + } + } + } +} +else +{ + print "WARNING: $pathutlpmpath not found, this environment is not supported!\n"; +} + + + +# checks if string exists in the file +sub string_exists_in_file +{ + my $filepath = $_[0]; + my $findstring = $_[1]; + my $match_found = 0; + + open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!"; + + # loop through the file for occurances + while () + { + if ($_ =~ /$findstring/) + { + $match_found = 1; + last; + } + } + + close FILE; + + return $match_found; +} + + +# reads lines from a file to an array +sub read_file_to_array +{ + my $filepath = $_[0]; + + open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!"; + my @data = ; + close FILE; + + return(@data); +} + + +# writes lines from an array to a file +sub write_file_from_array +{ + my ($filepath, @data) = @_; + + # take a backup of the file + copy ($filepath, $filepath."EnvPatcher") or die "Cannot take backup of $filepath to $filepath.EnvPatcher"; + + open(FILE, ">", $filepath) or die "Failed to open $filepath for writing!"; + + # write the array to file + foreach my $line (@data) + { + print FILE "$line"; + } + + close FILE; +} + +sub create_default_platform_paths_hrh +{ + # the file does not exist, so create the missing file + open(FILE, ">", $platformpathspath) or die "Failed to open $platformpathspath for writing!\n"; + + print FILE < thus they are first. +*/ +#define APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem + +/** +* This define statements defines the SYSTEMINCLUDE-line, which is intended to be +* used in the mmp-files that are part of the middleware-layer. It includes all +* the needed directories from the /epoc32/include, that are valid ones for the +* middleware-layer components. +*/ +#define MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem + +/** +* This define statements defines the SYSTEMINCLUDE-line, which is intended to be +* used in the mmp-files that are part of the osextensions-layer. It includes all +* the needed directories from the /epoc32/include, that are valid ones for the +* os-layer components. +*/ +#define OS_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem + + +// Below statement is Deprecated and the OS_LAYER_SYSTEMINCLUDE-macro has to be +// used. +#define OSEXT_LAYER_SYSTEMINCLUDE OS_LAYER_SYSTEMINCLUDE + +/** +* This define statements defines the SYSTEMINCLUDE-line, which is intended to be +* used in the mmp-files that are part of the os-layer. This is intended +* to be only used by those components which need to use in their mmp-file either +* kern_ext.mmh or nkern_ext.mmh. Reason is that those +* 2 files already contain the /epoc32/include as system include path. +* +*/ +#define OS_LAYER_KERNEL_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/oem + + +// Below statement is Deprecated and the OS_LAYER_KERNEL_SYSTEMINCLUDE-macro +// has to be used. +#define OSEXT_LAYER_KERNEL_SYSTEMINCLUDE OS_LAYER_KERNEL_SYSTEMINCLUDE + +/** +**************************************************************************** +* Definitions that also define the paths to the layer specific source directories. +**************************************************************************** +*/ +/** +* The below 3 macros define the paths to the layer-specific source dirs. +* See usage on top of this hrh-file, these are used the same way as +* for instance the OS_LAYER_DOMAIN_EXPORT_PATH +* Deprecated: is not allowed to be using in Symbian Foundation +*/ +#define APP_LAYER_SOURCE_PATH(rest) /s60/app/##rest +#define MW_LAYER_SOURCE_PATH(rest) /s60/mw/##rest +#define OSEXT_LAYER_SOURCE_PATH(rest) /s60/osext/##rest + +/** +**************************************************************************** +* Definitions to export IBY files to different folders where they will be taken +* to ROM image +**************************************************************************** +*/ +// Following definition is used for exporting tools and stubs IBY files to +// Core image. +#define CORE_IBY_EXPORT_PATH(path,exported) /epoc32/rom/include/##exported + +/** +* --------------------------------------- +* Macros for Configuration tool migration. +* The below macros define the location under epoc32, where the confml +* (Configuration Markup Language) and crml (Central Repository Markup Language) +* files should be exported. +* --------------------------------------- +*/ +#define CONFML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file +#define CRML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file +#define GCFML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file +#define CONFML_CONFIG_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/config/##file + +#define APP_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define APP_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define APP_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define APP_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) + +#define MW_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define MW_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define MW_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define MW_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) + +// Deprecate: Use the OS_LAYER_* macros instead of OSEXT_LAYER_* +#define OSEXT_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define OSEXT_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define OSEXT_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define OSEXT_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) +#define OS_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define OS_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define OS_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define OS_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) + +#endif // end of PLATFORM_PATHS_HRH + +ENDOFTHEFILE + + close FILE; +} diff -r 000000000000 -r d6fe6244b863 filebrowser/envpatcher/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/envpatcher/ReadMe.txt Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,46 @@ +Environment Patcher v1.0.1 +========================== + +Updated: 12th November 2009 + + +Introduction: +------------- +This tool can be used to patch your S60 SDK environment so that the tricks and +macros introduced in the latest SDKs can be used in a public SDK and older +OEM releases. + +This tool can perform the following tasks: +- Adds support for forward slashes in paths in bld.inf/.mmp files in S60 3.0 +- Removes an unncessary warning about DEPENDS and SMPSAFE resource keywords in + an .mmp file +- Creates a missing epoc32\include\platform_paths.hrh file for supporting + platform macros introduced since S60 3.2 OEM and Symbian Foundation releases +- Modifies epoc32\include\platform_paths.hrh for missing macros +- Creates a missing epoc32\include\oem directory to suppress a possible warning + + +Usage: +------ +EnvPatcher.pl + +Where EPOCROOT is the path to the root of the SDK, for example: + EnvPatcher.pl c:\Symbian\9.1\S60_3rd_MR + EnvPatcher.pl z:\ + + +Requirements: +------------- +- S60 SDK (public or OEM), version 3.0 or newer +- Perl 5.6.1 or newer + + + + +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 "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/BWINS/FileBrowserFileOpClientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/BWINS/FileBrowserFileOpClientU.DEF Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,14 @@ +EXPORTS + ??1CFBFileOpClient@@UAE@XZ @ 1 NONAME ; CFBFileOpClient::~CFBFileOpClient(void) + ?Attribs@CFBFileOpClient@@QAEHABVTDesC16@@IIABVTTime@@I@Z @ 2 NONAME ; int CFBFileOpClient::Attribs(class TDesC16 const &, unsigned int, unsigned int, class TTime const &, unsigned int) + ?Copy@CFBFileOpClient@@QAEHABVTDesC16@@0I@Z @ 3 NONAME ; int CFBFileOpClient::Copy(class TDesC16 const &, class TDesC16 const &, unsigned int) + ?CreateEmptyFile@CFBFileOpClient@@QAEHABVTDesC16@@@Z @ 4 NONAME ; int CFBFileOpClient::CreateEmptyFile(class TDesC16 const &) + ?Delete@CFBFileOpClient@@QAEHABVTDesC16@@I@Z @ 5 NONAME ; int CFBFileOpClient::Delete(class TDesC16 const &, unsigned int) + ?EraseMBR@CFBFileOpClient@@QAEHI@Z @ 6 NONAME ; int CFBFileOpClient::EraseMBR(unsigned int) + ?MkDirAll@CFBFileOpClient@@QAEHABVTDesC16@@@Z @ 7 NONAME ; int CFBFileOpClient::MkDirAll(class TDesC16 const &) + ?NewL@CFBFileOpClient@@SAPAV1@XZ @ 8 NONAME ; class CFBFileOpClient * CFBFileOpClient::NewL(void) + ?PartitionDrive@CFBFileOpClient@@QAEHII@Z @ 9 NONAME ; int CFBFileOpClient::PartitionDrive(unsigned int, unsigned int) + ?Rename@CFBFileOpClient@@QAEHABVTDesC16@@0I@Z @ 10 NONAME ; int CFBFileOpClient::Rename(class TDesC16 const &, class TDesC16 const &, unsigned int) + ?RmDir@CFBFileOpClient@@QAEHABVTDesC16@@I@Z @ 11 NONAME ; int CFBFileOpClient::RmDir(class TDesC16 const &, unsigned int) + ?CancelOp@CFBFileOpClient@@QAEXXZ @ 12 NONAME ; void CFBFileOpClient::CancelOp(void) + diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/eabi/FileBrowserFileOpClientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/eabi/FileBrowserFileOpClientu.def Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,20 @@ +EXPORTS + _ZN15CFBFileOpClient14PartitionDriveEjj @ 1 NONAME + _ZN15CFBFileOpClient15CreateEmptyFileERK7TDesC16 @ 2 NONAME + _ZN15CFBFileOpClient4CopyERK7TDesC16S2_j @ 3 NONAME + _ZN15CFBFileOpClient4NewLEv @ 4 NONAME + _ZN15CFBFileOpClient5RmDirERK7TDesC16j @ 5 NONAME + _ZN15CFBFileOpClient6DeleteERK7TDesC16j @ 6 NONAME + _ZN15CFBFileOpClient6RenameERK7TDesC16S2_j @ 7 NONAME + _ZN15CFBFileOpClient7AttribsERK7TDesC16jjRK5TTimej @ 8 NONAME + _ZN15CFBFileOpClient8EraseMBREj @ 9 NONAME + _ZN15CFBFileOpClient8MkDirAllERK7TDesC16 @ 10 NONAME + _ZN15CFBFileOpClientD0Ev @ 11 NONAME + _ZN15CFBFileOpClientD1Ev @ 12 NONAME + _ZN15CFBFileOpClientD2Ev @ 13 NONAME + _ZTI15CFBFileOpClient @ 14 NONAME ; ## + _ZTV15CFBFileOpClient @ 15 NONAME ; ## + _ZN15CFBFileOpClient8CancelOpEv @ 16 NONAME + _ZTI18CAsyncWaiterClient @ 17 NONAME ; ## + _ZTV18CAsyncWaiterClient @ 18 NONAME ; ## + diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/group/FBFileOpClient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/group/FBFileOpClient.mmp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,41 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 + + +TARGET FileBrowserFileOpClient.dll +TARGETTYPE dll + +CAPABILITY CAP_GENERAL_DLL + +SMPSAFE + +UID 0x102828D7 +VENDORID VID_DEFAULT + + +USERINCLUDE ../inc +SOURCEPATH ../src +OS_LAYER_SYSTEMINCLUDE + + +SOURCE FBFileOpClient.cpp + +LIBRARY euser.lib diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/group/bld.inf Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,20 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_MMPFILES +FBFileOpClient.mmp diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/inc/FBFileOpClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/inc/FBFileOpClient.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,108 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FBFILEOPCLIENT_H__ +#define __FBFILEOPCLIENT_H__ + +// INCLUDES +#include +#include +#include "FBFileOpClientServer.h" // TFileOpArgs + +// FORWARD DECLARATIONS + +// CLASS DECLARATIONS + +class RFBFileOpServerSession : public RSessionBase + { +public: + TInt Connect(); + + void Copy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch, TRequestStatus& aStatus); + TInt Rename(const TDesC& anOld, const TDesC& aNew, TUint aSwitch); + TInt Attribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch); + void RmDir(const TDesC& aDirName, TUint aSwitch, TRequestStatus& aStatus); + void Delete(const TDesC& aName, TUint aSwitch, TRequestStatus& aStatus); + TInt MkDirAll(const TDesC& aPath); + TInt CreateEmptyFile(const TDesC& aName); + TInt EraseMBR(TUint aDriveNumber); + TInt PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions); + TInt CancelOp(); + +private: + TVersion Version() const; + TPckgBuf iPckgBuf; + }; + + +class CFBFileOpClient : public CBase + { +public: + IMPORT_C static CFBFileOpClient* NewL(); + IMPORT_C ~CFBFileOpClient(); + IMPORT_C TInt Copy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch); + IMPORT_C TInt Rename(const TDesC& anOld, const TDesC& aNew, TUint aSwitch); + IMPORT_C TInt Attribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch); + IMPORT_C TInt RmDir(const TDesC& aDirName, TUint aSwitch); + IMPORT_C TInt Delete(const TDesC& aName, TUint aSwitch); + IMPORT_C TInt MkDirAll(const TDesC& aPath); + IMPORT_C TInt CreateEmptyFile(const TDesC& aName); + IMPORT_C TInt EraseMBR(TUint aDriveNumber); + IMPORT_C TInt PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions); + IMPORT_C void CancelOp(); + +private: + CFBFileOpClient(); + void ConstructL(); + + private : + RFBFileOpServerSession iFBFileOpServerSession; + }; + + +/** + * Similar class as CAsyncWaiter defined in FBUtils.h, except + * CAsyncWaiterClient uses iWait.AsyncStop() instead of + * CAknEnv::StopSchedulerWaitWithBusyMessage( iWait ) + * to stop the nested loop. This class can be utilized + * if CAknEnv is not running. + */ +class CAsyncWaiterClient : public CActive + { +public: + static CAsyncWaiterClient* NewL( TInt aPriority = EPriorityStandard ); + static CAsyncWaiterClient* NewLC( TInt aPriority = EPriorityStandard ); + ~CAsyncWaiterClient(); + + void StartAndWait(); + TInt Result() const; + +private: + CAsyncWaiterClient( TInt aPriority ); + + // from CActive + void RunL(); + void DoCancel(); + +private: + CActiveSchedulerWait iWait; + TInt iError; + }; + +#endif + diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/inc/FBFileOpClientServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/inc/FBFileOpClientServer.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,57 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FBCLIENTSERVER_H__ +#define __FBCLIENTSERVER_H__ + +#include + +const TUint KCopyServMajorVersionNumber = 1; +const TUint KCopyServMinorVersionNumber = 0; +const TUint KCopyServBuildVersionNumber = 0; + +_LIT(KMyServerName, "FileBrowserFileOpServer"); +_LIT(KMyServerImg, "FileBrowserFileOpServer"); // EXE name +const TUid KServerUid3 = {0x102828D8}; + +enum TFileOpMessages + { + EFileOpCopy, + EFileOpRename, + EFileOpAttribs, + EFileOpRmDir, + EFileOpDelete, + EFileOpMkDirAll, + EFileOpCreateEmptyFile, + EFileOpEraseMBR, + EFileOpPartitionDrive, + EFileOpCancel + }; + +class TFileOpArgs + { +public: + TFileName iBuf1; + TFileName iBuf2; + TUint iUint1; + TUint iUint2; + TUint iUint3; + TTime iTime1; + }; + +#endif \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopclient/src/FBFileOpClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopclient/src/FBFileOpClient.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,481 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// needed for client interface +#include "FBFileOpClient.h" + +const TUint KDefaultMessageSlots=4; + +// -------------------------------------------------------------------------------------------- + +static TInt StartServer() +// +// Start the server process. Simultaneous launching +// of two such processes should be detected when the second one attempts to +// create the server object, failing with KErrAlreadyExists. +// + { + const TUidType serverUid(KNullUid,KNullUid,KServerUid3); + RProcess server; + TInt r=server.Create(KMyServerImg,KNullDesC,serverUid); + if (r!=KErrNone) + return r; + TRequestStatus stat; + server.Rendezvous(stat); + if (stat!=KRequestPending) + server.Kill(0); // abort startup + else + server.Resume(); // logon OK - start the server + User::WaitForRequest(stat); // wait for start or death + // we can't use the 'exit reason' if the server panicked as this + // is the panic 'reason' and may be '0' which cannot be distinguished + // from KErrNone + r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + server.Close(); + return r; + } + +// -------------------------------------------------------------------------------------------- + +TVersion RFBFileOpServerSession::Version(void) const + { + return(TVersion(KCopyServMajorVersionNumber,KCopyServMinorVersionNumber,KCopyServBuildVersionNumber)); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::Connect() +// +// Connect to the server, attempting to start it if necessary +// + { + TInt retry=2; + for (;;) + { + TInt r=CreateSession(KMyServerName,Version(),KDefaultMessageSlots); + if (r!=KErrNotFound && r!=KErrServerTerminated) + return r; + if (--retry==0) + return r; + r=StartServer(); + if (r!=KErrNone && r!=KErrAlreadyExists) + return r; + } + } + +// -------------------------------------------------------------------------------------------- + +void RFBFileOpServerSession::Copy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch, TRequestStatus& aStatus) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(aSourceFullName); + argsStruct.iBuf2.Copy(aTargetFullName); + argsStruct.iUint1 = aSwitch; + + iPckgBuf = argsStruct; + TIpcArgs args(&iPckgBuf); + SendReceive(EFileOpCopy, args, aStatus); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::Rename(const TDesC& anOld, const TDesC& aNew, TUint aSwitch) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(anOld); + argsStruct.iBuf2.Copy(aNew); + argsStruct.iUint1 = aSwitch; + + TPckgBuf pckgBuf; + pckgBuf = argsStruct; + TIpcArgs args(&pckgBuf); + return SendReceive(EFileOpRename, args); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::Attribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(aName); + argsStruct.iUint1 = aSetMask; + argsStruct.iUint2 = aClearMask; + argsStruct.iTime1 = aTime; + argsStruct.iUint3 = aSwitch; + + TPckgBuf pckgBuf; + pckgBuf = argsStruct; + TIpcArgs args(&pckgBuf); + return SendReceive(EFileOpAttribs, args); + } + +// -------------------------------------------------------------------------------------------- + +void RFBFileOpServerSession::RmDir( const TDesC& aDirName, + TUint aSwitch, + TRequestStatus& aStatus ) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(aDirName); + argsStruct.iUint1 = aSwitch; + + iPckgBuf = argsStruct; + TIpcArgs args(&iPckgBuf); + SendReceive(EFileOpRmDir, args, aStatus); + } + +// -------------------------------------------------------------------------------------------- + +void RFBFileOpServerSession::Delete(const TDesC& aName, TUint aSwitch, TRequestStatus& aStatus) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(aName); + argsStruct.iUint1 = aSwitch; + + iPckgBuf = argsStruct; + TIpcArgs args(&iPckgBuf); + SendReceive(EFileOpDelete, args, aStatus); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::MkDirAll(const TDesC& aPath) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(aPath); + + TPckgBuf pckgBuf; + pckgBuf = argsStruct; + TIpcArgs args(&pckgBuf); + return SendReceive(EFileOpMkDirAll, args); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::CreateEmptyFile(const TDesC& aName) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iBuf1.Copy(aName); + + TPckgBuf pckgBuf; + pckgBuf = argsStruct; + TIpcArgs args(&pckgBuf); + return SendReceive(EFileOpCreateEmptyFile, args); + } +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::EraseMBR(TUint aDriveNumber) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iUint1 = aDriveNumber; + + TPckgBuf pckgBuf; + pckgBuf = argsStruct; + TIpcArgs args(&pckgBuf); + return SendReceive(EFileOpEraseMBR, args); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions) + { + TFileOpArgs argsStruct = TFileOpArgs(); + argsStruct.iUint1 = aDriveNumber; + argsStruct.iUint2 = aNumberOfPartitions; + + TPckgBuf pckgBuf; + pckgBuf = argsStruct; + TIpcArgs args(&pckgBuf); + return SendReceive(EFileOpPartitionDrive, args); + } + +// -------------------------------------------------------------------------------------------- + +TInt RFBFileOpServerSession::CancelOp() + { + TIpcArgs args( NULL ); + return SendReceive( EFileOpCancel, args ); + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +EXPORT_C CFBFileOpClient* CFBFileOpClient::NewL() + { + CFBFileOpClient* self = new(ELeave) CFBFileOpClient; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C CFBFileOpClient::~CFBFileOpClient() + { + iFBFileOpServerSession.Close(); + } + +// -------------------------------------------------------------------------------------------- + +CFBFileOpClient::CFBFileOpClient() + { + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpClient::ConstructL() + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::Copy( const TDesC& aSourceFullName, + const TDesC& aTargetFullName, + TUint aSwitch ) + { + CAsyncWaiterClient* waiter = CAsyncWaiterClient::NewLC(); + iFBFileOpServerSession.Copy( aSourceFullName, aTargetFullName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + TInt err = waiter->Result(); + + if ( err == KErrServerTerminated ) + { + User::LeaveIfError( iFBFileOpServerSession.Connect() ); + iFBFileOpServerSession.Copy( aSourceFullName, aTargetFullName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + err = waiter->Result(); + } + CleanupStack::PopAndDestroy( waiter ); + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::Rename(const TDesC& anOld, const TDesC& aNew, TUint aSwitch) + { + TInt err = iFBFileOpServerSession.Rename(anOld, aNew, aSwitch); + + if (err == KErrServerTerminated) + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + err = iFBFileOpServerSession.Rename(anOld, aNew, aSwitch); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::Attribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) + { + TInt err = iFBFileOpServerSession.Attribs(aName, aSetMask, aClearMask, aTime, aSwitch); + + if (err == KErrServerTerminated) + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + err = iFBFileOpServerSession.Attribs(aName, aSetMask, aClearMask, aTime, aSwitch); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::RmDir(const TDesC& aDirName, TUint aSwitch) + { + CAsyncWaiterClient* waiter = CAsyncWaiterClient::NewLC(); + iFBFileOpServerSession.RmDir( aDirName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + TInt err = waiter->Result(); + + if ( err == KErrServerTerminated ) + { + User::LeaveIfError( iFBFileOpServerSession.Connect() ); + iFBFileOpServerSession.RmDir( aDirName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + err = waiter->Result(); + } + CleanupStack::PopAndDestroy( waiter ); + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::Delete(const TDesC& aName, TUint aSwitch) + { + CAsyncWaiterClient* waiter = CAsyncWaiterClient::NewLC(); + iFBFileOpServerSession.Delete(aName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + TInt err = waiter->Result(); + + if ( err == KErrServerTerminated ) + { + User::LeaveIfError( iFBFileOpServerSession.Connect() ); + iFBFileOpServerSession.Delete(aName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + err = waiter->Result(); + } + CleanupStack::PopAndDestroy( waiter ); + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::MkDirAll(const TDesC& aPath) + { + TInt err = iFBFileOpServerSession.MkDirAll(aPath); + + if (err == KErrServerTerminated) + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + err = iFBFileOpServerSession.MkDirAll(aPath); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::CreateEmptyFile(const TDesC& aName) + { + TInt err = iFBFileOpServerSession.CreateEmptyFile(aName); + + if (err == KErrServerTerminated) + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + err = iFBFileOpServerSession.CreateEmptyFile(aName); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::EraseMBR(TUint aDriveNumber) + { + TInt err = iFBFileOpServerSession.EraseMBR(aDriveNumber); + + if (err == KErrServerTerminated) + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + err = iFBFileOpServerSession.EraseMBR(aDriveNumber); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C TInt CFBFileOpClient::PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions) + { + TInt err = iFBFileOpServerSession.PartitionDrive(aDriveNumber, aNumberOfPartitions); + + if (err == KErrServerTerminated) + { + User::LeaveIfError(iFBFileOpServerSession.Connect()); + err = iFBFileOpServerSession.PartitionDrive(aDriveNumber, aNumberOfPartitions); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +EXPORT_C void CFBFileOpClient::CancelOp() + { + TInt err = iFBFileOpServerSession.CancelOp(); + + if ( err == KErrServerTerminated ) + { + User::LeaveIfError( iFBFileOpServerSession.Connect() ); + err = iFBFileOpServerSession.CancelOp(); // Ignore return value this time + } + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CAsyncWaiterClient* CAsyncWaiterClient::NewL( TInt aPriority ) + { + CAsyncWaiterClient* self = new(ELeave) CAsyncWaiterClient( aPriority ); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CAsyncWaiterClient* CAsyncWaiterClient::NewLC( TInt aPriority ) + { + CAsyncWaiterClient* self = new (ELeave) CAsyncWaiterClient( aPriority ); + CleanupStack::PushL( self ); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CAsyncWaiterClient::CAsyncWaiterClient( TInt aPriority ) : CActive( aPriority ) + { + CActiveScheduler::Add( this ); + } + +// -------------------------------------------------------------------------------------------- + +CAsyncWaiterClient::~CAsyncWaiterClient() + { + Cancel(); + } + +// -------------------------------------------------------------------------------------------- + +void CAsyncWaiterClient::StartAndWait() + { + SetActive(); + iWait.Start(); + } + +// -------------------------------------------------------------------------------------------- + +TInt CAsyncWaiterClient::Result() const + { + return iError; + } + +// -------------------------------------------------------------------------------------------- + +void CAsyncWaiterClient::RunL() + { + iError = iStatus.Int(); + iWait.AsyncStop(); + } + +// -------------------------------------------------------------------------------------------- + +void CAsyncWaiterClient::DoCancel() + { + iError = KErrCancel; + if( iStatus == KRequestPending ) + { + TRequestStatus* s = &iStatus; + User::RequestComplete( s, KErrCancel ); + } + iWait.AsyncStop(); + } + +// -------------------------------------------------------------------------------------------- + diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopserver/group/FBFileOpServer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopserver/group/FBFileOpServer.mmp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,44 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 + + +TARGET FileBrowserFileOpServer.exe +TARGETTYPE exe +UID 0 0x102828D8 +VENDORID VID_DEFAULT + +CAPABILITY CAP_FILE_SERVER + +SMPSAFE + +USERINCLUDE ../inc +USERINCLUDE ../../fileopclient/inc +OS_LAYER_SYSTEMINCLUDE +//SYSTEMINCLUDE /epoc32/include/kernel +SOURCEPATH ../src + + +SOURCE FBFileOpServer.cpp +SOURCE FBDrivePartitioner.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY efile.lib diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopserver/group/bld.inf Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,20 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_MMPFILES +FBFileOpServer.mmp diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopserver/inc/FBDrivePartitioner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopserver/inc/FBDrivePartitioner.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,35 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FBDRIVEPARTITIONER_H__ +#define __FBDRIVEPARTITIONER_H__ + +#include +#include + +class FBDrivePartioner + { +public: + static TInt FindLocalDriveNumber(RFs& aFs, TInt aDriveNumber, TInt& aLocalDriveNum); + static TInt EraseMBR(RFs& aFs, TInt aDriveNumber); + static TInt CreatePartitions(RFs& aFs, TInt aDriveNumber, TInt aPartCount); + static TInt FormatPartitions(RFs& aFs, TInt aDriveNumber, TInt aPartCount); + }; + + +#endif diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopserver/inc/FBFileOpServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopserver/inc/FBFileOpServer.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,186 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FBFILEOPSERVER_H__ +#define __FBFILEOPSERVER_H__ + +#include +#include +#include "FBFileOpClientServer.h" + +// needed for creating server thread. +//const TUint KDefaultHeapSize=0x10000; + +// reasons for server panic +enum TMyPanic + { + EPanicBadDescriptor, + EPanicIllegalFunction + }; + +class CShutdown : public CTimer + { + enum {KMyShutdownDelay=0x200000}; // approx 2s + +public : + inline CShutdown(); + inline void ConstructL(); + inline void Start(); + +private : + void RunL(); + }; + +//********************************** +//CFBFileOpServer +//********************************** +/** +Our server class - an active object - and therefore derived ultimately from CActive. +It accepts requests from client threads and forwards +them to the client session to be dealt with. It also handles the creation +of the server-side client session. +*/ +class CFBFileOpServer : public CServer2 + { + +public : + static CServer2* NewLC(); + void AddSession(); + void DropSession(); + +protected : + +private : + CFBFileOpServer(); + void ConstructL(); + CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; + +public : + +private : + TInt iSessionCount; + CShutdown iShutdown; + + }; + +//********************************** +//CRequestObserver +//********************************** +/** +This class is for monitoring asynchronous request +and for completing related RMessage2 object. +*/ +class CRequestObserver : public CActive + { +public: + CRequestObserver( TInt aPriority ); + virtual ~CRequestObserver(); + + void StartWaiting( const RMessage2& aMsg ); + +private: + // from CActive + void RunL(); + void DoCancel(); + +private: + RMessage2 iMsg; + }; + + +//********************************** +//CFBFileOpServerSession +//********************************** +/** +This class represents a session with the server. +Functions are provided to respond appropriately to client messages. +*/ +class CFBFileOpServerSession : public CSession2, + public MFileManObserver + { + +public : + CFBFileOpServerSession(); + +private: // From MFileManObserver + + TControl NotifyFileManStarted(); + TControl NotifyFileManOperation(); + TControl NotifyFileManEnded(); + +protected : + // panic the client + void PanicClient(const RMessage2& aMessage,TInt aPanic) const; + +private : + ~CFBFileOpServerSession(); + inline CFBFileOpServer& Server(); + void CreateL(); + + //service requests + void ServiceL(const RMessage2& aMessage); + void DispatchMessageL(const RMessage2& aMessage, TBool& aComplete); + + void CopyL(const RMessage2& aMessage); + void RenameL(const RMessage2& aMessage); + void AttribsL(const RMessage2& aMessage); + void RmDirL(const RMessage2& aMessage, TBool& aComplete); + void DeleteL(const RMessage2& aMessage); + void MkDirAllL(const RMessage2& aMessage); + void CreateEmptyFileL(const RMessage2& aMessage); + void EraseMBRL(const RMessage2& aMessage); + void PartitionDriveL(const RMessage2& aMessage); + + void ServiceError(const RMessage2& aMessage, TInt aError); + + void CancelOp(); + +private : + RFs iFs; + RFile iFile; + CFileMan* iFileMan; + MFileManObserver::TControl iFileManObserverResult; + CRequestObserver* iReqObserver; + }; + + +//********************************** +//Inlines +//********************************** + +inline CShutdown::CShutdown() + :CTimer(-1) + {CActiveScheduler::Add(this);} + +inline void CShutdown::ConstructL() + {CTimer::ConstructL();} + +inline void CShutdown::Start() + {After(KMyShutdownDelay);} + +inline CFBFileOpServer::CFBFileOpServer() + :CServer2(0,ESharableSessions) + {} + +inline CFBFileOpServerSession::CFBFileOpServerSession() + {} + +inline CFBFileOpServer& CFBFileOpServerSession::Server() + {return *static_cast(const_cast(CSession2::Server()));} + +#endif diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopserver/src/FBDrivePartitioner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopserver/src/FBDrivePartitioner.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,454 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +#include +#include + +#include "FBDrivePartitioner.h" + + +// copied from coreapplicationuisdomainpskeys.h +const TUid KPSUidCoreApplicationUIs = { 0x101F8767 }; +const TUint32 KCoreAppUIsMmcRemovedWithoutEject = 0x00000109; +enum TCoreAppUIsMmcRemovedWithoutEject + { + ECoreAppUIsEjectCommandUsedUninitialized = 0, + ECoreAppUIsEjectCommandNotUsed, + ECoreAppUIsEjectCommandUsed, + ECoreAppUIsEjectCommandUsedToDrive // Low 16-bits contain this value and high 16-bits TDriveNumber to eject + }; + + +// trace macros +#define TRACE(a) {_LIT( KMsg, a ); RDebug::Print(KMsg);} +#define TRACE1(a,b) {_LIT( KMsg, a ); RDebug::Print(KMsg,b);} +#define TRACE2(a,b,c) {_LIT( KMsg, a ); RDebug::Print(KMsg,b,c);} + + +// Set the partition alignment boundary +const TInt KPartitionAlignment = 0x1000; // 4kB +const TInt KMBRSize = 512; +const TInt KSectorSize = 512; +const TInt KMBRPartitionInfoOffset = 0x1BE; +const TInt KLargeFAT16Partition = 0x2000000; // 32MB +const TInt KPartitionEntrySize = 16; + +// Set for the iX86BootIndicator +//const TInt KPartitionBootable = 0x80; +const TInt KPartitionNonBootable = 0x0; + + +class TMBRPartition + { +public: + TUint8 iX86BootIndicator; + TUint8 iStartHead; + TUint8 iStartSector; + TUint8 iStartCylinder; + TUint8 iPartitionType; + TUint8 iEndHead; + TUint8 iEndSector; + TUint8 iEndCylinder; + TUint32 iFirstSector; + TUint32 iNumSectors; + }; + + +// -------------------------------------------------------------------------------------------- + +TInt FBDrivePartioner::FindLocalDriveNumber(RFs& aFs, TInt aDriveNumber, TInt& aLocalDriveNum) + { + TRACE1( "FBDrivePartitioner::FindLocalDriveNumber: start aDriveNumber=%d", aDriveNumber ); + + TInt err(KErrNone); + + TDriveInfo driveInfo; + err = aFs.Drive(driveInfo, aDriveNumber); + + TRACE1( "FBDrivePartitioner::FindLocalDriveNumber: get DriveInfo err=%d", err ); + + + TVolumeInfo vi; + err = aFs.Volume(vi, aDriveNumber); + + TRACE1( "FBDrivePartitioner::FindLocalDriveNumber: get VolumeInfo err=%d", err ); + + + TMediaSerialNumber serialNum; + err = aFs.GetMediaSerialNumber(serialNum, aDriveNumber); + + TRACE1( "FBDrivePartitioner::FindLocalDriveNumber: get MediaSerialNumber err=%d", err ); + + + TInt len = serialNum.Length(); + TInt n(0); + for (n=0; n buf; + for (TInt m=n; m hexBuf; + hexBuf.Format(_L("%02X "),serialNum[m]); + buf.Append(hexBuf); + } + buf.Append(_L("\n")); + } + + TBusLocalDrive drv; + TBool chg(EFalse); + aLocalDriveNum = -1; + for (n=0; n mbrBuf; + mbrBuf.Fill(0, mbrBuf.MaxLength()); + +/* + // write the next 16 sectors with the buffer. Usually you only write the first one, but this one should erase any following invalid sectors + for (TInt i=0; i<16; i++) + { + err = drv.Write(i*KMBRSize, KMBRSize, &mbrBuf, -1 , 0, 0x40000000); // RLocalDrive::ELocDrvWholeMedia==0x40000000 + TRACE2("FBDrivePartitioner::EraseMBR: sector %d, write returns %d", i+1, err); + } +*/ + + // erase the MBR + err = drv.Write(0, KMBRSize, &mbrBuf, -1 , 0, 0x40000000); // RLocalDrive::ELocDrvWholeMedia==0x40000000 + TRACE1("FBDrivePartitioner::EraseMBR: write returns %d", err); + + drv.Disconnect(); + + // force a remount, if this is the protected area, then it will have to be remounted + TRACE1( "FBDrivePartitioner::EraseMBR: Remounting drive number %d", aDriveNumber ); + TInt err2 = aFs.RemountDrive(aDriveNumber, NULL, 0); + TRACE1( "FBDrivePartitioner::EraseMBR: RemountDrive err2=%d", err2 ); + + TRACE1( "FBDrivePartitioner::EraseMBR: returns %d", err ); + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt FBDrivePartioner::CreatePartitions(RFs& aFs, TInt aDriveNumber, TInt aPartCount) + { + TRACE2( "FBDrivePartitioner::CreatePartitions: start aDriveNumber=%d aPartCount=%d", aDriveNumber, aPartCount ); + TInt err(KErrNone); + + TUint8 MBRPartitionInfo[ KPartitionEntrySize*KMBRMaxPrimaryPartitions ]; + + // Prevent SysAp shutting down applications + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsed ); + + // Force the system to read the memory card erased MBR + err = aFs.RemountDrive( aDriveNumber ); + TRACE1( "FBDrivePartitioner::CreatePartitions: Remount result %d", err ); + + // Get the number of partitions from user + TUint8 partitionCount(aPartCount); + TBool change = EFalse; + TInt mcDriveNbr(2); + TLocalDriveCapsV4 dc; + TInt64 diskSpace(0); + +/* + err = FindLocalDriveNumber(aFs, aDriveNumber, mcDriveNbr); + + if (err != KErrNone) + { + TRACE1("FBDrivePartitioner::CreatePartitions: FindLocalDriveNumber err=%d returning", err); + return err; + } +*/ + + // Seek through the system drives to find memory card drive + for (TInt i = 0; i < KMaxLocalDrives; ++i) + { + RLocalDrive d; + change = EFalse; + err = d.Connect(i, change); + if (err == KErrNone) + { + TPckg capsPack(dc); + + if (d.Caps(capsPack) == KErrNone) + { + if (dc.iType == EMediaHardDisk) + { + mcDriveNbr = i; + diskSpace = dc.iSize; + TRACE1( "FBDrivePartitioner::CreatePartitions: found hard drive %d:", mcDriveNbr ); + } + } + d.Close(); + } + } + + // Connect to the local drive we found + RLocalDrive localDrive; + change = EFalse; + err = localDrive.Connect( mcDriveNbr, change ); + TRACE2( "FBDrivePartitioner::CreatePartitions: localDrive.Connect %d: %d", mcDriveNbr, err ); + TRACE1( "FBDrivePartitioner::CreatePartitions: diskSpace in sectors 0x%x, %d", diskSpace / KSectorSize ); + + // Let's read the MBR by using RLocalDrive + TUint8 data[KMBRSize]; + TPtr8 buf( &data[0], KMBRSize ); + err = localDrive.Read( 0, KMBRSize, buf ); + TRACE1( "FBDrivePartitioner::CreatePartitions: localDrive.Read %d", err ); + // Let's check the current drive layout here + memcpy( MBRPartitionInfo, &data[KMBRPartitionInfoOffset],(sizeof(TMBRPartition)<<2)); + TMBRPartition *partitionInfo = (TMBRPartition*) MBRPartitionInfo; + + // Clean the rest of the MBR buffer + buf.FillZ(); + + // Print out the partition info + for( TInt i = 0; i 0) + { + err = fmt.Next(count); + if (err != KErrNone) + { + TRACE1( "FBDrivePartitioner::FormatPartitions: Format error=%d", err ); + break; + } + } + fmt.Close(); + TRACE1( "FBDrivePartitioner::FormatPartitions: Format %S end", &name ); + } + + TRACE1("FBDrivePartitioner::FormatPartitions returns %d", err); + + return err; + } + +// -------------------------------------------------------------------------------------------- diff -r 000000000000 -r d6fe6244b863 filebrowser/fileopserver/src/FBFileOpServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/fileopserver/src/FBFileOpServer.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,474 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBFileOpServer.h" +#include "FBDrivePartitioner.h" + +#include +#include + +// -------------------------------------------------------------------------------------------- + +//*********************************** +//CFBFileOpServer - implementations +//*********************************** + +CServer2* CFBFileOpServer::NewLC() + { + CFBFileOpServer* self = new(ELeave) CFBFileOpServer; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// -------------------------------------------------------------------------------------------- + +// +// 2nd phase construction - ensure the timer and server objects are running +// +void CFBFileOpServer::ConstructL() + { + StartL(KMyServerName); + iShutdown.ConstructL(); + // ensure that the server still exits even if the 1st client fails to connect + iShutdown.Start(); + } + +// -------------------------------------------------------------------------------------------- + +// +// Cretae a new client session. This should really check the version number. +// +CSession2* CFBFileOpServer::NewSessionL(const TVersion&,const RMessage2&) const + { + return new(ELeave) CFBFileOpServerSession(); + } + +// -------------------------------------------------------------------------------------------- + +// +// A new session is being created +// Cancel the shutdown timer if it was running +// +void CFBFileOpServer::AddSession() + { + ++iSessionCount; + iShutdown.Cancel(); + } + +// -------------------------------------------------------------------------------------------- + +// +// A session is being destroyed +// Start the shutdown timer if it is the last session. +// +void CFBFileOpServer::DropSession() + { + if (--iSessionCount==0) + iShutdown.Start(); + } + +// -------------------------------------------------------------------------------------------- + +CRequestObserver::CRequestObserver( TInt aPriority ) : CActive( aPriority ) + { + CActiveScheduler::Add( this ); + } + +CRequestObserver::~CRequestObserver() + { + Cancel(); + } + +void CRequestObserver::StartWaiting( const RMessage2& aMsg ) + { + iMsg = aMsg; + SetActive(); + } + +void CRequestObserver::RunL() + { + iMsg.Complete( iStatus.Int() ); + } + +void CRequestObserver::DoCancel() + { + iMsg.Complete( KErrCancel ); + } + +// -------------------------------------------------------------------------------------------- + +//*********************************** +//CFBFileOpServerSession - implementations +//*********************************** + +// +// 2nd phase construct for sessions - called by the CServer framework +// +void CFBFileOpServerSession::CreateL() + { + User::LeaveIfError(iFs.Connect()); + iFileMan = CFileMan::NewL( iFs, this ); + iReqObserver = new (ELeave) CRequestObserver( CActive::EPriorityStandard ); + Server().AddSession(); + } + +// -------------------------------------------------------------------------------------------- + +CFBFileOpServerSession::~CFBFileOpServerSession() + { + if (iFileMan) + { + delete iFileMan; + iFileMan = NULL; + } + iFs.Close(); + delete iReqObserver; + Server().DropSession(); + } + +// -------------------------------------------------------------------------------------------- + +/** +Services a client request. +*/ +void CFBFileOpServerSession::ServiceL(const RMessage2& aMessage) + { + TBool completeImmediately( ETrue ); + TRAPD( err,DispatchMessageL( aMessage, completeImmediately ) ); + if ( completeImmediately ) aMessage.Complete( err ); + } + +// -------------------------------------------------------------------------------------------- + +/** +Called by ServiceL() + +It tests the function code and then delegates to +the appropriate function. +*/ +void CFBFileOpServerSession::DispatchMessageL(const RMessage2& aMessage, TBool& aComplete) + { + switch (aMessage.Function()) + { + case EFileOpCopy: + CopyL(aMessage); + aComplete = EFalse; + return; + + case EFileOpRename: + RenameL(aMessage); + return; + + case EFileOpAttribs: + AttribsL(aMessage); + return; + + case EFileOpRmDir: + RmDirL(aMessage, aComplete); + return; + + case EFileOpDelete: + DeleteL(aMessage); + aComplete = EFalse; + return; + + case EFileOpMkDirAll: + MkDirAllL(aMessage); + return; + + case EFileOpCreateEmptyFile: + CreateEmptyFileL(aMessage); + return; + + case EFileOpEraseMBR: + EraseMBRL(aMessage); + return; + + case EFileOpPartitionDrive: + PartitionDriveL(aMessage); + return; + + case EFileOpCancel: + CancelOp(); + return; + + default: + PanicClient(aMessage, EPanicIllegalFunction); + return; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::CopyL( const RMessage2& aMessage ) + { + __ASSERT_ALWAYS( iReqObserver && !iReqObserver->IsActive(), User::Leave( KErrServerBusy ) ); + TPckgBuf pckgBuf; + aMessage.ReadL( 0, pckgBuf, 0 ); + TFileOpArgs argsStruct = pckgBuf(); + + TInt err = iFileMan->Copy( argsStruct.iBuf1, argsStruct.iBuf2, argsStruct.iUint1, iReqObserver->iStatus ); + User::LeaveIfError( err ); + iFileManObserverResult = MFileManObserver::EContinue; + iReqObserver->StartWaiting( aMessage ); // start asynchronous waiting + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::RenameL(const RMessage2& aMessage) + { + TPckgBuf pckgBuf; + aMessage.ReadL(0, pckgBuf, 0); + TFileOpArgs argsStruct = pckgBuf(); + + iFileManObserverResult = MFileManObserver::EContinue; + User::LeaveIfError(iFileMan->Rename(argsStruct.iBuf1, argsStruct.iBuf2, argsStruct.iUint1)); + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::AttribsL(const RMessage2& aMessage) + { + TPckgBuf pckgBuf; + aMessage.ReadL(0, pckgBuf, 0); + TFileOpArgs argsStruct = pckgBuf(); + + iFileManObserverResult = MFileManObserver::EContinue; + User::LeaveIfError(iFileMan->Attribs(argsStruct.iBuf1, argsStruct.iUint1, argsStruct.iUint2, argsStruct.iTime1, argsStruct.iUint3)); + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::RmDirL( const RMessage2& aMessage, TBool& aComplete ) + { + TPckgBuf pckgBuf; + aMessage.ReadL( 0, pckgBuf, 0 ); + TFileOpArgs argsStruct = pckgBuf(); + + if ( argsStruct.iUint1 & CFileMan::ERecurse ) + { + __ASSERT_ALWAYS( iReqObserver && !iReqObserver->IsActive(), User::Leave( KErrServerBusy ) ); + User::LeaveIfError( iFileMan->RmDir( argsStruct.iBuf1, iReqObserver->iStatus ) ); + iFileManObserverResult = MFileManObserver::EContinue; + aComplete = EFalse; + iReqObserver->StartWaiting( aMessage ); // start asynchronous waiting + } + else + { + iFileManObserverResult = MFileManObserver::EContinue; + User::LeaveIfError( iFs.RmDir( argsStruct.iBuf1 ) ); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::DeleteL( const RMessage2& aMessage ) + { + __ASSERT_ALWAYS( iReqObserver && !iReqObserver->IsActive(), User::Leave( KErrServerBusy ) ); + TPckgBuf pckgBuf; + aMessage.ReadL( 0, pckgBuf, 0 ); + TFileOpArgs argsStruct = pckgBuf(); + + User::LeaveIfError( iFileMan->Delete(argsStruct.iBuf1, argsStruct.iUint1, iReqObserver->iStatus ) ); + iFileManObserverResult = MFileManObserver::EContinue; + iReqObserver->StartWaiting( aMessage ); // start asynchronous waiting + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::MkDirAllL(const RMessage2& aMessage) + { + TPckgBuf pckgBuf; + aMessage.ReadL(0, pckgBuf, 0); + TFileOpArgs argsStruct = pckgBuf(); + + User::LeaveIfError(iFs.MkDirAll(argsStruct.iBuf1)); + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::CreateEmptyFileL(const RMessage2& aMessage) + { + TPckgBuf pckgBuf; + aMessage.ReadL(0, pckgBuf, 0); + TFileOpArgs argsStruct = pckgBuf(); + + TInt err(KErrNone); + RFile newFile; + err = newFile.Create(iFs, argsStruct.iBuf1, EFileShareExclusive); + if (err == KErrNone) + err = newFile.Flush(); + newFile.Close(); + + User::LeaveIfError(err); + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::EraseMBRL(const RMessage2& aMessage) + { + TPckgBuf pckgBuf; + aMessage.ReadL(0, pckgBuf, 0); + TFileOpArgs argsStruct = pckgBuf(); + + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + User::LeaveIfError(FBDrivePartioner::EraseMBR(fs, argsStruct.iUint1)); + + CleanupStack::PopAndDestroy(); //fs + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::PartitionDriveL(const RMessage2& aMessage) + { + TPckgBuf pckgBuf; + aMessage.ReadL(0, pckgBuf, 0); + TFileOpArgs argsStruct = pckgBuf(); + + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + FBDrivePartioner::CreatePartitions(fs, argsStruct.iUint1, argsStruct.iUint2); + User::LeaveIfError(FBDrivePartioner::FormatPartitions(fs, argsStruct.iUint1, argsStruct.iUint2)); + + CleanupStack::PopAndDestroy(); //fs + } + +// -------------------------------------------------------------------------------------------- + +// +// Panics the client +// +void CFBFileOpServerSession::PanicClient(const RMessage2& aMessage, TInt aPanic) const + { + _LIT(KTxtServer,"FBFileOpServer"); + aMessage.Panic(KTxtServer, aPanic); + } + +// -------------------------------------------------------------------------------------------- + +// +// Handle an error from CFBFileOpServerSession::ServiceL() +// A bad descriptor error implies a badly programmed client, so panic it; +// otherwise use the default handling (report the error to the client) +// +void CFBFileOpServerSession::ServiceError(const RMessage2& aMessage, TInt aError) + { + if (aError==KErrBadDescriptor) + PanicClient(aMessage,EPanicBadDescriptor); + CSession2::ServiceError(aMessage,aError); + } + +// -------------------------------------------------------------------------------------------- + +MFileManObserver::TControl CFBFileOpServerSession::NotifyFileManStarted() + { + return iFileManObserverResult; + } + +// -------------------------------------------------------------------------------------------- + +MFileManObserver::TControl CFBFileOpServerSession::NotifyFileManOperation() + { + return iFileManObserverResult; + } +// -------------------------------------------------------------------------------------------- + +MFileManObserver::TControl CFBFileOpServerSession::NotifyFileManEnded() + { + return iFileManObserverResult; + } + +// -------------------------------------------------------------------------------------------- + +void CFBFileOpServerSession::CancelOp() + { + iFileManObserverResult = MFileManObserver::ECancel; + iReqObserver->Cancel(); + } + +// -------------------------------------------------------------------------------------------- + +//********************************** +//Global functions +//********************************** + +// +// Initiate server exit when the timer expires +// +void CShutdown::RunL() + { + CActiveScheduler::Stop(); + } + +// -------------------------------------------------------------------------------------------- + +// +// Perform all server initialisation, in particular creation of the +// scheduler and server and then run the scheduler +// +static void RunServerL() + { + // naming the server thread after the server helps to debug panics + User::LeaveIfError(RThread::RenameMe(KMyServerName)); + // + // create and install the active scheduler we need + CActiveScheduler* s=new(ELeave) CActiveScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + // + // create the server (leave it on the cleanup stack) + CFBFileOpServer::NewLC(); + // + // Initialisation complete, now signal the client + RProcess::Rendezvous(KErrNone); + // + // Ready to run + CActiveScheduler::Start(); + // + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy(2); + } + +// -------------------------------------------------------------------------------------------- + +// +// Server process entry-point +// +TInt E32Main() + { + __UHEAP_MARK; + // + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL()); + delete cleanup; + } + // + __UHEAP_MARKEND; + return r; + } + +// -------------------------------------------------------------------------------------------- diff -r 000000000000 -r d6fe6244b863 filebrowser/group/ReleaseNotes_FileBrowser.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/ReleaseNotes_FileBrowser.txt Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,245 @@ +=============================================================================== + +RELEASE NOTES - FILEBROWSER v4.5.2 +RELEASED 10th December 2009 + +SUPPORTS S60 3.0+ + +=============================================================================== + +Product Description: +==================== +The FileBrowser tool can be used to browse directory hierarchies and perform +file operations under the S60 environment. It also contains some smaller tools +and functionalities that help RnD development and verification. + +Main Features: +============== +- Showing a drive list +- Browsing through directory hierarchies +- Disk admin tools for generic disk operations +- Searching files with different parameters +- Full clipboard functionality +- Copying/moving files with the help of a separate dialog +- Creating new files and directories +- Showing properties of files, directories and disks +- Sending, deleting, renaming, touching, setting attributes, + compressing and uncompressing of files +- Recursive directory support +- Sorting and ordering file view +- Filtering entries with a search field +- Text and hex viewer for files +- A settings screen for altering different kind of settings +- Data type viewer/editor +- Ability to give TCB capability for file operations +- Showing message attachments from Symbian messaging store +- Touch UI toolbar (S60 5.x only) + +=============================================================================== + +What's New in v4.5.2 +==================== +- Fix: UI layout problems fixed +- Fix: Filebrowser crashes with too long filenames + +=============================================================================== + +Installation Notes: +=================== +FileBrowser is typically preinstalled on ROM. If not, it can be added to the +ROM with the .iby file. Alternatively, the .sis file can be found under the sis- +directory, but the user need to sign it with their own developer certificate. +In Nokia R&D environment, you can use directly the R&D-signed .sis file under the +internal\sis directory. + +FileBrowser is provided as full and lite version. Lite version is aimed for +those who cannot sign with TCB capability. Lite version can be generated by +defining FILEBROWSER_LITE flag and then by recompiling the application and +regenerating the sis file. + +When signing with own developer certificate, the following capabilities are +needed in the lite version: + ReadDeviceData + WriteDeviceData + DiskAdmin + AllFiles + SwEvent + NetworkServices + LocalServices + ReadUserData + WriteUserData + Location + UserEnvironment + +The full version requires these addtional capabilities: + CommDD + PowerMgmt + MultimediaDD + DRM + TrustedUI + ProtServ + NetworkControl + SurroundingsDD + TCB + +When builing FileBrowser against S60 3.0 or 3.1, you may need to patch your SDK +environment first with some fixes. For more information, please refer to the +instructions under the "envpatcher" directory. + +=============================================================================== + +System Requirements: +==================== +Basic Requirements: +- Any S60 3.x device or emulator environment + +=============================================================================== + +Compatibility Issues: +===================== +N/A + +=============================================================================== + +Known Issues: +============= +N/A + +=============================================================================== + +Version History: +================ + +Version 4.5.1 - 15th May 2009 +----------------------------- +- Fix: Refreshing display does not work well when starting FileBrowser +- Fix: Internal Mass storage drive is displayed as Memory Card + +Version 4.5.0 - 13th February 2009 +---------------------------------- +- Feature: Touch UI toolbar introduced with Navigate Up, Filter and Select + functionalities (S60 5.x only) +- Fix: Date and directory attributes don't work correctly with search + +Version 4.4.0 - 12th December 2008 +---------------------------------- +- Feature: "Remember last folder": File list view now remembers which folder + had the last focus before navigating deeper in a directory, and selects that + folder instead of the root of the directory when navigating back upwards. +- Fix: Execution of long file operations may cause WSERV 11 panic +- Fix: Allow formatting even if files are in use + +Version 4.3.3 - 8th August 2008 +------------------------------- +- Fix: Calculation of partition size with 64-bit values caused unwanted side + effects + +Version 4.3.2 - 5th May 2008 +------------------------------ +- Fix: Size of drive partitions should be calculated with 64-bit values + +Version 4.3.1 - 7th March 2008 +------------------------------ +- Fix: Crash when search field was active and changing file view mode + +Version 4.3.0 - 28th January 2008 +--------------------------------- +- Feature: Extended file view now displays also the directory/file time +- Feature: Text file viewer/editor supports also in UTF-8, UTF-16 little endian + and UTF-16 big endian formats +- Change: Opening with apparc is not anymore a default opening action but now + a list of another common actions appears +- Change: Font size in file list view has been adjusted to suit better in + currently used resolution +- Change: In first time start, extended view is activated in QHD resolution +- Change: Font size in file viewer and editor is now smaller so that more text + fits to the screen +- Change: Settings are now saved in dictionary store instead of cenreps +- Fix: Copy/move to folder functionality was broken +- Fix: Scroll bar did not work properly in text viewer when used via touch UI +- Fix: Last line of hex viewer was not warpped correctly +- Fix: Menu bars of file viewer and editor did not work properly +- Fix: Search should not return directories when searching a string +- Fix: Hash key selection should not be active in qwerty mode + +Version 4.2.0 - 14th January 2008 +--------------------------------- +- Feature: User mapped remote drives are visible in drive list view as normal + drive when setting is turned on +- Feature: Files can be edited in both text and hex modes +- Feature: Show checksums (message digests) on different algorithms for a file +- Feature: Error strings are now displayed for various operations instead of + generic error messages +- Feature: Disk can be ejected and dismounted via disk admin +- Change: Increased maximum heap usage to 32Mb to allow loading large files to + file editor +- Fix: Trying to create a directory which already exists did not return an + error +- Fix: In the file list view active item not visible when deleting last item in + the view +- Fix: Some file specific commands were visibile in menus also for directory + entries +- Fix: Utilizing secure backup leaked memory + +Version 4.1.0 - 17th December 2007 +---------------------------------- +- Feature: File operations are now started asynchronously with own recursion + handler which allows removing file locks and any protection attributes +- Feature: Status of each file operation can be monitored via RDebug +- Feature: Remove file locks via Secure Backup +- Feature: File operation functionality can be customized via the settings + dialog +- Feature: Multidrive support with erasing MBR and drive partition for drives + which support it +- Change: Remove screen capture support since the same functionality can be + done with the ScreenGrabber tool +- Fix: Forms were incorrectly constructed in search dialog and attribute editor + +Version 4.0.7 - 16th November 2007 +-------------------------------- +- Feature: In the list view, left/right arrow keys can be simulated with drag to + left/right gestures +- Fix: Touch click in the listbox view +- Fix: Scroll bar in the hex/text viewer can be scrolled on a touch UI + +Version 4.0.6 - 9th October 2007 +-------------------------------- +- Feature: Data type editor +- Fix: Layout in hex/text viewer in mirrored mode + +Version 4.0.5 - 27th August 2007 +-------------------------------- +- Fix: Wrong functionality while moving a folder +- Change: Handle backup session while formatting a drive + +Version 4.0.4 - 23th May 2007 +----------------------------- +- Feature: Modify debug mask +- Feature: Simulate Symbian OS error types +- Feature: Enable/disable icon server cache + +Version 4.0.3 - 28th February 2007 +---------------------------------- +- Feature: Drive snapshot functionality under the main drive selection list + +Version 4.0.2 - 31st January 2007 +--------------------------------- +- Feature: Dump message store walk into a text file +- Change: Enhance hex/text viewer +- Fix: Enhance folder browsing speed in Z-drive + +Version 4.0.1 - 17th January 2007 +--------------------------------- +- Fix: Opening of search field +- Fix: Enabling extended errors if c:\resource directory does not already + exist + +=============================================================================== + +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 "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". diff -r 000000000000 -r d6fe6244b863 filebrowser/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/backup_registration.xml Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 000000000000 -r d6fe6244b863 filebrowser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/bld.inf Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,65 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 + +#ifndef FILEBROWSER_LITE + #include "../fileopserver/group/bld.inf" + #include "../fileopclient/group/bld.inf" +#endif + +PRJ_EXPORTS +../group/backup_registration.xml Z:/private/102828D6/backup_registration.xml +../rom/filebrowser.iby CORE_IBY_EXPORT_PATH(tools,filebrowser.iby) + + +PRJ_MMPFILES +#if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__S60_32__) + gnumakefile filebrowser_icons_aif.mk + gnumakefile filebrowser_extraicons.mk + + #ifdef MARM + gnumakefile filebrowser_stub_sis.mk + #endif +#endif + +filebrowser.mmp + + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + PRJ_EXTENSIONS + START EXTENSION s60/mifconv + OPTION TARGETFILE filebrowser_aif.mif + OPTION SOURCEDIR ../icons + OPTION SOURCES -c8,8 qgn_menu_filebrowser + END + + START EXTENSION s60/mifconv + OPTION TARGETFILE filebrowser_extraicons.mif + OPTION HEADERFILE filebrowser_extraicons.mbg + OPTION SOURCEDIR ../icons + OPTION SOURCES -c8,8 qgn_indi_tb_filebrowser_folder_parent -c8,8 qgn_indi_tb_filebrowser_find -c8,8 qgn_indi_tb_filebrowser_selection -c8,8 qgn_indi_tb_filebrowser_selection_active + END + + #ifdef MARM + START EXTENSION app-services/buildstubsis + OPTION SRCDIR ../sis + OPTION SISNAME FileBrowser_stub + END + #endif +#endif diff -r 000000000000 -r d6fe6244b863 filebrowser/group/filebrowser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/filebrowser.mmp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,116 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 + +TARGET FileBrowser.exe +TARGETTYPE exe +EPOCSTACKSIZE 0x5000 +EPOCHEAPSIZE 0x10000 0x2000000 // Min 64kB, Max 32MB + +UID 0x100039CE 0x102828D6 + +VENDORID VID_DEFAULT +CAPABILITY CAP_APPLICATION AllFiles DiskAdmin + +SMPSAFE + +LANG SC + + +START RESOURCE ../data/filebrowser.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END + +START RESOURCE ../data/filebrowser_reg.rss +DEPENDS filebrowser.rsg +TARGETPATH /private/10003a3f/apps +END + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/connect +USERINCLUDE ../inc +#ifndef FILEBROWSER_LITE + USERINCLUDE ../fileopclient/inc +#endif +SOURCEPATH ../src + + +SOURCE FBApp.cpp +SOURCE FBDocument.cpp +SOURCE FBAppUi.cpp +SOURCE FBFileListView.cpp +SOURCE FBFileListContainer.cpp +SOURCE FBModel.cpp +SOURCE FBSettingViewDlg.cpp +SOURCE FBFileUtils.cpp +SOURCE FBFileOps.cpp +SOURCE FBFileDlgs.cpp +SOURCE FBFileEditor.cpp +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + SOURCE FBToolbar.cpp +#endif + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY aknnotify.lib +LIBRARY ws32.lib +LIBRARY fbscli.lib +LIBRARY ImageConversion.lib +LIBRARY PlatformEnv.lib +LIBRARY CommonDialogs.lib +LIBRARY eikcoctl.lib +LIBRARY aknskins.lib +LIBRARY apgrfx.lib +LIBRARY efsrv.lib +LIBRARY CommonEngine.lib +LIBRARY bafl.lib +LIBRARY CentralRepository.lib +LIBRARY mediaclientaudio.lib +LIBRARY estor.lib +LIBRARY gdi.lib +LIBRARY eikctl.lib +LIBRARY eikcdlg.lib +LIBRARY eikdlg.lib +LIBRARY aknicon.lib +LIBRARY egul.lib +LIBRARY commonui.lib +LIBRARY apmime.lib +LIBRARY sendui.lib +LIBRARY msgs.lib +LIBRARY ezlib.lib +LIBRARY cdlengine.lib +LIBRARY remconcoreapi.lib +LIBRARY remconinterfacebase.lib +LIBRARY sbeclient.lib +LIBRARY hash.lib +LIBRARY etext.lib +LIBRARY charconv.lib +LIBRARY AknLayout2Scalable.lib +LIBRARY tzclient.lib + +#ifndef FILEBROWSER_LITE + LIBRARY filebrowserfileopclient.lib +#endif + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/group/filebrowser_extraicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/filebrowser_extraicons.mk Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,63 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies 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 +ICONTARGETFILENAME=$(TARGETDIR)\filebrowser_extraicons.mif + +HEADERDIR=\epoc32\include +HEADERFILENAME=$(HEADERDIR)\filebrowser_extraicons.mbg + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + @if exist $(HEADERFILENAME) erase $(HEADERFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) (HEADERFILENAME) : ..\icons\qgn_indi_tb_filebrowser_folder_parent.svg ..\icons\qgn_indi_tb_filebrowser_find.svg ..\icons\qgn_indi_tb_filebrowser_selection.svg ..\icons\qgn_indi_tb_filebrowser_selection_active.svg + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 ..\icons\qgn_indi_tb_filebrowser_folder_parent.svg \ + /c8,8 ..\icons\qgn_indi_tb_filebrowser_find.svg \ + /c8,8 ..\icons\qgn_indi_tb_filebrowser_selection.svg \ + /c8,8 ..\icons\qgn_indi_tb_filebrowser_selection_active.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME) && \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r d6fe6244b863 filebrowser/group/filebrowser_icons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/filebrowser_icons_aif.mk Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,54 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies 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 +ICONTARGETFILENAME=$(TARGETDIR)\filebrowser_aif.mif + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : ..\icons\qgn_menu_filebrowser.svg + mifconv $(ICONTARGETFILENAME) \ + /c8,8 ..\icons\qgn_menu_filebrowser.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r d6fe6244b863 filebrowser/group/filebrowser_stub_sis.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/group/filebrowser_stub_sis.mk Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,56 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install + +SISNAME=FileBrowser_stub +PKGNAME=FileBrowser_stub + +$(TARGETDIR) : + @perl -S emkdir.pl "$(TARGETDIR)" + +do_nothing : + rem do_nothing + +SISFILE=$(TARGETDIR)\$(SISNAME).sis + +$(SISFILE) : ..\sis\$(PKGNAME).pkg + makesis -s $? $@ + + + +MAKMAKE : do_nothing + +RESOURCE : do_nothing + +SAVESPACE : do_nothing + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : $(TARGETDIR) $(SISFILE) + +CLEAN : + @if exist $(SISFILE) erase $(SISFILE) + +RELEASABLES : + @echo $(SISFILE) diff -r 000000000000 -r d6fe6244b863 filebrowser/helpertools/snapshot_compare_dirs.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/helpertools/snapshot_compare_dirs.pl Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,202 @@ +# +# 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 "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +use strict; + +use Getopt::Std; +use Digest::MD5 qw( md5 ); +use File::Basename; +use File::Copy; +use File::Find; +use File::Path; + +my @changed_files=(); +my $dir_1_length; +my $dir_2_length; +my $directory1; +my $directory2; +my %list1=(); +my %list2=(); +my %opts=(); +my $switch= 0; +my $result_dir; + +################################################### +## usage() ## +## Prints the usage ## +################################################### +sub usage +{ + print "\nUsage\n\tsnapshot_compare_dirs.pl -1 -2 -r \n"; + print "\nWhere\n\t-1 Original directory\n\t-2 Updated directory\n\t-r Result directory\n"; + exit; +} + +################################################### +## get_param() ## +## Gets command line parameters ## +################################################### +sub get_param +{ + getopts('h1:2:r:', \%opts); + + if ( $opts{'h'} ) { + usage(); + } + + if ( $opts{'1'} ) { + $directory1 = $opts{'1'}; + if ( ! -d $directory1 ) { + print "\nError:\t Directory \"$directory1\" doesn't exist\n"; + exit; + } + } else { + usage(); + } + + if ( $opts{'2'} ) { + $directory2 = $opts{'2'}; + if ( ! -d $directory2 ) { + print "\nError:\t Directory \"$directory2\" doesn't exist\n"; + exit; + } + } else { + usage(); + } + + if ( $opts{'r'} ) { + $result_dir = $opts{'r'}; + if ( ! -d $result_dir ) { + mkdir $result_dir; + } + } else { + usage(); + } + +} + +################################################### +## calculate_hash() Reads file content and ## +## calculates MD5 hash ## +################################################### +sub calculate_hash +{ + my ( $file_name ) = @_; + + open( FILE, $file_name ) or die "Error: Cannot open $file_name\n"; + my @file_stat = stat FILE; + binmode( FILE ); + + my ( $buffer, $hash_value ); + read( FILE, $buffer, $file_stat[7] ); + + close FILE; + + $hash_value = md5( $buffer ); + + return $hash_value; +} + +################################################### +## copy_file() ## +## Copies files with same directory structure ## +################################################### +sub copy_file +{ + my ( $file1, $file2 ) = @_; + my $dir_name = dirname( $file2 ); + + mkpath( $dir_name, 0, 0777 ); + + copy( $file1, $file2 ); +} + +################################################### +## process_files() ## +## Indexes files ## +################################################### +sub process_files +{ + my $file = $File::Find::name; + + if ( -f $file ) { + if ($switch eq 0 ) { + $file = substr( $file, $dir_1_length ); + $list1{$file} = 1;; + } else { + $file = substr( $file, $dir_2_length ); + $list2{$file} = 1; + } + } +} + +################################################### +## main() ## +## Main function ## +################################################### +sub main +{ + get_param(); + + $dir_1_length = length( $directory1 ); + $dir_2_length = length( $directory2 ); + + print "Info:\tProcessing files. This may take some time\n"; + + $switch = 0; + find( \&process_files, $directory1 ); + + $switch = 1; + find( \&process_files, $directory2 ); + + print "Info:\tFiles only exist in \"$directory2\" :\n\n"; + my $counter = 0; + my $file; + my $key; + my $hash1; + my $hash2; + + foreach $key ( sort keys %list2 ){ + if ( $list1{$key} ne 1 ) { + $key =~ s/\//\\/g; + print "\t$key\n"; + copy_file( "$directory2$key", "$result_dir$key" ); + $counter++; + } else { + $hash1 = calculate_hash("$directory1$key"); + $hash2 = calculate_hash("$directory2$key"); + if ($hash1 ne $hash2) { + push @changed_files, $key; + } + } + } + + print "\nInfo:\tTotal $counter new file(s)\n"; + + print "\nInfo:\tList of the changed file\n"; + + $counter = 0; + + foreach $file ( @changed_files ){ + $counter++; + print "\t$file\n"; + } + + print "\nInfo:\tTotal $counter file(s) changed\n"; + print "Info:\tNote: Only new files are copied to $result_dir\n"; +} + +main(); diff -r 000000000000 -r d6fe6244b863 filebrowser/icons/qgn_indi_tb_filebrowser_find.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/icons/qgn_indi_tb_filebrowser_find.svg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 filebrowser/icons/qgn_indi_tb_filebrowser_folder_parent.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/icons/qgn_indi_tb_filebrowser_folder_parent.svg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 filebrowser/icons/qgn_indi_tb_filebrowser_selection.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/icons/qgn_indi_tb_filebrowser_selection.svg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,34 @@ + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 filebrowser/icons/qgn_indi_tb_filebrowser_selection_active.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/icons/qgn_indi_tb_filebrowser_selection_active.svg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 filebrowser/icons/qgn_menu_filebrowser.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/icons/qgn_menu_filebrowser.svg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,454 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FB.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FB.hrh Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,271 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_HRH +#define FILEBROWSER_HRH + +enum TFileBrowserCommandIds + { + EFileBrowserCmdFile = 1, + EFileBrowserCmdFileBack, + EFileBrowserCmdFileOpen, + EFileBrowserCmdFileOpenApparc, + EFileBrowserCmdFileOpenDocHandlerEmbed, + EFileBrowserCmdFileOpenDocHandlerStandAlone, + EFileBrowserCmdFileOpenFileService, + EFileBrowserCmdFileOpenDrive, + EFileBrowserCmdFileOpenDirectory, + EFileBrowserCmdFileView, + EFileBrowserCmdFileViewText, + EFileBrowserCmdFileViewHex, + EFileBrowserCmdFileEdit, + EFileBrowserCmdFileEditText, + EFileBrowserCmdFileEditHex, + EFileBrowserCmdFileSearch, + EFileBrowserCmdFileSendTo, + EFileBrowserCmdFileNew, + EFileBrowserCmdFileNewFile, + EFileBrowserCmdFileNewDirectory, + EFileBrowserCmdFileDelete, + EFileBrowserCmdFileRename, + EFileBrowserCmdFileTouch, + EFileBrowserCmdFileProperties, + EFileBrowserCmdFileChecksums, + EFileBrowserCmdFileChecksumsMD5, + EFileBrowserCmdFileChecksumsMD2, + EFileBrowserCmdFileChecksumsSHA1, + EFileBrowserCmdFileSetAttributes, + EFileBrowserCmdFileCompress, + EFileBrowserCmdFileDecompress, + EFileBrowserCmdEdit, + EFileBrowserCmdSnapShot, + EFileBrowserCmdEditCut, + EFileBrowserCmdEditCopy, + EFileBrowserCmdEditPaste, + EFileBrowserCmdEditCopyToFolder, + EFileBrowserCmdEditMoveToFolder, + EFileBrowserCmdEditSelect, + EFileBrowserCmdEditUnselect, + EFileBrowserCmdEditSelectAll, + EFileBrowserCmdEditUnselectAll, + EFileBrowserCmdView, + EFileBrowserCmdViewSort, + EFileBrowserCmdViewSortByName, + EFileBrowserCmdViewSortByExtension, + EFileBrowserCmdViewSortByDate, + EFileBrowserCmdViewSortBySize, + EFileBrowserCmdViewOrder, + EFileBrowserCmdViewOrderAscending, + EFileBrowserCmdViewOrderDescending, + EFileBrowserCmdViewFilterEntries, + EFileBrowserCmdViewRefresh, + EFileBrowserCmdDiskAdmin, + EFileBrowserCmdDiskAdminSetDrivePassword, + EFileBrowserCmdDiskAdminUnlockDrive, + EFileBrowserCmdDiskAdminClearDrivePassword, + EFileBrowserCmdDiskAdminEraseDrivePassword, + EFileBrowserCmdDiskAdminFormatDrive, + EFileBrowserCmdDiskAdminQuickFormatDrive, + EFileBrowserCmdDiskAdminCheckDisk, + EFileBrowserCmdDiskAdminScanDrive, + EFileBrowserCmdDiskAdminSetDriveName, + EFileBrowserCmdDiskAdminSetDriveVolumeLabel, + EFileBrowserCmdDiskAdminEraseMBR, + EFileBrowserCmdDiskAdminDrivePartition, + EFileBrowserCmdDiskAdminEjectDrive, + EFileBrowserCmdDiskAdminDismountFileSystem, + EFileBrowserCmdTools, + EFileBrowserCmdToolsAllFiles, + EFileBrowserCmdToolsAvkonIconCache, + EFileBrowserCmdToolsAvkonIconCacheEnable, + EFileBrowserCmdToolsAvkonIconCacheDisable, + EFileBrowserCmdToolsDisableExtErrors, + EFileBrowserCmdToolsEditDataTypes, + EFileBrowserCmdToolsEnableExtErrors, + EFileBrowserCmdToolsErrorSimulate, + EFileBrowserCmdToolsErrorSimulateLeave, + EFileBrowserCmdToolsErrorSimulatePanic, + EFileBrowserCmdToolsErrorSimulateException, + EFileBrowserCmdToolsLocalConnectivity, + EFileBrowserCmdToolsLocalConnectivityActivateInfrared, + EFileBrowserCmdToolsLocalConnectivityLaunchBTUI, + EFileBrowserCmdToolsLocalConnectivityLaunchUSBUI, + EFileBrowserCmdToolsInstalledApps, + EFileBrowserCmdToolsOpenFiles, + EFileBrowserCmdToolsMsgAttachments, + EFileBrowserCmdToolsMsgAttachmentsInbox, + EFileBrowserCmdToolsMsgAttachmentsDrafts, + EFileBrowserCmdToolsMsgAttachmentsSentItems, + EFileBrowserCmdToolsMsgAttachmentsOutbox, + EFileBrowserCmdToolsMsgStoreWalk, + EFileBrowserCmdToolsSecureBackup, + EFileBrowserCmdToolsSecureBackupStartBackup, + EFileBrowserCmdToolsSecureBackupStartRestore, + EFileBrowserCmdToolsSecureBackupStop, + EFileBrowserCmdToolsSetDebugMask, + EFileBrowserCmdToolsMemoryInfo, + EFileBrowserCmdSettings, + EFileBrowserCmdAbout, + EFileBrowserCmdSettingsChange, + EFileBrowserCmdSettingsExit, + EFileBrowserCmdSettingsBack, + EFileBrowserSettingItemList, + EFileBrowserCmdDataTypesChangeMapping, + EFileBrowserCmdDataTypesSetDefaultMapping, + EFileBrowserCmdDataTypesRefresh, + EFileBrowserCmdDataTypesExit, + EFileBrowserCmdDataTypesBack, + EFileBrowserDataTypesList, + EFileBrowserProgressNote, + EFileBrowserWaitNote, + EFileBrowserAttributeEditorSetArchive, + EFileBrowserAttributeEditorSetHidden, + EFileBrowserAttributeEditorSetReadOnly, + EFileBrowserAttributeEditorSetSystem, + EFileBrowserAttributeEditorSetRecurse, + EFileBrowserSearchQuerySearchDir, + EFileBrowserSearchQueryWildCards, + EFileBrowserSearchQueryTextInFile, + EFileBrowserSearchQueryMinSize, + EFileBrowserSearchQueryMaxSize, + EFileBrowserSearchQueryMinDate, + EFileBrowserSearchQueryMaxDate, + EFileBrowserSearchQueryRecurse, + EFileBrowserCmdFileEditorViewAsText, + EFileBrowserCmdFileEditorViewAsHex, + EFileBrowserCmdFileEditorSave, + EFileBrowserCmdFileEditorSaveAs, + EFileBrowserCmdFileEditorSaveFormat, + EFileBrowserCmdFileEditorSaveFormatANSIASCII, + EFileBrowserCmdFileEditorSaveFormatUTF8, + EFileBrowserCmdFileEditorSaveFormatUTF16LE, + EFileBrowserCmdFileEditorSaveFormatUTF16BE, + EFileBrowserCmdFileEditorEditAsText, + EFileBrowserCmdFileEditorEditAsHex, + EFileBrowserCmdFileEditorExit, + EFileBrowserFileOpCommandAttribs, + EFileBrowserFileOpCommandCopy, + EFileBrowserFileOpCommandMove, + EFileBrowserFileOpCommandRename, + EFileBrowserFileOpCommandDelete, + EFileBrowserFileOpCommandDriveSnapShot + }; + +enum TFileBrowserFixedIconIds + { + EFixedIconMarking = 0, + EFixedIconEmpty, + EFixedIconPhoneMemory, + EFixedIconMemoryCard, + EFixedIconMemoryCardDisabled, + EFixedIconFolder, + EFixedIconFolderSub, + EFixedIconFolderCurrent, + EFixedIconListLength // this should be last + }; + +enum TFileBrowserEntryOverwriteActions + { + EFileActionOverwriteAll = 0, + EFileActionSkipAllExisting, + EFileActionGenerateUniqueFilenames, + EFileActionQueryPostFix + }; + +enum TFileBrowserSecureBackupState + { + ESecureBackupStateFull = 0, + ESecureBackupStatePartial + }; + +enum TFileBrowserSecureBackupType + { + ESecureBackupTypeBase = 0, + ESecureBackupTypeIncremental + }; + +enum TFileBrowserDataTypePriorities + { + EDataTypePriorityMaximum = 0, + EDataTypePriorityHigh, + EDataTypePriorityNormal, + EDataTypePriorityLow, + EDataTypePriorityLastResort + }; + +enum TFileBrowserCommonFileActions + { + ECommonFileActionViewAsTextHex = 0, + ECommonFileActionOpenWithApparc, + ECommonFileActionOpenWithDocHandlerEmbed + }; + +enum TFileBrowserSettingListTabs + { + ETabGeneral = 0, + ETabFileOps + }; + +enum TFileBrowserSettingListIds + { + ESettingListDisplayModeSelection = 0, + ESettingListFileViewModeSelection, + ESettingListShowSubdirectoryInfoSelection, + ESettingListShowAssociatedIconsSelection, + ESettingListRememberLastPathSelection, + ESettingListRememberFolderSelection, + ESettingListEnableToolbar, + + ESettingListSupportNetworkDrivesSelection, + ESettingListBypassPlatformSecuritySelection, + ESettingListRemoveFileLocksSelection, + ESettingListIgnoreProtectionsAttsSelection, + ESettingListRemoveROMWriteProtectionSelection + }; + +enum TFileBrowserSettingDisplayModes + { + EDisplayModeFullScreen = 0, + EDisplayModeNormal + }; + +enum TFileBrowserSettingFileViewModes + { + EFileViewModeSimple = 0, + EFileViewModeExtended + }; + +enum TFileBrowserFileEditorModes + { + EFileEditorViewAsText = 0, + EFileEditorViewAsHex, + EFileEditorEditAsText, + EFileEditorEditAsHex + }; + +enum + { + EFileViewerDialogControl = 0x5FEC + }; + +enum + { + EFileEditorDialogId = 1 + }; + +#endif // FILEBROWSER_HRH diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBApp.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSERAPP_H +#define FILEBROWSERAPP_H + +// INCLUDES +#include + +// CONSTANTS +// UID of the application +const TUid KUidFileBrowser = { 0x102828D6 }; + +// CLASS DECLARATION + +/** +* CFileBrowserApp application class. +* Provides factory to create concrete document object. +* +*/ +class CFileBrowserApp : public CAknApplication + { + + public: // Functions from base classes + /** + * From CApaApplication, overridden to enable INI file support. + * @return A pointer to the dictionary store + */ + CDictionaryStore* OpenIniFileLC(RFs& aFs) const; + private: + + /** + * From CApaApplication, creates CFileBrowserDocument document object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication, returns application's UID (KUidFileBrowser). + * @return The value of KUidFileBrowser. + */ + TUid AppDllUid() const; + }; + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBAppUi.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,89 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSERAPPUI_H +#define FILEBROWSERAPPUI_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include "FBStd.h" + +// FORWARD DECLARATIONS +class CFileBrowserFileListContainer; +class CFileBrowserModel; + +// CONSTANTS +//const ?type ?constant_var = ?constant; + + +// CLASS DECLARATION + + +class CFileBrowserAppUi : public CAknViewAppUi + { + public: // // Constructors and destructor + + /** + * EPOC default constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CFileBrowserAppUi(); + + public: // New functions + + public: // Functions from base classes + void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); + + private: + // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + + private: + /** + * 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: //Data + CFileBrowserModel* iModel; + + }; + +#endif + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBDocument.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,84 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSERDOCUMENT_H +#define FILEBROWSERDOCUMENT_H + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CEikAppUi; +class CFileBrowserModel; + + +// CLASS DECLARATION + +/** +* CFileBrowserDocument application class. +*/ +class CFileBrowserDocument : public CAknDocument + { + public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CFileBrowserDocument* NewL(CEikApplication& aApp); + + /** + * Destructor. + */ + virtual ~CFileBrowserDocument(); + + public: // New functions + + public: // from CEikDocument + CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs); + protected: // New functions + + protected: // Functions from base classes + + private: + + /** + * EPOC default constructor. + */ + CFileBrowserDocument(CEikApplication& aApp); + void ConstructL(); + + private: + + /** + * From CEikDocument, create CFileBrowserAppUi "App UI" object. + */ + CEikAppUi* CreateAppUiL(); + + public: + CFileBrowserModel* Model(); + + private: + CFileBrowserModel* iModel; + + }; + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBFileDlgs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBFileDlgs.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,164 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_FILEDLGS_H +#define FILEBROWSER_FILEDLGS_H + + +// INCLUDES +#include "FBFileUtils.h" + +#include +#include +#include +#include +#include + + +// FORWARD DECLARATIONS +class CAknIconArray; +class CAknSingleGraphicStyleListBox; + + +// CLASS DEFINITIONS + +class CFileBrowserDestinationFolderSelectionDlg : public CAknListQueryDialog + { +public: + static CFileBrowserDestinationFolderSelectionDlg* NewL(TDes& aReturnPath, CDriveEntryList* aDriveEntryList, CAknIconArray* aIconArray); + virtual ~CFileBrowserDestinationFolderSelectionDlg(); + +private: // Constructors + CFileBrowserDestinationFolderSelectionDlg(TDes& aReturnPath, CAknIconArray* aIconArray); + void ConstructL(CDriveEntryList* aDriveEntryList); + +protected: // From CEikDialog + TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + void PreLayoutDynInitL(); + void PostLayoutDynInitL(); + TBool OkToExitL(TInt aButtonId); + +protected: // From CCoeControl + //void HandlePointerEventL(const TPointerEvent &aPointerEvent); + +private: // New methods + void MoveUpOneLevelL(); + void MoveDownToDirectoryL(); + void RefreshViewL(); + inline TBool IsDriveListViewActive() { return iCurrentPath==KNullDesC; } + +public: // New methods + TBool RunCopyDlgLD(); + TBool RunMoveDlgLD(); + +private: // Data + TInt iSelectedIndex; + TBuf<16> iLSKActionText; + TDes& iReturnPath; + RFs iFs; + CDriveEntryList* iDriveEntryList; + CFileEntryList* iFileEntryList; + CAknIconArray* iIconArray; + TFileName iCurrentPath; + //TPoint iDragStartPoint; + //TBool iIsDragging; + }; + + +class CFileBrowserAttributeEditorDlg : public CAknForm + { +public: + static CFileBrowserAttributeEditorDlg* NewL(TUint& aSetAttMask, TUint& aClearAttMask, TBool& aRecurse); + virtual ~CFileBrowserAttributeEditorDlg(); + +private: // Constructors + CFileBrowserAttributeEditorDlg(TUint& aSetAttMask, TUint& aClearAttMask, TBool& aRecurse); + void ConstructL(); + +protected: // From CEikDialog + TBool OkToExitL(TInt aButtonId); + void PreLayoutDynInitL(); + +public: // New methods + TBool RunEditorLD(); + +private: // Data + TUint& iSetAttMask; + TUint& iClearAttMask; + TBool& iRecurse; + }; + + +class CFileBrowserSearchQueryDlg : public CAknForm + { +public: + static CFileBrowserSearchQueryDlg* NewL(TSearchAttributes& aSearchAttributes); + virtual ~CFileBrowserSearchQueryDlg(); + +private: // Constructors + CFileBrowserSearchQueryDlg(TSearchAttributes& aSearchAttributes); + void ConstructL(); + +protected: // From CEikDialog + TBool OkToExitL(TInt aButtonId); + void PreLayoutDynInitL(); + +public: // New methods + TBool RunQueryLD(); + +private: // Data + TSearchAttributes& iSearchAttributes; + }; + + +class CFileBrowserDataTypesDlg : public CAknDialog, public MEikListBoxObserver + { +public: + static CFileBrowserDataTypesDlg* NewL(); + virtual ~CFileBrowserDataTypesDlg(); + +public: // From MEikListBoxObserver + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + +public: // From CAknDialog + void ProcessCommandL(TInt aCommandId); + +private: // Constructors + CFileBrowserDataTypesDlg(); + void ConstructL(); + +protected: // From CEikDialog + void PreLayoutDynInitL(); + TBool OkToExitL(TInt aButtonId); + +public: // New methods + void GetDataTypesL(); + void ChangeMappingL(); + void SetDefaultMappingL(); + TBool RunQueryLD(); + +private: // Data + CAknSingleGraphicStyleListBox* iListBox; + RApaLsSession iLs; + CDataTypeArray* iDTArray; + }; + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBFileEditor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBFileEditor.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,137 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_FILEVIEWERDLG_H +#define FILEBROWSER_FILEVIEWERDLG_H + +// INCLUDES +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CFileBrowserFileEditorViewControl; +class CEikEdwin; +class CParaFormat; +class CEikScrollBarFrame; + + +// CLASS DEFINITIONS + +class CFileBrowserFileEditorDlg : public CAknDialog + { +public: + static CFileBrowserFileEditorDlg* NewL(const TDesC& aFileName, TInt aMode); + virtual ~CFileBrowserFileEditorDlg(); + +private: // Constructors + CFileBrowserFileEditorDlg(const TDesC& aFileName, TInt aMode); + void ConstructL(); + +protected: // From CAknDialog + void ProcessCommandL(TInt aCommandId); + void PreLayoutDynInitL(); + void PostLayoutDynInitL(); + +protected: // From CEikDialog + void SetSizeAndPosition(const TSize& aSize); + SEikControlInfo CreateCustomControlL(TInt aControlType); + +protected: // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + +public: // New methods + TBool RunDlgLD(); + +private: // New methods + void OpenFileLC(RFile& aFile, const TDesC& aFileName); + void LoadFileL(); + void GetTextFileMode(RFile& aFile, TInt& aFileSize); + HBufC16* ConvertBuf8ToBuf16L(HBufC8* aBuf8); + HBufC8* ConvertBuf16ToBuf8L(HBufC16* aBuf16); + void SaveEditorDataL(TBool aQueryNewName=EFalse); + TBool IsHexChar(TInt aCh); + +private: // Data + CFileBrowserFileEditorViewControl* iViewer; + CEikEdwin* iTextEditor; + CParaFormat* iEditorPF; + TFileName iFileName; + TInt iActiveMode; + TInt iTextFormat; + }; + + + +class CFileBrowserFileEditorViewControl : public CCoeControl, MEikScrollBarObserver + { +public: + virtual ~CFileBrowserFileEditorViewControl(); + +public: // Constructors + CFileBrowserFileEditorViewControl(); + void ConstructL(); + +protected: // From CCoeControl + void Draw(const TRect& aRect) const; + TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + TSize MinimumSize(); + CCoeControl* ComponentControl(TInt aIndex) const; + TInt CountComponentControls() const; + void HandleResourceChange(TInt aType); + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + +protected: // From MEikScrollBarObserver + void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType); + +public: // New methods + void FormatAsTextL(HBufC16* aBuf=NULL); + void FormatAsHexL(HBufC8* aBuf=NULL); + +private: // New methods + void InitVariables(); + void ResetVariables(TBool aResetData=ETrue); + void UpdateScrollBarL(); + +private: // Data + TInt iActiveMode; + TRect iViewerRect; + TInt iDrawingWidth; + TInt iLeftDrawingPosition; + TReal iX_factor; + TReal iY_factor; + TInt iNumberOfLinesFitsScreen; + CEikScrollBarFrame* iScrollBarFrame; + CFont* iFont; + TInt iCurrentLine; + TInt iTotalNumberOfLines; + + HBufC8* iHexesBuffer; + TInt iHexGrougWidth; + TInt iAmountOfHexesFitsHorizontally; + + HBufC16* iTextBuf; + CArrayFix* iWrappedTextArray; + }; + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBFileListContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBFileListContainer.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,123 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSERMAINCONTAINER_H +#define FILEBROWSERMAINCONTAINER_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CFileBrowserModel; +class CEikTextListBox; +class CAknSearchField; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknIconArray; +class CAknInfoPopupNoteController; +class CFont; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + class CFileBrowserToolbar; +#endif + +// CLASS DECLARATIONS + +class CFileBrowserFileListContainer : public CCoeControl, MCoeControlObserver, MEikListBoxObserver + { +public: + void ConstructL(const TRect& aRect); + ~CFileBrowserFileListContainer(); + +private: + void SizeChanged(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; + void Draw(const TRect& aRect) const; + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + void HandleResourceChange(TInt aType); + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); // From MEikListBoxObserver + void HandlePointerEventL(const TPointerEvent &aPointerEvent); + +public: + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/); + void CreateEmptyNaviPaneLabelL(); + void DeleteNaviPane(); + void CreateListBoxL(TInt aFileViewMode); + TInt CurrentListBoxItemIndex(); + const CArrayFix* ListBoxSelectionIndexes(); + TInt ListBoxSelectionIndexesCount(); + TInt ListBoxNumberOfVisibleItems(); + CAknIconArray* ListBoxIconArrayL(); + void SetListBoxIconArrayL(CAknIconArray* aIconArray); + void SetListBoxTextArrayL(CDesCArray* aTextArray); + void EnableSearchFieldL(); + TBool IsSearchFieldEnabled(); + void DisableSearchFieldL(); + void SetScreenLayoutL(TInt aLayoutMode); + void SetNaviPaneTextL(const TDesC& aText); + inline CEikTextListBox* ListBox() { return iListBox; } + inline CAknSearchField* SearchField() { return iSearchField; } + void HandleSettingsChangeL(); + void HideToolbar(); + void UpdateToolbar(); + +private: + CFileBrowserModel* iModel; + CEikTextListBox* iListBox; + CAknSearchField* iSearchField; + CAknNavigationControlContainer* iNaviContainer; + CAknNavigationDecorator* iNaviDecorator; + CAknInfoPopupNoteController* iInfoPopup; + TInt iFileViewMode; + TPoint iDragStartPoint; + TBool iIsDragging; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + CFileBrowserToolbar* iToolbar; +#endif + }; + + +class CSimpleFileViewListBox : public CAknSingleGraphicStyleListBox + { +private: + ~CSimpleFileViewListBox(); + void ReleaseFonts(); + void SizeChanged(); + void SizeChangedL(); +private: + CFont* iFont; + }; + + +class CExtendedFileViewListBox : public CAknDoubleGraphicStyleListBox + { +private: + ~CExtendedFileViewListBox(); + void ReleaseFonts(); + void SizeChanged(); + void SizeChangedL(); +private: + CFont* iFont1; + CFont* iFont2; + }; + +#endif + +// End of File \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBFileListView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBFileListView.h Tue Feb 02 00:17:27 2010 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSERMAINVIEW_H +#define FILEBROWSERMAINVIEW_H + +// INCLUDES +#include +#include + +#include "FBStd.h" + + + +// CONSTANTS +// UID of view +const TUid KFileListViewUID = {1}; + + +// FORWARD DECLARATIONS +class CFileBrowserFileListContainer; +class CFileBrowserModel; +class CRemConInterfaceSelector; +class CRemConCoreApiTarget; + + +// CLASS DECLARATION + +/** +* CFileBrowserFileListView view class. +* +*/ +class CFileBrowserFileListView : public CAknView, public MRemConCoreApiTargetObserver + { + public: // Constructors and destructor + + /** + * EPOC default constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CFileBrowserFileListView(); + + public: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + TUid Id() const; + + /** + * From ?base_class ?member_description + */ + void HandleCommandL(TInt aCommand); + + /** + * From ?base_class ?member_description + */ + void HandleClientRectChange(); + + private: + // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + private: + // From MRemConCoreApiTargetObserver + void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct); + + private: + + /** + * From AknView, ?member_description + */ + void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * From AknView, ?member_description + */ + void DoDeactivate(); + + private: // Data + CFileBrowserFileListContainer* iContainer; + CFileBrowserModel* iModel; + CRemConInterfaceSelector* iRemConSelector; + CRemConCoreApiTarget* iRemConTarget; + }; + +#endif + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBFileOps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBFileOps.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,134 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_FILEOPS_H +#define FILEBROWSER_FILEOPS_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class TFileEntry; +class CFBFileOpClient; +class CFileMan; +class CFileBrowserModel; +class CSBEClient; + + +class CFileBrowserFileOps : public CBase, + public MFileManObserver + { +private: + enum TRecursiveOperation + { + EFileOpInvalid = -1, + EFileOpCopy, + EFileOpMove, + EFileOpRename, + EFileOpAttribs, + EFileOpDelete, + EFileOpMkDirAll, + EFileOpCreateEmptyFile, + EFileOpEraseMBR, + EFileOpPartitionDrive + }; +public: + static CFileBrowserFileOps* NewL(CFileBrowserModel* aModel); + ~CFileBrowserFileOps(); + +public: // From MFileManObserver + + TControl NotifyFileManStarted(); + TControl NotifyFileManOperation(); + TControl NotifyFileManEnded(); + +private: + CFileBrowserFileOps(CFileBrowserModel* aModel); + void ConstructL(); + +public: + TInt ActivateSecureBackUpViaFileOp(); + TInt DeActivateSecureBackUpViaFileOp(); + TInt ActivateSecureBackUp(conn::TBURPartType aPartType=conn::EBURBackupFull, conn::TBackupIncType aBackupIncType=conn::EBackupBase); + TInt DeActivateSecureBackUp(); + TInt Copy(const TFileEntry& aSourceEntry, const TDesC& aTargetFullName, TUint aSwitch=CFileMan::EOverWrite, TBool aDeleteSource=EFalse); + TInt Rename(const TFileEntry& aSourceEntry, const TDesC& aNew, TUint aSwitch=CFileMan::EOverWrite); + TInt Attribs(const TFileEntry& aSourceEntry, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch=0); + TInt Delete(const TFileEntry& aSourceEntry, TUint aSwitch=0); + TInt MkDirAll(const TDesC& aPath, TInt aSetAtts=0, TBool aQuickOperation=EFalse); + TInt CreateEmptyFile(const TDesC& aName); + TInt DriveSnapShot(TChar aSourceDriveLetter, TChar aTargetDriveLetter); + TInt EraseMBR(TUint aDriveNumber); + TInt PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions); + void CancelOp(); + +private: + TInt DoFindEntries(const TDesC& aFileName, const TDesC& aPath); + TInt DoFindEntriesRecursiveL(const TDesC& aFileName, const TDesC& aPath); + + TInt FileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch); + TInt DoFileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch); + + TInt FileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch); + TInt DoFileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch); + + TInt FileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch); + TInt DoFileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch); + + TInt FileOpDeleteFile(const TDesC& aName, TUint aSwitch); + TInt DoFileOpDeleteFile(const TDesC& aName, TUint aSwitch); + + TInt FileOpRmDir(const TDesC& aDirName, TUint aSwitch); + TInt DoFileOpRmDir(const TDesC& aDirName, TUint aSwitch); + + TInt FileOpMkDirAll(const TDesC& aPath, TInt aSetAtts=0); + TInt DoFileOpMkDirAll(const TDesC& aPath); + + TInt FileOpCreateEmptyFile(const TDesC& aName); + TInt DoFileOpCreateEmptyFile(const TDesC& aName); + +public: + inline TBool SecureBackUpActive() { return iSecureBackUpActive; } + inline TBool FileCommandActivatedSecureBackup() { return iFileCommandActivatedSecureBackup; } + +private: + TInt iRecursiveState; + CFileBrowserModel* iModel; + CFBFileOpClient* iFileOpClient; + CFileMan* iFileMan; + RFs iFs; + TInt iOperationError; + conn::CSBEClient* iSBEClient; + TBool iSecureBackUpActive; + TBool iFileCommandActivatedSecureBackup; + + TFileName iBuf1; + TFileName iBuf2; + TUint iUint1; + TUint iUint2; + TUint iUint3; + TTime iTime1; + MFileManObserver::TControl iFileManObserverResult; + }; + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBFileUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBFileUtils.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,380 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_FILEUTILS_H +#define FILEBROWSER_FILEUTILS_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KIRAppPath, "z:\\sys\\bin\\irapp.exe"); +_LIT(KBTAppPath, "z:\\sys\\bin\\btui.exe"); +_LIT(KUSBAppPath, "z:\\sys\\bin\\usbclasschangeui.exe"); +_LIT(KErrRdPath, "c:\\resource\\ErrRd"); +_LIT(KErrRdDir, "c:\\resource\\"); + + +// FORWARD DECLARATIONS +class CFileBrowserModel; +class CFileBrowserFileOps; +class CAknIconArray; +class TAknsItemID; +class CDocumentHandler; +class CAknWaitDialog; +class CAknProgressDialog; +class CEikProgressInfo; +class CFBFileOpClient; +class CAknProgressDialog; +class CEikProgressInfo; +class CAknOpenFileService; +class CMessageDigest; + +// CLASS DECLARATIONS + +class TSearchAttributes + { +public: + TFileName iSearchDir; + TFileName iWildCards; + TFileName iTextInFile; + TUint iMinSize; + TUint iMaxSize; + TTime iMinDate; + TTime iMaxDate; + TBool iRecurse; + }; + +class TDriveEntry + { +public: + TChar iLetter; + TInt iNumber; + TVolumeInfo iVolumeInfo; + TBuf<64> iMediaTypeDesc; + TBuf<128> iAttributesDesc; + TInt iIconId; + }; + +class TFileEntry + { +public: + TFileName iPath; + TEntry iEntry; + TInt iDirEntries; + TInt iIconId; + }; + +class TAppIcon + { +public: + TInt iId; + TUid iUid; + }; + +typedef CArrayFixSeg CDriveEntryList; +typedef CArrayFixSeg CFileEntryList; +typedef CArrayFixSeg CAppIconList; + + +class CCommandParamsBase : public CBase + { + }; + +class CCommandParamsAttribs : public CCommandParamsBase + { +public: + TFileEntry iSourceEntry; + TUint iSetMask; + TUint iClearMask; + TTime iTime; + TUint iSwitch; +public: + CCommandParamsAttribs(const TFileEntry& aSourceEntry, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) : iSourceEntry(aSourceEntry), iSetMask(aSetMask), iClearMask(aClearMask), iTime(aTime), iSwitch(aSwitch) {} + }; + +class CCommandParamsCopyOrMove : public CCommandParamsBase + { +public: + TFileEntry iSourceEntry; + TFileName iTargetPath; + TUint iSwitch; +public: + CCommandParamsCopyOrMove(const TFileEntry& aSourceEntry, const TDesC& aTargetPath, TUint aSwitch) : iSourceEntry(aSourceEntry), iTargetPath(aTargetPath), iSwitch(aSwitch) {} + }; + +class CCommandParamsRename : public CCommandParamsBase + { +public: + TFileEntry iSourceEntry; + TFileName iTargetPath; + TUint iSwitch; +public: + CCommandParamsRename(const TFileEntry& aSourceEntry, const TDesC& aTargetPath, TUint aSwitch) : iSourceEntry(aSourceEntry), iTargetPath(aTargetPath), iSwitch(aSwitch) {} + }; + +class CCommandParamsDelete : public CCommandParamsBase + { +public: + TFileEntry iSourceEntry; + TUint iSwitch; +public: + CCommandParamsDelete(const TFileEntry& aSourceEntry, TUint aSwitch) : iSourceEntry(aSourceEntry), iSwitch(aSwitch) {} + }; + +class CCommandParamsDriveSnapShot : public CCommandParamsBase + { +public: + TInt iSourceDriveLetter; + TInt iTargetDriveLetter; +public: + CCommandParamsDriveSnapShot(TChar aSourceDriveLetter, TChar aTargetDriveLetter) : iSourceDriveLetter(aSourceDriveLetter), iTargetDriveLetter(aTargetDriveLetter) {} + }; + +class TCommand + { +public: + TInt iCommandId; + CCommandParamsBase* iParameters; +public: + TCommand(TInt aCommandId, CCommandParamsBase* aParameters) : iCommandId(aCommandId), iParameters(aParameters) {} + }; + +typedef CArrayFixSeg CCommandArray; + + + +class CFileBrowserFileUtils : public CActive, public MAknServerAppExitObserver, public MMsvSessionObserver, public MProgressDialogCallback + { +private: + enum TState // active object states + { + EIdle = 0, // do nothing + }; + + enum TClipBoardMode + { + EClipBoardModeCut = 0, + EClipBoardModeCopy + }; + + enum TListingMode + { + ENormalEntries = 0, + ESearchResults, + EOpenFiles, + EMsgAttachmentsInbox, + EMsgAttachmentsDrafts, + EMsgAttachmentsSentItems, + EMsgAttachmentsOutbox + }; + +public: + static CFileBrowserFileUtils* NewL(CFileBrowserModel* aModel); + ~CFileBrowserFileUtils(); + +private: + CFileBrowserFileUtils(CFileBrowserModel* aModel); + void ConstructL(); + +private: // from CActive + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + +private: // from MAknServerAppExitObserver + void HandleServerAppExit(TInt aReason); + +private: // from MMsvSessionObserver + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); + +private: //from MProgressDialogCallback + void DialogDismissedL(TInt aButtonId); + +private: // command handling + void StartExecutingCommandsL(const TDesC& aLabel); + void ExecuteCommand(); + void CheckForMoreCommandsL(); + void AppendToCommandArrayL(TInt aCommand, CCommandParamsBase* aParameters); + TInt CommandArrayCount() const; + void ResetCommandArray(); + +private: // misc functionality + void GenerateDirectoryDataL(); + void GetDriveListL(); + void GetDirectoryListingL(); + CAknIconArray* GenerateIconArrayL(TBool aGenerateNewBasicIconArray=EFalse); + void AppendGulIconToIconArrayL(CAknIconArray* aIconArray, const TDesC& aIconFile, TInt aIconId, TInt aMaskId, const TAknsItemID aAknsItemId); + TInt AppIconIdForUid(TUid aUid); + TUid GetAppUid(TFileEntry aFileEntry); + CDesCArray* GenerateItemTextArrayL(); + TInt GetSelectedItemsOrCurrentItemL(CFileEntryList* aFileEntryList); + void DoCopyToFolderL(CFileEntryList* aEntryList, const TDesC& aTargetDir, TBool aDeleteSource); + TInt DoSearchFiles(const TDesC& aFileName, const TDesC& aPath); + TInt DoSearchFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath); + TInt DoFindFiles(const TDesC& aFileName, const TDesC& aPath); + TInt DoFindFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath); + void ReadAttachmentPathsRecursiveL(CMsvSession* aSession, CMsvEntry* aContext, CDesCArray* aAttPaths); + void WriteMessageEntryInfoRecursiveL(CMsvSession* aSession, CMsvEntry* aContext, RFile& aFile, TInt& aLevel); + void DoWriteMessageEntryInfoL(CMsvEntry* aContext, RFile& aFile, TInt aLevel); + void ConvertCharsToPwd(TDesC& aWord, TDes8& aConverted) const; + HBufC8* MessageDigestInHexLC(CMessageDigest* aMD, RFile& aFile); + void OpenCommonFileActionQueryL(); + +public: // public interfaces + TKeyResponse HandleOfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + void HandleSettingsChangeL(); + void SetSortModeL(TInt aSortMode); + void SetOrderModeL(TInt aOrderMode); + void RefreshViewL(); + TBool IsCurrentDriveReadOnly(); + TBool IsCurrentItemDirectory(); + void MoveUpOneLevelL(); + void MoveDownToDirectoryL(); + void ClipboardCutL(); + void ClipboardCopyL(); + void ClipboardPasteL(); + void CopyToFolderL(TBool aMove=EFalse); + void DeleteL(); + void TouchL(); + void RenameL(); + void SetAttributesL(); + void SearchL(); + void NewFileL(); + void NewDirectoryL(); + void SendToL(); + void CompressL(); + void DecompressL(); + void PropertiesL(); + void OpenWithApparcL(); + void OpenWithDocHandlerL(TBool aEmbed); + void OpenWithFileServiceL(); + TBool FileExists(const TDesC& aPath); + TInt LaunchProgramL(const TDesC& aPath); + void MemoryInfoPopupL(); + void ShowFileCheckSumsL(TInt aType); + void SetErrRdL(TBool aEnable); + void EnableAvkonIconCacheL(TBool aEnable); + void SimulateLeaveL(); + void SimulatePanicL(); + void SimulateExceptionL(); + void SetDebugMaskL(); + void WriteAllAppsL(); + void WriteAllFilesL(); + void ListOpenFilesL(); + void ListMessageAttachmentsL(TInt aType); + void WriteMsgStoreWalkL(); + void FileEditorL(TInt aType); + void SetDrivePasswordL(); + void UnlockDriveL(); + void ClearDrivePasswordL(); + void EraseDrivePasswordL(); + void FormatDriveL(TBool aQuickFormat); + void CheckDiskL(); + void ScanDriveL(); + void SetDriveNameL(); + void SetDriveVolumeLabelL(); + void EjectDriveL(); + void DismountFileSystemL(); + void EraseMBRL(); + void PartitionDriveL(); + TBool DriveSnapShotPossible(); + void DriveSnapShotL(); + void EditDataTypesL(); + void SecureBackupL(TInt aType); + +public: + inline TInt SortMode() { return iSortMode; } + inline TInt OrderMode() { return iOrderMode; } + inline CFileEntryList* ClipBoardList() { return iClipBoardList; } + inline TBool IsDriveListViewActive() { return iCurrentPath==KNullDesC && iListingMode==ENormalEntries; } + inline TBool IsNormalModeActive() { return iListingMode==ENormalEntries; } + +private: + TState iState; + CFileBrowserModel* iModel; + CFileBrowserFileOps* iFileOps; + CAknWaitDialog* iWaitDialog; + CAknProgressDialog* iProgressDialog; + CEikProgressInfo* iProgressInfo; + CCommandArray* iCommandArray; + TInt iCurrentEntry; + TInt iSucceededOperations; + TInt iFailedOperations; + TInt iLastError; + RTimer iTimer; + RFs iFs; + TListingMode iListingMode; + CFileMan* iFileMan; + TInt iViewMode; + TFileName iCurrentPath; + TInt iSortMode; + TInt iOrderMode; + TInt iClipboardMode; + CDesCArray* iClipboardPaths; + CDriveEntryList* iDriveEntryList; + CFileEntryList* iFileEntryList; + CFileEntryList* iFindFileEntryList; + CAppIconList* iAppIconList; + TClipBoardMode iClipBoardMode; + CFileEntryList* iClipBoardList; + TSearchAttributes iSearchAttributes; + CDocumentHandler* iDocHandler; + CAknOpenFileService* iOpenFileService; + RFile iMsgStoreWalkFile; + TInt iPrevFolderIndex; + TFileName iPrevFolderName; + RTz iTz; + }; + + +// utility class for waiting for asychronous requests +class CAsyncWaiter : public CActive + { +public: + static CAsyncWaiter* NewL( TInt aPriority = EPriorityStandard ); + static CAsyncWaiter* NewLC( TInt aPriority = EPriorityStandard ); + ~CAsyncWaiter(); + + void StartAndWait(); + TInt Result() const; + +private: + CAsyncWaiter( TInt aPriority ); + + // from CActive + void RunL(); + void DoCancel(); + +private: + CActiveSchedulerWait iWait; + TInt iError; + }; + + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBModel.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,118 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FILEBROWSER_MODEL_H__ +#define __FILEBROWSER_MODEL_H__ + +// INCLUDES +#include +#include +#include +#include + + +// setting keys (do not change uids of existing keys to maintain compatibility to older versions!) +const TUid KFBSettingDisplayMode = { 0x00 }; +const TUid KFBSettingFileViewMode = { 0x01 }; +const TUid KFBSettingShowSubDirectoryInfo = { 0x02 }; +const TUid KFBSettingShowAssociatedIcons = { 0x03 }; +const TUid KFBSettingRememberLastPath = { 0x04 }; +const TUid KFBSettingLastPath = { 0x05 }; + +const TUid KFBSettingSupportNetworkDrives = { 0x06 }; +const TUid KFBSettingBypassPlatformSecurity = { 0x07 }; +const TUid KFBSettingRemoveFileLocks = { 0x08 }; +const TUid KFBSettingIgnoreProtectionsAtts = { 0x09 }; +const TUid KFBSettingRemoveROMWriteProtection = { 0x0A }; + +const TUid KFBSettingFolderSelection = { 0x0B }; +const TUid KFBSettingEnableToolbar = { 0x0C }; + + +// FORWARD DECLARATIONS +class CFileBrowserFileListContainer; +class CFileBrowserScreenCapture; +class CFileBrowserFileUtils; +class CEikonEnv; +class CAknGlobalConfirmationQuery; +class CDictionaryFileStore; + +// CLASS DECLARATIONS + +class TFileBrowserSettings + { +public: + TInt iDisplayMode; + TInt iFileViewMode; + TBool iShowSubDirectoryInfo; + TBool iShowAssociatedIcons; + TBool iRememberLastPath; + TFileName iLastPath; + TBool iRememberFolderSelection; + TBool iEnableToolbar; + + TBool iSupportNetworkDrives; + TBool iBypassPlatformSecurity; + TBool iRemoveFileLocks; + TBool iIgnoreProtectionsAtts; + TBool iRemoveROMWriteProrection; + }; + + +class CFileBrowserModel : public CBase + { +public: + static CFileBrowserModel* NewL(); + ~CFileBrowserModel(); + +private: + CFileBrowserModel(); + void ConstructL(); + void LoadSettingsL(); + void GetHashKeySelectionStatus(); + void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue); + void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue); + void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue); + void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue); + +public: + void ActivateModelL(); + void DeActivateModelL(); + void SaveSettingsL(TBool aNotifyModules=ETrue); + void SetFileListContainer(CFileBrowserFileListContainer* aFileListContainer); + TInt LaunchSettingsDialogL(); + inline TFileBrowserSettings& Settings() { return iSettings; } + inline CEikonEnv* EikonEnv() { return iEnv; } + inline RApaLsSession& LsSession() { return iLs; } + inline CFileBrowserScreenCapture* ScreenCapture() { return iScreenCapture; } + inline CFileBrowserFileUtils* FileUtils() { return iFileUtils; } + inline CFileBrowserFileListContainer* FileListContainer() { return iFileListContainer; } + inline TBool IsHashKeySelectionInUse() { return iIsHashKeySelectionInUse; } + +private: + CFileBrowserFileListContainer* iFileListContainer; + CFileBrowserScreenCapture* iScreenCapture; + CFileBrowserFileUtils* iFileUtils; + CEikonEnv* iEnv; + TFileBrowserSettings iSettings; + RApaLsSession iLs; + TBool iIsHashKeySelectionInUse; + }; + + +#endif // __FILEBROWSER_MODEL_H__ \ No newline at end of file diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBSettingViewDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBSettingViewDlg.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,82 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_SETTINGVIEWDLG_H +#define FILEBROWSER_SETTINGVIEWDLG_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CAknSettingItemArray; +class CAknSettingStyleListBox; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknTabGroup; +class TFileBrowserSettings; + + +// CLASS DEFINITIONS + +class CFileBrowserSettingViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver + { +public: + static CFileBrowserSettingViewDlg* NewL(TFileBrowserSettings& aSettings); + virtual ~CFileBrowserSettingViewDlg(); + +public: // From MEikListBoxObserver + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + +public: // From MAknTabObserver + void TabChangedL(TInt aIndex); + +public: // From CAknDialog + void ProcessCommandL(TInt aCommandId); + +protected: // From CEikDialog + TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + void PreLayoutDynInitL(); + TBool OkToExitL(TInt aButtonId); + +private: // New methods + void ShowSettingPageL(TBool aCalledFromMenu); + void SetVisibilitiesOfSettingItemsL(); + void UpdateListBoxL(); + void AddSettingItemL(TInt aId, TInt aTitleResource, TInt aSettingPageResource, TInt aAssociatedResource, TInt aOrdinal); + +private: // Constructors + CFileBrowserSettingViewDlg(TFileBrowserSettings& aSettings); + void ConstructL(); + +private: // Data + CAknSettingItemArray* iSettingItemArray; + CAknSettingStyleListBox* iListBox; + CAknNavigationControlContainer* iNaviContainer; + CAknNavigationDecorator* iDecoratedTabGroup; + CAknTabGroup* iTabGroup; + TFileBrowserSettings& iSettings; + }; + + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBStd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBStd.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_STD_H +#define FILEBROWSER_STD_H + +#include +#include +#include + +LOCAL_C inline TBool IsQHD(const TSize& aSize) { return ((aSize.iWidth==640 && aSize.iHeight==360) || (aSize.iWidth==360 && aSize.iHeight==640)); } + +#endif + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBToolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBToolbar.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,127 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSERTOOLBAR_H +#define FILEBROWSERTOOLBAR_H + + +#include +#include +#include // MCoeControlObserver + +#ifdef RD_CALEN_ENHANCED_MSK +#include // for CDesCArrayFlat +#endif + +//Forward declarations +class CAknToolbar; +class CAknButton; +class CCoeControl; +class CAknView; +class CFileBrowserModel; +class CAknInfoPopupNoteController; + +class CFileBrowserToolbar : public CBase, + public MAknToolbarObserver, + public MCoeControlObserver + { + public: + /** + * 1st phase constructor + */ + static CFileBrowserToolbar* NewL(); + + /** + * 1st phase constructor + */ + static CFileBrowserToolbar* NewLC(); + + /** + * Destructor + */ + ~CFileBrowserToolbar(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: + // from MAknToolbarObserver + + /** + * From MAknToolbarObserver + */ + void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar ); + + /** + * Handling toolbar key events + */ + void OfferToolbarEventL( TInt aCommand ); + + public: + // from MCoeControlObserver + + /** + * Handles toolbar event + */ + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); + + public: + // New functions + + /** + * Updates the toolbar state to default state + */ + void ResetState(); + + /** + * Enables the display of toolbar + */ + void ShowToolbarL(); + + /** + * Disables the display of toolbar + */ + void HideToolbarL(); + + /** + * Returns whether the toolbar is shown or not + */ + TBool IsShown(); + + const TRect Rect() const; + + private: + // New functions + CFileBrowserToolbar(); + + // private: + public: + CFileBrowserModel* iModel; + CAknToolbar* iViewerToolbar; + TBool iShown; + TInt iFirstSelectionIndex; + TInt iLastSelectionIndex; + CAknInfoPopupNoteController* iInfoPopup; + CAknButton* iSelectbutton; + }; + +#endif // FILEBROWSERTOOLBAR_H + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/inc/FBTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/inc/FBTraces.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,103 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 FILEBROWSER_TRACES_H +#define FILEBROWSER_TRACES_H + +#include + + +// --------------------------------------------------------------------------- +// You can change these logging method values below! Recompile the application to take changes effect. + + // logging methods + // 0 = No logging + // 1 = Flogger + // 2 = RDebug + // 3 = Flogger and RDebug + + #ifndef _DEBUG + + // Logging method for UREL/release builds: + #define FILEBROWSER_LOGGING_METHOD 0 + + #else + + // Logging method for UDEB/debug builds: + #define FILEBROWSER_LOGGING_METHOD 2 + + #endif + + + +// --------------------------------------------------------------------------- +// Do not make any changes to lines below... + + #if FILEBROWSER_LOGGING_METHOD == 1 || FILEBROWSER_LOGGING_METHOD == 3 + + #include + _LIT(KLogFolder,"Launcher"); + _LIT(KLogFile,"Launcher_Trace.txt"); + + #endif + + #if FILEBROWSER_LOGGING_METHOD == 2 || FILEBROWSER_LOGGING_METHOD == 3 + + #include + + #endif + + + #if FILEBROWSER_LOGGING_METHOD == 0 + + #define LOGTEXT(AAA) + #define LOGSTRING(AAA) + #define LOGSTRING2(AAA,BBB) + #define LOGSTRING3(AAA,BBB,CCC) + #define LOGSTRING4(AAA,BBB,CCC,DDD) + + + #elif FILEBROWSER_LOGGING_METHOD == 1 + + #define LOGTEXT(AAA) RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA) + #define LOGSTRING(AAA) do { _LIT(tempLogDes,AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0) + #define LOGSTRING2(AAA,BBB) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB); } while (0) + #define LOGSTRING3(AAA,BBB,CCC) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC); } while (0) + #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC,DDD); } while (0) + + #elif FILEBROWSER_LOGGING_METHOD == 2 + + #define LOGTEXT(AAA) RDebug::Print(AAA) + #define LOGSTRING(AAA) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); } while (0) + #define LOGSTRING2(AAA,BBB) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); } while (0) + #define LOGSTRING3(AAA,BBB,CCC) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); } while (0) + #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); } while (0) + + #elif FILEBROWSER_LOGGING_METHOD == 3 + + #define LOGTEXT(AAA) RDebug::Print(AAA); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AAA) + #define LOGSTRING(AAA) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes); RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,tempLogDes()); } while (0) + #define LOGSTRING2(AAA,BBB) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB); } while (0) + #define LOGSTRING3(AAA,BBB,CCC) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC); } while (0) + #define LOGSTRING4(AAA,BBB,CCC,DDD) do { _LIT(tempLogDes,AAA); RDebug::Print(tempLogDes, BBB, CCC, DDD); RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue(tempLogDes()),BBB,CCC,DDD); } while (0) + + #endif + +// --------------------------------------------------------------------------- + +#endif diff -r 000000000000 -r d6fe6244b863 filebrowser/rom/filebrowser.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/rom/filebrowser.iby Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 __FILEBROWSER_IBY__ +#define __FILEBROWSER_IBY__ + +S60_APP_EXE(FileBrowser) +S60_APP_AIF_ICONS(FileBrowser) +S60_APP_RESOURCE(FileBrowser) +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,FileBrowser_ExtraIcons) +#ifdef S60_UPGRADABLE_APP_REG_RSC + S60_UPGRADABLE_APP_REG_RSC(FileBrowser) +#else + S60_APP_AIF_RSC(FileBrowser) +#endif + +#ifndef FILEBROWSER_LITE +file=ABI_DIR\BUILD_DIR\FileBrowserFileOpServer.exe PROGRAMS_DIR\FileBrowserFileOpServer.exe +file=ABI_DIR\BUILD_DIR\FileBrowserFileOpClient.dll SHARED_LIB_DIR\FileBrowserFileOpClient.dll +#endif + +data=ZPRIVATE\102828D6\backup_registration.xml private\102828D6\backup_registration.xml +data=ZSYSTEM\Install\FileBrowser_stub.sis \system\install\FileBrowser_stub.sis + +#endif // __FILEBROWSER_IBY__ diff -r 000000000000 -r d6fe6244b863 filebrowser/sis/FileBrowser_S60-30.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/sis/FileBrowser_S60-30.pkg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,42 @@ +; +; 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 "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"FileBrowser"},(0x102828D6),4,5,2,TYPE=SA + +; Supports S60 v 3.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\UREL\FileBrowser.exe"-"!:\sys\bin\FileBrowser.exe" +"\epoc32\data\z\Resource\apps\FileBrowser_aif.mif"-"!:\Resource\Apps\FileBrowser_aif.mif" +"\epoc32\data\z\Resource\apps\FileBrowser_ExtraIcons.mif"-"!:\Resource\Apps\FileBrowser_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\FileBrowser.rsc"-"!:\Resource\Apps\FileBrowser.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\FileBrowser_reg.rsc"-"!:\private\10003a3f\import\apps\FileBrowser_reg.rsc" +"..\group\backup_registration.xml"-"!:\private\102828D6\backup_registration.xml" + +; remove the following two entrys for lite version +"\epoc32\RELEASE\armv5\UREL\FileBrowserFileOpServer.exe"-"!:\sys\bin\FileBrowserFileOpServer.exe" +"\epoc32\RELEASE\armv5\UREL\FileBrowserFileOpClient.dll"-"!:\sys\bin\FileBrowserFileOpClient.dll" diff -r 000000000000 -r d6fe6244b863 filebrowser/sis/FileBrowser_S60-30.sis Binary file filebrowser/sis/FileBrowser_S60-30.sis has changed diff -r 000000000000 -r d6fe6244b863 filebrowser/sis/FileBrowser_S60-50.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/sis/FileBrowser_S60-50.pkg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,42 @@ +; +; 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 "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"FileBrowser"},(0x102828D6),4,5,2,TYPE=SA + +; Supports S60 v 5.0 +[0x1028315F], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\UREL\FileBrowser.exe"-"!:\sys\bin\FileBrowser.exe" +"\epoc32\data\z\Resource\apps\FileBrowser_aif.mif"-"!:\Resource\Apps\FileBrowser_aif.mif" +"\epoc32\data\z\Resource\apps\FileBrowser_ExtraIcons.mif"-"!:\Resource\Apps\FileBrowser_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\FileBrowser.rsc"-"!:\Resource\Apps\FileBrowser.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\FileBrowser_reg.rsc"-"!:\private\10003a3f\import\apps\FileBrowser_reg.rsc" +"..\group\backup_registration.xml"-"!:\private\102828D6\backup_registration.xml" + +; remove the following two entrys for lite version +"\epoc32\RELEASE\armv5\UREL\FileBrowserFileOpServer.exe"-"!:\sys\bin\FileBrowserFileOpServer.exe" +"\epoc32\RELEASE\armv5\UREL\FileBrowserFileOpClient.dll"-"!:\sys\bin\FileBrowserFileOpClient.dll" diff -r 000000000000 -r d6fe6244b863 filebrowser/sis/FileBrowser_S60-50.sis Binary file filebrowser/sis/FileBrowser_S60-50.sis has changed diff -r 000000000000 -r d6fe6244b863 filebrowser/sis/FileBrowser_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/sis/FileBrowser_stub.pkg Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,38 @@ +; +; 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 "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"FileBrowser"},(0x102828D6),1,0,0 + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +""-"z:\sys\bin\FileBrowser.exe" +""-"z:\Resource\Apps\FileBrowser_aif.mif" +""-"z:\Resource\Apps\FileBrowser.rsc" +""-"z:\private\10003a3f\import\apps\FileBrowser_reg.rsc" +""-"z:\private\102828D6\backup_registration.xml" + +""-"z:\sys\bin\FileBrowserFileOpServer.exe" +""-"z:\sys\bin\FileBrowserFileOpClient.dll" diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBApp.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,73 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBApp.h" +#include "FBDocument.h" + +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CFileBrowserApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------- +// +TUid CFileBrowserApp::AppDllUid() const + { + return KUidFileBrowser; + } + +// --------------------------------------------------------- +// CDictionaryStore* CFileBrowserApp::OpenIniFileLC(RFs& aFs) const +// overrides CAknApplication::OpenIniFileLC to enable INI file support +// --------------------------------------------------------- +// +CDictionaryStore* CFileBrowserApp::OpenIniFileLC(RFs& aFs) const +{ + return CEikApplication::OpenIniFileLC(aFs); +} + +// --------------------------------------------------------- +// CFileBrowserApp::CreateDocumentL() +// Creates CFileBrowserDocument object +// --------------------------------------------------------- +// +CApaDocument* CFileBrowserApp::CreateDocumentL() + { + return CFileBrowserDocument::NewL( *this ); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +LOCAL_C CApaApplication* NewApplication() + { + return new CFileBrowserApp; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBAppUi.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,126 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBAppUi.h" +#include "FBFileListView.h" +#include "FB.hrh" +#include "FBModel.h" +#include "FBDocument.h" +#include + +#include +#include + +// ================= MEMBER FUNCTIONS ======================= +// +// ---------------------------------------------------------- +// CFileBrowserAppUi::ConstructL() +// ?implementation_description +// ---------------------------------------------------------- +// +void CFileBrowserAppUi::ConstructL() + { + BaseConstructL(EAknEnableSkin); + + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + + CFileBrowserFileListView* fileListView = new (ELeave) CFileBrowserFileListView; + CleanupStack::PushL( fileListView ); + fileListView->ConstructL(); + AddViewL( fileListView ); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // fileListView + + SetDefaultViewL(*fileListView); + + // notify the model that everything has been constructed + iModel->ActivateModelL(); + } + +// ---------------------------------------------------- +// CFileBrowserAppUi::~CFileBrowserAppUi() +// Destructor +// Frees reserved resources +// ---------------------------------------------------- +// +CFileBrowserAppUi::~CFileBrowserAppUi() + { + // notify the model that app ui will be deconstructed + if (iModel) + TRAP_IGNORE(iModel->DeActivateModelL()); + } + +// ------------------------------------------------------------------------------ +// CFileBrowserAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) +// This function is called by the EIKON framework just before it displays +// a menu pane. Its default implementation is empty, and by overriding it, +// the application can set the state of menu items dynamically according +// to the state of application data. +// ------------------------------------------------------------------------------ +// +void CFileBrowserAppUi::DynInitMenuPaneL( + TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) + { + } + +// ---------------------------------------------------- +// CFileBrowserAppUi::HandleKeyEventL( +// const TKeyEvent& aKeyEvent,TEventCode /*aType*/) +// ?implementation_description +// ---------------------------------------------------- +// +TKeyResponse CFileBrowserAppUi::HandleKeyEventL( + const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// ---------------------------------------------------- +// CFileBrowserAppUi::HandleCommandL(TInt aCommand) +// ?implementation_description +// ---------------------------------------------------- +// +void CFileBrowserAppUi::HandleCommandL(TInt aCommand) + { + switch ( aCommand ) + { + // a normal way to close an application + case EAknCmdExit: + case EEikCmdExit: + { + Exit(); + } + break; + + default: + break; + } + } + +// ---------------------------------------------------- +// CFileBrowserAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) +// ?implementation_description +// ---------------------------------------------------- +// +void CFileBrowserAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) + { + //if (iModel->ScreenCapture()->HandleKeyCaptureEventsL(aEvent)) + CAknViewAppUi::HandleWsEventL(aEvent, aDestination); //continue the event loop if needed + } + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBDocument.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,86 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBDocument.h" +#include "FBAppUi.h" +#include "FBModel.h" + +// ================= MEMBER FUNCTIONS ======================= + +// constructor +CFileBrowserDocument::CFileBrowserDocument(CEikApplication& aApp) +: CAknDocument(aApp) + { + } + +// destructor +CFileBrowserDocument::~CFileBrowserDocument() + { + delete iModel; + } + +// EPOC default constructor can leave. +void CFileBrowserDocument::ConstructL() + { + iModel = CFileBrowserModel::NewL(); + } + +// Two-phased constructor. +CFileBrowserDocument* CFileBrowserDocument::NewL( + CEikApplication& aApp) // CFileBrowserApp reference + { + CFileBrowserDocument* self = new (ELeave) CFileBrowserDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ---------------------------------------------------- +// CFileBrowserDocument::CreateAppUiL() +// constructs CFileBrowserAppUi +// ---------------------------------------------------- +// +CEikAppUi* CFileBrowserDocument::CreateAppUiL() + { + return new (ELeave) CFileBrowserAppUi; + } + +// ---------------------------------------------------- +// CFileBrowserDocument::OpenFileL +// Overrides CAknDocument::OpenFileL to support document file +// ---------------------------------------------------- +// +CFileStore* CFileBrowserDocument::OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs) + { + return CEikDocument::OpenFileL(aDoOpen, aFilename, aFs); + } + + +// ---------------------------------------------------- + +CFileBrowserModel* CFileBrowserDocument::Model() + { + return iModel; + } + +// ---------------------------------------------------- + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBFileDlgs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBFileDlgs.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1115 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBFileDlgs.h" +#include "FBFileUtils.h" +#include "FB.hrh" +#include "FBStd.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TInt KAttOn = 1; +const TInt KAttOff = 2; +const TInt KAttEnableRecursion = 0; +const TInt KAttDisableRecursion = 1; +const TInt64 KAlmostaDayInMicroSeconds = 86399999999; + + +// ===================================== MEMBER FUNCTIONS ===================================== + +CFileBrowserDestinationFolderSelectionDlg* CFileBrowserDestinationFolderSelectionDlg::NewL( + TDes& aReturnPath, CDriveEntryList* aDriveEntryList, CAknIconArray* aIconArray) + { + CFileBrowserDestinationFolderSelectionDlg* self = new(ELeave) CFileBrowserDestinationFolderSelectionDlg(aReturnPath, aIconArray); + CleanupStack::PushL(self); + self->ConstructL(aDriveEntryList); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserDestinationFolderSelectionDlg::~CFileBrowserDestinationFolderSelectionDlg() + { + delete iFileEntryList; + delete iDriveEntryList; + + iFs.Close(); + + iEikonEnv->InfoMsgCancel(); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserDestinationFolderSelectionDlg::CFileBrowserDestinationFolderSelectionDlg( + TDes& aReturnPath, CAknIconArray* aIconArray) : CAknListQueryDialog(&iSelectedIndex), + iReturnPath(aReturnPath), iIconArray(aIconArray) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDestinationFolderSelectionDlg::ConstructL(CDriveEntryList* aDriveEntryList) + { + User::LeaveIfError( iFs.Connect() ); + iDriveEntryList = new(ELeave) CDriveEntryList(8); + iFileEntryList = new(ELeave) CFileEntryList(32); + iCurrentPath = KNullDesC; + + //iIsDragging = EFalse; + //EnableDragEvents(); + + // get only writeable drives + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = aDriveEntryList->At(i); + + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt != KMediaAttWriteProtected && driveEntry.iVolumeInfo.iDrive.iMediaAtt != KMediaAttLocked && driveEntry.iVolumeInfo.iDrive.iDriveAtt != KDriveAbsent) + { + iDriveEntryList->AppendL(driveEntry); + } + } + } + +// -------------------------------------------------------------------------------------------- + +/* +void CFileBrowserDestinationFolderSelectionDlg::HandlePointerEventL(const TPointerEvent &aPointerEvent) + { + // detect direction of dragging by comparing the start and finish points + + if (aPointerEvent.iType == TPointerEvent::EButton1Down) + { + iDragStartPoint = aPointerEvent.iPosition; + iIsDragging = EFalse; + } + else if (aPointerEvent.iType == TPointerEvent::EDrag) + { + iIsDragging = ETrue; + + return; + } + else if (aPointerEvent.iType == TPointerEvent::EButton1Up) + { + if (iIsDragging) + { + const TInt KDelta = iDragStartPoint.iX - aPointerEvent.iPosition.iX; + const TInt KThreshold = 30; + + if (KDelta < -KThreshold) // dragging to right + { + // "emulate" right key press + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyRightArrow; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + OfferKeyEventL(keyEvent, type); + + return; + } + else if (KDelta > KThreshold) // dragging to left + { + // "emulate" left key press + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyLeftArrow; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + OfferKeyEventL(keyEvent, type); + + return; + } + } + iIsDragging = EFalse; + } + else + { + iIsDragging = EFalse; + } + + CAknListQueryDialog::HandlePointerEventL(aPointerEvent); + } +*/ + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CFileBrowserDestinationFolderSelectionDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if(aType != EEventKey) + return EKeyWasNotConsumed; + + if (aKeyEvent.iCode == EKeyLeftArrow && !IsDriveListViewActive()) + { + MoveUpOneLevelL(); + return EKeyWasConsumed; + } + else if (aKeyEvent.iCode == EKeyRightArrow && ((ListBox()->CurrentItemIndex() > 0 && !IsDriveListViewActive()) || IsDriveListViewActive())) + { + MoveDownToDirectoryL(); + return EKeyWasConsumed; + } + else if (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) + { + if (IsDriveListViewActive()) + { + MoveDownToDirectoryL(); + return EKeyWasConsumed; + } + else if (ListBox()->CurrentItemIndex() == 0) + { + TryExitL(EAknSoftkeyOk); + return EKeyWasConsumed; + } + else if (ListBox()->CurrentItemIndex() > 0) + { + MoveDownToDirectoryL(); + return EKeyWasConsumed; + } + } + + TKeyResponse result = CAknDialog::OfferKeyEventL(aKeyEvent, aType); + + // update LSK label + if (!IsDriveListViewActive()) + { + if (ListBox()->CurrentItemIndex() == 0) + { + ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, iLSKActionText); + ButtonGroupContainer().DrawNow(); + } + else + { + ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, _L("Open dir")); + ButtonGroupContainer().DrawNow(); + } + } + + return result; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDestinationFolderSelectionDlg::PreLayoutDynInitL() + { + CAknListQueryDialog::PreLayoutDynInitL(); + + static_cast(ListBox())->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDestinationFolderSelectionDlg::PostLayoutDynInitL() + { + CAknListQueryDialog::PostLayoutDynInitL(); + + SetIconArrayL(static_cast*>(iIconArray)); + + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserDestinationFolderSelectionDlg::OkToExitL(TInt aButtonId) + { + if (aButtonId == GetLeftCBAShortKeyPress()) + { + if (IsDriveListViewActive()) + { + MoveDownToDirectoryL(); + return EFalse; + } + else if (ListBox()->CurrentItemIndex() == 0) + { + // close the dialog + iReturnPath = iCurrentPath; + return ETrue; + } + else if (ListBox()->CurrentItemIndex() > 0) + { + MoveDownToDirectoryL(); + return EFalse; + } + else + return EFalse; + } + else if (aButtonId == GetRightCBAShortKeyPress()) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDestinationFolderSelectionDlg::MoveUpOneLevelL() + { + if (iCurrentPath.Length() <= 3) + { + // move to drive list view is the current path is already short enough + iCurrentPath = KNullDesC; + } + else + { + // move one directory up + TInt marker(iCurrentPath.Length()); + + // find second last dir marker + for (TInt i=iCurrentPath.Length()-2; i>=0; i--) + { + if (iCurrentPath[i] == '\\') + { + marker = i; + break; + } + + } + iCurrentPath = iCurrentPath.LeftTPtr(marker+1); + } + + // update view + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDestinationFolderSelectionDlg::MoveDownToDirectoryL() + { + TInt index = ListBox()->CurrentItemIndex(); + + if (index >= 0) + { + if (IsDriveListViewActive()) + { + // currently in a drive list view, move to root of selected drive + if (iDriveEntryList->Count() > index) + { + TDriveEntry driveEntry = iDriveEntryList->At(index); + + iCurrentPath.Append(driveEntry.iLetter); + iCurrentPath.Append(_L(":\\")); + } + } + else + { + // this needed because we have an extra item in the listbox + index--; + + // append the new directory + if (iFileEntryList->Count() > index) + { + TFileEntry fileEntry = iFileEntryList->At(index); + + if (fileEntry.iEntry.IsDir()) + { + iCurrentPath.Append(fileEntry.iEntry.iName); + iCurrentPath.Append(_L("\\")); + } + } + } + + // update view + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDestinationFolderSelectionDlg::RefreshViewL() + { + CDesCArray* textArray = new(ELeave) CDesCArrayFlat(16); + + if (IsDriveListViewActive()) + { + _LIT(KSimpleDriveEntry, "%d\t%c: <%S>\t\t"); + + for (TInt i=0; iCount(); i++) + { + TFileName textEntry; + TDriveEntry driveEntry = iDriveEntryList->At(i); + + textEntry.Format(KSimpleDriveEntry, driveEntry.iIconId, TUint(driveEntry.iLetter), &driveEntry.iMediaTypeDesc); + + textArray->AppendL(textEntry); + } + + // set default LSK label + ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, _L("Open drive")); + ButtonGroupContainer().DrawNow(); + } + + else + { + // first get the directory list + iFileEntryList->Reset(); + + CDir* dir = NULL; + if (iFs.GetDir(iCurrentPath, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst, dir) == KErrNone) + { + CleanupStack::PushL(dir); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry; + fileEntry.iPath = iCurrentPath; + fileEntry.iEntry = (*dir)[i]; + fileEntry.iDirEntries = KErrNotFound; + fileEntry.iIconId = EFixedIconEmpty; + + // check for directory entries + if (fileEntry.iEntry.IsDir()) + { + fileEntry.iIconId = EFixedIconFolder; + + TFileName subPath = fileEntry.iPath; + subPath.Append(fileEntry.iEntry.iName); + subPath.Append(_L("\\")); + + // check if any sub directories + CDir* subDir = NULL; + if (iFs.GetDir(subPath, KEntryAttDir|KEntryAttMatchMask, ESortNone | EDirsFirst, subDir) == KErrNone) + { + fileEntry.iDirEntries = subDir->Count(); + + for (TInt j=0; jCount(); j++) + { + TEntry entry = (*subDir)[j]; + + if (entry.IsDir()) + { + fileEntry.iIconId = EFixedIconFolderSub; + break; + } + } + + delete subDir; + } + } + + iFileEntryList->AppendL(fileEntry); + } + + CleanupStack::PopAndDestroy(); //dir + } + + + _LIT(KSimpleFileEntry, "%d\t%S\t\t"); + + + // append current folder item + TParse nameParser; + TInt err = nameParser.SetNoWild(iCurrentPath.LeftTPtr(iCurrentPath.Length()-1), NULL, NULL); + TFileName currentFolderName = nameParser.Name(); + if (currentFolderName == KNullDesC) + currentFolderName.Copy(_L("[root level]")); + + TFileName currentDirTextEntry; + currentDirTextEntry.Format(KSimpleFileEntry, EFixedIconFolderCurrent, ¤tFolderName); + textArray->AppendL(currentDirTextEntry); + + + for (TInt i=0; iCount(); i++) + { + TFileName textEntry; + TFileEntry fileEntry = iFileEntryList->At(i); + + textEntry.Format(KSimpleFileEntry, fileEntry.iIconId, &fileEntry.iEntry.iName); + + textArray->AppendL(textEntry); + } + + // set default LSK label + ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, iLSKActionText); + ButtonGroupContainer().DrawNow(); + } + + if (iCurrentPath == KNullDesC) + iEikonEnv->InfoMsgWithDuration(_L("<- up dir down dir ->"), TTimeIntervalMicroSeconds32(KMaxTInt)); + else + iEikonEnv->InfoMsgWithDuration(iCurrentPath, TTimeIntervalMicroSeconds32(KMaxTInt)); + + SetItemTextArray(textArray); + SetOwnershipType(ELbmOwnsItemArray); + ListBox()->HandleItemAdditionL(); + Layout(); + ListBox()->SetCurrentItemIndex(0); + DrawNow(); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserDestinationFolderSelectionDlg::RunCopyDlgLD() + { + iLSKActionText.Copy(_L("Copy")); + return ExecuteLD(R_COPY_TO_FOLDER_SELECTION_QUERY); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserDestinationFolderSelectionDlg::RunMoveDlgLD() + { + iLSKActionText.Copy(_L("Move")); + return ExecuteLD(R_MOVE_TO_FOLDER_SELECTION_QUERY); + } + +// -------------------------------------------------------------------------------------------- + +TInt CAknQueryDialog::GetLeftCBAShortKeyPress() + { + return TInt16(0xffff & TInt16(ButtonGroupContainer().ButtonGroup()->CommandId(0))); + } + +// -------------------------------------------------------------------------------------------- + +TInt CAknQueryDialog::GetRightCBAShortKeyPress() + { + return TInt16(0xffff & TInt16(ButtonGroupContainer().ButtonGroup()->CommandId(2))); + } + + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + + +CFileBrowserAttributeEditorDlg* CFileBrowserAttributeEditorDlg::NewL(TUint& aSetAttMask, TUint& aClearAttMask, TBool& aRecurse) + { + CFileBrowserAttributeEditorDlg* self = new(ELeave) CFileBrowserAttributeEditorDlg(aSetAttMask, aClearAttMask, aRecurse); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserAttributeEditorDlg::~CFileBrowserAttributeEditorDlg() + { + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserAttributeEditorDlg::CFileBrowserAttributeEditorDlg(TUint& aSetAttMask, TUint& aClearAttMask, TBool& aRecurse) : + iSetAttMask(aSetAttMask), iClearAttMask(aClearAttMask), iRecurse(aRecurse) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserAttributeEditorDlg::ConstructL() + { + CAknForm::ConstructL(); + + // set title text + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("Set attributes") ); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserAttributeEditorDlg::PreLayoutDynInitL() + { + CAknForm::PreLayoutDynInitL(); + + // set default LSK label + ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, _L("Save")); + + // load values + CAknPopupFieldText* archivePopup = static_cast(Control(EFileBrowserAttributeEditorSetArchive)); + CAknPopupFieldText* hiddenPopup = static_cast(Control(EFileBrowserAttributeEditorSetHidden)); + CAknPopupFieldText* readOnlyPopup = static_cast(Control(EFileBrowserAttributeEditorSetReadOnly)); + CAknPopupFieldText* systemPopup = static_cast(Control(EFileBrowserAttributeEditorSetSystem)); + CAknPopupFieldText* recursePopup = static_cast(Control(EFileBrowserAttributeEditorSetRecurse)); + + if (iSetAttMask & KEntryAttArchive) + archivePopup->SetCurrentValueIndex(KAttOn); + else if (iClearAttMask & KEntryAttArchive) + archivePopup->SetCurrentValueIndex(KAttOff); + + if (iSetAttMask & KEntryAttHidden) + hiddenPopup->SetCurrentValueIndex(KAttOn); + else if (iClearAttMask & KEntryAttHidden) + hiddenPopup->SetCurrentValueIndex(KAttOff); + + if (iSetAttMask & KEntryAttReadOnly) + readOnlyPopup->SetCurrentValueIndex(KAttOn); + else if (iClearAttMask & KEntryAttReadOnly) + readOnlyPopup->SetCurrentValueIndex(KAttOff); + + if (iSetAttMask & KEntryAttSystem) + systemPopup->SetCurrentValueIndex(KAttOn); + else if (iClearAttMask & KEntryAttSystem) + systemPopup->SetCurrentValueIndex(KAttOff); + + if (iRecurse) + recursePopup->SetCurrentValueIndex(KAttEnableRecursion); + else + recursePopup->SetCurrentValueIndex(KAttDisableRecursion); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserAttributeEditorDlg::OkToExitL(TInt aButtonId) + { + if (aButtonId == EAknSoftkeyOk) + { + // save changes + CAknPopupFieldText* archivePopup = static_cast(Control(EFileBrowserAttributeEditorSetArchive)); + CAknPopupFieldText* hiddenPopup = static_cast(Control(EFileBrowserAttributeEditorSetHidden)); + CAknPopupFieldText* readOnlyPopup = static_cast(Control(EFileBrowserAttributeEditorSetReadOnly)); + CAknPopupFieldText* systemPopup = static_cast(Control(EFileBrowserAttributeEditorSetSystem)); + CAknPopupFieldText* recursePopup = static_cast(Control(EFileBrowserAttributeEditorSetRecurse)); + + iSetAttMask = 0; + iClearAttMask = 0; + + if (archivePopup->CurrentValueIndex() == KAttOn) + iSetAttMask |= KEntryAttArchive; + else if (archivePopup->CurrentValueIndex() == KAttOff) + iClearAttMask |= KEntryAttArchive; + + if (hiddenPopup->CurrentValueIndex() == KAttOn) + iSetAttMask |= KEntryAttHidden; + else if (hiddenPopup->CurrentValueIndex() == KAttOff) + iClearAttMask |= KEntryAttHidden; + + if (readOnlyPopup->CurrentValueIndex() == KAttOn) + iSetAttMask |= KEntryAttReadOnly; + else if (readOnlyPopup->CurrentValueIndex() == KAttOff) + iClearAttMask |= KEntryAttReadOnly; + + if (systemPopup->CurrentValueIndex() == KAttOn) + iSetAttMask |= KEntryAttSystem; + else if (systemPopup->CurrentValueIndex() == KAttOff) + iClearAttMask |= KEntryAttSystem; + + if (recursePopup->CurrentValueIndex() == KAttEnableRecursion) + iRecurse = ETrue; + else if (recursePopup->CurrentValueIndex() == KAttDisableRecursion) + iRecurse = EFalse; + } + + return ETrue; + } +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserAttributeEditorDlg::RunEditorLD() + { + return ExecuteLD(R_ATTRIBUTE_EDITOR_FORM_DIALOG); + } + + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + + +CFileBrowserSearchQueryDlg* CFileBrowserSearchQueryDlg::NewL(TSearchAttributes& aSearchAttributes) + { + CFileBrowserSearchQueryDlg* self = new(ELeave) CFileBrowserSearchQueryDlg(aSearchAttributes); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserSearchQueryDlg::~CFileBrowserSearchQueryDlg() + { + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserSearchQueryDlg::CFileBrowserSearchQueryDlg(TSearchAttributes& aSearchAttributes) : + iSearchAttributes(aSearchAttributes) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSearchQueryDlg::ConstructL() + { + CAknForm::ConstructL(); + + // set title text + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("Search") ); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSearchQueryDlg::PreLayoutDynInitL() + { + CAknForm::PreLayoutDynInitL(); + + // set default LSK label + ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, _L("Search")); + + // load values + CEikEdwin* searchDir = static_cast(Control(EFileBrowserSearchQuerySearchDir)); + CEikEdwin* wildCards = static_cast(Control(EFileBrowserSearchQueryWildCards)); + CEikEdwin* textInFile = static_cast(Control(EFileBrowserSearchQueryTextInFile)); + CEikNumberEditor* minSize = static_cast(Control(EFileBrowserSearchQueryMinSize)); + CEikNumberEditor* maxSize = static_cast(Control(EFileBrowserSearchQueryMaxSize)); + CEikDateEditor* minDate = static_cast(Control(EFileBrowserSearchQueryMinDate)); + CEikDateEditor* maxDate = static_cast(Control(EFileBrowserSearchQueryMaxDate)); + CAknPopupFieldText* recurse = static_cast(Control(EFileBrowserSearchQueryRecurse)); + + searchDir->SetTextL(&iSearchAttributes.iSearchDir); + wildCards->SetTextL(&iSearchAttributes.iWildCards); + textInFile->SetTextL(&iSearchAttributes.iTextInFile); + minSize->SetNumber(iSearchAttributes.iMinSize); + maxSize->SetNumber(iSearchAttributes.iMaxSize); + minDate->SetDate(iSearchAttributes.iMinDate); + maxDate->SetDate(iSearchAttributes.iMaxDate); + recurse->SetCurrentValueIndex(iSearchAttributes.iRecurse); + } +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserSearchQueryDlg::OkToExitL(TInt aButtonId) + { + if (aButtonId == EAknSoftkeyOk) + { + // save changes + CEikEdwin* searchDir = static_cast(Control(EFileBrowserSearchQuerySearchDir)); + CEikEdwin* wildCards = static_cast(Control(EFileBrowserSearchQueryWildCards)); + CEikEdwin* textInFile = static_cast(Control(EFileBrowserSearchQueryTextInFile)); + CEikNumberEditor* minSize = static_cast(Control(EFileBrowserSearchQueryMinSize)); + CEikNumberEditor* maxSize = static_cast(Control(EFileBrowserSearchQueryMaxSize)); + CEikDateEditor* minDate = static_cast(Control(EFileBrowserSearchQueryMinDate)); + CEikDateEditor* maxDate = static_cast(Control(EFileBrowserSearchQueryMaxDate)); + CAknPopupFieldText* recurse = static_cast(Control(EFileBrowserSearchQueryRecurse)); + + // get the current value of search dir and make sure it has a trailing backslash + TFileName searchDirBuf; + searchDir->GetText(searchDirBuf); + if (searchDirBuf.Length() && searchDirBuf[searchDirBuf.Length()-1] != '\\') + searchDirBuf.Append('\\'); + + // check that the path is valid + if (searchDirBuf.Length() && !EikFileUtils::PathExists(searchDirBuf)) + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Given search directory does not exists")); + + return EFalse; + } + + iSearchAttributes.iSearchDir = searchDirBuf; + wildCards->GetText(iSearchAttributes.iWildCards); + textInFile->GetText(iSearchAttributes.iTextInFile); + iSearchAttributes.iMinSize = minSize->Number(); + iSearchAttributes.iMaxSize = maxSize->Number(); + iSearchAttributes.iMinDate = minDate->Date(); + iSearchAttributes.iMaxDate = maxDate->Date(); + // Adjust the MaxDate to the end of the day: + iSearchAttributes.iMaxDate += TTimeIntervalMicroSeconds( KAlmostaDayInMicroSeconds ); + iSearchAttributes.iRecurse = recurse->CurrentValueIndex(); + } + + return ETrue; + } +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserSearchQueryDlg::RunQueryLD() + { + return ExecuteLD(R_SEARCH_QUERY_FORM_DIALOG); + } + + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + + +CFileBrowserDataTypesDlg* CFileBrowserDataTypesDlg::NewL() + { + CFileBrowserDataTypesDlg* self = new(ELeave) CFileBrowserDataTypesDlg(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserDataTypesDlg::~CFileBrowserDataTypesDlg() + { + delete iDTArray; + + iLs.Close(); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserDataTypesDlg::CFileBrowserDataTypesDlg() + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::ConstructL() + { + // construct a menu bar + CAknDialog::ConstructL(R_FILEBROWSER_DATA_TYPES_MENUBAR); + + // set title text + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("Data types") ); + + User::LeaveIfError(iLs.Connect()); + + iDTArray = new(ELeave) CDataTypeArray(32); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + // reserved for future extensions; + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::ProcessCommandL(TInt aCommandId) + { + CAknDialog::ProcessCommandL(aCommandId); + + switch (aCommandId) + { + case EFileBrowserCmdDataTypesChangeMapping: + ChangeMappingL(); + break; + case EFileBrowserCmdDataTypesSetDefaultMapping: + SetDefaultMappingL(); + break; + case EFileBrowserCmdDataTypesRefresh: + GetDataTypesL(); + break; + case EFileBrowserCmdDataTypesExit: + TryExitL(EAknCmdExit); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::PreLayoutDynInitL() + { + CAknDialog::PreLayoutDynInitL(); + + iListBox = static_cast( Control(EFileBrowserDataTypesList) ); + iListBox->SetContainerWindowL(*this); + iListBox->View()->SetListEmptyTextL(_L("No data types")); + + iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + iListBox->SetListBoxObserver(this); + + iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); + + GetDataTypesL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::GetDataTypesL() + { + // get an instance of the listbox's item array + MDesCArray* tempArray = iListBox->Model()->ItemTextArray(); + CDesCArray* listBoxArray = (CDesCArray*)tempArray; + listBoxArray->Reset(); + + // create an icon array + CAknIconArray* iconArray = new(ELeave) CAknIconArray(32); + CleanupStack::PushL(iconArray); + + // get data types + iDTArray->Reset(); + User::LeaveIfError(iLs.GetSupportedDataTypesL(*iDTArray)); + + // sort the array + TKeyArrayFix key(0, ECmpFolded8); // iDataType is located in offset 0 and contain 8-bit descriptor + iDTArray->Sort(key); + + + // loop each data type + for (TInt i=0; iCount(); i++) + { + TDataType& dt = iDTArray->At(i); + + // get app uid which handles this data type + TUid appUid; + TInt err = iLs.AppForDataType(dt, appUid); + + // generate icon which is the app icon which handles this mime type + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + CGulIcon* appIcon = NULL; + + TRAPD(err2, + AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appUid, EAknsAppIconTypeList, bitmap, mask); + appIcon = CGulIcon::NewL(bitmap, mask); + CleanupStack::Pop(2); //bitmap, mask + ); + + // append to the icon array + appIcon->SetBitmapsOwnedExternally(EFalse); + iconArray->AppendL(appIcon); + + TFileName entry; + entry.AppendNum(i); + entry.Append(_L("\t")); + entry.Append(dt.Des()); + entry.Append(_L(" <<")); + + + // get caption of the handling app + TFileName appCaption; + + if (err || err2 || appUid == KNullUid) + entry.Append(_L("none")); + else + { + TApaAppInfo appInfo; + + if (iLs.GetAppInfo(appInfo, appUid) == KErrNone) + entry.Append(appInfo.iCaption); + else + entry.Append(_L("none")); + } + + entry.Append(_L(">>")); + + listBoxArray->AppendL( entry ); + } + + + // clear any previous icon array + CAknIconArray* oldIconArray = static_cast(iListBox->ItemDrawer()->ColumnData()->IconArray()); + if (oldIconArray) + delete oldIconArray; + + + CleanupStack::Pop(); //iconArray + + // updates the listbox + iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray); + iListBox->HandleItemAdditionL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::ChangeMappingL() + { + TInt currentItemIndex = iListBox->CurrentItemIndex(); + + if (iDTArray->Count() > currentItemIndex && currentItemIndex >= 0) + { + // create list of TApaAppInfo + CArrayFixFlat* appInfoArray = new(ELeave) CArrayFixFlat(64); + CleanupStack::PushL(appInfoArray); + + // get list of applications + TApaAppInfo appInfo; + User::LeaveIfError(iLs.GetAllApps()); + + while (iLs.GetNextApp(appInfo) == KErrNone) + { + appInfoArray->AppendL(appInfo); + } + + // sort the array + TKeyArrayFix key(_FOFF(TApaAppInfo,iCaption), ECmpFolded16); + appInfoArray->Sort(key); + + // create a popup with listbox + CAknSingleGraphicPopupMenuStyleListBox* listBox = new(ELeave) CAknSingleGraphicPopupMenuStyleListBox(); + CleanupStack::PushL(listBox); + CAknPopupList* popupList = CAknPopupList::NewL(listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuGraphicWindow ); + CleanupStack::PushL(popupList); + listBox->ConstructL( popupList, 0 ); + listBox->CreateScrollBarFrameL(ETrue); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + listBox->View()->SetListEmptyTextL(_L("No apps")); + listBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + listBox->Model()->SetOwnershipType(ELbmOwnsItemArray); + popupList->SetTitleL(_L("Select app")); + popupList->EnableFind(); + + + // get an instance of the listbox's item array + MDesCArray* tempArray = listBox->Model()->ItemTextArray(); + CDesCArray* listBoxArray = (CDesCArray*)tempArray; + + // create an icon array + CAknIconArray* iconArray = new(ELeave) CAknIconArray(32); + CleanupStack::PushL(iconArray); + + // loop each app info + for (TInt i=0; iCount(); i++) + { + + // get icon of this app + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + CGulIcon* appIcon = NULL; + + TRAP_IGNORE( + AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appInfoArray->At(i).iUid, EAknsAppIconTypeList, bitmap, mask); + appIcon = CGulIcon::NewL(bitmap, mask); + CleanupStack::Pop(2); //bitmap, mask + ); + + // append to the icon array + appIcon->SetBitmapsOwnedExternally(EFalse); + iconArray->AppendL(appIcon); + + TFileName entry; + entry.AppendNum(i); + entry.Append(_L("\t")); + entry.Append(appInfoArray->At(i).iCaption); + + listBoxArray->AppendL(entry); + } + + + CleanupStack::Pop(); //iconArray + + // updates the listbox + listBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray); + listBox->HandleItemAdditionL(); + + + // execute the popup to query the application + if (popupList->ExecuteLD()) + { + + // query priority + TInt queryIndex(0); + CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex); + + if (listQueryDlg->ExecuteLD(R_DATA_TYPE_PRIORITY_QUERY)) + { + TInt32 selectedPriority(0); + + if (queryIndex == EDataTypePriorityMaximum) + selectedPriority = KDataTypeUnTrustedPriorityThreshold; + else if (queryIndex == EDataTypePriorityHigh) + selectedPriority = KDataTypePriorityHigh; + else if (queryIndex == EDataTypePriorityNormal) + selectedPriority = KDataTypePriorityNormal; + else if (queryIndex == EDataTypePriorityLow) + selectedPriority = KDataTypePriorityLow; + else + selectedPriority = KDataTypePriorityLastResort; + + + TApaAppInfo& selectedAppInfo = appInfoArray->At(listBox->CurrentItemIndex()); + + if (iLs.InsertDataMapping(iDTArray->At(currentItemIndex), selectedPriority, selectedAppInfo.iUid) == KErrNone) + { + GetDataTypesL(); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Mapping changed")); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Unable to change mapping")); + } + } + } + + CleanupStack::Pop(); // popupList + CleanupStack::PopAndDestroy(2); // listBox, appInfoArray + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserDataTypesDlg::SetDefaultMappingL() + { + TInt currentItemIndex = iListBox->CurrentItemIndex(); + + if (iDTArray->Count() > currentItemIndex && currentItemIndex >= 0) + { + if (iLs.DeleteDataMapping(iDTArray->At(currentItemIndex)) == KErrNone) + { + GetDataTypesL(); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Restored default")); + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Nothing to restore")); + } + } + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserDataTypesDlg::OkToExitL(TInt aButtonId) + { + return CAknDialog::OkToExitL(aButtonId); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserDataTypesDlg::RunQueryLD() + { + return ExecuteLD(R_DATA_TYPES_DIALOG); + } + +// -------------------------------------------------------------------------------------------- + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBFileEditor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBFileEditor.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1300 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBFileEditor.h" +#include "FBStd.h" +#include "FB.hrh" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TUint KLeftMargin = 2; +const TUint KRightMargin = 2; +const TUint KHexSeparatorMargin = 4; + +const TInt KEditorFontHeight = 117; +const TInt KViewerFontHeight = 117; +const TInt KEditorFontHeightQHD = 100; +const TInt KViewerFontHeightQHD = 100; + + + +// ================= MEMBER FUNCTIONS ======================= + +CFileBrowserFileEditorDlg* CFileBrowserFileEditorDlg::NewL(const TDesC& aFileName, TInt aMode) + { + CFileBrowserFileEditorDlg* self = new(ELeave) CFileBrowserFileEditorDlg(aFileName, aMode); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileEditorDlg::~CFileBrowserFileEditorDlg() + { + if (iEditorPF) + delete iEditorPF; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileEditorDlg::CFileBrowserFileEditorDlg(const TDesC& aFileName, TInt aMode) : + iFileName(aFileName), iActiveMode(aMode) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::ConstructL() + { + // construct a menu bar + if (iActiveMode == EFileEditorEditAsText || iActiveMode == EFileEditorEditAsHex) + CAknDialog::ConstructL(R_FILEBROWSER_FILEEDITOR_MENUBAR); + else + CAknDialog::ConstructL(R_FILEBROWSER_FILEVIEWER_MENUBAR); + + iTextFormat = EFileBrowserCmdFileEditorSaveFormatANSIASCII; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::PreLayoutDynInitL() + { + CAknDialog::PreLayoutDynInitL(); + + // set title text + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("File editor") ); + + + // init edwin editor component + if (iActiveMode == EFileEditorEditAsText || iActiveMode == EFileEditorEditAsHex) + { + CCoeControl* control = CreateLineByTypeL(KNullDesC, EFileEditorDialogId, EEikCtEdwin, NULL); + iTextEditor = static_cast(control); + iTextEditor->SetMopParent(this); + iTextEditor->ConstructL(EEikEdwinOwnsWindow|EEikEdwinNoHorizScrolling|EEikEdwinInclusiveSizeFixed|EEikEdwinNoAutoSelection, 0, 0, 0 ); + iTextEditor->CreateTextViewL(); + iTextEditor->SetAknEditorFlags(EAknEditorFlagEnableScrollBars); + iTextEditor->CreateScrollBarFrameL(); + iTextEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + iTextEditor->ForceScrollBarUpdateL(); + iTextEditor->SetBackgroundColorL(KRgbWhite); + iTextEditor->SetFocus(ETrue); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::PostLayoutDynInitL() + { + CAknDialog::PostLayoutDynInitL(); + + // modify layout of the texteditor + if (iActiveMode == EFileEditorEditAsText || iActiveMode == EFileEditorEditAsHex) + { + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + const TSize screenSize = dev->SizeInPixels(); + + // Set the font of the editor + TFontSpec fontSpec = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont)->FontSpecInTwips(); + fontSpec.iHeight = IsQHD(screenSize) ? KEditorFontHeightQHD : KEditorFontHeight; // set height + + TCharFormat cf(fontSpec.iTypeface.iName, fontSpec.iHeight); + cf.iFontPresentation.iTextColor = KRgbBlack; + + TCharFormatMask cfm; + cfm.SetAll(); + + CCharFormatLayer *charFL = CCharFormatLayer::NewL(cf, cfm); + iTextEditor->SetCharFormatLayer(charFL); + + if (iEditorPF) + { + delete iEditorPF; + iEditorPF = NULL; + } + + iEditorPF = CParaFormat::NewL(); + iEditorPF->iLineSpacingInTwips = IsQHD(screenSize) ? KEditorFontHeightQHD : KEditorFontHeight; + iEditorPF->iFillColor = KRgbWhite; + + TParaFormatMask pfm; + pfm.SetAll(); + + CParaFormatLayer *paraFL = CParaFormatLayer::NewL(iEditorPF, pfm); + iTextEditor->SetParaFormatLayer(paraFL); + + + // set size of the editor + TRect rect = Rect(); + iTextEditor->SetRect(rect); + //iTextEditor->Size().iWidth - (CEikScrollBar::DefaultScrollBarBreadth()); + } + + // load the file to editor or viewer + LoadFileL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::OpenFileLC(RFile& aFile, const TDesC& aFileName) + { + TInt err = aFile.Open(CEikonEnv::Static()->FsSession(), aFileName, EFileRead|EFileShareReadersOnly); + + if (err == KErrInUse) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("The file is in use, cannot open")); + User::Leave(KErrNone); + } + else if (err != KErrNone) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Cannot open the file")); + User::Leave(KErrNone); + } + else + { + // opened succesfully, add to cleanup stack + CleanupClosePushL(aFile); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::GetTextFileMode(RFile& aFile, TInt& aFileSize) + { + iTextFormat = EFileBrowserCmdFileEditorSaveFormatANSIASCII; + + // if we are working with text files, check the type first + if (iActiveMode == EFileEditorEditAsText || iActiveMode == EFileEditorViewAsText) + { + TBuf8<4> BOM; + + // first check for UTF-16 + if (aFileSize >= 2 && aFile.Read(0, BOM, 2) == KErrNone) + { + if (BOM.Length()==2 && BOM[0]==0xFF && BOM[1]==0xFE) + { + iTextFormat = EFileBrowserCmdFileEditorSaveFormatUTF16LE; + aFileSize -= 2; + return; + } + else if (BOM.Length()==2 && BOM[0]==0xFE && BOM[1]==0xFF) + { + iTextFormat = EFileBrowserCmdFileEditorSaveFormatUTF16BE; + aFileSize -= 2; + return; + } + } + + // then check for UTF-8 + if (aFileSize >= 3 && aFile.Read(0, BOM, 3) == KErrNone) + { + if (BOM.Length()==3 && BOM[0]==0xEF && BOM[1]==0xBB && BOM[2]==0xBF) + { + iTextFormat = EFileBrowserCmdFileEditorSaveFormatUTF8; + aFileSize -= 3; + return; + } + } + + + // none of those, seek back to beginning + TInt pos(0); + aFile.Seek(ESeekStart, pos); + } + } + + +// -------------------------------------------------------------------------------------------- + +HBufC16* CFileBrowserFileEditorDlg::ConvertBuf8ToBuf16L(HBufC8* aBuf8) + { + __ASSERT_ALWAYS(aBuf8 != NULL, User::Panic(_L("Emp.Buf."),942)); + + HBufC16* buf16 = NULL; + TPtr8 buf8Ptr(aBuf8->Des()); + + if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatANSIASCII) + { + // simple conversion + buf16 = HBufC16::NewMaxL(aBuf8->Length()); + buf16->Des().Copy(aBuf8->Des()); + } + + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF8) + { + // use the conversion service + buf16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aBuf8->Des()); + } + + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16LE || iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16BE) + { + buf16 = HBufC16::NewL(aBuf8->Length()); + buf16->Des().Copy(KNullDesC); + + HBufC16* oneUniCodeChar = HBufC16::NewMaxLC(1); + TUint16* oneUniCodeCharPtr = &oneUniCodeChar->Des()[0]; + + for (TInt i=0; iDes().Append( oneUniCodeChar->Des() ); + } + + CleanupStack::PopAndDestroy(); // oneUniCodeChar + } + + return buf16; //ownership of buf16 will transferred to the caller + } + +// -------------------------------------------------------------------------------------------- + +HBufC8* CFileBrowserFileEditorDlg::ConvertBuf16ToBuf8L(HBufC16* aBuf16) + { + __ASSERT_ALWAYS(aBuf16 != NULL, User::Panic(_L("Emp.Buf."),943)); + + HBufC8* buf8 = NULL; + TPtr16 buf16Ptr(aBuf16->Des()); + + if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatANSIASCII) + { + // simple conversion + buf8 = HBufC8::NewMaxL(aBuf16->Length()); + buf8->Des().Copy(aBuf16->Des()); + } + + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF8) + { + // use the conversion service + buf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aBuf16->Des()); + } + + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16LE || iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16BE) + { + buf8 = HBufC8::NewL(aBuf16->Length()*2); + buf8->Des().Copy(KNullDesC); + + TUint16* charPtr = NULL; + TBuf8<2> twoChars; + twoChars.Copy(_L8("XX")); + + for (TInt i=0; iLength(); i++) + { + charPtr = &aBuf16->Des()[i]; + + // get 16-bit character to two variables + if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16LE) + { + twoChars[0] = TUint8(charPtr[0]); + twoChars[1] = TUint8(charPtr[0] << 8); + } + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16BE) + { + twoChars[0] = TUint8(charPtr[0] << 8); + twoChars[1] = TUint8(charPtr[0]); + } + + // append to the buffer + buf8->Des().Append(twoChars); + + } // for + + } // else if + + return buf8; //ownership of buf8 will transferred to the caller + } +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::LoadFileL() + { + // open the file for reading + RFile fileP; + OpenFileLC(fileP, iFileName); + + // get file size + TInt fileSize(0); + User::LeaveIfError(fileP.Size(fileSize)); + + // read BOM from file + GetTextFileMode(fileP, fileSize); + + + // editor related file loading + if (iActiveMode == EFileEditorEditAsText || iActiveMode == EFileEditorEditAsHex) + { + // make sure that there is currently no text in the editor + iTextEditor->Text()->Reset(); + + // set character handling related cases for the editor + if (iActiveMode == EFileEditorEditAsText) + { + iTextEditor->SetOnlyASCIIChars(EFalse); + iTextEditor->SetAknEditorCase(EAknEditorTextCase); + } + else if (iActiveMode == EFileEditorEditAsHex) + { + iTextEditor->SetOnlyASCIIChars(ETrue); + iTextEditor->SetAknEditorCase(EAknEditorUpperCase); + } + + const TInt KBufSize(1024); + TInt fileOffset(0); + TInt printOffset(0); + + HBufC8* buf = HBufC8::NewLC(KBufSize); + TPtr8 bufPtr(buf->Des()); + TChar ch; + _LIT(KHex, "%02x"); + TBuf<3> hexBuf; + + // read to buffer and supply the editor + while (fileOffset < fileSize) + { + // read to buffer + User::LeaveIfError( fileP.Read(bufPtr, KBufSize) ); + + // handle in text format + if (iActiveMode == EFileEditorEditAsText) + { + HBufC16* buf16 = ConvertBuf8ToBuf16L(buf); + CleanupStack::PushL(buf16); + TPtr16 buf16Ptr(buf16->Des()); + + // replace any line breaks and append to the editor + for (TInt i=0; iText()->InsertL(printOffset, ch); + printOffset++; + } + + CleanupStack::PopAndDestroy(); // buf16 + } + + // or handle in hex format + else if (iActiveMode == EFileEditorEditAsHex) + { + for (TInt i=0; iText()->InsertL(printOffset, hexBuf); + printOffset += 3; + } + } + + fileOffset += bufPtr.Length(); + } + + CleanupStack::PopAndDestroy(); // buf + + // make sure that the cursor position is in the beginning + iTextEditor->SetCursorPosL(0, EFalse); + iTextEditor->NotifyNewDocumentL(); + iTextEditor->UpdateScrollBarsL(); + } + + + // viewer related file loading + else if (iActiveMode == EFileEditorViewAsText || iActiveMode == EFileEditorViewAsHex) + { + // load the entire file to buffer + HBufC8* buf = HBufC8::NewLC(fileSize); + TPtr8 bufPtr(buf->Des()); + + User::LeaveIfError( fileP.Read(bufPtr, fileSize) ); + + // send the buffer to viewer + if (iActiveMode == EFileEditorViewAsText) + { + HBufC16* buf16 = ConvertBuf8ToBuf16L(buf); + CleanupStack::PopAndDestroy(); // buf + iViewer->FormatAsTextL(buf16); + } + + else if (iActiveMode == EFileEditorViewAsHex) + { + iViewer->FormatAsHexL(buf); + CleanupStack::Pop(); // buf + } + } + + CleanupStack::PopAndDestroy(); // fileP + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::SaveEditorDataL(TBool aQueryNewName) + { + TBool doSave(ETrue); + CPlainText* docText = iTextEditor->Text(); + TInt docLength = docText->DocumentLength(); + + TFileName fileName; + fileName.Copy(iFileName); + + // check that format of the file is valid + if (iActiveMode == EFileEditorEditAsHex) + { + // check every 3rd char is a space + for (TInt i=2; iRead(i, 1); + if (docPtr.Length() < 1 || docPtr[0] != ' ') + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Separate hex blocks with space!")); + return; + } + } + + // check for valid chars + for (TInt i=0; iRead(i, 2); + if (docPtr.Length() < 2 || !IsHexChar(docPtr[0]) || !IsHexChar(docPtr[1])) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Use only hex characters!")); + return; + } + } + } + + + // query new file name + if (aQueryNewName) + { + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(fileName); + textQuery->SetPromptL(_L("Full path:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + doSave = ETrue; + } + else + { + doSave = EFalse; + } + } + + + // continue with writing + if (doSave) + { + RFile fileP; + TInt err = fileP.Replace(CEikonEnv::Static()->FsSession(), fileName, EFileWrite); + + if (err == KErrNone) + { + CleanupClosePushL(fileP); + + const TInt KBufSize(1002); + TInt fileOffset(0); + TInt docOffset(0); + TLex converter; + TUint hexValue(0); + + // write BOM for text files + if (iActiveMode == EFileEditorEditAsText) + { + if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16LE) + { + TBuf8<2> BOM; + BOM.Append(0xFF); + BOM.Append(0xFE); + + if (fileP.Write(0, BOM, 2) == KErrNone) + fileOffset += 2; + } + + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16BE) + { + TBuf8<2> BOM; + BOM.Append(0xFE); + BOM.Append(0xFF); + + if (fileP.Write(0, BOM, 2) == KErrNone) + fileOffset += 2; + } + + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF8) + { + TBuf8<3> BOM; + BOM.Append(0xEF); + BOM.Append(0xBB); + BOM.Append(0xBF); + + if (fileP.Write(0, BOM, 3) == KErrNone) + fileOffset += 3; + } + } + + + HBufC8* buf = HBufC8::NewLC(KBufSize * 2); + TPtr8 bufPtr(buf->Des()); + + while (docOffset < docLength) + { + // get text from storage + TPtrC docPtr = docText->Read(docOffset, KBufSize); + bufPtr.Copy(KNullDesC); + + if (iActiveMode == EFileEditorEditAsText) + { + HBufC16* convBuf = HBufC16::NewLC(docPtr.Length()); + convBuf->Des().Copy(KNullDesC); + + // convert to line breaks first + for (TInt i=0; iDes().Append('\n'); + else + convBuf->Des().Append(docPtr[i]); + } + + HBufC8* buf8 = ConvertBuf16ToBuf8L(convBuf); + + // make sure the sizes are correct + if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatANSIASCII || iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF8) + { + bufPtr.Copy(buf8->Des().Left(convBuf->Length())); + } + else if (iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16LE || iTextFormat == EFileBrowserCmdFileEditorSaveFormatUTF16BE) + { + bufPtr.Copy(buf8->Des().Left(convBuf->Length()*2)); + } + + delete buf8; + buf8 = NULL; + + CleanupStack::PopAndDestroy(); // convBuf + } + + else if (iActiveMode == EFileEditorEditAsHex) + { + for (TInt i=0; i= docPtr.Length() - 1) + break; + + TBuf<3> buf2; + buf2.Append(docPtr[i]); + buf2.Append(docPtr[i+1]); + + // convert from hex to decimal + converter.Assign(buf2); + if (converter.Val(hexValue, EHex) == KErrNone) + { + bufPtr.Append(hexValue); + } + } + } + + // write to a file + err = fileP.Write(fileOffset, bufPtr, bufPtr.Length()); + if (err != KErrNone) + break; + + docOffset += docPtr.Length(); + fileOffset += bufPtr.Length(); + } + + CleanupStack::PopAndDestroy(2); // buf, fileP + } + + if (err == KErrNone) + { + // remember the new file name if save was succesfull + iFileName.Copy(fileName); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Saved succesfully")); + } + else if (err == KErrInUse) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("The file is in use, cannot write")); + User::Leave(KErrNone); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Cannot write to the file")); + User::Leave(KErrNone); + } + } + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileEditorDlg::IsHexChar(TInt aCh) + { + if (aCh >= '0' && aCh <= '9') + return ETrue; + else if (aCh >= 'a' && aCh <= 'f') + return ETrue; + else if (aCh >= 'A' && aCh <= 'F') + return ETrue; + else + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::ProcessCommandL(TInt aCommandId) + { + CAknDialog::ProcessCommandL(aCommandId); + + switch (aCommandId) + { + case EFileBrowserCmdFileEditorViewAsText: + { + iActiveMode = EFileEditorViewAsText; + LoadFileL(); + } + break; + + case EFileBrowserCmdFileEditorViewAsHex: + { + iActiveMode = EFileEditorViewAsHex; + LoadFileL(); + } + break; + +// + case EFileBrowserCmdFileEditorSave: + { + SaveEditorDataL(); + } + break; + + case EFileBrowserCmdFileEditorSaveAs: + { + SaveEditorDataL(ETrue); + } + break; + + case EFileBrowserCmdFileEditorSaveFormatANSIASCII: + case EFileBrowserCmdFileEditorSaveFormatUTF8: + case EFileBrowserCmdFileEditorSaveFormatUTF16LE: + case EFileBrowserCmdFileEditorSaveFormatUTF16BE: + { + iTextFormat = aCommandId; + } + break; + + case EFileBrowserCmdFileEditorEditAsText: + { + iActiveMode = EFileEditorEditAsText; + LoadFileL(); + } + break; + + case EFileBrowserCmdFileEditorEditAsHex: + { + iActiveMode = EFileEditorEditAsHex; + LoadFileL(); + } + break; + +// + case EFileBrowserCmdFileEditorExit: + TryExitL(EAknCmdExit); + break; + + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + if (aResourceId == R_FILEBROWSER_FILEVIEWER_MENUPANE) + { + aMenuPane->SetItemDimmed(EFileBrowserCmdFileEditorViewAsText, iActiveMode == EFileEditorViewAsText); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileEditorViewAsHex, iActiveMode == EFileEditorViewAsHex); + } + else if (aResourceId == R_FILEBROWSER_FILEEDITOR_MENUPANE) + { + aMenuPane->SetItemDimmed(EFileBrowserCmdFileEditorEditAsText, iActiveMode == EFileEditorEditAsText); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileEditorEditAsHex, iActiveMode == EFileEditorEditAsHex); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileEditorSaveFormat, iActiveMode == EFileEditorEditAsHex); + } + else if (aResourceId == R_FILEBROWSER_FILEEDITOR_SAVEFORMAT_SUBMENU) + { + aMenuPane->SetItemButtonState(iTextFormat, EEikMenuItemSymbolOn); + } + } + +// -------------------------------------------------------------------------------------------- + +SEikControlInfo CFileBrowserFileEditorDlg::CreateCustomControlL(TInt aControlType) + { + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + + if (aControlType == EFileViewerDialogControl) + { + // create a control + iViewer = new(ELeave) CFileBrowserFileEditorViewControl(); + iViewer->SetMopParent(this); + iViewer->ConstructL(); + + controlInfo.iControl = iViewer; + } + + return controlInfo; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorDlg::SetSizeAndPosition(const TSize& /*aSize*/) + { + // fill whole window + TRect mainPaneRect; + TRect naviPaneRect; + + if (Layout_Meta_Data::IsLandscapeOrientation() || + iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); + mainPaneRect.iTl.iY = naviPaneRect.Height(); + } + + SetRect(mainPaneRect); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileEditorDlg::RunDlgLD() + { + if (iActiveMode == EFileEditorViewAsText || iActiveMode == EFileEditorViewAsHex) + return ExecuteLD(R_FILEBROWSER_FILEVIEWER_DIALOG); + else + return ExecuteLD(R_FILEBROWSER_FILEEDITOR_DIALOG); + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileEditorViewControl::~CFileBrowserFileEditorViewControl() + { + ResetVariables(); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileEditorViewControl::CFileBrowserFileEditorViewControl() + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::ConstructL() + { + CreateWindowL(); + SetBlank(); + SetRect(Rect()); + ActivateL(); + + iTotalNumberOfLines = 0; + } + +// -------------------------------------------------------------------------------------------- + +TSize CFileBrowserFileEditorViewControl::MinimumSize() + { + TRect mainPaneRect; + TRect naviPaneRect; + + if (Layout_Meta_Data::IsLandscapeOrientation() || + iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); + mainPaneRect.iTl.iY = naviPaneRect.Height(); + } + + return mainPaneRect.Size(); + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CFileBrowserFileEditorViewControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if(aType != EEventKey) + return EKeyWasNotConsumed; + + // normally scroll only one line + TInt scrollLines(1); + + // with special keys scroll iNumberOfLinesFitsScreen-1 lines instead + if (aKeyEvent.iCode == EKeyIncVolume || aKeyEvent.iCode=='#' || aKeyEvent.iCode == EKeyDecVolume || aKeyEvent.iCode=='*') + scrollLines = iNumberOfLinesFitsScreen-1; + + + if (aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyIncVolume || aKeyEvent.iCode=='#') + { + if (iCurrentLine > 0) + { + iCurrentLine -= scrollLines; + + if (iCurrentLine < 0) + iCurrentLine = 0; + + UpdateScrollBarL(); + DrawNow(); + } + + return EKeyWasConsumed; + } + + else if (aKeyEvent.iCode == EKeyDownArrow || aKeyEvent.iCode == EKeyDecVolume || aKeyEvent.iCode=='*') + { + if (iActiveMode == EFileEditorViewAsText) + { + // no need to scroll text if it fits to the screen + if (iTotalNumberOfLines <= iNumberOfLinesFitsScreen) + return EKeyWasConsumed; + + iCurrentLine += scrollLines; + + // adjust the last line to end of the screen + if (iCurrentLine > iTotalNumberOfLines - iNumberOfLinesFitsScreen) + iCurrentLine = iTotalNumberOfLines - iNumberOfLinesFitsScreen; + } + else if (iActiveMode == EFileEditorViewAsHex) + { + iCurrentLine += scrollLines; + + // last line can be first line on the screen + if (iCurrentLine > iTotalNumberOfLines - 1) + iCurrentLine = iTotalNumberOfLines - 1; + } + + UpdateScrollBarL(); + DrawNow(); + + return EKeyWasConsumed; + } + + return EKeyWasNotConsumed; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::FormatAsTextL(HBufC16* aBuf) + { + if (aBuf == NULL) + ResetVariables(EFalse); + else + ResetVariables(); + + InitVariables(); + iActiveMode = EFileEditorViewAsText; + + // store the bugger + if (aBuf != NULL) + iTextBuf = aBuf; + + iWrappedTextArray = new(ELeave) CArrayFixFlat(32); + + // wrap to array + AknTextUtils::WrapToArrayL(iTextBuf->Des(), iDrawingWidth, *iFont, *iWrappedTextArray); + iTotalNumberOfLines = iWrappedTextArray->Count(); + + // count amount of lines fits to screen + iNumberOfLinesFitsScreen = TInt(iViewerRect.Height() / (iFont->HeightInPixels())); + + // update scroll bars + UpdateScrollBarL(); + + // update the screen + DrawNow(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::FormatAsHexL(HBufC8* aBuf) + { + if (aBuf == NULL) + ResetVariables(EFalse); + else + ResetVariables(); + + InitVariables(); + iActiveMode = EFileEditorViewAsHex; + + // store the buffer + if (aBuf != NULL) + iHexesBuffer = aBuf; + + // calculate amount of hex values fits to the screen + TUint charWidth = iFont->CharWidthInPixels('X'); + iHexGrougWidth = charWidth*2 + TInt (KHexSeparatorMargin*iX_factor); + iAmountOfHexesFitsHorizontally = TUint( iDrawingWidth / iHexGrougWidth ); + + // calculate total number of files + iTotalNumberOfLines = iHexesBuffer->Length() / iAmountOfHexesFitsHorizontally + 1; + + // count amount of lines fits to screen + iNumberOfLinesFitsScreen = TInt(iViewerRect.Height() / iFont->HeightInPixels()) - 1; + + // update scroll bars + UpdateScrollBarL(); + + // update the screen + DrawNow(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::InitVariables() + { + iCurrentLine = 0; + + // calculate layout data + TRect mainPaneRect; + TRect naviPaneRect; + + if (Layout_Meta_Data::IsLandscapeOrientation() || + iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); + mainPaneRect.iTl.iY = naviPaneRect.Height(); + } + + iViewerRect = TRect(mainPaneRect.Size()); + + iX_factor = TReal(iViewerRect.Width()) / 176; + iY_factor = TReal(iViewerRect.Height()) / 144; + + + // define drawing width, some extra space needed for double span scrolling bar + if (AknLayoutUtils::LayoutMirrored()) // scroll bar on 'left' + { + iLeftDrawingPosition = KLeftMargin + 12; + iDrawingWidth = TUint( iViewerRect.Width() - iLeftDrawingPosition*iX_factor - (KRightMargin*iX_factor)); + } + else // scroll bar on 'right' + { + iLeftDrawingPosition = KLeftMargin; + iDrawingWidth = TUint( iViewerRect.Width() - iLeftDrawingPosition*iX_factor - (KRightMargin*iX_factor + 7*iX_factor)); + } + + + // set font + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + const TSize screenSize = dev->SizeInPixels(); + + TFontSpec fontSpec = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont)->FontSpecInTwips(); + fontSpec.iHeight = IsQHD(screenSize) ? KViewerFontHeightQHD : KViewerFontHeight; // set height + dev->GetNearestFontInTwips(iFont, fontSpec); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::ResetVariables(TBool aResetData) + { + if (iScrollBarFrame) + { + delete iScrollBarFrame; + iScrollBarFrame = NULL; + } + + if (iHexesBuffer && aResetData) + { + delete iHexesBuffer; + iHexesBuffer = NULL; + } + + if (iWrappedTextArray) + { + delete iWrappedTextArray; + iWrappedTextArray = NULL; + } + + if (iTextBuf && aResetData) + { + delete iTextBuf; + iTextBuf = NULL; + } + + if (iFont) + { + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + dev->ReleaseFont(iFont); + iFont = NULL; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::UpdateScrollBarL() + { + TRect rect(iViewerRect); + + // init the scroll bar + if (!iScrollBarFrame) + { + iScrollBarFrame = new(ELeave) CEikScrollBarFrame(this, this, ETrue); + iScrollBarFrame->CreateDoubleSpanScrollBarsL(ETrue, EFalse); + iScrollBarFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EDoubleSpan); + iScrollBarFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + } + + + // update values + TEikScrollBarModel horizontalBar; + TEikScrollBarModel verticalBar; + + if (iActiveMode == EFileEditorViewAsText) + { + verticalBar.iThumbPosition = iCurrentLine; + verticalBar.iScrollSpan = iTotalNumberOfLines - iNumberOfLinesFitsScreen + 1; + verticalBar.iThumbSpan = 1; + } + + else if (iActiveMode == EFileEditorViewAsHex) + { + verticalBar.iThumbPosition = iCurrentLine; + verticalBar.iScrollSpan = iTotalNumberOfLines; + verticalBar.iThumbSpan = 1; + } + + TEikScrollBarFrameLayout layout; + layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant; + + // do not let scrollbar values overflow + if (verticalBar.iThumbPosition + verticalBar.iThumbSpan > verticalBar.iScrollSpan) + verticalBar.iThumbPosition = verticalBar.iScrollSpan - verticalBar.iThumbSpan; + + TAknDoubleSpanScrollBarModel horizontalDSBar(horizontalBar); + TAknDoubleSpanScrollBarModel verticalDSBar(verticalBar); + + iScrollBarFrame->TileL(&horizontalDSBar, &verticalDSBar, rect, rect, layout); + iScrollBarFrame->SetVFocusPosToThumbPos(verticalDSBar.FocusPosition()); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + gc.Clear(aRect); + gc.SetPenColor(KRgbBlack); + gc.UseFont(iFont); + + TInt fontHeight = iFont->HeightInPixels(); + + if (iActiveMode == EFileEditorViewAsText) + { + // draw the text + for (TInt i=0; i= 0 && iTotalNumberOfLines > i+iCurrentLine) + gc.DrawText(iWrappedTextArray->At(i+iCurrentLine), TPoint(TInt(iLeftDrawingPosition*iX_factor), TInt(fontHeight*(i+1)))); + } + } + + else if (iActiveMode == EFileEditorViewAsHex) + { + TInt hexesOffSet = iCurrentLine * iAmountOfHexesFitsHorizontally; + TInt topLineHeight = 2*iY_factor + fontHeight; + + // draw the top line + gc.SetPenColor(KRgbWhite); + + gc.SetBrushColor(KRgbBlue); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + if (AknLayoutUtils::LayoutMirrored()) // scroll bar on 'left' + { + gc.DrawRect(TRect((KLeftMargin + 12)*iX_factor, 0, aRect.iBr.iX, topLineHeight)); + } + else // scroll bar on 'right' + { + gc.DrawRect(TRect(0, 0, aRect.iBr.iX-(KRightMargin*iX_factor + 7*iX_factor), topLineHeight)); + } + + TBuf<128> topLineBuf; + topLineBuf.AppendNum(hexesOffSet); + topLineBuf.Append(_L(": ")); + + for (TInt i=0; iDes().Length()) + { + topLineBuf.Append(iHexesBuffer->Des()[pos]); + } + } + + gc.DrawText(topLineBuf, TPoint(TInt(iLeftDrawingPosition*iX_factor), TInt(fontHeight))); + + + // draw hex values + gc.SetPenColor(KRgbBlack); + for (TInt i=0; i= iHexesBuffer->Des().Length()) + return; + + TUint8* ptr = &iHexesBuffer->Des()[pos]; + + _LIT(KHex, "%02x"); + TBuf<5> hexBuf; + hexBuf.Format(KHex, ptr[0]); + hexBuf.UpperCase(); + + gc.DrawText(hexBuf, TPoint(TInt(iLeftDrawingPosition*iX_factor + j*iHexGrougWidth), TInt(topLineHeight + fontHeight*(i+1)))); + } + } + } + + gc.DiscardFont(); + } + +// -------------------------------------------------------------------------------------------- + +CCoeControl* CFileBrowserFileEditorViewControl::ComponentControl(TInt aIndex) const + { + if (aIndex == 0 && iScrollBarFrame) + return iScrollBarFrame->VerticalScrollBar(); + else + return NULL; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileEditorViewControl::CountComponentControls() const + { + if (iScrollBarFrame) + return 1; + else + return 0; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType) + { + if ((aEventType == EEikScrollPageDown) || (aEventType == EEikScrollPageUp) || + (aEventType == EEikScrollThumbDragVert) || (aEventType == EEikScrollUp) || + (aEventType == EEikScrollDown)) + { + iCurrentLine = aScrollBar->ThumbPosition(); + UpdateScrollBarL(); + DrawNow(); + } + } + +// -------------------------------------------------------------------------------------------- + +TTypeUid::Ptr CFileBrowserFileEditorViewControl::MopSupplyObject(TTypeUid aId) + { + return CCoeControl::MopSupplyObject(aId); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileEditorViewControl::HandleResourceChange(TInt aType) + { + if (aType == KEikDynamicLayoutVariantSwitch) + { + SetRect(Rect()); + ActivateL(); + + // reformat the text + if (iActiveMode == EFileEditorViewAsText) + { + FormatAsTextL(); + } + else if (iActiveMode == EFileEditorViewAsHex) + { + FormatAsHexL(); + } + } + else + { + CCoeControl::HandleResourceChange(aType); + } + } + +// -------------------------------------------------------------------------------------------- + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBFileListContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBFileListContainer.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1133 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBFileListContainer.h" +#include "FB.hrh" +#include "FBDocument.h" +#include "FBAppUi.h" +#include "FBModel.h" +#include "FBFileUtils.h" +#include "FBStd.h" +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + #include "FBToolbar.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KEmptyDirectory, "No entries"); +_LIT(KNoMatches, "No matches"); + +const TInt KSimpleViewFontHeight = 127; +const TInt KExtendedViewFontHeight1 = 127; +const TInt KExtendedViewFontHeight2 = 105; + +const TInt KSimpleViewFontHeightQHD = 120; +const TInt KExtendedViewFontHeight1QHD = 115; +const TInt KExtendedViewFontHeight2QHD = 90; + +// ===================================== MEMBER FUNCTIONS ===================================== + +void CFileBrowserFileListContainer::ConstructL(const TRect& /*aRect*/) + { + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + iModel->SetFileListContainer(this); + + iFileViewMode = -1; + iIsDragging = EFalse; + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) + iToolbar = CFileBrowserToolbar::NewL(); + if ( iModel->Settings().iEnableToolbar && + AknLayoutUtils::PenEnabled() ) + { + iToolbar->ShowToolbarL(); + } + else + { + iToolbar->HideToolbarL(); + } +#endif + + CreateWindowL(); + Window().SetShadowDisabled(EFalse); + SetBlank(); + + SetScreenLayoutL(iModel->Settings().iDisplayMode); + + CreateEmptyNaviPaneLabelL(); + + iModel->FileUtils()->RefreshViewL(); + + EnableDragEvents(); + + ActivateL(); + + iInfoPopup = CAknInfoPopupNoteController::NewL(); + iInfoPopup->SetTimePopupInView(5000); + iInfoPopup->SetTimeDelayBeforeShow(500); + iInfoPopup->SetTextL(_L("TIP: Use left arrow key or touch drag to left to move up in the directory structure.")); + iInfoPopup->ShowInfoPopupNote(); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileListContainer::~CFileBrowserFileListContainer() + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + delete iToolbar; +#endif + delete iInfoPopup; + + DeleteNaviPane(); + + if (iSearchField) + delete iSearchField; + + if (iListBox) + delete iListBox; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::CreateEmptyNaviPaneLabelL() + { + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iNaviDecorator = iNaviContainer->CreateNavigationLabelL(); + iNaviContainer->PushL(*iNaviDecorator); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::DeleteNaviPane() + { + if (iNaviContainer) + { + iNaviContainer->Pop(iNaviDecorator); + } + + if (iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + gc.Clear(aRect); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::HandleControlEventL( + CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) + { + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CFileBrowserFileListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + // open search field with alpha digit numbers + if (aType == EEventKeyDown && !iSearchField && aKeyEvent.iScanCode < EStdKeyF1 && TChar(aKeyEvent.iScanCode).IsAlphaDigit()) + { + EnableSearchFieldL(); + + if (iSearchField) + { + //static_cast(iListBox->Model())->Filter()->DeferredSendKeyEventToFepL(aKeyEvent.iCode); + return EKeyWasConsumed; + } + } + + // close search field with clear-button if it's empty + if (iSearchField && aKeyEvent.iCode == EKeyBackspace) + { + TFileName searchText; + iSearchField->GetSearchText(searchText); + + if (searchText == KNullDesC) + { + DisableSearchFieldL(); + return EKeyWasConsumed; + } + } + + // check file/directory handling related cases + if (iModel->FileUtils()->HandleOfferKeyEventL(aKeyEvent, aType) == EKeyWasConsumed) + return EKeyWasConsumed; + + TKeyResponse result = EKeyWasNotConsumed; + + if (iSearchField && iListBox) + { + // find items with all event codes (that's the reason why there is EEventKey instead of aType) + TBool needsRefresh(EFalse); + result = AknFind::HandleFindOfferKeyEventL(aKeyEvent, EEventKey, this, iListBox, iSearchField, EFalse, needsRefresh); + + if (needsRefresh) + DrawNow(); + } + + // scroll one page up/down with volume keys + if (result == EKeyWasNotConsumed && iListBox && iListBox->Model()->NumberOfItems() > 0 && (aKeyEvent.iCode == EKeyIncVolume || (aKeyEvent.iCode=='#' && !iModel->IsHashKeySelectionInUse()))) + { + CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection; + CListBoxView::TCursorMovement moveto = CListBoxView::ECursorPrevScreen; + + iListBox->View()->MoveCursorL(moveto, selectionMode); + + iListBox->SetCurrentItemIndex(iListBox->CurrentItemIndex()); + iListBox->DrawDeferred(); + + return EKeyWasConsumed; + + } + else if (result == EKeyWasNotConsumed && iListBox && iListBox->Model()->NumberOfItems() > 0 && (aKeyEvent.iCode == EKeyDecVolume || aKeyEvent.iCode=='*')) + { + CListBoxView::TSelectionMode selectionMode = CListBoxView::ENoSelection; + CListBoxView::TCursorMovement moveto = CListBoxView::ECursorNextScreen; + + if (iListBox->CurrentItemIndex() >= iListBox->Model()->NumberOfItems() - iListBox->View()->NumberOfItemsThatFitInRect(iListBox->View()->ViewRect())) + moveto = CListBoxView::ECursorLastItem; + + iListBox->View()->MoveCursorL(moveto, selectionMode); + + iListBox->SetCurrentItemIndex(iListBox->CurrentItemIndex()); + iListBox->DrawDeferred(); + + return EKeyWasConsumed; + } + + // offer key event to the listbox if not already consumed + else if (result == EKeyWasNotConsumed && iListBox) + return iListBox->OfferKeyEventL(aKeyEvent, aType); + else + return result; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + { + // "emulate" enter key press and send it to file utils for prosessing + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyEnter; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + iModel->FileUtils()->HandleOfferKeyEventL(keyEvent, type); + } + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::HandlePointerEventL(const TPointerEvent &aPointerEvent) + { + // detect direction of dragging by comparing the start and finish points + + if (aPointerEvent.iType == TPointerEvent::EButton1Down) + { + iDragStartPoint = aPointerEvent.iPosition; + iIsDragging = EFalse; + } + else if (aPointerEvent.iType == TPointerEvent::EDrag) + { + iIsDragging = ETrue; + + return; + } + else if (aPointerEvent.iType == TPointerEvent::EButton1Up) + { + if (iIsDragging) + { + const TInt KDelta = iDragStartPoint.iX - aPointerEvent.iPosition.iX; + const TInt KThreshold = 30; + + if (KDelta < -KThreshold) // dragging to right + { + // "emulate" right key press and send it to file utils for prosessing + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyRightArrow; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + iModel->FileUtils()->HandleOfferKeyEventL(keyEvent, type); + + return; + } + else if (KDelta > KThreshold) // dragging to left + { + // "emulate" left key press and send it to file utils for prosessing + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyLeftArrow; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + iModel->FileUtils()->HandleOfferKeyEventL(keyEvent, type); + + return; + } + } + iIsDragging = EFalse; + } + else + { + iIsDragging = EFalse; + } + + CCoeControl::HandlePointerEventL(aPointerEvent); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::CreateListBoxL(TInt aFileViewMode) + { + iFileViewMode = aFileViewMode; + + if (iSearchField) + DisableSearchFieldL(); + + if (iListBox) + { + delete iListBox; + iListBox = NULL; + } + + if (iFileViewMode == EFileViewModeSimple) + { + iListBox = new(ELeave) CSimpleFileViewListBox; + } + else + { + iListBox = new(ELeave) CExtendedFileViewListBox; + } + + + iListBox->SetContainerWindowL(*this); + iListBox->ConstructL(this, EAknListBoxMarkableList); + + iListBox->View()->SetListEmptyTextL(KEmptyDirectory); + + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + iListBox->SetListBoxObserver(this); + + // make sure listbox has correct size + SizeChanged(); + + iListBox->ActivateL(); + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileListContainer::CurrentListBoxItemIndex() + { + if (iListBox && iSearchField) + { + TInt currentItemIndex = iListBox->CurrentItemIndex(); + + if (currentItemIndex >= 0) + return static_cast(iListBox->Model())->Filter()->FilteredItemIndex(currentItemIndex); + else + return KErrNotFound; + } + else if (iListBox) + { + return iListBox->CurrentItemIndex(); + } + else + return KErrNotFound; + } + +// -------------------------------------------------------------------------------------------- + +const CArrayFix* CFileBrowserFileListContainer::ListBoxSelectionIndexes() + { + if (iListBox && iSearchField) + { + TRAP_IGNORE( static_cast(iListBox->Model())->Filter()->UpdateSelectionIndexesL() ); // !!! + return static_cast(iListBox->Model())->Filter()->SelectionIndexes(); + } + else if (iListBox) + { + const CListBoxView::CSelectionIndexArray* indices = iListBox->SelectionIndexes(); + return static_cast*>(indices); + } + else + return NULL; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileListContainer::ListBoxSelectionIndexesCount() + { + if (iListBox && iSearchField) + { + TRAP_IGNORE( static_cast(iListBox->Model())->Filter()->UpdateSelectionIndexesL() ); // !!! + return static_cast(iListBox->Model())->Filter()->SelectionIndexes()->Count(); + } + else if (iListBox) + { + return iListBox->SelectionIndexes()->Count(); + } + else + return KErrNotFound; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileListContainer::ListBoxNumberOfVisibleItems() + { + if (iListBox && iSearchField) + { + return static_cast(iListBox->Model())->Filter()->FilteredNumberOfItems(); + } + else if (iListBox) + { + return iListBox->Model()->NumberOfItems(); + } + else + return KErrNotFound; + } + +// -------------------------------------------------------------------------------------------- + +CAknIconArray* CFileBrowserFileListContainer::ListBoxIconArrayL() + { + if (iListBox) + { + if (iFileViewMode == EFileViewModeSimple) + { + return static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->IconArray()); + } + else if (iFileViewMode == EFileViewModeExtended) + { + return static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->IconArray()); + } + } + + return NULL; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::SetListBoxIconArrayL(CAknIconArray* aIconArray) + { + if (iListBox) + { + if (iFileViewMode == EFileViewModeSimple) + { + //CArrayPtr* currentIconArray = static_cast(iListBox)->ItemDrawer()->ColumnData()->IconArray(); + //delete currentIconArray; + //currentIconArray = NULL; + static_cast(iListBox)->ItemDrawer()->ColumnData()->SetIconArray(aIconArray); + } + else if (iFileViewMode == EFileViewModeExtended) + { + //CArrayPtr* currentIconArray = static_cast(iListBox)->ItemDrawer()->ColumnData()->IconArray(); + //delete currentIconArray; + //currentIconArray = NULL; + static_cast(iListBox)->ItemDrawer()->ColumnData()->SetIconArray(aIconArray); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::SetListBoxTextArrayL(CDesCArray* aTextArray) + { + if (iListBox) + { + iListBox->Model()->SetItemTextArray(aTextArray); + iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::EnableSearchFieldL() + { + if (iListBox && !iSearchField && iListBox->Model()->NumberOfItems() > 0) + { + iSearchField = CAknSearchField::NewL(*this, CAknSearchField::ESearch, NULL, KMaxFileName); + + iSearchField->SetObserver(this); + iSearchField->SetFocus(ETrue); + iSearchField->MakeVisible(ETrue); + iSearchField->ResetL(); + + iListBox->View()->SetListEmptyTextL(KNoMatches); + + // enable filtering + ((CAknFilteredTextListBoxModel*)iListBox->Model())->CreateFilterL(iListBox, iSearchField); + + SizeChanged(); + + // update cba + CEikButtonGroupContainer* cbaGroup = CEikButtonGroupContainer::Current(); + cbaGroup->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_CANCEL); + cbaGroup->DrawNow(); + } + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileListContainer::IsSearchFieldEnabled() + { + return iSearchField != NULL; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::DisableSearchFieldL() + { + if (iSearchField) + { + iSearchField->MakeVisible( EFalse ); + iSearchField->SetFocusing( EFalse ); + + delete iSearchField; + iSearchField = NULL; + + iListBox->View()->SetListEmptyTextL(KEmptyDirectory); + + // disable filtering + ((CAknFilteredTextListBoxModel*)iListBox->Model())->RemoveFilter(); + + SizeChanged(); + DrawNow(); + + // update cba + CEikButtonGroupContainer* cbaGroup = CEikButtonGroupContainer::Current(); + cbaGroup->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT); + cbaGroup->DrawNow(); + + // Clear selections because using filter causes selections to go out of sync + UpdateToolbar(); + AknSelectionService::HandleMarkableListProcessCommandL( EAknUnmarkAll, iListBox ); + } + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileListContainer::CountComponentControls() const + { + TInt controls(0); + + if (iListBox) + controls++; + + if (iSearchField) + controls++; + + return controls; + } + +// -------------------------------------------------------------------------------------------- + +CCoeControl* CFileBrowserFileListContainer::ComponentControl(TInt aIndex) const + { + switch (aIndex) + { + case 0: + { + return iListBox; + } + case 1: + { + return iSearchField; + } + default: + { + return NULL; + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::SetScreenLayoutL(TInt aLayoutMode) + { + // make sure that the search field has been disabled + DisableSearchFieldL(); + + // make sure that the title of the application is correct + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("FileBrowser") ); + + // change the layout mode + if (aLayoutMode == EDisplayModeFullScreen) + sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL); + else + sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); + + // update layout + HandleResourceChange(KEikDynamicLayoutVariantSwitch); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::SetNaviPaneTextL(const TDesC& aText) + { + if (iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + iNaviDecorator = iNaviContainer->CreateMessageLabelL(aText); + iNaviContainer->PushL(*iNaviDecorator); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::SizeChanged() + { + if (iListBox && iSearchField) + { + TSize findPaneSize; + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EFindPane, findPaneSize); + + TRect mainPaneRect; + TRect naviPaneRect; + + if (Layout_Meta_Data::IsLandscapeOrientation() || + iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iToolbar && iModel->Settings().iEnableToolbar ) + { + iToolbar->ShowToolbarL(); + // Get location of softkeys + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) + { + // here there is the BSK mode + mainPaneRect.iBr.iX -= iToolbar->Rect().Width(); + findPaneSize.iWidth -= iToolbar->Rect().Width(); + } + } +#endif + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); + mainPaneRect.iTl.iY = naviPaneRect.Height(); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iToolbar && iModel->Settings().iEnableToolbar ) + { + iToolbar->ShowToolbarL(); + mainPaneRect.iBr.iY -= iToolbar->Rect().Height(); + } +#endif + } + + mainPaneRect.iBr.iY -= findPaneSize.iHeight; + + TRect listBoxRect(mainPaneRect.Size()); + iListBox->SetRect(listBoxRect); + + if (iFileViewMode == EFileViewModeSimple) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + else if (iFileViewMode == EFileViewModeExtended) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + + iSearchField->SetRect(TRect(TPoint(0,mainPaneRect.Height()), findPaneSize)); + + if (iSearchField->IsVisible() && iListBox->IsVisible()) + iSearchField->SetLinePos(2); + + } + + else if (iListBox) + { + TRect mainPaneRect; + TRect naviPaneRect; + + if (Layout_Meta_Data::IsLandscapeOrientation() || + iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iToolbar && iModel->Settings().iEnableToolbar ) + { + iToolbar->ShowToolbarL(); + // Get location of softkeys + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) + { + // here there is the BSK mode + mainPaneRect.iBr.iX -= iToolbar->Rect().Width(); + } + } +#endif + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); + mainPaneRect.iTl.iY = naviPaneRect.Height(); + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iToolbar && iModel->Settings().iEnableToolbar ) + { + iToolbar->ShowToolbarL(); + mainPaneRect.iBr.iY -= iToolbar->Rect().Height(); + } +#endif + } + + TRect listBoxRect(mainPaneRect.Size()); + iListBox->SetRect(listBoxRect); + + if (iFileViewMode == EFileViewModeSimple) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + else if (iFileViewMode == EFileViewModeExtended) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::HandleResourceChange(TInt aType) + { + CCoeControl::HandleResourceChange(aType); + + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect mainPaneRect; + TRect naviPaneRect; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) + TBool needToCutSearchFieldLength( EFalse ); +#endif + + if (Layout_Meta_Data::IsLandscapeOrientation() || + iEikonEnv->AppUiFactory()->StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_SMALL) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) + if ( iToolbar && iModel->Settings().iEnableToolbar ) + { + iToolbar->ShowToolbarL(); + // Get location of softkeys + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) + { + // here there is the BSK mode + mainPaneRect.iBr.iX -= iToolbar->Rect().Width(); + needToCutSearchFieldLength = ETrue; + } + } +#endif + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::ENaviPane, naviPaneRect); + mainPaneRect.iTl.iY = naviPaneRect.Height(); + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) + if ( iToolbar && iModel->Settings().iEnableToolbar ) + { + iToolbar->ShowToolbarL(); + mainPaneRect.iBr.iY -= iToolbar->Rect().Height(); + } +#endif + } + + SetRect(mainPaneRect); + + if (iListBox && iSearchField) + { + TSize findPaneSize; + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EFindPane, findPaneSize); +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __SERIES60_32__) + if ( needToCutSearchFieldLength ) + { + findPaneSize.iWidth -= iToolbar->Rect().Width(); + } +#endif + mainPaneRect.iBr.iY -= findPaneSize.iHeight; + + TRect listBoxRect(mainPaneRect.Size()); + iListBox->SetRect(listBoxRect); + + if (iFileViewMode == EFileViewModeSimple) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + else if (iFileViewMode == EFileViewModeExtended) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + + iSearchField->SetRect(TRect(TPoint(0,mainPaneRect.Height()), findPaneSize)); + + if (iSearchField->IsVisible() && iListBox->IsVisible()) + iSearchField->SetLinePos(2); + + TRAP_IGNORE(iListBox->UpdateScrollBarsL()); + } + else if (iListBox) + { + TRect listBoxRect(mainPaneRect.Size()); + iListBox->SetRect(listBoxRect); + + if (iFileViewMode == EFileViewModeSimple) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + else if (iFileViewMode == EFileViewModeExtended) + { + CAknsListBoxBackgroundControlContext* listBoxContext = static_cast(static_cast(iListBox)->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + listBoxContext->SetRect(listBoxRect); + } + + TRAP_IGNORE(iListBox->UpdateScrollBarsL()); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::HandleSettingsChangeL() + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iModel->Settings().iEnableToolbar ) + { + if ( AknLayoutUtils::PenEnabled() ) + { + if ( !iToolbar ) + { + iToolbar = CFileBrowserToolbar::NewL(); + } + iToolbar->ShowToolbarL(); + } + } + else + { + HideToolbar(); + } + SizeChanged(); +#endif + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::HideToolbar() + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iToolbar && iToolbar->IsShown() ) + { + iToolbar->HideToolbarL(); + } +#endif + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileListContainer::UpdateToolbar() + { +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( iToolbar && iToolbar->IsShown() ) + { + iToolbar->ResetState(); + } +#endif + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CSimpleFileViewListBox::~CSimpleFileViewListBox() + { + ReleaseFonts(); + } + +// -------------------------------------------------------------------------------------------- + +void CSimpleFileViewListBox::ReleaseFonts() + { + if (iFont) + { + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + dev->ReleaseFont(iFont); + iFont = NULL; + } + } + +// -------------------------------------------------------------------------------------------- + +void CSimpleFileViewListBox::SizeChanged() + { + // call the base class function first + CAknSingleGraphicStyleListBox::SizeChanged(); + + // customize the list box + TRAP_IGNORE(SizeChangedL()); + } + +// -------------------------------------------------------------------------------------------- + +void CSimpleFileViewListBox::SizeChangedL() + { + // disable separator line + ItemDrawer()->ColumnData()->SetSeparatorLinePosition(ENoLine); + + // enable marquee + ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + + // get font + ReleaseFonts(); + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + const TSize screenSize = dev->SizeInPixels(); + + TFontSpec fontSpec = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont)->FontSpecInTwips(); + fontSpec.iHeight = IsQHD(screenSize) ? KSimpleViewFontHeightQHD : KSimpleViewFontHeight; + dev->GetNearestFontInTwips(iFont, fontSpec); + + // set fonts + ItemDrawer()->ColumnData()->SetColumnFontL(0, iFont); + ItemDrawer()->ColumnData()->SetColumnFontL(1, iFont); + ItemDrawer()->ColumnData()->SetColumnFontL(2, iFont); + ItemDrawer()->ColumnData()->SetColumnFontL(3, iFont); + + // set row height + TInt rowHeight = iFont->HeightInPixels()+4; + TSize itemCellSize = View()->ItemDrawer()->ItemCellSize(); + itemCellSize.iHeight = rowHeight; + SetItemHeightL(rowHeight); + View()->ItemDrawer()->SetItemCellSize(itemCellSize); + + // set icon sizes + TInt normalIconSize = rowHeight * 0.9; + TInt markingIconSize = rowHeight * 0.8; + ItemDrawer()->ColumnData()->SetSubCellIconSize(0, TSize(normalIconSize,normalIconSize)); + ItemDrawer()->ColumnData()->SetSubCellIconSize(2, TSize(markingIconSize,markingIconSize)); + ItemDrawer()->ColumnData()->SetSubCellIconSize(3, TSize(markingIconSize,markingIconSize)); + + // set column widths + ItemDrawer()->ColumnData()->SetColumnWidthPixelL(0, normalIconSize); + ItemDrawer()->ColumnData()->SetColumnWidthPixelL(1, itemCellSize.iWidth-normalIconSize-markingIconSize); + ItemDrawer()->ColumnData()->SetColumnWidthPixelL(2, markingIconSize); + ItemDrawer()->ColumnData()->SetColumnWidthPixelL(3, markingIconSize); + + // set baseline for the text + ItemDrawer()->ColumnData()->SetColumnBaselinePosL(1, iFont->HeightInPixels()-iFont->BaselineOffsetInPixels()-1); + + // set margins + TMargins iconMargins; + iconMargins.iBottom = 0; + iconMargins.iLeft = 0; + iconMargins.iRight = 0; + iconMargins.iTop = 0; + + TMargins textMargins; + textMargins.iBottom = 0; + textMargins.iLeft = markingIconSize * 0.15; + textMargins.iRight = markingIconSize * 0.15; + textMargins.iTop = 0; + + ItemDrawer()->ColumnData()->SetColumnMarginsL(0, iconMargins); + ItemDrawer()->ColumnData()->SetColumnMarginsL(1, textMargins); + ItemDrawer()->ColumnData()->SetColumnMarginsL(2, iconMargins); + ItemDrawer()->ColumnData()->SetColumnMarginsL(3, iconMargins); + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CExtendedFileViewListBox::~CExtendedFileViewListBox() + { + ReleaseFonts(); + } + +// -------------------------------------------------------------------------------------------- + +void CExtendedFileViewListBox::ReleaseFonts() + { + if (iFont1) + { + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + dev->ReleaseFont(iFont1); + iFont1 = NULL; + } + + if (iFont2) + { + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + dev->ReleaseFont(iFont2); + iFont2 = NULL; + } + } + +// -------------------------------------------------------------------------------------------- + +void CExtendedFileViewListBox::SizeChanged() + { + // call the base class function first + CAknDoubleGraphicStyleListBox::SizeChanged(); + + // customize the list box + TRAP_IGNORE(SizeChangedL()); + } + +// -------------------------------------------------------------------------------------------- + +void CExtendedFileViewListBox::SizeChangedL() + { + // disable separator line + ItemDrawer()->ColumnData()->SetSeparatorLinePosition(ENoLine); + + // enable marquee + ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + + // get fonts + ReleaseFonts(); + CGraphicsDevice* dev = iCoeEnv->ScreenDevice(); + const TSize screenSize = dev->SizeInPixels(); + + TFontSpec fontSpec1 = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont)->FontSpecInTwips(); + fontSpec1.iHeight = IsQHD(screenSize) ? KExtendedViewFontHeight1QHD : KExtendedViewFontHeight1; + dev->GetNearestFontInTwips(iFont1, fontSpec1); + + TFontSpec fontSpec2 = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont)->FontSpecInTwips(); + fontSpec2.iHeight = IsQHD(screenSize) ? KExtendedViewFontHeight2QHD : KExtendedViewFontHeight2; + dev->GetNearestFontInTwips(iFont2, fontSpec2); + + + // set fonts + ItemDrawer()->ColumnData()->SetSubCellFontL(0, iFont1); + ItemDrawer()->ColumnData()->SetSubCellFontL(1, iFont1); + ItemDrawer()->ColumnData()->SetSubCellFontL(2, iFont2); + ItemDrawer()->ColumnData()->SetSubCellFontL(3, iFont1); + ItemDrawer()->ColumnData()->SetSubCellFontL(4, iFont1); + + // set row height + TInt rowHeight1 = iFont1->HeightInPixels()+3; + TInt rowHeight2 = iFont2->HeightInPixels()+3; + TSize itemCellSize = View()->ItemDrawer()->ItemCellSize(); + itemCellSize.iHeight = rowHeight1+rowHeight2; + SetItemHeightL(rowHeight1+rowHeight2); + View()->ItemDrawer()->SetItemCellSize(itemCellSize); + + + // set icon sizes + TInt normalIconSize = rowHeight1 * 0.9; + TInt markingIconSize = rowHeight1 * 0.8; + ItemDrawer()->ColumnData()->SetSubCellIconSize(0, TSize(normalIconSize,normalIconSize)); + ItemDrawer()->ColumnData()->SetSubCellIconSize(3, TSize(markingIconSize,markingIconSize)); + ItemDrawer()->ColumnData()->SetSubCellIconSize(4, TSize(markingIconSize,markingIconSize)); + + // set sub cell sizes + ItemDrawer()->ColumnData()->SetSubCellSizeL(0, TSize(normalIconSize,rowHeight1+rowHeight2)); + ItemDrawer()->ColumnData()->SetSubCellSizeL(1, TSize(itemCellSize.iWidth-normalIconSize-markingIconSize,rowHeight1)); + ItemDrawer()->ColumnData()->SetSubCellSizeL(2, TSize(itemCellSize.iWidth-normalIconSize-markingIconSize,rowHeight2)); + ItemDrawer()->ColumnData()->SetSubCellSizeL(3, TSize(markingIconSize,rowHeight1+rowHeight2)); + ItemDrawer()->ColumnData()->SetSubCellSizeL(4, TSize(markingIconSize,rowHeight1+rowHeight2)); + + // set sub cell positions + ItemDrawer()->ColumnData()->SetSubCellPositionL(0, TPoint(0,0)); + ItemDrawer()->ColumnData()->SetSubCellPositionL(1, TPoint(normalIconSize,0)); + ItemDrawer()->ColumnData()->SetSubCellPositionL(2, TPoint(normalIconSize,rowHeight1)); + ItemDrawer()->ColumnData()->SetSubCellPositionL(3, TPoint(itemCellSize.iWidth-normalIconSize-markingIconSize,0)); + ItemDrawer()->ColumnData()->SetSubCellPositionL(4, TPoint(itemCellSize.iWidth-normalIconSize-markingIconSize,0)); + + // set baselines for the texts + ItemDrawer()->ColumnData()->SetSubCellBaselinePosL(1, iFont1->HeightInPixels()-iFont1->BaselineOffsetInPixels()-1); + ItemDrawer()->ColumnData()->SetSubCellBaselinePosL(2, rowHeight1+iFont2->HeightInPixels()-iFont2->BaselineOffsetInPixels()-1); + + // set margins + TMargins iconMargins; + iconMargins.iBottom = rowHeight2; + iconMargins.iLeft = 0; + iconMargins.iRight = 0; + iconMargins.iTop = 0; + + TMargins textMargins; + textMargins.iBottom = 0; + textMargins.iLeft = markingIconSize * 0.15; + textMargins.iRight = markingIconSize * 0.15; + textMargins.iTop = 0; + + ItemDrawer()->ColumnData()->SetSubCellMarginsL(0, iconMargins); + ItemDrawer()->ColumnData()->SetSubCellMarginsL(1, textMargins); + ItemDrawer()->ColumnData()->SetSubCellMarginsL(2, textMargins); + ItemDrawer()->ColumnData()->SetSubCellMarginsL(3, iconMargins); + ItemDrawer()->ColumnData()->SetSubCellMarginsL(4, iconMargins); + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBFileListView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBFileListView.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,763 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FB.hrh" +#include "FBFileListView.h" +#include "FBFileListContainer.h" +#include "FBDocument.h" +#include "FBModel.h" +#include "FBFileUtils.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CFileBrowserFileListView::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +void CFileBrowserFileListView::ConstructL() + { + BaseConstructL( R_FILEBROWSER_VIEW_FILELIST ); + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + + iRemConSelector = CRemConInterfaceSelector::NewL(); + iRemConTarget = CRemConCoreApiTarget::NewL(*iRemConSelector, *this); + iRemConSelector->OpenTargetL(); + } + +// --------------------------------------------------------- +// CFileBrowserFileListView::~CFileBrowserFileListView() +// ?implementation_description +// --------------------------------------------------------- +// +CFileBrowserFileListView::~CFileBrowserFileListView() + { + delete iRemConSelector; + + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + } + +// --------------------------------------------------------- +// TUid CFileBrowserFileListView::Id() +// ?implementation_description +// --------------------------------------------------------- +// +TUid CFileBrowserFileListView::Id() const + { + return KFileListViewUID; + } + +// --------------------------------------------------------- +// TUid CFileBrowserFileListView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) +// ?implementation_description +// --------------------------------------------------------- +// + +void CFileBrowserFileListView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + TBool emptyListBox = iContainer->ListBoxNumberOfVisibleItems() == 0; + TBool driveListActive = iModel->FileUtils()->IsDriveListViewActive(); + TBool normalModeActive = iModel->FileUtils()->IsNormalModeActive(); + TBool currentDriveReadOnly = iModel->FileUtils()->IsCurrentDriveReadOnly(); + TBool currentItemDirectory = iModel->FileUtils()->IsCurrentItemDirectory(); + TBool listBoxSelections = iContainer->ListBoxSelectionIndexesCount() == 0; + TBool emptyClipBoard = iModel->FileUtils()->ClipBoardList()->Count() == 0; + TBool showSnapShot = iModel->FileUtils()->DriveSnapShotPossible(); + + TBool hideEditMenu(EFalse); + if (driveListActive) + { + if (!showSnapShot || emptyListBox && emptyClipBoard) + hideEditMenu = ETrue; + else + hideEditMenu = EFalse; + } + else + { + if (emptyListBox && emptyClipBoard) + hideEditMenu = ETrue; + else + hideEditMenu = EFalse; + } + + + if (aResourceId == R_FILEBROWSER_VIEW_FILELIST_MENU) + { + aMenuPane->SetItemDimmed(EFileBrowserCmdEdit, hideEditMenu); + aMenuPane->SetItemDimmed(EFileBrowserCmdDiskAdmin, !driveListActive); + } + + else if (aResourceId == R_FILEBROWSER_FILE_SUBMENU) + { + aMenuPane->SetItemDimmed(EFileBrowserCmdFileBack, driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, emptyListBox || driveListActive || currentItemDirectory); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpenDrive, emptyListBox || !driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpenDirectory, emptyListBox || driveListActive || !currentItemDirectory); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, emptyListBox || driveListActive || currentItemDirectory); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileNew, driveListActive || currentDriveReadOnly); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileDelete, emptyListBox || driveListActive || currentDriveReadOnly); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileRename, emptyListBox || driveListActive || currentDriveReadOnly || !listBoxSelections); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileTouch, emptyListBox || driveListActive || currentDriveReadOnly); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileProperties, emptyListBox || !listBoxSelections); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileChecksums, emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileSetAttributes, emptyListBox || driveListActive || currentDriveReadOnly); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileCompress, currentDriveReadOnly || emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdFileDecompress, currentDriveReadOnly || emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive); + } + + else if (aResourceId == R_FILEBROWSER_EDIT_SUBMENU) + { + TBool currentSelected = iContainer->ListBox()->View()->ItemIsSelected(iContainer->ListBox()->View()->CurrentItemIndex()); + TBool allSelected = iContainer->ListBox()->SelectionIndexes()->Count() == iContainer->ListBox()->Model()->NumberOfItems(); + TBool noneSelected = iContainer->ListBox()->SelectionIndexes()->Count() == 0; + + aMenuPane->SetItemDimmed(EFileBrowserCmdSnapShot, !driveListActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditCut, driveListActive || currentDriveReadOnly || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditCopy, driveListActive || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditPaste, driveListActive || emptyClipBoard || currentDriveReadOnly); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditCopyToFolder, driveListActive || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditMoveToFolder, driveListActive || currentDriveReadOnly || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditSelect, driveListActive || currentSelected || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditUnselect, driveListActive || !currentSelected || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditSelectAll, driveListActive || allSelected || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdEditUnselectAll, driveListActive || noneSelected || emptyListBox); + } + + else if (aResourceId == R_FILEBROWSER_VIEW_SUBMENU) + { + aMenuPane->SetItemDimmed(EFileBrowserCmdViewSort, !normalModeActive || driveListActive || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdViewOrder, !normalModeActive || driveListActive || emptyListBox); + aMenuPane->SetItemDimmed(EFileBrowserCmdViewRefresh, !normalModeActive); + aMenuPane->SetItemDimmed(EFileBrowserCmdViewFilterEntries, emptyListBox); + } + + else if (aResourceId == R_FILEBROWSER_VIEW_SORT_SUBMENU) + { + aMenuPane->SetItemButtonState(iModel->FileUtils()->SortMode(), EEikMenuItemSymbolOn); + } + + else if (aResourceId == R_FILEBROWSER_VIEW_ORDER_SUBMENU) + { + aMenuPane->SetItemButtonState(iModel->FileUtils()->OrderMode(), EEikMenuItemSymbolOn); + } + + else if (aResourceId == R_FILEBROWSER_TOOLS_SUBMENU) + { + TBool noLocalCon = !iModel->FileUtils()->FileExists(KIRAppPath) && !iModel->FileUtils()->FileExists(KBTAppPath) && !iModel->FileUtils()->FileExists(KUSBAppPath); + + aMenuPane->SetItemDimmed(EFileBrowserCmdToolsDisableExtErrors, !iModel->FileUtils()->FileExists(KErrRdPath)); + aMenuPane->SetItemDimmed(EFileBrowserCmdToolsEnableExtErrors, iModel->FileUtils()->FileExists(KErrRdPath)); + aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivity, noLocalCon); + } + + else if (aResourceId == R_FILEBROWSER_TOOLS_LOCALCONNECTIVITY_SUBMENU) + { + aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivityActivateInfrared, !iModel->FileUtils()->FileExists(KIRAppPath)); + aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivityLaunchBTUI, !iModel->FileUtils()->FileExists(KBTAppPath)); + aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivityLaunchUSBUI, !iModel->FileUtils()->FileExists(KUSBAppPath)); + } + else + { + AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); + } + } + +// --------------------------------------------------------- +// CFileBrowserFileListView::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct) +// Used to handle multimedia keys +// --------------------------------------------------------- +// + +void CFileBrowserFileListView::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction /*aButtonAct*/) + { + switch(aOperationId) + { + case ERemConCoreApiVolumeUp: + { + // simulate a keyevent, so that it can be handled as all other key events + TKeyEvent keyEvent; + keyEvent.iCode = EKeyIncVolume; + keyEvent.iScanCode = 0; + keyEvent.iModifiers = 0; + keyEvent.iRepeats = 0; + + //TRAP_IGNORE( iContainer->OfferKeyEventL(keyEvent, EEventKey) ); + + //RWsSession& wsSession=iCoeEnv->WsSession(); + //wsSession.SimulateKeyEvent(keyEvent); + //wsSession.Flush(); + + iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyDown); + iCoeEnv->SimulateKeyEventL(keyEvent,EEventKey); + iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyUp); + + break; + } + case ERemConCoreApiVolumeDown: + { + // simulate a keyevent, so that it can be handled as all other key events + TKeyEvent keyEvent; + keyEvent.iCode = EKeyDecVolume; + keyEvent.iScanCode = 0; + keyEvent.iModifiers = 0; + keyEvent.iRepeats = 0; + + //TRAP_IGNORE( iContainer->OfferKeyEventL(keyEvent, EEventKey) ); + + //RWsSession& wsSession=iCoeEnv->WsSession(); + //wsSession.SimulateKeyEvent(keyEvent); + //wsSession.Flush(); + + iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyDown); + iCoeEnv->SimulateKeyEventL(keyEvent,EEventKey); + iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyUp); + + break; + } + } + } + + +// --------------------------------------------------------- +// CFileBrowserFileListView::HandleCommandL(TInt aCommand) +// ?implementation_description +// --------------------------------------------------------- +// +void CFileBrowserFileListView::HandleCommandL(TInt aCommand) + { + switch ( aCommand ) + { + + case EFileBrowserCmdFileBack: + { + iModel->FileUtils()->MoveUpOneLevelL(); + break; + } + + case EFileBrowserCmdFileOpenApparc: + { + iModel->FileUtils()->OpenWithApparcL(); + break; + } + + case EFileBrowserCmdFileOpenDocHandlerEmbed: + { + iModel->FileUtils()->OpenWithDocHandlerL(ETrue); + break; + } + + case EFileBrowserCmdFileOpenDocHandlerStandAlone: + { + iModel->FileUtils()->OpenWithDocHandlerL(EFalse); + break; + } + + case EFileBrowserCmdFileOpenFileService: + { + iModel->FileUtils()->OpenWithFileServiceL(); + break; + } + + case EFileBrowserCmdFileOpenDrive: + case EFileBrowserCmdFileOpenDirectory: + { + iModel->FileUtils()->MoveDownToDirectoryL(); + break; + } + + case EFileBrowserCmdFileViewText: + case EFileBrowserCmdFileViewHex: + case EFileBrowserCmdFileEditText: + case EFileBrowserCmdFileEditHex: + { + iModel->FileUtils()->FileEditorL(aCommand); + break; + } + + case EFileBrowserCmdFileSearch: + { + iModel->FileListContainer()->HideToolbar(); + iModel->FileUtils()->SearchL(); + break; + } + + case EFileBrowserCmdFileSendTo: + { + iModel->FileUtils()->SendToL(); + break; + } + + case EFileBrowserCmdFileNewFile: + { + iModel->FileUtils()->NewFileL(); + break; + } + + case EFileBrowserCmdFileNewDirectory: + { + iModel->FileUtils()->NewDirectoryL(); + break; + } + + case EFileBrowserCmdFileDelete: + { + iModel->FileUtils()->DeleteL(); + break; + } + + case EFileBrowserCmdFileRename: + { + iModel->FileUtils()->RenameL(); + break; + } + + case EFileBrowserCmdFileTouch: + { + iModel->FileUtils()->TouchL(); + break; + } + + case EFileBrowserCmdFileProperties: + { + iModel->FileUtils()->PropertiesL(); + break; + } + + case EFileBrowserCmdFileChecksumsMD5: + case EFileBrowserCmdFileChecksumsMD2: + case EFileBrowserCmdFileChecksumsSHA1: + { + iModel->FileUtils()->ShowFileCheckSumsL(aCommand); + break; + } + + case EFileBrowserCmdFileSetAttributes: + { + iModel->FileListContainer()->HideToolbar(); + iModel->FileUtils()->SetAttributesL(); + break; + } + + case EFileBrowserCmdFileCompress: + { + iModel->FileUtils()->CompressL(); + break; + } + + case EFileBrowserCmdFileDecompress: + { + iModel->FileUtils()->DecompressL(); + break; + } +/// + case EFileBrowserCmdSnapShot: + { + iModel->FileUtils()->DriveSnapShotL(); + break; + } + + case EFileBrowserCmdEditCut: + { + iModel->FileUtils()->ClipboardCutL(); + break; + } + + case EFileBrowserCmdEditCopy: + { + iModel->FileUtils()->ClipboardCopyL(); + break; + } + + case EFileBrowserCmdEditPaste: + { + iModel->FileUtils()->ClipboardPasteL(); + break; + } + + case EFileBrowserCmdEditCopyToFolder: + { + iModel->FileUtils()->CopyToFolderL(); + break; + } + + case EFileBrowserCmdEditMoveToFolder: + { + iModel->FileUtils()->CopyToFolderL(ETrue); + break; + } + + case EFileBrowserCmdEditSelect: + { + iModel->FileListContainer()->UpdateToolbar(); + AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdMark, iContainer->ListBox() ); + break; + } + + case EFileBrowserCmdEditUnselect: + { + iModel->FileListContainer()->UpdateToolbar(); + AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdUnmark, iContainer->ListBox() ); + break; + } + + case EFileBrowserCmdEditSelectAll: + { + iModel->FileListContainer()->UpdateToolbar(); + AknSelectionService::HandleMarkableListProcessCommandL( EAknMarkAll, iContainer->ListBox() ); + break; + } + + case EFileBrowserCmdEditUnselectAll: + { + iModel->FileListContainer()->UpdateToolbar(); + AknSelectionService::HandleMarkableListProcessCommandL( EAknUnmarkAll, iContainer->ListBox() ); + break; + } +/// + case EFileBrowserCmdViewSortByName: + case EFileBrowserCmdViewSortByExtension: + case EFileBrowserCmdViewSortByDate: + case EFileBrowserCmdViewSortBySize: + { + iModel->FileUtils()->SetSortModeL(aCommand); + break; + } + + case EFileBrowserCmdViewOrderAscending: + case EFileBrowserCmdViewOrderDescending: + { + iModel->FileUtils()->SetOrderModeL(aCommand); + break; + } + + case EFileBrowserCmdViewFilterEntries: + { + iContainer->EnableSearchFieldL(); + break; + } + + case EFileBrowserCmdViewRefresh: + { + iModel->FileUtils()->RefreshViewL(); + break; + } +/// + case EFileBrowserCmdDiskAdminSetDrivePassword: + { + iModel->FileUtils()->SetDrivePasswordL(); + break; + } + + case EFileBrowserCmdDiskAdminUnlockDrive: + { + iModel->FileUtils()->UnlockDriveL(); + break; + } + + case EFileBrowserCmdDiskAdminClearDrivePassword: + { + iModel->FileUtils()->ClearDrivePasswordL(); + break; + } + + case EFileBrowserCmdDiskAdminEraseDrivePassword: + { + iModel->FileUtils()->EraseDrivePasswordL(); + break; + } + + case EFileBrowserCmdDiskAdminFormatDrive: + { + iModel->FileUtils()->FormatDriveL(EFalse); + break; + } + + case EFileBrowserCmdDiskAdminQuickFormatDrive: + { + iModel->FileUtils()->FormatDriveL(ETrue); + break; + } + + case EFileBrowserCmdDiskAdminCheckDisk: + { + iModel->FileUtils()->CheckDiskL(); + break; + } + + case EFileBrowserCmdDiskAdminScanDrive: + { + iModel->FileUtils()->ScanDriveL(); + break; + } + + case EFileBrowserCmdDiskAdminSetDriveName: + { + iModel->FileUtils()->SetDriveNameL(); + break; + } + + case EFileBrowserCmdDiskAdminSetDriveVolumeLabel: + { + iModel->FileUtils()->SetDriveVolumeLabelL(); + break; + } + + case EFileBrowserCmdDiskAdminEjectDrive: + { + iModel->FileUtils()->EjectDriveL(); + break; + } + + case EFileBrowserCmdDiskAdminDismountFileSystem: + { + iModel->FileUtils()->DismountFileSystemL(); + break; + } + + case EFileBrowserCmdDiskAdminEraseMBR: + { + iModel->FileUtils()->EraseMBRL(); + break; + } + + case EFileBrowserCmdDiskAdminDrivePartition: + { + iModel->FileUtils()->PartitionDriveL(); + break; + } + +/// + case EFileBrowserCmdToolsAllFiles: + { + iModel->FileUtils()->WriteAllFilesL(); + break; + } + + case EFileBrowserCmdToolsAvkonIconCacheEnable: + { + iModel->FileUtils()->EnableAvkonIconCacheL(ETrue); + break; + } + + case EFileBrowserCmdToolsAvkonIconCacheDisable: + { + iModel->FileUtils()->EnableAvkonIconCacheL(EFalse); + break; + } + + case EFileBrowserCmdToolsEditDataTypes: + { + iModel->FileUtils()->EditDataTypesL(); + break; + } + + case EFileBrowserCmdToolsDisableExtErrors: + { + iModel->FileUtils()->SetErrRdL(EFalse); + break; + } + + case EFileBrowserCmdToolsEnableExtErrors: + { + iModel->FileUtils()->SetErrRdL(ETrue); + break; + } + + case EFileBrowserCmdToolsErrorSimulateLeave: + { + iModel->FileUtils()->SimulateLeaveL(); + break; + } + + case EFileBrowserCmdToolsErrorSimulatePanic: + { + iModel->FileUtils()->SimulatePanicL(); + break; + } + + case EFileBrowserCmdToolsErrorSimulateException: + { + iModel->FileUtils()->SimulateExceptionL(); + break; + } + + case EFileBrowserCmdToolsLocalConnectivityActivateInfrared: + { + iModel->FileUtils()->LaunchProgramL(KIRAppPath); + break; + } + + case EFileBrowserCmdToolsLocalConnectivityLaunchBTUI: + { + iModel->FileUtils()->LaunchProgramL(KBTAppPath); + break; + } + + case EFileBrowserCmdToolsLocalConnectivityLaunchUSBUI: + { + iModel->FileUtils()->LaunchProgramL(KUSBAppPath); + break; + } + + case EFileBrowserCmdToolsInstalledApps: + { + iModel->FileUtils()->WriteAllAppsL(); + break; + } + + case EFileBrowserCmdToolsOpenFiles: + { + iModel->FileUtils()->ListOpenFilesL(); + break; + } + + case EFileBrowserCmdToolsSetDebugMask: + { + iModel->FileUtils()->SetDebugMaskL(); + break; + } + + case EFileBrowserCmdToolsMsgAttachmentsInbox: + case EFileBrowserCmdToolsMsgAttachmentsDrafts: + case EFileBrowserCmdToolsMsgAttachmentsSentItems: + case EFileBrowserCmdToolsMsgAttachmentsOutbox: + { + iModel->FileUtils()->ListMessageAttachmentsL(aCommand); + break; + } + + case EFileBrowserCmdToolsMsgStoreWalk: + { + iModel->FileUtils()->WriteMsgStoreWalkL(); + break; + } + + case EFileBrowserCmdToolsMemoryInfo: + { + iModel->FileUtils()->MemoryInfoPopupL(); + break; + } + + case EFileBrowserCmdToolsSecureBackupStartBackup: + case EFileBrowserCmdToolsSecureBackupStartRestore: + case EFileBrowserCmdToolsSecureBackupStop: + { + iModel->FileUtils()->SecureBackupL(aCommand); + break; + } + +/// + case EFileBrowserCmdSettings: + { + if (iModel->LaunchSettingsDialogL() == EAknCmdExit) + AppUi()->HandleCommandL( EEikCmdExit ); + break; + } + + case EFileBrowserCmdAbout: + { + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + dialog->ExecuteLD(R_FILEBROWSER_ABOUT_DIALOG); + } + break; + + case EAknSoftkeyCancel: + { + iContainer->DisableSearchFieldL(); + break; + } + + case EAknSoftkeyExit: + { + AppUi()->HandleCommandL( EEikCmdExit ); + break; + } + + default: + { + AppUi()->HandleCommandL( aCommand ); + break; + } + } + } + +// --------------------------------------------------------- +// CFileBrowserFileListView::HandleClientRectChange() +// --------------------------------------------------------- +// +void CFileBrowserFileListView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CFileBrowserFileListView::DoActivateL(...) +// ?implementation_description +// --------------------------------------------------------- +// +void CFileBrowserFileListView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + if (!iContainer) + { + iContainer = new (ELeave) CFileBrowserFileListContainer; + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect() ); + AppUi()->AddToStackL( *this, iContainer ); + } + } + +// --------------------------------------------------------- +// CFileBrowserFileListView::HandleCommandL(TInt aCommand) +// ?implementation_description +// --------------------------------------------------------- +// +void CFileBrowserFileListView::DoDeactivate() + { + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iContainer; + iContainer = NULL; + } + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBFileOps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBFileOps.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1158 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBFileOps.h" +#include "FBFileUtils.h" +#include "FBModel.h" +#include "FBTraces.h" + +#ifndef FILEBROWSER_LITE + #include "FBFileOpClient.h" +#endif + +#include +#include +#include +#include + +const TInt KSecureBackupStartDelay = 750000; +const TInt KSecureBackupLoopDelay = 100000; +const TInt KSecureBackupEndDelay = 200000; +const TInt KMaxFileLockAttempts = 3; + + +// ================= MEMBER FUNCTIONS ======================= + +CFileBrowserFileOps* CFileBrowserFileOps::NewL(CFileBrowserModel* aModel) + { + CFileBrowserFileOps* self = new(ELeave) CFileBrowserFileOps(aModel); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileOps::CFileBrowserFileOps(CFileBrowserModel* aModel) : iModel(aModel) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileOps::ConstructL() + { + iRecursiveState = EFileOpInvalid; + iSecureBackUpActive = EFalse; + iFileCommandActivatedSecureBackup = EFalse; + + User::LeaveIfError(iFs.Connect()); + iFileMan = CFileMan::NewL( iFs, this ); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileOps::~CFileBrowserFileOps() + { + if (iSBEClient) + delete iSBEClient; + + #ifndef FILEBROWSER_LITE + if (iFileOpClient) + delete iFileOpClient; + #endif + + delete iFileMan; + iFs.Close(); + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::ActivateSecureBackUpViaFileOp() + { + iFileManObserverResult = MFileManObserver::EContinue; + // if already activate by a file command, return ok + if (iFileCommandActivatedSecureBackup) + return KErrNone; + else + { + // if secure backup is already active, disable it first, because it may in wrong state + if (iSecureBackUpActive) + DeActivateSecureBackUp(); + } + + // try to activate full secure backup + TInt err = ActivateSecureBackUp(conn::EBURBackupFull, conn::EBackupBase); + + if (err == KErrNone) + iFileCommandActivatedSecureBackup = ETrue; + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DeActivateSecureBackUpViaFileOp() + { + TInt err(KErrGeneral); + iFileManObserverResult = MFileManObserver::EContinue; + + // if activate by a file command, try to reactivate it + if (iFileCommandActivatedSecureBackup) + { + err = DeActivateSecureBackUp(); + + // even if it fails, forget the state + iFileCommandActivatedSecureBackup = EFalse; + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::ActivateSecureBackUp(conn::TBURPartType aPartType, conn::TBackupIncType aBackupIncType) + { + iFileManObserverResult = MFileManObserver::EContinue; + // check for invalid parameters + if (aPartType == conn::EBURNormal || aBackupIncType == conn::ENoBackup) + User::Panic(_L("Inv.Usage.SE"), 532); + + TInt err(KErrNone); + + if (!iSBEClient) + { + TRAP(err, iSBEClient = conn::CSBEClient::NewL()); + if (err != KErrNone) + return err; + } + + TDriveList driveList; + err = iFs.DriveList(driveList); + + if (err == KErrNone) + { + // make sure that the application has a system status to prevent getting shut down events + iModel->EikonEnv()->SetSystem(ETrue); + + // activating secure back up removes locks from files which respect this fuctionality + TRAP(err, iSBEClient->SetBURModeL(driveList, aPartType, aBackupIncType)); + + if (err == KErrNone) + { + iSecureBackUpActive = ETrue; + User::After(KSecureBackupStartDelay); // a short delay to wait to activate + } + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DeActivateSecureBackUp() + { + TInt err(KErrNone); + + if (!iSBEClient) + { + TRAP(err, iSBEClient = conn::CSBEClient::NewL()); + if (err != KErrNone) + return err; + + // make sure that the application has a system status + iModel->EikonEnv()->SetSystem(ETrue); + } + + TDriveList driveList; + err = iFs.DriveList(driveList); + + if (err == KErrNone) + { + // deactivate secure backup + TRAP(err, iSBEClient->SetBURModeL(driveList, conn::EBURNormal, conn::ENoBackup)); + + User::After(KSecureBackupEndDelay); // a short delay to wait to deactivate + + // system status not needed anymore + iModel->EikonEnv()->SetSystem(EFalse); + } + + iSecureBackUpActive = EFalse; + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFindEntries(const TDesC& aFileName, const TDesC& aPath) + { + TFindFile fileFinder(iFs); + CDir* dir; + TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir); + + while (err == KErrNone && iFileManObserverResult != MFileManObserver::ECancel) + { + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + if (entry.iName.Length() && aPath.Length()) + { + // parse the entry + TParse parsedName; + parsedName.Set(entry.iName, &fileFinder.File(), NULL); + + if (parsedName.Drive().Length() && aPath.Length() && parsedName.Drive()[0] == aPath[0]) + { + // get full source path + TFileName fullSourcePath = parsedName.FullName(); + if (entry.IsDir()) + fullSourcePath.Append(_L("\\")); + + // call the file operation command + switch(iRecursiveState) + { + case EFileOpAttribs: + { + // the same attribs command can be given for both directories and files + FileOpAttribs(fullSourcePath, iUint1, iUint2, iTime1, iUint3); + } + break; + + case EFileOpCopy: + { + // calculate length of new entries added to the original source path + TUint newEntriesLength = fullSourcePath.Length() - iBuf1.Length(); + + // get pointer description to the rightmost data + TPtr16 newEntriesPtr = fullSourcePath.RightTPtr(newEntriesLength); + + // generate target path + TFileName fullTargetPath = iBuf2; + fullTargetPath.Append(newEntriesPtr); + + if (entry.IsDir()) + { + // if it is a directory entry, just create it based on the entry's attributes + FileOpMkDirAll(fullTargetPath, entry.iAtt); + } + else + { + // otherwise copy the file + FileOpCopy(fullSourcePath, fullTargetPath, iUint1); + } + } + break; + + case EFileOpDelete: + { + if (entry.IsDir()) + { + // for directories call rmdir + FileOpRmDir(fullSourcePath, iUint1); + } + else + { + // for files call the normal file deletion operation + FileOpDeleteFile(fullSourcePath, iUint1); + } + } + break; + + default: + User::Panic (_L("FileOpRecurs"), 775); + break; + } + } + } + if ( iFileManObserverResult == MFileManObserver::ECancel ) break; + } + + delete dir; + dir = NULL; + if ( iFileManObserverResult != MFileManObserver::ECancel ) + { + err = fileFinder.FindWild(dir); + } + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFindEntriesRecursiveL(const TDesC& aFileName, const TDesC& aPath) + { + TInt err(KErrNone); + + // it is logical to scan upwards when deleting and changing attributes + CDirScan::TScanDirection scanDirection = CDirScan::EScanUpTree; + + // when copying files, it is more logical to move downwards + if (iRecursiveState == EFileOpCopy) + scanDirection = CDirScan::EScanDownTree; + + + CDirScan* scan = CDirScan::NewLC(iFs); + scan->SetScanDataL(aPath, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst, scanDirection); + CDir* dir = NULL; + + for(;;) + { + TRAP(err, scan->NextL(dir)); + if (!dir || (err != KErrNone)) + break; + + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + if (entry.IsDir()) + { + TFileName path(scan->FullPath()); + + if (path.Length()) + { + path.Append(entry.iName); + path.Append(_L("\\")); + DoFindEntries(aFileName, path); + } + } + if ( iFileManObserverResult == MFileManObserver::ECancel ) + { + break; + } + } + delete(dir); + if ( iFileManObserverResult == MFileManObserver::ECancel ) + { + break; + } + } + + CleanupStack::PopAndDestroy(scan); + return err; + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::Copy(const TFileEntry& aSourceEntry, const TDesC& aTargetFullName, TUint aSwitch, TBool aDeleteSource) + { + iOperationError = KErrNone; + iFileManObserverResult = MFileManObserver::EContinue; + + TFileName sourcePath = aSourceEntry.iPath; + sourcePath.Append(aSourceEntry.iEntry.iName); + + TInt err(KErrNone); + + if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse)) + { + // find all files recursively and run the operation for them + iRecursiveState = EFileOpCopy; + sourcePath.Append(_L("\\")); + + TFileName targetPath = aTargetFullName; + targetPath.Append(_L("\\")); + + // remove the recursion flag because we will implement our own recursion + TUint newSwitch(aSwitch); + newSwitch &= ~CFileMan::ERecurse; + + iBuf1.Copy(sourcePath); + iBuf2.Copy(targetPath); + iUint1 = newSwitch; + + // create initial directory - if it does not succeed, do not even try to continue + err = FileOpMkDirAll(targetPath, aSourceEntry.iEntry.iAtt); + + if (iOperationError == KErrNone) + { + TRAP(err, DoFindEntries(_L("*"), sourcePath)); // entries under current directory entry + if ( iFileManObserverResult != MFileManObserver::ECancel ) + { + TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath)); // recursively under directories of current directory entry + } + } + } + + else if (aSourceEntry.iEntry.IsDir()) + { + TFileName targetPath = aTargetFullName; + targetPath.Append(_L("\\")); + + // just create a directory based on the file attributes of the source directory + err = FileOpMkDirAll(targetPath, aSourceEntry.iEntry.iAtt); + } + + else + { + // remove a recursion flag if present (this should never happen, but some extra error checking) + if (aSwitch & CFileMan::ERecurse) + aSwitch &= ~CFileMan::ERecurse; + + // do the operation for a file entry + err = FileOpCopy(sourcePath, aTargetFullName, aSwitch); + } + + + // delete source if needed and copy succeeded without any errors (== move operation) + if ( aDeleteSource && iOperationError == KErrNone && + iFileManObserverResult != MFileManObserver::ECancel ) + { + err = Delete(aSourceEntry, aSwitch); + } + + if ( !iOperationError && iFileManObserverResult == MFileManObserver::ECancel ) + { + iOperationError = KErrCancel; + } + + return iOperationError; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch) + { + TInt err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch); + + // if locked, unlock the file and retry + if (iModel->Settings().iRemoveFileLocks && err == KErrInUse) + { + // try to remove the file lock by activating secure backup mode + if (ActivateSecureBackUpViaFileOp() == KErrNone) + { + // try the operation several times + for (TInt i=0; iSettings().iIgnoreProtectionsAtts && err == KErrAccessDenied && BaflUtils::FileExists(iFs, aTargetFullName)) + { + if (FileOpDeleteFile(aTargetFullName, 0) == KErrNone) + { + err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch); + } + } + + // if the file already exists, it is not an error + if (err == KErrAlreadyExists) + err = KErrNone; + + + // if copying from a ROM drive, remove the writing protection flag + if (iModel->Settings().iRemoveROMWriteProrection && err == KErrNone && aSourceFullName.Length() > 3 && (aSourceFullName[0]=='z' || aSourceFullName[0]=='Z')) + { + FileOpAttribs(aTargetFullName, 0, KEntryAttReadOnly, 0, 0); + } + + + // remember the "lowest" error + if (err < iOperationError) + iOperationError = err; + + LOGSTRING4("FileBrowser: FileOpCopy %S -> %S, err=%d", &aSourceFullName, &aTargetFullName, err); + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch) + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->Copy(aSourceFullName, aTargetFullName, aSwitch); + } + else + { + #endif + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + TInt result = iFileMan->Copy( aSourceFullName, aTargetFullName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + if ( !result ) result = waiter->Result(); + CleanupStack::PopAndDestroy( waiter ); + return result; + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::Rename(const TFileEntry& aSourceEntry, const TDesC& aNew, TUint aSwitch) + { + iOperationError = KErrNone; + iFileManObserverResult = MFileManObserver::EContinue; + + TFileName sourcePath = aSourceEntry.iPath; + sourcePath.Append(aSourceEntry.iEntry.iName); + + if (aSourceEntry.iEntry.IsDir()) + { + // do the operation for a directory entry + FileOpRename(sourcePath, aNew, aSwitch); + } + else + { + // do the operation for a file + FileOpRename(sourcePath, aNew, aSwitch); + } + + return iOperationError; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch) + { + TBool setBackROFlag(EFalse); + + TInt err = DoFileOpRename(aName, aNew, aSwitch); + + // if locked, unlock the file and retry + if (iModel->Settings().iRemoveFileLocks && err == KErrInUse) + { + // try to remove the file lock by activating secure backup mode + if (ActivateSecureBackUpViaFileOp() == KErrNone) + { + // try the operation several times + for (TInt i=0; iSettings().iIgnoreProtectionsAtts && err == KErrAccessDenied) + { + // remove write protection and try again + if (FileOpAttribs(aName, 0, KEntryAttReadOnly, 0, 0) == KErrNone) + { + err = DoFileOpRename(aName, aNew, aSwitch); + + setBackROFlag = ETrue; + } + } + + // if still access denied, then try to remove the target path and try again + if (iModel->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied && BaflUtils::FileExists(iFs, aNew)) + { + if (FileOpDeleteFile(aNew, 0) == KErrNone) + { + err = DoFileOpRename(aName, aNew, aSwitch); + } + } + + // set back the read only flag + if (setBackROFlag) + FileOpAttribs(aName, KEntryAttReadOnly, 0, 0, 0); + + + // remember the "lowest" error + if (err < iOperationError) + iOperationError = err; + + LOGSTRING3("FileBrowser: FileOpRename %S, err=%d", &aName, err); + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch) + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->Rename(aName, aNew, aSwitch); + } + else + { + #endif + return iFileMan->Rename(aName, aNew, aSwitch); + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::Attribs(const TFileEntry& aSourceEntry, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) + { + iOperationError = KErrNone; + iFileManObserverResult = MFileManObserver::EContinue; + + TFileName sourcePath = aSourceEntry.iPath; + sourcePath.Append(aSourceEntry.iEntry.iName); + + TInt err(KErrNone); + + if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse)) + { + // do the operation for a current directory entry + err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0); + + // find all files recursively and run the operation for them + iRecursiveState = EFileOpAttribs; + sourcePath.Append(_L("\\")); + + iBuf1.Copy(sourcePath); + iUint1 = aSetMask; + iUint2 = aClearMask; + iTime1 = aTime; + iUint3 = 0; + + TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath)); // recursively under directories of current directory entry + TRAP(err, DoFindEntries(_L("*"), sourcePath)); // entries under current directory entry + } + + else if (aSourceEntry.iEntry.IsDir()) + { + //sourcePath.Append(_L("\\")); // <-- do not apply! + + // do the operation for a directory entry + err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0); + } + + else + { + // do the operation for a file entry + err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0); + } + + return iOperationError; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) + { + TInt err = DoFileOpAttribs(aName, aSetMask, aClearMask, aTime, aSwitch); + + // if locked, unlock the file and retry + if (iModel->Settings().iRemoveFileLocks && err == KErrInUse) + { + // try to remove the file lock by activating secure backup mode + if (ActivateSecureBackUpViaFileOp() == KErrNone) + { + // try the operation several times + for (TInt i=0; iSettings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->Attribs(aName, aSetMask, aClearMask, aTime, aSwitch); + } + else + { + #endif + return iFileMan->Attribs(aName, aSetMask, aClearMask, aTime, aSwitch); + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::Delete(const TFileEntry& aSourceEntry, TUint aSwitch) + { + iOperationError = KErrNone; + iFileManObserverResult = MFileManObserver::EContinue; + + TFileName sourcePath = aSourceEntry.iPath; + sourcePath.Append(aSourceEntry.iEntry.iName); + + TInt err(KErrNone); + + if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse)) + { + // find all files recursively and run the operation for them + iRecursiveState = EFileOpDelete; + sourcePath.Append(_L("\\")); + + iBuf1.Copy(sourcePath); + iUint1 = 0; + + TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath)); // recursively under directories of current directory entry + if ( iFileManObserverResult != MFileManObserver::ECancel ) + { + TRAP(err, DoFindEntries(_L("*"), sourcePath)); // entries under current directory entry + } + + if ( iFileManObserverResult != MFileManObserver::ECancel ) + { + // do the operation for a current directory entry as well + err = FileOpRmDir(sourcePath, 0); + } + } + + else if (aSourceEntry.iEntry.IsDir()) + { + sourcePath.Append(_L("\\")); + + // do the operation for a directory entry + err = FileOpRmDir(sourcePath, 0); + } + + else + { + // do the operation for a file entry + err = FileOpDeleteFile(sourcePath, 0); + } + if ( !iOperationError && iFileManObserverResult == MFileManObserver::ECancel ) + { + iOperationError = KErrCancel; + } + return iOperationError; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpDeleteFile(const TDesC& aName, TUint aSwitch) + { + TInt err = DoFileOpDeleteFile(aName, aSwitch); + + // if locked, unlock the file and retry + if (iModel->Settings().iRemoveFileLocks && err == KErrInUse) + { + // try to remove the file lock by activating secure backup mode + if (ActivateSecureBackUpViaFileOp() == KErrNone) + { + // try the operation several times + for (TInt i=0; iSettings().iIgnoreProtectionsAtts && (err == KErrAccessDenied || err == KErrNotFound)) + { + // remove protections and try again + if (FileOpAttribs(aName, 0, KEntryAttReadOnly|KEntryAttSystem|KEntryAttHidden, 0, 0) == KErrNone) + { + err = DoFileOpDeleteFile(aName, aSwitch); + } + } + + // remember the "lowest" error + if (err < iOperationError) + iOperationError = err; + + LOGSTRING3("FileBrowser: FileOpDeleteFile %S, err=%d", &aName, err); + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFileOpDeleteFile(const TDesC& aName, TUint aSwitch) + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->Delete(aName, aSwitch); + } + else + { + #endif + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + TInt result = iFileMan->Delete( aName, aSwitch, waiter->iStatus ); + waiter->StartAndWait(); + if ( iFileManObserverResult == MFileManObserver::ECancel ) result = KErrCancel; + if ( !result ) result = waiter->Result(); + CleanupStack::PopAndDestroy( waiter ); + return result; + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpRmDir(const TDesC& aName, TUint aSwitch) + { + TInt err = DoFileOpRmDir(aName, aSwitch); + + // if write protected or system directory, remove protections and retry + if (iModel->Settings().iIgnoreProtectionsAtts && (err == KErrAccessDenied || err == KErrInUse)) + { + // remove protections and try again + if (FileOpAttribs(aName.Left(aName.Length()-1), 0, KEntryAttReadOnly|KEntryAttSystem|KEntryAttHidden, 0, 0) == KErrNone) + { + err = DoFileOpRmDir(aName, aSwitch); + } + } + + // remember the "lowest" error + if (err < iOperationError) + iOperationError = err; + + LOGSTRING3("FileBrowser: FileOpRmDir %S, err=%d", &aName, err); + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFileOpRmDir(const TDesC& aDirName, TUint aSwitch) + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->RmDir(aDirName, aSwitch); + } + else + { + #endif + if ( aSwitch & CFileMan::ERecurse ) + { + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + TInt result = iFileMan->RmDir( aDirName, waiter->iStatus ); + waiter->StartAndWait(); + if ( iFileManObserverResult == MFileManObserver::ECancel ) result = KErrCancel; + if ( !result ) result = waiter->Result(); + CleanupStack::PopAndDestroy( waiter); + return result; + } + else + return iFs.RmDir(aDirName); + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::MkDirAll(const TDesC& aPath, TInt aSetAtts, TBool aQuickOperation) + { + iFileManObserverResult = MFileManObserver::EContinue; + if (aQuickOperation) + return DoFileOpMkDirAll(aPath); + else + return FileOpMkDirAll(aPath, aSetAtts); + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpMkDirAll(const TDesC& aPath, TInt aSetAtts) + { + TInt err = DoFileOpMkDirAll(aPath); + + // if the directory already exists, it is not an error + if (err == KErrAlreadyExists) + err = KErrNone; + + + // set attributes for directory just created + if (aSetAtts > 0 && err == KErrNone && aPath.Length() > 3) + { + // a path has a trailing backslash so it needs to be removed before the call + err = FileOpAttribs(aPath.Left(aPath.Length()-1), aSetAtts, 0, 0, 0); + } + + + // remember the "lowest" error + if (err < iOperationError) + iOperationError = err; + + LOGSTRING3("FileBrowser: FileOpMkDirAll %S, err=%d", &aPath, err); + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFileOpMkDirAll(const TDesC& aPath) + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->MkDirAll(aPath); + } + else + { + #endif + return iFs.MkDirAll(aPath); + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::CreateEmptyFile(const TDesC& aName) + { + return DoFileOpCreateEmptyFile(aName); + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::FileOpCreateEmptyFile(const TDesC& aName) + { + TInt err = DoFileOpCreateEmptyFile(aName); + + // remember the "lowest" error + if (err < iOperationError) + iOperationError = err; + + LOGSTRING3("FileBrowser: FileOpCreateEmptyFile %S, err=%d", &aName, err); + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DoFileOpCreateEmptyFile(const TDesC& aName) + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->CreateEmptyFile(aName); + } + else + { + #endif + TInt err(KErrNone); + + RFile newFile; + err = newFile.Create(iFs, aName, EFileShareExclusive); + if (err == KErrNone) + err = newFile.Flush(); + newFile.Close(); + + return err; + #ifndef FILEBROWSER_LITE + } + #endif + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::DriveSnapShot(TChar aSourceDriveLetter, TChar aTargetDriveLetter) + { + TInt err(KErrNone); + iFileManObserverResult = MFileManObserver::EContinue; + + // remember old settings and force them to be true for this operation + TBool currentRemoveFileLocksValue = iModel->Settings().iRemoveFileLocks; + TBool currentIgnoreProtectionAttsValue = iModel->Settings().iIgnoreProtectionsAtts; + TBool currentRemoveROMWriteProrection = iModel->Settings().iRemoveROMWriteProrection; + iModel->Settings().iRemoveFileLocks = ETrue; + iModel->Settings().iIgnoreProtectionsAtts = ETrue; + iModel->Settings().iRemoveROMWriteProrection = ETrue; + + + TFileName sourceDir; + sourceDir.Append(aSourceDriveLetter); + sourceDir.Append(_L(":")); + + _LIT(KTargetDir, "%c:\\SnapShot_%c_drive"); + TFileName targetDir; + targetDir.Format(KTargetDir, TUint(aTargetDriveLetter), TUint(aSourceDriveLetter)); + + // remove any existing content, first get TEntry + TEntry entry; + err = iFs.Entry(targetDir, entry); + + // entry directory exists, delete it + if (err == KErrNone && entry.IsDir()) + { + TFileName targetRoot; + targetRoot.Append(aTargetDriveLetter); + targetRoot.Append(_L(":\\")); + + TFileEntry targetEntry; + targetEntry.iPath = targetRoot; + targetEntry.iEntry = entry; + + err = Delete(targetEntry, CFileMan::ERecurse); + } + + // do not care if removing succeeded or not, just continue with copying + TEntry fakeEntry; + fakeEntry.iAtt |= KEntryAttDir; + + TFileEntry sourceEntry; + sourceEntry.iPath = sourceDir; + sourceEntry.iEntry = fakeEntry; + + err = Copy(sourceEntry, targetDir, CFileMan::ERecurse|CFileMan::EOverWrite); + + + // restore back settings + iModel->Settings().iRemoveFileLocks = currentRemoveFileLocksValue; + iModel->Settings().iIgnoreProtectionsAtts = currentIgnoreProtectionAttsValue; + iModel->Settings().iRemoveROMWriteProrection = currentRemoveROMWriteProrection; + + + return iOperationError; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::EraseMBR(TUint aDriveNumber) + { + #ifndef FILEBROWSER_LITE + + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->EraseMBR(aDriveNumber); + + #else + return KErrNotSupported; + #endif + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileOps::PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions) + { + #ifndef FILEBROWSER_LITE + + if (!iFileOpClient) + iFileOpClient = CFBFileOpClient::NewL(); + + return iFileOpClient->PartitionDrive(aDriveNumber, aNumberOfPartitions); + + #else + return KErrNotSupported + #endif + } + +// -------------------------------------------------------------------------------------------- + +MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManStarted() + { + return iFileManObserverResult; + } + +// -------------------------------------------------------------------------------------------- + +MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManOperation() + { + return iFileManObserverResult; + } +// -------------------------------------------------------------------------------------------- + +MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManEnded() + { + return iFileManObserverResult; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileOps::CancelOp() + { +#ifndef FILEBROWSER_LITE + + if ( iModel->Settings().iBypassPlatformSecurity ) + { + if ( !iFileOpClient ) + iFileOpClient = CFBFileOpClient::NewL(); + + iFileOpClient->CancelOp(); + } + + // we need this information even when using iFileOpClient + // to be able to not execute aggregate operations + iFileManObserverResult = MFileManObserver::ECancel; + +#else + iFileManObserverResult = MFileManObserver::ECancel; +#endif + } + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBFileUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBFileUtils.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,5147 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBFileUtils.h" +#include "FBFileOps.h" +#include "FBModel.h" +#include "FBFileDlgs.h" +#include "FBFileEditor.h" +#include "FBFileListContainer.h" +#include "FB.hrh" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if (!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#endif // !defined __SERIES60_30__ && !defined __SERIES60_31__ + +#ifndef __SERIES60_30__ + #include +#endif + +_LIT(KGZipExt, ".gz"); +_LIT8(KFileNewLine, "\r\n"); +const TInt KForcedFormatTimeout = 1000000; + +// copied from coreapplicationuisdomainpskeys.h +const TUid KPSUidCoreApplicationUIs = { 0x101F8767 }; +const TUint32 KCoreAppUIsMmcRemovedWithoutEject = 0x00000109; +enum TCoreAppUIsMmcRemovedWithoutEject + { + ECoreAppUIsEjectCommandUsedUninitialized = 0, + ECoreAppUIsEjectCommandNotUsed, + ECoreAppUIsEjectCommandUsed, + ECoreAppUIsEjectCommandUsedToDrive // Low 16-bits contain this value and high 16-bits TDriveNumber to eject + }; +const TInt KDriveLetterStringLength = 3; // e.g. C:\ + +// ================= MEMBER FUNCTIONS ======================= + +CFileBrowserFileUtils* CFileBrowserFileUtils::NewL(CFileBrowserModel* aModel) + { + CFileBrowserFileUtils* self = new(ELeave) CFileBrowserFileUtils(aModel); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileUtils::CFileBrowserFileUtils(CFileBrowserModel* aModel) : CActive(EPriorityStandard), iModel(aModel) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); + User::LeaveIfError(iFs.Connect()); + User::LeaveIfError(iTz.Connect()); + + iState = EIdle; + iListingMode = ENormalEntries; + + iSortMode = EFileBrowserCmdViewSortByName; + iOrderMode = EFileBrowserCmdViewOrderAscending; + iCurrentPath = KNullDesC; + + iFileOps = CFileBrowserFileOps::NewL(iModel); + + iDriveEntryList = new(ELeave) CDriveEntryList(8); + iFileEntryList = new(ELeave) CFileEntryList(64); + iFindFileEntryList = new(ELeave) CFileEntryList(64); + iAppIconList = new(ELeave) CAppIconList(16); + iClipBoardList = new(ELeave) CFileEntryList(64); + + iDocHandler = CDocumentHandler::NewL(); + iDocHandler->SetExitObserver(this); + + // set defaults to the search settings + iSearchAttributes.iSearchDir = KNullDesC; + iSearchAttributes.iWildCards = _L("*.jpg"); + iSearchAttributes.iTextInFile = KNullDesC; + iSearchAttributes.iMinSize = 0; + iSearchAttributes.iMaxSize = 999999999; + iSearchAttributes.iMinDate = TDateTime(1980, EJanuary, 0,0,0,0,0); + iSearchAttributes.iMaxDate = TDateTime(2060, EDecember, 30,0,0,0,0); + iSearchAttributes.iRecurse = ETrue; + + // init the command array + iCommandArray = new(ELeave) CCommandArray(64); + + // get current path from settings + if (iModel->Settings().iRememberLastPath) + { + TFileName settingPath = iModel->Settings().iLastPath; + if (BaflUtils::PathExists(iFs, settingPath)) + iCurrentPath = settingPath; + + if (iCurrentPath != KNullDesC) + GetDriveListL(); + } + + CActiveScheduler::Add(this); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFileUtils::~CFileBrowserFileUtils() + { + Cancel(); + + // save current path from settings + if (iModel->Settings().iRememberLastPath) + { + iModel->Settings().iLastPath = iCurrentPath; + TRAP_IGNORE(iModel->SaveSettingsL(EFalse)); + } + + if (iWaitDialog) + TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); + + if (iProgressDialog) + TRAP_IGNORE(iProgressDialog->ProcessFinishedL()); + + delete iFileOps; + + delete iDocHandler; + + if (iOpenFileService) + delete iOpenFileService; + + delete iClipBoardList; + delete iAppIconList; + delete iFindFileEntryList; + delete iFileEntryList; + delete iDriveEntryList; + + delete iFileMan; + + if (iCommandArray) + { + ResetCommandArray(); + delete iCommandArray; + } + + iTz.Close(); + iFs.Close(); + iTimer.Close(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DoCancel() + { + iTimer.Cancel(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& aLabel) + { + if (iCommandArray->Count() >= 2) + { + // init progress bar + iProgressDialog = new(ELeave) CAknProgressDialog((reinterpret_cast(&iProgressDialog)), ETrue); + iProgressDialog->SetCallback(this); + iProgressDialog->PrepareLC(R_GENERAL_PROGRESS_NOTE); + iProgressDialog->SetCurrentLabelL( EAknCtNote, aLabel ); + iProgressInfo = iProgressDialog->GetProgressInfoL(); + iProgressInfo->SetFinalValue( CommandArrayCount() ); + iProgressDialog->RunLD(); + iProgressDialog->MakeVisible( ETrue ); + } + else if (iCommandArray->Count() >= 1) + { + // init wait dialog + iWaitDialog = new(ELeave) CAknWaitDialog((reinterpret_cast(&iWaitDialog)), ETrue); + iWaitDialog->SetCallback(this); + iWaitDialog->PrepareLC(R_GENERAL_WAIT_NOTE); + iWaitDialog->SetTextL( aLabel ); + iWaitDialog->RunLD(); + } + else + { + // no commands, just do nothing + return; + } + + + // start with the first operation + iCurrentEntry = 0; + iSucceededOperations = 0; + iFailedOperations = 0; + + // starts executing commands + ExecuteCommand(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ExecuteCommand() + { + // make sure the engine isn't active, should never happen + __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("FileUtils:IsActive"), 333)); + + // execute a command after a very short delay (25ms) + iTimer.After(iStatus, 25); + SetActive(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::RunL() + { + TInt err(KErrNone); + TInt currentCommand = iCommandArray->At(iCurrentEntry).iCommandId; + + // execute a command from the queue + switch(currentCommand) + { + case EFileBrowserFileOpCommandAttribs: + { + CCommandParamsAttribs* params = static_cast(iCommandArray->At(iCurrentEntry).iParameters); + err = iFileOps->Attribs(params->iSourceEntry, params->iSetMask, params->iClearMask, params->iTime, params->iSwitch); + } + break; + + case EFileBrowserFileOpCommandCopy: + { + CCommandParamsCopyOrMove* params = static_cast(iCommandArray->At(iCurrentEntry).iParameters); + err = iFileOps->Copy(params->iSourceEntry, params->iTargetPath, params->iSwitch); + } + break; + + case EFileBrowserFileOpCommandMove: + { + CCommandParamsCopyOrMove* params = static_cast(iCommandArray->At(iCurrentEntry).iParameters); + err = iFileOps->Copy(params->iSourceEntry, params->iTargetPath, params->iSwitch, ETrue); + } + break; + + case EFileBrowserFileOpCommandRename: + { + CCommandParamsRename* params = static_cast(iCommandArray->At(iCurrentEntry).iParameters); + err = iFileOps->Rename(params->iSourceEntry, params->iTargetPath, params->iSwitch); + } + break; + + case EFileBrowserFileOpCommandDelete: + { + CCommandParamsDelete* params = static_cast(iCommandArray->At(iCurrentEntry).iParameters); + err = iFileOps->Delete(params->iSourceEntry, params->iSwitch); + } + break; + + case EFileBrowserFileOpCommandDriveSnapShot: + { + CCommandParamsDriveSnapShot* params = static_cast(iCommandArray->At(iCurrentEntry).iParameters); + err = iFileOps->DriveSnapShot(params->iSourceDriveLetter, params->iTargetDriveLetter); + } + break; + + default: + User::Panic (_L("Unknown command"), 400); + break; + } + + + if (err == KErrNone) + { + iSucceededOperations++; + } + else if ( err != KErrCancel ) + { + iFailedOperations++; + } + + iLastError = err; + + // check for more commands in queue + TRAP_IGNORE( CheckForMoreCommandsL() ); + } + +// --------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::RunError(TInt aError) + { + _LIT(KMessage, "Command error %d"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, aError); + + iModel->EikonEnv()->InfoMsg(noteMsg); + + TRAP_IGNORE( CheckForMoreCommandsL() ); + + return KErrNone; + } + +// --------------------------------------------------------------------------- + +void CFileBrowserFileUtils::CheckForMoreCommandsL() + { + //LOGSTRING("Creator: CCreatorEngine::CheckForMoreCommandsL"); + + // update the progress bar + if (iProgressInfo) + iProgressInfo->IncrementAndDraw(1); + + // check if we have more commands to be executed + if (iCurrentEntry >= CommandArrayCount() - 1) + { + //LOGSTRING("Creator: CCreatorEngine::CheckForMoreCommandsL all done"); + + // all done, free resources + ResetCommandArray(); + + // deactive secure backup if it was activated by a file command + iFileOps->DeActivateSecureBackUpViaFileOp(); + + // dismiss any wait/progress dialogs + if (iWaitDialog) + { + TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); + iWaitDialog = NULL; + } + if (iProgressDialog) + { + TRAP_IGNORE(iProgressDialog->ProcessFinishedL()); + iProgressDialog = NULL; + } + + + // show result note + if ( iSucceededOperations == 0 && iFailedOperations == 0 ) + { + // single operation cancelled -> show nothing + } + else if (iSucceededOperations == 1 && iFailedOperations == 0) + { + _LIT(KMessage, "Operation succeeded"); + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(KMessage); + } + else if (iSucceededOperations > 0 && iFailedOperations == 0) + { + _LIT(KMessage, "%d operations succeeded"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, iSucceededOperations); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(noteMsg); + } + else if (iSucceededOperations == 0 && iFailedOperations > 1) + { + _LIT(KMessage, "%d operations failed"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, iFailedOperations); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(noteMsg); + } + else if (iSucceededOperations > 0 && iFailedOperations > 0) + { + _LIT(KMessage, "%d operations succeeded, %d failed"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, iSucceededOperations, iFailedOperations); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(iLastError, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + + } + else + { + // maintain requests + iCurrentEntry++; + + //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry); + + ExecuteCommand(); + } + } +// -------------------------------------------------------------------------------------------- + +// This callback function is called when cancel button of the progress bar was pressed +void CFileBrowserFileUtils::DialogDismissedL(TInt aButtonId) + { + iProgressDialog = NULL; + iProgressInfo = NULL; + iWaitDialog = NULL; + + // check if cancel button was pressed + if (aButtonId == EAknSoftkeyCancel) + { + // cancel the active object, command executer + Cancel(); + + iFileOps->CancelOp(); + + ResetCommandArray(); + + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("Cancelled")); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::AppendToCommandArrayL(TInt aCommand, CCommandParamsBase* aParameters) + { + if (iCommandArray) + iCommandArray->AppendL( TCommand(aCommand, aParameters) ); + else + User::Leave(KErrNotReady); + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::CommandArrayCount() const + { + TInt count(0); + + if (iCommandArray) + count = iCommandArray->Count(); + + return count; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ResetCommandArray() + { + // delete params first + for (TInt i=0; iAt(i).iParameters ) + { + delete iCommandArray->At(i).iParameters; + iCommandArray->At(i).iParameters = NULL; + } + } + + // reset the entries + iCommandArray->Reset(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::HandleSettingsChangeL() + { + if (iModel->FileListContainer()) + { + iModel->FileListContainer()->SetScreenLayoutL(iModel->Settings().iDisplayMode); + iModel->FileListContainer()->CreateListBoxL(iModel->Settings().iFileViewMode); + //iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetSortModeL(TInt aSortMode) + { + iSortMode = aSortMode; + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetOrderModeL(TInt aOrderMode) + { + iOrderMode = aOrderMode; + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CFileBrowserFileUtils::HandleOfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if(aType != EEventKey) + return EKeyWasNotConsumed; + + TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift) || + (aKeyEvent.iModifiers & EModifierLeftShift) || + (aKeyEvent.iModifiers & EModifierRightShift); + TBool controlKeyPressed = (aKeyEvent.iModifiers & EModifierCtrl) || + (aKeyEvent.iModifiers & EModifierRightCtrl); + + // handle left arrow key press + if (aKeyEvent.iCode == EKeyLeftArrow) + { + MoveUpOneLevelL(); + return EKeyWasConsumed; + } + + // handle right arrow key press + else if (aKeyEvent.iCode == EKeyRightArrow) + { + if (IsDriveListViewActive() && iDriveEntryList->Count() > 0) + { + MoveDownToDirectoryL(); + return EKeyWasConsumed; + } + else if (iFileEntryList->Count() > 0) + { + MoveDownToDirectoryL(); + return EKeyWasConsumed; + } + } + + // skip OK/Enter keys when shift or ctrl is pressed because those are needed by the listbox + else if ((aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) && (shiftKeyPressed || controlKeyPressed)) + { + return EKeyWasNotConsumed; + } + + // handle OK/Enter keys + else if (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) + { + if (IsDriveListViewActive() && iDriveEntryList->Count() > 0) + { + MoveDownToDirectoryL(); + return EKeyWasConsumed; + } + else if (iFileEntryList->Count() > 0) + { + TFileEntry fileEntry = iFileEntryList->At(iModel->FileListContainer()->CurrentListBoxItemIndex()); + + if (fileEntry.iEntry.IsDir()) + MoveDownToDirectoryL(); + else + OpenCommonFileActionQueryL(); + + return EKeyWasConsumed; + } + } + + // handle Delete/Backspace keys + else if (!iModel->FileListContainer()->SearchField() && (aKeyEvent.iCode == EKeyBackspace || aKeyEvent.iCode == EKeyDelete) && + !iModel->FileUtils()->IsCurrentDriveReadOnly() && !iModel->FileUtils()->IsDriveListViewActive()) + { + DeleteL(); + return EKeyWasConsumed; + } + + return EKeyWasNotConsumed; + } +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::RefreshViewL() + { + if (iModel->FileListContainer()) + { + // update navi pane text + if (iListingMode == ENormalEntries) + iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + else if (iListingMode == ESearchResults) + iModel->FileListContainer()->SetNaviPaneTextL(_L("Search results")); + else if (iListingMode == EOpenFiles) + iModel->FileListContainer()->SetNaviPaneTextL(_L("Open files")); + else if (iListingMode == EMsgAttachmentsInbox) + iModel->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Inbox")); + else if (iListingMode == EMsgAttachmentsDrafts) + iModel->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Drafts")); + else if (iListingMode == EMsgAttachmentsSentItems) + iModel->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Sent Items")); + else if (iListingMode == EMsgAttachmentsOutbox) + iModel->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Outbox")); + + // create a list box if it doesn't already exist + if (!iModel->FileListContainer()->ListBox()) + iModel->FileListContainer()->CreateListBoxL(iModel->Settings().iFileViewMode); + + // clear selections if any + iModel->FileListContainer()->ListBox()->ClearSelection(); + + // make sure that the search field is disabled + iModel->FileListContainer()->DisableSearchFieldL(); + + // read directory listing + GenerateDirectoryDataL(); + + // set an icon array + iModel->FileListContainer()->SetListBoxIconArrayL(GenerateIconArrayL()); + + // set text items + iModel->FileListContainer()->SetListBoxTextArrayL(GenerateItemTextArrayL()); + + // make sure that the current item index is not out of array + if (iModel->FileListContainer()->CurrentListBoxItemIndex() == -1 && // -1 is a hardcoded value meaning that no current item index + iModel->FileListContainer()->ListBox()->Model()->NumberOfItems() > 0) + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex( iModel->FileListContainer()->ListBox()->Model()->NumberOfItems() - 1 ); + + } + + iModel->FileListContainer()->UpdateToolbar(); + } + +// -------------------------------------------------------------------------------------------- + +CAknIconArray* CFileBrowserFileUtils::GenerateIconArrayL(TBool aGenerateNewBasicIconArray) + { + CAknIconArray* iconArray = NULL; + + if (aGenerateNewBasicIconArray) + { + iconArray = new(ELeave) CAknIconArray(16); + } + else + { + if (iModel->FileListContainer()) + iconArray = iModel->FileListContainer()->ListBoxIconArrayL(); + + if (!iconArray) + iconArray = new(ELeave) CAknIconArray(16); + } + + + CleanupStack::PushL(iconArray); + + // generate basic items if not already existing + if (iconArray->Count() < EFixedIconListLength) + { + // reset arrays + iconArray->Reset(); + iAppIconList->Reset(); + + // get default control color + TRgb defaultColor; + defaultColor = iModel->EikonEnv()->Color(EColorControlText); + + // create a color icon of the marking indicator + CFbsBitmap* markBitmap = NULL; + CFbsBitmap* markBitmapMask = NULL; + + AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(), + KAknsIIDQgnIndiMarkedAdd, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + markBitmap, + markBitmapMask, + AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_indi_marked_add, + EMbmAvkonQgn_indi_marked_add_mask, + defaultColor + ); + + // 0 marking indicator + CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask); + iconArray->AppendL(markIcon); + + // 1 empty + AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask, KAknsIIDQgnPropEmpty); + // 2 phone memory + AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_phone_memc, EMbmAvkonQgn_prop_phone_memc_mask, KAknsIIDQgnPropPhoneMemc); + // 3 memory card + AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile, + EMbmAknmemorycarduiQgn_prop_mmc_memc, EMbmAknmemorycarduiQgn_prop_mmc_memc_mask, KAknsIIDQgnPropMmcMemc); + // 4 memory card disabled + AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile, + EMbmAknmemorycarduiQgn_prop_mmc_non, EMbmAknmemorycarduiQgn_prop_mmc_non_mask, KAknsIIDQgnPropMmcNon); + // 5 folder + AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_folder_small, EMbmAvkonQgn_prop_folder_small_mask, KAknsIIDQgnPropFolderSmall); + // 6 folder with subfolders + AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_folder_sub_small, EMbmAvkonQgn_prop_folder_sub_small_mask, KAknsIIDQgnPropFolderSubSmall); + // 7 current folder + AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_folder_current, EMbmAvkonQgn_prop_folder_current_mask, KAknsIIDQgnPropFolderCurrent); + } + + // append custom icons if not in drive list view and setting is enabled + if (!aGenerateNewBasicIconArray && !IsDriveListViewActive() && iModel->Settings().iShowAssociatedIcons) + { + // init id counter + TInt idCounter(EFixedIconListLength + iAppIconList->Count()); + + // loop all items in the file list + for (TInt i=0; iCount(); i++) + { + TFileEntry& fileEntry = iFileEntryList->At(i); + + // just check for normal files + if (!fileEntry.iEntry.IsDir()) + { + TUid appUid = GetAppUid(fileEntry); + TInt iconId = AppIconIdForUid(appUid); + + if (appUid != KNullUid && iconId == KErrNotFound) + { + // icon not found from the icon array, generate it + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + CGulIcon* appIcon = NULL; + + TRAPD(err, + AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appUid, EAknsAppIconTypeList, bitmap, mask); + appIcon = CGulIcon::NewL(bitmap, mask); + CleanupStack::Pop(2); //bitmap, mask + ); + + if (err == KErrNone) + { + TAppIcon appIconEntry; + appIconEntry.iId = idCounter; + appIconEntry.iUid = appUid; + + appIcon->SetBitmapsOwnedExternally(EFalse); + iconArray->AppendL(appIcon); + iAppIconList->AppendL(appIconEntry); + + fileEntry.iIconId = idCounter; + + idCounter++; + } + else + { + delete bitmap; + delete mask; + + TAppIcon appIconEntry; + appIconEntry.iId = EFixedIconEmpty; + appIconEntry.iUid = appUid; + + iAppIconList->AppendL(appIconEntry); + } + } + + else if (appUid != KNullUid && iconId >= 0) + { + // we already have already generated an icon for this uid, use it + fileEntry.iIconId = iconId; + } + } + } + } + + CleanupStack::Pop(); //iconArray + return iconArray; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::AppendGulIconToIconArrayL(CAknIconArray* aIconArray, const TDesC& aIconFile, TInt aIconId, TInt aMaskId, const TAknsItemID aAknsItemId) + { + CGulIcon* icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + aAknsItemId, + aIconFile, + aIconId, + aMaskId); + CleanupStack::PushL(icon); + + icon->SetBitmapsOwnedExternally(EFalse); + aIconArray->AppendL(icon); + + CleanupStack::Pop(); //icon + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::AppIconIdForUid(TUid aUid) + { + TInt result(KErrNotFound); + + for (TInt i=0; iCount(); i++) + { + if (iAppIconList->At(i).iUid == aUid) + { + result = iAppIconList->At(i).iId; + break; + } + } + + return result; + } + +// -------------------------------------------------------------------------------------------- + +TUid CFileBrowserFileUtils::GetAppUid(TFileEntry aFileEntry) + { + TFileName fullPath; + fullPath.Copy(aFileEntry.iPath); + fullPath.Append(aFileEntry.iEntry.iName); + + TParse parsedName; + parsedName.Set(fullPath, NULL, NULL); + + // this will boost performance in \sys\bin folder + if (parsedName.Ext().CompareF(_L(".dll")) == 0 || parsedName.Ext().CompareF(_L(".rsc")) == 0) + return KNullUid; + + TInt err1(KErrNone), err2(KErrNone); + TUid appUid; + TDataType dataType; + TBool isProgram; + + err1 = iModel->LsSession().AppForDocument(fullPath, appUid, dataType); + err2 = iModel->LsSession().IsProgram(fullPath, isProgram); + + if (err1 == KErrNone && err2 == KErrNone) + { + if (isProgram) + { + // get the real app Uid from the app list + TApaAppInfo appInfo; + iModel->LsSession().GetAllApps(); + + while (iModel->LsSession().GetNextApp(appInfo) == KErrNone) + { + if (fullPath.CompareF(appInfo.iFullName) == 0) + return appInfo.iUid; + } + } + else + { + // return the app Uid associated for it + return appUid; + } + } + + return KNullUid; + } +// -------------------------------------------------------------------------------------------- + +CDesCArray* CFileBrowserFileUtils::GenerateItemTextArrayL() + { + CDesCArray* textArray = new(ELeave) CDesCArrayFlat(64); + CleanupStack::PushL(textArray); + + if (IsDriveListViewActive()) + { + _LIT(KSimpleDriveEntry, "%d\t%c: <%S>\t\t"); + _LIT(KExtendedDriveEntry, "%d\t%c: <%S>\t%LD / %LD kB\t"); + + for (TInt i=0; iCount(); i++) + { + TFileName textEntry; + TDriveEntry driveEntry = iDriveEntryList->At(i); + + if (iModel->Settings().iFileViewMode == EFileViewModeSimple) + { + textEntry.Format(KSimpleDriveEntry, driveEntry.iIconId, TUint(driveEntry.iLetter), &driveEntry.iMediaTypeDesc); + } + else if (iModel->Settings().iFileViewMode == EFileViewModeExtended) + { + textEntry.Format(KExtendedDriveEntry, driveEntry.iIconId, TUint(driveEntry.iLetter), &driveEntry.iMediaTypeDesc, driveEntry.iVolumeInfo.iFree/1024, driveEntry.iVolumeInfo.iSize/1024); + } + + textArray->AppendL(textEntry); + } + } + + else + { + _LIT(KSimpleFileEntry, "%d\t%S\t\t"); + _LIT(KExtendedFileEntry, "%d\t%S\t%S\t"); + + for (TInt i=0; iCount(); i++) + { + TBuf textEntry; + TFileEntry fileEntry = iFileEntryList->At(i); + + // format text line entries + if (iModel->Settings().iFileViewMode == EFileViewModeSimple) + { + textEntry.Format(KSimpleFileEntry, fileEntry.iIconId, &fileEntry.iEntry.iName); + } + else if (iModel->Settings().iFileViewMode == EFileViewModeExtended) + { + TBuf<128> extraData; + + // append entry date + TTime entryModified = fileEntry.iEntry.iModified; + if ( iTz.ConvertToLocalTime( entryModified ) == KErrNone ) + { + entryModified = fileEntry.iEntry.iModified; + } + + _LIT(KCurrentDate,"%D%M%*Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); + entryModified.FormatL(extraData, KCurrentDate); + + // for a directory append number of entries and for a file the file size + if (fileEntry.iEntry.IsDir() && fileEntry.iDirEntries >= 0) + { + extraData.Append(_L(" - ")); + extraData.AppendNum(fileEntry.iDirEntries); + + if (fileEntry.iDirEntries == 1) + extraData.Append(_L(" entry")); + else + extraData.Append(_L(" entries")); + } + + // normal file entry + else if (!fileEntry.iEntry.IsDir()) + { + extraData.Append(_L(" - ")); + + if (fileEntry.iEntry.iSize < 1024) + { + extraData.AppendNum(fileEntry.iEntry.iSize); + extraData.Append(_L(" B")); + } + else if (fileEntry.iEntry.iSize < 1024*1024) + { + TReal sizeKB = (TReal)fileEntry.iEntry.iSize / 1024; + extraData.AppendNum(sizeKB, TRealFormat(KDefaultRealWidth, 1)); + extraData.Append(_L(" kB")); + } + else + { + TReal sizeMB = (TReal)fileEntry.iEntry.iSize / (1024*1024); + extraData.AppendNum(sizeMB, TRealFormat(KDefaultRealWidth, 1)); + extraData.Append(_L(" MB")); + } + } + + // append attribute flags if any + TBuf<4> atts; + if (fileEntry.iEntry.IsArchive()) + atts.Append(_L("A")); + if (fileEntry.iEntry.IsHidden()) + atts.Append(_L("H")); + if (fileEntry.iEntry.IsReadOnly()) + atts.Append(_L("R")); + if (fileEntry.iEntry.IsSystem()) + atts.Append(_L("S")); + + if (atts.Length() > 0) + { + extraData.Append(_L(" - [")); + extraData.Append(atts); + extraData.Append(_L("]")); + } + + // format + textEntry.Format(KExtendedFileEntry, fileEntry.iIconId, &fileEntry.iEntry.iName, &extraData); + } + + if( fileEntry.iEntry.iName.Length() + fileEntry.iPath.Length() <= KMaxFileName ) + { + textArray->AppendL(textEntry); + } + else + { + // Too long filenames are deleted from the list + iFileEntryList->Delete(i--); + } + } + } + + CleanupStack::Pop(); //textArray + return textArray; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::GenerateDirectoryDataL() + { + if (iListingMode == ENormalEntries) + { + if (IsDriveListViewActive()) + GetDriveListL(); + else + GetDirectoryListingL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::GetDriveListL() + { + TDriveList driveList; + + // get drive listing depending of the support for network drives + if (iModel->Settings().iSupportNetworkDrives) + { + #ifndef __SERIES60_30__ + #ifndef __SERIES60_31__ + User::LeaveIfError(iFs.DriveList(driveList, KDriveAttAll)); + #endif + #else + User::LeaveIfError(iFs.DriveList(driveList)); + #endif + } + else + { + User::LeaveIfError(iFs.DriveList(driveList)); + } + + iDriveEntryList->Reset(); + + for (TInt i=0; iCount(); + } + + iDriveEntryList->AppendL(driveEntry); + } + } + + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::GetDirectoryListingL() + { + iFileEntryList->Reset(); + + TInt sortMode(ESortByName); + if (iSortMode == EFileBrowserCmdViewSortByExtension) + sortMode = ESortByExt; + else if (iSortMode == EFileBrowserCmdViewSortBySize) + sortMode = ESortBySize; + else if (iSortMode == EFileBrowserCmdViewSortByDate) + sortMode = ESortByDate; + + TInt orderMode(EAscending); + if (iOrderMode == EFileBrowserCmdViewOrderDescending) + orderMode = EDescending; + + CDir* dir = NULL; + if (iFs.GetDir(iCurrentPath, KEntryAttMatchMask, sortMode | orderMode | EDirsFirst, dir) == KErrNone) + { + CleanupStack::PushL(dir); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry; + fileEntry.iPath = iCurrentPath; + fileEntry.iEntry = (*dir)[i]; + fileEntry.iDirEntries = KErrNotFound; + fileEntry.iIconId = EFixedIconEmpty; + + if ( iPrevFolderName != KNullDesC && iPrevFolderName == fileEntry.iEntry.iName ) + { + iPrevFolderIndex = i; + } + + // check for directory entries + if (fileEntry.iEntry.IsDir()) + { + fileEntry.iIconId = EFixedIconFolder; + + TFileName subPath = fileEntry.iPath; + subPath.Append(fileEntry.iEntry.iName); + subPath.Append(_L("\\")); + + // get number of entries in this directory if extended info about sub directories enabled + if (iModel->Settings().iShowSubDirectoryInfo && iModel->Settings().iFileViewMode == EFileViewModeExtended) + { + CDir* subDir = NULL; + if (iFs.GetDir(subPath, KEntryAttMatchMask, ESortNone | EDirsFirst, subDir) == KErrNone) + { + fileEntry.iDirEntries = subDir->Count(); + delete subDir; + } + } + + // apply subfolder icon for known directories (speed improvement) + if (subPath[0]=='Z' && (subPath.CompareF(_L("Z:\\data\\"))==0 || subPath.CompareF(_L("Z:\\Nokia\\"))==0 + || subPath.Compare(_L("Z:\\private\\"))==0 || subPath.Compare(_L("Z:\\resource\\"))==0 + || subPath.Compare(_L("Z:\\sys\\"))==0 || subPath.Compare(_L("Z:\\system\\"))==0)) + { + fileEntry.iIconId = EFixedIconFolderSub; + } + else if (subPath[0]=='Z' && (subPath.CompareF(_L("Z:\\sys\\bin\\"))==0)) + { + // normal folder icon for these ones + fileEntry.iIconId = EFixedIconFolder; + } + else + { + // check if this folder has subdirectories + CDir* subDir = NULL; + if (iFs.GetDir(subPath, KEntryAttDir|KEntryAttMatchMask, ESortNone | EDirsFirst, subDir) == KErrNone) + { + for (TInt j=0; jCount(); j++) + { + TEntry entry = (*subDir)[j]; + + if (entry.IsDir()) + { + fileEntry.iIconId = EFixedIconFolderSub; + break; + } + } + + delete subDir; + } + } + } + + iFileEntryList->AppendL(fileEntry); + } + + CleanupStack::PopAndDestroy(); //dir + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::MoveUpOneLevelL() + { + iPrevFolderIndex = KErrNotFound; + iPrevFolderName.Zero(); + + // change back to normal mode or move up + if (iListingMode != ENormalEntries) + { + iListingMode = ENormalEntries; + } + else + { + // do nothing if displaying drive list view + if (IsDriveListViewActive()) + return; + + if (iCurrentPath.Length() <= KDriveLetterStringLength) + { + if ( iCurrentPath.Length() > 0 ) + { + iPrevFolderName.Append( iCurrentPath[0] ); + } + // move to drive list view if the current path is already short enough + iCurrentPath = KNullDesC; + } + else + { + // move one directory up + TInt marker(iCurrentPath.Length()); + + // find second last dir marker + for (TInt i=iCurrentPath.Length()-2; i>=0; i--) + { + if (iCurrentPath[i] == '\\') + { + marker = i; + break; + } + + } + + // update iPrevDir with the directory name that we just left + iPrevFolderName.Copy( iCurrentPath.RightTPtr( iCurrentPath.Length() - marker - 1 ) ); + iPrevFolderName.Delete( iPrevFolderName.Length() -1, 2 ); // remove extra '\\' + + iCurrentPath = iCurrentPath.LeftTPtr(marker+1); + } + } + + if (iModel->FileListContainer()) + { + //iModel->FileListContainer()->DisableSearchFieldL(); + //iModel->FileListContainer()->ListBox()->ClearSelection(); + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex(0); + //iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + } + + // update view + RefreshViewL(); + + if ( iModel->Settings().iRememberFolderSelection && + iModel->FileListContainer() && iPrevFolderIndex > KErrNotFound ) + { + + TInt visibleItems = iModel->FileListContainer()->ListBox()->Rect().Height() / + iModel->FileListContainer()->ListBox()->ItemHeight() + - 1; // for the title row + + // By default, the selected item would be the last visible item on the listbox. + // We want the selected item be displayed at the middle of the listbox, so we + // select one of the successor items first to scroll down a bit + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex( + Min( iModel->FileListContainer()->ListBox()->Model()->ItemTextArray()->MdcaCount() -1, + iPrevFolderIndex + visibleItems / 2 ) ); + + // ...and after that we select the the correct item. + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex( iPrevFolderIndex ); + + // update view + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::MoveDownToDirectoryL() + { + // change back to normal mode + if (iListingMode != ENormalEntries) + { + iListingMode = ENormalEntries; + } + + TInt index = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (index >= 0) + { + TBool needsRefresh(EFalse); + + if (IsDriveListViewActive()) + { + // currently in a drive list view, move to root of selected drive + if (iDriveEntryList->Count() > index) + { + TDriveEntry driveEntry = iDriveEntryList->At(index); + + iCurrentPath.Append(driveEntry.iLetter); + iCurrentPath.Append(_L(":\\")); + + needsRefresh = ETrue; + } + } + else + { + // otherwise just append the new directory + if (iFileEntryList->Count() > index) + { + TFileEntry fileEntry = iFileEntryList->At(index); + + if (fileEntry.iEntry.IsDir()) + { + iCurrentPath.Copy(fileEntry.iPath); + iCurrentPath.Append(fileEntry.iEntry.iName); + iCurrentPath.Append(_L("\\")); + + needsRefresh = ETrue; + } + } + } + + if (needsRefresh && iModel->FileListContainer()) + { + //iModel->FileListContainer()->DisableSearchFieldL(); + //iModel->FileListContainer()->ListBox()->ClearSelection(); + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex(0); + //iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + + // update view + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileUtils::IsCurrentDriveReadOnly() + { + if (iListingMode !=ENormalEntries || iCurrentPath.Length() < 2) + return EFalse; + else + { + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = iDriveEntryList->At(i); + + if (driveEntry.iLetter == iCurrentPath[0]) + { + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt == KMediaAttWriteProtected || driveEntry.iVolumeInfo.iDrive.iMediaAtt == KMediaAttLocked || driveEntry.iVolumeInfo.iDrive.iDriveAtt == KDriveAbsent) + return ETrue; + else + return EFalse; + } + } + } + + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileUtils::IsCurrentItemDirectory() + { + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (currentItemIndex < 0) + return EFalse; + else + { + if (iFileEntryList->Count() > currentItemIndex) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex) ; + return fileEntry.iEntry.IsDir(); + } + else + return EFalse; + } + + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::GetSelectedItemsOrCurrentItemL(CFileEntryList* aFileEntryList) + { + aFileEntryList->Reset(); + + const CArrayFix* selectionIndexes = iModel->FileListContainer()->ListBoxSelectionIndexes(); + + // by default use selected items + if (selectionIndexes && selectionIndexes->Count() > 0) + { + TInt ref(0); + TKeyArrayFix key(0, ECmpTUint16); + TInt index(0); + + for (TInt i=0; iCount(); i++) + { + ref = i; + + if (selectionIndexes->Find(ref, key, index) == 0) + { + aFileEntryList->AppendL(iFileEntryList->At(i)); + } + } + } + + // or if none selected, use the current item index + else + { + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + aFileEntryList->AppendL(iFileEntryList->At(currentItemIndex)); + } + } + + return aFileEntryList->Count(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ClipboardCutL() + { + iClipBoardMode = EClipBoardModeCut; + TInt operations = GetSelectedItemsOrCurrentItemL(iClipBoardList); + + _LIT(KMessage, "%d entries cut to clipboard"); + TFileName noteMsg; + noteMsg.Format(KMessage, operations); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ClipboardCopyL() + { + iClipBoardMode = EClipBoardModeCopy; + TInt operations = GetSelectedItemsOrCurrentItemL(iClipBoardList); + + _LIT(KMessage, "%d entries copied to clipboard"); + TFileName noteMsg; + noteMsg.Format(KMessage, operations); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ClipboardPasteL() + { + if (iClipBoardMode == EClipBoardModeCut) + { + DoCopyToFolderL(iClipBoardList, iCurrentPath, ETrue); + iClipBoardList->Reset(); + } + else if (iClipBoardMode == EClipBoardModeCopy) + { + DoCopyToFolderL(iClipBoardList, iCurrentPath, EFalse); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::CopyToFolderL(TBool aMove) + { + TFileName destinationFolder; + + // generate an icon array + CAknIconArray* iconArray = GenerateIconArrayL(ETrue); + CleanupStack::PushL(iconArray); + + // run folder selection dialog + CFileBrowserDestinationFolderSelectionDlg* dlg = CFileBrowserDestinationFolderSelectionDlg::NewL(destinationFolder, iDriveEntryList, iconArray); + + TBool dialogOK(EFalse); + + if (aMove) + dialogOK = dlg->RunMoveDlgLD(); + else + dialogOK = dlg->RunCopyDlgLD(); + + if (dialogOK) + { + // get entry list + CFileEntryList* entryList = new(ELeave) CFileEntryList(32); + GetSelectedItemsOrCurrentItemL(entryList); + CleanupStack::PushL(entryList); + + // do the file operations + if (aMove) + DoCopyToFolderL(entryList, destinationFolder, ETrue); + else + DoCopyToFolderL(entryList, destinationFolder, EFalse); + + CleanupStack::PopAndDestroy(); // entryList + } + + CleanupStack::Pop(); //iconArray + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DoCopyToFolderL(CFileEntryList* aEntryList, const TDesC& aTargetDir, TBool aDeleteSource) + { + if (aEntryList && aEntryList->Count() > 0) + { + TBool someEntryExists(EFalse); + TBool doFileOperations(ETrue); + TInt queryIndex(0); + TFileName postFix; + TInt overWriteFlags = CFileMan::EOverWrite; + + // check if some destination entries also exists + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = aEntryList->At(i); + + TFileName targetEntry = aTargetDir; + targetEntry.Append(fileEntry.iEntry.iName); + + if (fileEntry.iEntry.IsDir()) + { + targetEntry.Append(_L("\\")); + + if (BaflUtils::PathExists(iFs, targetEntry)) + { + someEntryExists = ETrue; + break; + } + } + else + { + if (BaflUtils::FileExists(iFs, targetEntry)) + { + someEntryExists = ETrue; + break; + } + } + } + + // show a query if existing entries + if (someEntryExists) + { + CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex); + + if (listQueryDlg->ExecuteLD(R_ENTRY_OVERWRITE_TYPE_QUERY)) + { + if (queryIndex == EFileActionQueryPostFix) + { + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(postFix); + textQuery->SetPromptL(_L("Postfix:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + + } + else + { + doFileOperations = EFalse; + } + } + else if (queryIndex == EFileActionSkipAllExisting) + { + overWriteFlags = 0; + } + } + else + { + doFileOperations = EFalse; + } + } + + + if (doFileOperations) + { + // set correct command id depending if we are copying or moving + TInt commandId(EFileBrowserFileOpCommandCopy); + if (aDeleteSource) + commandId = EFileBrowserFileOpCommandMove; + + // do the file operations for each entry + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = aEntryList->At(i); + + TFileName targetEntry = aTargetDir; + targetEntry.Append(fileEntry.iEntry.iName); + + if (queryIndex == EFileActionGenerateUniqueFilenames) + { + CApaApplication::GenerateFileName(iFs, targetEntry); + } + else if (queryIndex == EFileActionQueryPostFix) + { + targetEntry.Append(postFix); + } + + + // append the new command to the command array + if (fileEntry.iEntry.IsDir()) + { + AppendToCommandArrayL(commandId, + new(ELeave)CCommandParamsCopyOrMove(fileEntry, targetEntry, overWriteFlags|CFileMan::ERecurse) + ); + } + else + { + AppendToCommandArrayL(commandId, + new(ELeave)CCommandParamsCopyOrMove(fileEntry, targetEntry, overWriteFlags) + ); + } + + } + + // execute all operations + if (aDeleteSource) + StartExecutingCommandsL(_L("Moving")); + else + StartExecutingCommandsL(_L("Copying")); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DeleteL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(32); + TInt operations = GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + CAknQueryDialog* query = CAknQueryDialog::NewL(); + _LIT(KQueryMessage, "Delete %d entries?"); + TFileName queryMsg; + queryMsg.Format(KQueryMessage, operations); + + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, queryMsg)) + { + // do the file operations for each entry + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + // append the new command to the command array + if (fileEntry.iEntry.IsDir()) + { + AppendToCommandArrayL(EFileBrowserFileOpCommandDelete, + new(ELeave)CCommandParamsDelete(fileEntry, CFileMan::ERecurse) + ); + } + else + { + AppendToCommandArrayL(EFileBrowserFileOpCommandDelete, + new(ELeave)CCommandParamsDelete(fileEntry, 0) + ); + } + + } + + // execute all operations + StartExecutingCommandsL(_L("Deleting")); + } + + CleanupStack::PopAndDestroy(); //entries + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::TouchL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(32); + GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + TBool recurse(EFalse); + + // check if any directories and ask recursion + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + if (fileEntry.iEntry.IsDir()) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Recurse touch for all selected dirs?"))) + { + recurse = ETrue; + } + break; + } + } + + // now go through all entries + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + // touch to current time + TTime now; + now.UniversalTime(); + + + // append the new command to the command array + if (fileEntry.iEntry.IsDir() && recurse) + { + AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, + new(ELeave)CCommandParamsAttribs(fileEntry, NULL, NULL, now, CFileMan::ERecurse) + ); + } + else + { + AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, + new(ELeave)CCommandParamsAttribs(fileEntry, NULL, NULL, now, 0) + ); + } + } + + // execute all operations + StartExecutingCommandsL(_L("Touching")); + + CleanupStack::PopAndDestroy(); //entries + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::RenameL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(16); + GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + TFileName newName = fileEntry.iEntry.iName; + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(newName); + textQuery->SetPromptL(_L("Enter new name:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + TFileName targetEntry = fileEntry.iPath; + targetEntry.Append(newName); + + TBool alreadyExists(EFalse); + TBool doRenameOperation(ETrue); + + if (fileEntry.iEntry.IsDir()) + { + //targetEntry.Append(_L("\\")); + alreadyExists = BaflUtils::PathExists(iFs, targetEntry); + } + else + { + alreadyExists = BaflUtils::FileExists(iFs, targetEntry); + } + + if (alreadyExists) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + _LIT(KQueryMessage, "%S already exists, overwrite?"); + TFileName queryMsg; + queryMsg.Format(KQueryMessage, &newName); + + if (!query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, queryMsg)) + { + doRenameOperation = EFalse; + } + } + + if (doRenameOperation) + { + // append the new command to the command array + AppendToCommandArrayL(EFileBrowserFileOpCommandRename, + new(ELeave)CCommandParamsRename(fileEntry, targetEntry, CFileMan::EOverWrite) + ); + } + } + } + + // execute all operations + StartExecutingCommandsL(_L("Renaming")); + + CleanupStack::PopAndDestroy(); //entries + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetAttributesL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(16); + GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + if (entries->Count() > 0) + { + TFileName naviText = _L("Multiple entries"); + + TUint setAttMask(0); + TUint clearAttMask(0); + TBool recurse(EFalse); + + // set default masks if only one file selected + if (entries->Count() == 1) + { + TFileEntry fileEntry = entries->At(0); + + naviText.Copy(fileEntry.iEntry.iName); + + if (fileEntry.iEntry.IsArchive()) + setAttMask |= KEntryAttArchive; + else + clearAttMask |= KEntryAttArchive; + + if (fileEntry.iEntry.IsHidden()) + setAttMask |= KEntryAttHidden; + else + clearAttMask |= KEntryAttHidden; + + if (fileEntry.iEntry.IsReadOnly()) + setAttMask |= KEntryAttReadOnly; + else + clearAttMask |= KEntryAttReadOnly; + + if (fileEntry.iEntry.IsSystem()) + setAttMask |= KEntryAttSystem; + else + clearAttMask |= KEntryAttSystem; + } + + iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeNormal); + iModel->FileListContainer()->SetNaviPaneTextL(naviText); + + CFileBrowserAttributeEditorDlg* dlg = CFileBrowserAttributeEditorDlg::NewL(setAttMask, clearAttMask, recurse); + TBool dlgResult = dlg->RunEditorLD(); + + iModel->FileListContainer()->SetScreenLayoutL(iModel->Settings().iDisplayMode); + iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + + if (dlgResult && (setAttMask > 0 || clearAttMask > 0)) + { + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + // append the new command to the command array + if (fileEntry.iEntry.IsDir() && recurse) + { + AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, + new(ELeave)CCommandParamsAttribs(fileEntry, setAttMask, clearAttMask, fileEntry.iEntry.iModified, CFileMan::ERecurse) + ); + } + else + { + AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, + new(ELeave)CCommandParamsAttribs(fileEntry, setAttMask, clearAttMask, fileEntry.iEntry.iModified, 0) + ); + } + } + + // execute all operations + StartExecutingCommandsL(_L("Changing attributes")); + } + } + + CleanupStack::PopAndDestroy(); //entries + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SearchL() + { + iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeNormal); + iModel->FileListContainer()->SetNaviPaneTextL(KNullDesC); + + iSearchAttributes.iSearchDir = iCurrentPath; + + CFileBrowserSearchQueryDlg* dlg = CFileBrowserSearchQueryDlg::NewL(iSearchAttributes); + TBool dlgResult = dlg->RunQueryLD(); + + iModel->FileListContainer()->SetScreenLayoutL(iModel->Settings().iDisplayMode); + iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + + if (dlgResult) + { + iModel->EikonEnv()->BusyMsgL(_L("** Searching **"), TGulAlignment(EHCenterVTop)); + + iFileEntryList->Reset(); + + // if search dir is empty, find from all drives + if (iSearchAttributes.iSearchDir == KNullDesC) + { + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = iDriveEntryList->At(i); + + TBuf<10> driveRoot; + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":\\")); + + DoSearchFiles(iSearchAttributes.iWildCards, driveRoot); + + if (iSearchAttributes.iRecurse) + DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, driveRoot); + + } + + } + + // otherwise just search from the selected directory + else + { + DoSearchFiles(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir); + + if (iSearchAttributes.iRecurse) + DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir); + } + + iModel->EikonEnv()->BusyMsgCancel(); + + TInt operations = iFileEntryList->Count(); + + iListingMode = ESearchResults; + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex(0); + RefreshViewL(); + + _LIT(KMessage, "%d entries found"); + TFileName noteMsg; + noteMsg.Format(KMessage, operations); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::DoSearchFiles(const TDesC& aFileName, const TDesC& aPath) + { + TFindFile fileFinder(iFs); + CDir* dir; + TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir); + + while (err == KErrNone) + { + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + TTime entryModified = entry.iModified; + // convert from universal time + if ( iTz.ConvertToLocalTime( entryModified ) == KErrNone ) + { + entryModified = entry.iModified; + } + if ((entry.IsDir() && entryModified >= iSearchAttributes.iMinDate && entryModified <= iSearchAttributes.iMaxDate) || + (!entry.IsDir() &&entry.iSize >= iSearchAttributes.iMinSize && entry.iSize <= iSearchAttributes.iMaxSize && + entryModified >= iSearchAttributes.iMinDate && entryModified <= iSearchAttributes.iMaxDate)) + { + TParse parsedName; + parsedName.Set(entry.iName, &fileFinder.File(), NULL); + + if (parsedName.Drive().Length() && aPath.Length() && parsedName.Drive()[0] == aPath[0]) + { + TFileEntry fileEntry; + fileEntry.iPath = parsedName.DriveAndPath(); + fileEntry.iEntry = entry; + fileEntry.iDirEntries = KErrNotFound; + + TBool appendToArray(EFalse); + + // append directories always + if (entry.IsDir() && !iSearchAttributes.iTextInFile.Length()) + { + fileEntry.iIconId = EFixedIconFolder; + appendToArray = ETrue; + } + + // normal file + else + { + fileEntry.iIconId = EFixedIconEmpty; + + // check if a string needs to be found inside the file + if (iSearchAttributes.iTextInFile.Length()) + { + // currently only 8-bit searching, so convert from 16-bit + TBuf8<256> searchText; + searchText.Copy(iSearchAttributes.iTextInFile); + + // specify buffer size and create a buffer + const TInt KReadBufSize = 1024*1024; + HBufC8* buffer = HBufC8::NewLC(KReadBufSize); + TPtr8 bufferPtr = buffer->Des(); + + // open the file for reading + RFile file; + if (file.Open(iFs, parsedName.FullName(), EFileRead) == KErrNone) + { + TInt currentPos(0); + + for (;;) + { + // read from the file + file.Read(currentPos, bufferPtr, KReadBufSize); + + // stop looping if the read buffer isn't long enough + if (bufferPtr.Length() < searchText.Length()) + { + break; + } + + // try to find the text + if (bufferPtr.FindF(searchText) >= 0) + { + // match found! + appendToArray = ETrue; + break; + } + + // calculate the next position + currentPos += KReadBufSize - searchText.Length(); + } + + file.Close(); + } + + CleanupStack::PopAndDestroy(); //buffer + } + else + { + appendToArray = ETrue; + } + } + + if (appendToArray) + TRAP(err, iFileEntryList->AppendL(fileEntry)); + } + } + } + + delete dir; + err = fileFinder.FindWild(dir); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::DoSearchFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath) + { + TInt err(KErrNone); + CDirScan* scan = CDirScan::NewLC(iFs); + scan->SetScanDataL(aPath, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst); + CDir* dir = NULL; + + for(;;) + { + TRAP(err, scan->NextL(dir)); + if (!dir || (err != KErrNone)) + break; + + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + if (entry.IsDir()) + { + TFileName path(scan->FullPath()); + + if (path.Length()) + { + path.Append(entry.iName); + path.Append(_L("\\")); + DoSearchFiles(aFileName, path); + } + } + } + delete(dir); + } + + CleanupStack::PopAndDestroy(scan); + return err; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::NewFileL() + { + TFileName newName; + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(newName); + textQuery->SetPromptL(_L("Enter filename:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + TFileName fullPath = iCurrentPath; + fullPath.Append(newName); + + TParse nameParser; + TInt err = nameParser.SetNoWild(fullPath, NULL, NULL); + + if (err == KErrNone) + { + // do not try to recreate the file if it already exists + if (BaflUtils::PathExists(iFs, nameParser.DriveAndPath())) + { + err = iFileOps->CreateEmptyFile(fullPath); + } + else + err = KErrAlreadyExists; + } + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("New file created")); + } + + else if (err == KErrAlreadyExists) + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("File already exists")); + } + + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::NewDirectoryL() + { + TFileName newDirectory; + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(newDirectory); + textQuery->SetPromptL(_L("Enter directory name:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + TFileName fullPath = iCurrentPath; + fullPath.Append(newDirectory); + fullPath.Append(_L("\\")); + + TInt err = iFileOps->MkDirAll(fullPath, 0, ETrue); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("New directory created")); + } + + else if (err == KErrAlreadyExists) + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Directory already exists")); + } + + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SendToL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(32); + GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + TInt operations(0); + + CSendUi* sendUi = CSendUi::NewL(); + CleanupStack::PushL(sendUi); + CMessageData* messageData = CMessageData::NewL(); + CleanupStack::PushL(messageData); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + // only supported for normal file entries + if (!fileEntry.iEntry.IsDir()) + { + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + messageData->AppendAttachmentL(fullPath); + operations++; + + } + } + + if (operations > 0) + { + sendUi->ShowQueryAndSendL(messageData, TSendingCapabilities(0, 0, TSendingCapabilities::ESupportsAttachments)); + + // I guess this note is not needed.. + /* + _LIT(KMessage, "%d entries sent"); + TFileName noteMsg; + noteMsg.Format(KMessage, operations); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(noteMsg); + */ + } + else + { + _LIT(KMessage, "Nothing to send"); + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(KMessage); + } + + CleanupStack::PopAndDestroy(3); // entries, sendUi, messageData + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::CompressL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(16); + GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + TFileName sourceEntry = fileEntry.iPath; + sourceEntry.Append(fileEntry.iEntry.iName); + + TFileName targetEntry = sourceEntry; + targetEntry.Append(KGZipExt); + + TFileName targetEntryShort; + targetEntryShort.Copy(fileEntry.iEntry.iName); + targetEntryShort.Append(KGZipExt); + + if (BaflUtils::FileExists(iFs, targetEntry)) + { + _LIT(KMessage, "%S already exists"); + TFileName noteMsg; + noteMsg.Format(KMessage, &targetEntryShort); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + else + { + TRAPD(err, + RFile inputFile; + User::LeaveIfError(inputFile.Open(iFs, sourceEntry, EFileStream | EFileRead | EFileShareAny)); + CleanupClosePushL(inputFile); + + CEZFileToGZip* gZip = CEZFileToGZip::NewLC(iFs, targetEntry, inputFile); + + while (gZip->DeflateL()) + ; + + CleanupStack::PopAndDestroy(2); //inputFile, gZip + ); + + if (err == KErrNone) + { + _LIT(KMessage, "%S created succesfully"); + TFileName noteMsg; + noteMsg.Format(KMessage, &targetEntryShort); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(noteMsg); + } + else + { + _LIT(KMessage, "Unable to create %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &targetEntryShort); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(noteMsg); + } + + RefreshViewL(); + } + } + + CleanupStack::PopAndDestroy(); //entries + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DecompressL() + { + CFileEntryList* entries = new(ELeave) CFileEntryList(16); + GetSelectedItemsOrCurrentItemL(entries); + CleanupStack::PushL(entries); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = entries->At(i); + + TFileName sourceEntry = fileEntry.iPath; + sourceEntry.Append(fileEntry.iEntry.iName); + + TFileName targetEntry; + TFileName targetEntryShort; + + TInt sourceNameLen = fileEntry.iEntry.iName.Length(); + TInt gZipExtLen = KGZipExt().Length(); + + if (sourceNameLen > gZipExtLen && sourceEntry.Right(gZipExtLen).CompareF(KGZipExt) == 0) + { + targetEntry = sourceEntry.Left(sourceEntry.Length() - gZipExtLen); + targetEntryShort = fileEntry.iEntry.iName.Left(sourceNameLen - gZipExtLen); + + if (BaflUtils::FileExists(iFs, targetEntry)) + { + _LIT(KMessage, "%S already exists"); + TFileName noteMsg; + noteMsg.Format(KMessage, &targetEntryShort); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + else + { + TRAPD(err, + RFile outputFile; + User::LeaveIfError(outputFile.Create(iFs, targetEntry, EFileStream | EFileWrite | EFileShareExclusive)); + CleanupClosePushL(outputFile); + + CEZGZipToFile* gZip = CEZGZipToFile::NewLC(iFs, sourceEntry, outputFile); + + while (gZip->InflateL()) + ; + + CleanupStack::PopAndDestroy(2); //outputFile, gZip + ); + + if (err == KErrNone) + { + _LIT(KMessage, "%S decompressed succesfully"); + TFileName noteMsg; + noteMsg.Format(KMessage, &fileEntry.iEntry.iName); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(noteMsg); + } + else + { + _LIT(KMessage, "Unable to decompress %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &fileEntry.iEntry.iName); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(noteMsg); + } + + RefreshViewL(); + } + } + else + { + _LIT(KMessage, "%S does not have %S extension"); + TFileName noteMsg; + noteMsg.Format(KMessage, &fileEntry.iEntry.iName, &KGZipExt); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + } + + CleanupStack::PopAndDestroy(); //entries + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::PropertiesL() + { + TBool showDialog(EFalse); + + _LIT(KPropertiesEntryStr, "%S\t%S"); + _LIT(KPropertiesEntryInt, "%S\t%d"); + _LIT(KPropertiesEntryUintHex, "%S\t0x%x"); + + _LIT(KDateFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3"); + _LIT(KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B"); + + _LIT(KMediaType, "Media"); + _LIT(KAttributes, "Atts"); + _LIT(KVolumeName, "Name"); + _LIT(KUniqueID, "ID"); + _LIT(KNumberOfEntries, "Entries"); + _LIT(KNumberOfFiles, "Files"); + _LIT(KUsed, "Used (B)"); + _LIT(KFree, "Free (B)"); + _LIT(KSize, "Size (B)"); + _LIT(KPath, "Path"); + _LIT(KDate, "Date"); + _LIT(KTime, "Time"); + _LIT(KMimeType, "Mime"); + _LIT(KOpensWith, "Opens"); + + + // create an array for the items + CDesCArray* entryLines = new(ELeave) CDesCArrayFlat(16); + CleanupStack::PushL(entryLines); + TFileName titleText; + + // just get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (IsDriveListViewActive() && iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + // it is a drive entry + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + TFileName textEntry; + + // set title + titleText.Append(driveEntry.iLetter); + titleText.Append(_L(":")); + + // media type + textEntry.Format(KPropertiesEntryStr, &KMediaType, &driveEntry.iMediaTypeDesc); + entryLines->AppendL(textEntry); + + // attributes + textEntry.Format(KPropertiesEntryStr, &KAttributes, &driveEntry.iAttributesDesc); + entryLines->AppendL(textEntry); + + // volume name + if (driveEntry.iVolumeInfo.iName.Length()) + { + textEntry.Format(KPropertiesEntryStr, &KVolumeName, &driveEntry.iVolumeInfo.iName); + entryLines->AppendL(textEntry); + } + + // unique id + textEntry.Format(KPropertiesEntryUintHex, &KUniqueID, driveEntry.iVolumeInfo.iUniqueID); + entryLines->AppendL(textEntry); + + // number of files + if (iModel->Settings().iShowSubDirectoryInfo) + { + iFindFileEntryList->Reset(); + + TBuf<10> driveRoot; + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":\\")); + + DoFindFiles(_L("*"), driveRoot); + DoFindFilesRecursiveL(_L("*"), driveRoot); + + textEntry.Format(KPropertiesEntryInt, &KNumberOfFiles, iFindFileEntryList->Count()); + entryLines->AppendL(textEntry); + + iFindFileEntryList->Reset(); + } + + // used + TBuf<32> usedBuf; + usedBuf.AppendNum(driveEntry.iVolumeInfo.iSize-driveEntry.iVolumeInfo.iFree, TRealFormat(KDefaultRealWidth, 0)); + textEntry.Format(KPropertiesEntryStr, &KUsed, &usedBuf); + entryLines->AppendL(textEntry); + + // free + TBuf<32> freeBuf; + freeBuf.AppendNum(driveEntry.iVolumeInfo.iFree, TRealFormat(KDefaultRealWidth, 0)); + textEntry.Format(KPropertiesEntryStr, &KFree, &freeBuf); + entryLines->AppendL(textEntry); + + // size + TBuf<32> sizeBuf; + sizeBuf.AppendNum(driveEntry.iVolumeInfo.iSize, TRealFormat(KDefaultRealWidth, 0)); + textEntry.Format(KPropertiesEntryStr, &KSize, &sizeBuf); + entryLines->AppendL(textEntry); + + showDialog = ETrue; + } + + else if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + // it is a file or a directory entry + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + TFileName textEntry; + + // set title + titleText.Append(fileEntry.iEntry.iName); + + // path + textEntry.Format(KPropertiesEntryStr, &KPath, &fileEntry.iPath); + entryLines->AppendL(textEntry); + + // date + TTime entryModified = fileEntry.iEntry.iModified; + + // convert from universal time + if ( iTz.ConvertToLocalTime( entryModified ) == KErrNone ) + { + entryModified = fileEntry.iEntry.iModified; // use universal time + } + + TBuf<32> dateBuf; + entryModified.FormatL(dateBuf, KDateFormat); + textEntry.Format(KPropertiesEntryStr, &KDate, &dateBuf); + entryLines->AppendL(textEntry); + + // time + TBuf<32> timeBuf; + entryModified.FormatL(timeBuf, KTimeFormat); + textEntry.Format(KPropertiesEntryStr, &KTime, &timeBuf); + entryLines->AppendL(textEntry); + + if (!fileEntry.iEntry.IsDir()) + { + // size + TBuf<32> sizeBuf; + sizeBuf.AppendNum(fileEntry.iEntry.iSize, TRealFormat(KDefaultRealWidth, 0)); + textEntry.Format(KPropertiesEntryStr, &KSize, &sizeBuf); + entryLines->AppendL(textEntry); + } + else if (fileEntry.iEntry.IsDir() && iModel->Settings().iShowSubDirectoryInfo) + { + iFindFileEntryList->Reset(); + + TFileName fullPath; + fullPath.Append(fileEntry.iPath); + fullPath.Append(fileEntry.iEntry.iName); + fullPath.Append(_L("\\")); + + // number of entries + CDir* subDir = NULL; + if (iFs.GetDir(fullPath, KEntryAttMatchMask, ESortNone | EDirsFirst, subDir) == KErrNone) + { + CleanupStack::PushL(subDir); + textEntry.Format(KPropertiesEntryInt, &KNumberOfEntries, subDir->Count()); + entryLines->AppendL(textEntry); + CleanupStack::PopAndDestroy(); //subDir + } + + // number of files + DoFindFiles(_L("*"), fullPath); + DoFindFilesRecursiveL(_L("*"), fullPath); + textEntry.Format(KPropertiesEntryInt, &KNumberOfFiles, iFindFileEntryList->Count()); + entryLines->AppendL(textEntry); + + // size + TInt64 size(0); + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = iFindFileEntryList->At(i); + size += fileEntry.iEntry.iSize; + } + + TBuf<32> sizeBuf; + sizeBuf.AppendNum(size, TRealFormat(KDefaultRealWidth, 0)); + textEntry.Format(KPropertiesEntryStr, &KSize, &sizeBuf); + entryLines->AppendL(textEntry); + + iFindFileEntryList->Reset(); + } + + // attributes + TBuf<32> attBuf; + if (fileEntry.iEntry.IsArchive()) + attBuf.Append(_L("Arc ")); + if (fileEntry.iEntry.IsHidden()) + attBuf.Append(_L("Hid ")); + if (fileEntry.iEntry.IsReadOnly()) + attBuf.Append(_L("R/O ")); + if (fileEntry.iEntry.IsSystem()) + attBuf.Append(_L("Sys")); + textEntry.Format(KPropertiesEntryStr, &KAttributes, &attBuf); + entryLines->AppendL(textEntry); + + if (!fileEntry.iEntry.IsDir()) + { + // mime type + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + TDataType dataType; + TUid appUid; + if (iModel->LsSession().AppForDocument(fullPath, appUid, dataType) == KErrNone) + { + TBuf<128> mimeTypeBuf; + mimeTypeBuf.Copy(dataType.Des8()); + if (mimeTypeBuf == KNullDesC) + mimeTypeBuf.Copy(_L("N/A")); + textEntry.Format(KPropertiesEntryStr, &KMimeType, &mimeTypeBuf); + entryLines->AppendL(textEntry); + } + + // opens with + TApaAppInfo appInfo; + if (iModel->LsSession().GetAppInfo(appInfo, appUid) == KErrNone) + { + TFileName opensWithBuf; + _LIT(KOpensWithFormat, "%S (0x%08X)"); + opensWithBuf.Format(KOpensWithFormat, &appInfo.iCaption, appInfo.iUid); + textEntry.Format(KPropertiesEntryStr, &KOpensWith, &opensWithBuf); + entryLines->AppendL(textEntry); + } + } + + showDialog = ETrue; + } + + + if (showDialog) + { + CAknSingleHeadingPopupMenuStyleListBox* listBox = new(ELeave) CAknSingleHeadingPopupMenuStyleListBox; + CleanupStack::PushL(listBox); + + CAknPopupList* popupList = CAknPopupList::NewL(listBox, R_AVKON_SOFTKEYS_OK_EMPTY, AknPopupLayouts::EMenuDoubleWindow); + CleanupStack::PushL(popupList); + + listBox->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); + listBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + listBox->CreateScrollBarFrameL(ETrue); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + listBox->Model()->SetItemTextArray(entryLines); + listBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); + listBox->HandleItemAdditionL(); + + popupList->SetTitleL(titleText); + popupList->ExecuteLD(); + + CleanupStack::Pop(); // popupList + CleanupStack::PopAndDestroy(); // listBox + } + + CleanupStack::PopAndDestroy(); //entryLines + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::OpenWithApparcL() + { + // just get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + TInt err1(KErrNone), err2(KErrNone); + TUid appUid; + TDataType dataType; + TBool isProgram; + + err1 = iModel->LsSession().AppForDocument(fullPath, appUid, dataType); + err2 = iModel->LsSession().IsProgram(fullPath, isProgram); + + if (err1 == KErrNone && err2 == KErrNone) + { + if (appUid != KNullUid) + { + // found an app, run using it + TApaTaskList taskList(iModel->EikonEnv()->WsSession()); + TApaTask task = (taskList.FindApp(appUid)); + if (task.Exists()) + { + User::LeaveIfError(task.SwitchOpenFile(fullPath)); + task.BringToForeground(); + } + else + { + TThreadId id; + iModel->LsSession().StartDocument(fullPath, appUid, id, RApaLsSession::ESwitchFiles); + } + } + else if (isProgram) + { + LaunchProgramL(fullPath); + } + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::HandleServerAppExit(TInt aReason) + { + if (iOpenFileService) + { + delete iOpenFileService; + iOpenFileService = NULL; + } + MAknServerAppExitObserver::HandleServerAppExit(aReason); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::OpenWithDocHandlerL(TBool aEmbed) + { + // just get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + RFile sharableFile; + iDocHandler->OpenTempFileL(fullPath, sharableFile); + CleanupClosePushL(sharableFile); + TDataType dataType; + if (aEmbed) + iDocHandler->OpenFileEmbeddedL(sharableFile, dataType); + else + iDocHandler->OpenFileL(sharableFile, dataType); + CleanupStack::PopAndDestroy(); //sharableFile + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::OpenWithFileServiceL() + { + // just get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + TBool itemSelected(EFalse); + RFile sharableFile; + TUid appUidExtracted; + + TRAPD(err, + + // use doc handler to get a sharable file handle + iDocHandler->OpenTempFileL(fullPath, sharableFile); + CleanupClosePushL(sharableFile); + + // find the data type + TDataRecognitionResult dataType; + User::LeaveIfError(iModel->LsSession().RecognizeData(sharableFile, dataType)); + + // get all apps that support OpenFileService for this datatype + CApaAppServiceInfoArray* apps = iModel->LsSession().GetServiceImplementationsLC(KOpenServiceUid, dataType.iDataType); + TArray appServiceInfos = apps->Array(); + + if (appServiceInfos.Count() > 0) + { + // build an array of the app names + CDesCArray* names = new (ELeave) CDesCArrayFlat(16); + CleanupStack::PushL(names); + for (TInt ii=0; iiLsSession().GetAppInfo(appInfo, appUid) == KErrNone) + { + names->AppendL(appInfo.iCaption); + } + else + { + TBuf<10> buf; + buf.Format(_L("0x%08x"), appUid); + names->AppendL(buf); + } + } + + // use a list query to select the app + TInt index(0); + CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&index); + dlg->PrepareLC(R_APP_SELECTION_QUERY); + dlg->SetItemTextArray(names); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + + if(dlg->RunLD()) + { + // extract the chosen UID + appUidExtracted = appServiceInfos[index].Uid(); + itemSelected = ETrue; + } + + CleanupStack::PopAndDestroy(); // names + } + + if (itemSelected) + { + // start OpenFileService for the selected app + CAiwGenericParamList& paramList = iDocHandler->InParamListL(); + + if (iOpenFileService) + { + delete iOpenFileService; + iOpenFileService = NULL; + } + + iOpenFileService = CAknOpenFileService::NewL(appUidExtracted, sharableFile, this, ¶mList); + } + + CleanupStack::PopAndDestroy(2); // sharableFile, apps + + ); // TRAPD + + if (err != KErrNone) + { + _LIT(KMessage, "No file service available for %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &fileEntry.iEntry.iName); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + } + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileUtils::FileExists(const TDesC& aPath) + { + return BaflUtils::FileExists(iFs, aPath); + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::LaunchProgramL(const TDesC& aPath) + { + CApaCommandLine* commandLine = CApaCommandLine::NewLC(); + commandLine->SetExecutableNameL(aPath); + commandLine->SetCommandL(EApaCommandRun); + TInt err = iModel->LsSession().StartApp(*commandLine); + CleanupStack::PopAndDestroy(); //commandLine + return err; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::MemoryInfoPopupL() + { + _LIT(KUsedBytesEntry, "Used: %S bytes\n"); + _LIT(KFreeBytesEntry, "Free: %S bytes\n"); + _LIT(KSizeBytesEntry, "Size: %S bytes\n"); + + HBufC* messageBuf = HBufC::NewLC(2048); + TPtr messagePtr = messageBuf->Des(); + TBuf<128> entryLine; + + // RAM + TMemoryInfoV1Buf ramMemory; + UserHal::MemoryInfo(ramMemory); + messagePtr.Append(_L("RAM\n")); + + // used + TBuf<32> usedBuf; + usedBuf.AppendNum(ramMemory().iMaxFreeRamInBytes-ramMemory().iFreeRamInBytes, TRealFormat(KDefaultRealWidth, 0)); + entryLine.Format(KUsedBytesEntry, &usedBuf); + messagePtr.Append(entryLine); + + // free + TBuf<32> freeBuf; + freeBuf.AppendNum(ramMemory().iFreeRamInBytes, TRealFormat(KDefaultRealWidth, 0)); + entryLine.Format(KFreeBytesEntry, &freeBuf); + messagePtr.Append(entryLine); + + // size + TBuf<32> sizeBuf; + sizeBuf.AppendNum(ramMemory().iMaxFreeRamInBytes, TRealFormat(KDefaultRealWidth, 0)); + entryLine.Format(KSizeBytesEntry, &sizeBuf); + messagePtr.Append(entryLine); + + // All drives + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = iDriveEntryList->At(i); + + messagePtr.Append(_L("\n")); + messagePtr.Append(driveEntry.iLetter); + messagePtr.Append(_L(":\n")); + + // used + TBuf<32> usedBuf; + usedBuf.AppendNum(driveEntry.iVolumeInfo.iSize-driveEntry.iVolumeInfo.iFree, TRealFormat(KDefaultRealWidth, 0)); + entryLine.Format(KUsedBytesEntry, &usedBuf); + messagePtr.Append(entryLine); + + // free + TBuf<32> freeBuf; + freeBuf.AppendNum(driveEntry.iVolumeInfo.iFree, TRealFormat(KDefaultRealWidth, 0)); + entryLine.Format(KFreeBytesEntry, &freeBuf); + messagePtr.Append(entryLine); + + // size + TBuf<32> sizeBuf; + sizeBuf.AppendNum(driveEntry.iVolumeInfo.iSize, TRealFormat(KDefaultRealWidth, 0)); + entryLine.Format(KSizeBytesEntry, &sizeBuf); + messagePtr.Append(entryLine); + } + + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + dialog->PrepareLC(R_MEMORYINFO_DIALOG); + dialog->SetMessageTextL(messagePtr); + dialog->RunLD(); + + CleanupStack::PopAndDestroy(); //messageBuf + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ShowFileCheckSumsL(TInt aType) + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + // try to open the file for reading + RFile fileP; + TInt err = fileP.Open(iModel->EikonEnv()->FsSession(), fullPath, EFileRead|EFileShareReadersOnly); + + if (err == KErrNone) + { + CleanupClosePushL(fileP); + + TBuf<128> checkSum; + HBufC* messageBuf = HBufC::NewLC(2048); + TPtr messagePtr = messageBuf->Des(); + + // get MD5 checksum + if (aType == EFileBrowserCmdFileChecksumsMD5) + { + CMD5* md5 = CMD5::NewL(); + CleanupStack::PushL(md5); + HBufC8* md5Buf = MessageDigestInHexLC(md5, fileP); + checkSum.Copy(*md5Buf); + messagePtr.Append(_L("MD5\n")); + messagePtr.Append(checkSum); + CleanupStack::PopAndDestroy(2); // md5, md5Buf + } + + // get MD2 checksum + else if (aType == EFileBrowserCmdFileChecksumsMD2) + { + CMD2* md2 = CMD2::NewL(); + CleanupStack::PushL(md2); + HBufC8* md2Buf = MessageDigestInHexLC(md2, fileP); + checkSum.Copy(*md2Buf); + messagePtr.Append(_L("MD2\n")); + messagePtr.Append(checkSum); + CleanupStack::PopAndDestroy(2); // md2, md2Buf + } + + // get SHA-1 checksum + else if (aType == EFileBrowserCmdFileChecksumsSHA1) + { + CSHA1* sha1 = CSHA1::NewL(); + CleanupStack::PushL(sha1); + HBufC8* sha1Buf = MessageDigestInHexLC(sha1, fileP); + checkSum.Copy(*sha1Buf); + messagePtr.Append(_L("SHA-1\n")); + messagePtr.Append(checkSum); + CleanupStack::PopAndDestroy(2); // sha1, sha1Buf + } + + else + { + User::Panic(_L("Inv.CS.Type"), 723); + } + + // show dialog + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + dialog->PrepareLC(R_CHECKSUMS_DIALOG); + dialog->SetMessageTextL(messagePtr); + dialog->SetHeaderTextL(fileEntry.iEntry.iName); + dialog->RunLD(); + + CleanupStack::PopAndDestroy(2); // messageBuf, fileP + } + else + { + // open failed, show an error note + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + } + } + +// -------------------------------------------------------------------------------------------- + +HBufC8* CFileBrowserFileUtils::MessageDigestInHexLC(CMessageDigest* aMD, RFile& aFile) + { + // seek to file start + TInt startPos(0); + aFile.Seek(ESeekStart, startPos); + + // create result buffer + HBufC8* result = HBufC8::NewLC(128); + + const TInt KBufSize(1024); + TInt fileSize(0); + TInt fileOffset(0); + + // get file size + aFile.Size(fileSize); + + HBufC8* buf = HBufC8::NewMaxLC(KBufSize); + TPtr8 bufPtr(buf->Des()); + + // read to buffer + while (fileOffset < fileSize - KBufSize) + { + aFile.Read(bufPtr, KBufSize); + aMD->Hash(bufPtr); + fileOffset += bufPtr.Length(); + } + + aFile.Read(bufPtr, fileSize - fileOffset); + bufPtr.SetLength(fileSize - fileOffset); + + // get final message digest + TPtrC8 hashedSig(aMD->Final(bufPtr)); + + // change size of the result buffer + result->ReAllocL(hashedSig.Length() * 2); + TPtr8 resultPtr = result->Des(); + + // convert to hex format + for (TInt i=0; iSettings().iBypassPlatformSecurity) + { + TInt err(KErrNone); + + if (aEnable) + { + // make sure that the directory exists + iFileOps->MkDirAll(KErrRdPath); + + // create the file + err = iFileOps->CreateEmptyFile(KErrRdPath); + } + else + { + // get TEntry of ErrRd + TEntry entry; + err = iFs.Entry(KErrRdPath, entry); + + if (err == KErrNone) + { + TFileEntry fileEntry; + fileEntry.iPath = KErrRdDir; + fileEntry.iEntry = entry; + + err = iFileOps->Delete(fileEntry); + } + } + + // update view + RefreshViewL(); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("State changed")); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Cannot change the state")); + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Enable \"bypass platform security\" from the settings first")); + } + #else + aEnable = aEnable; + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Not supported in lite version")); + #endif + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::EnableAvkonIconCacheL(TBool aEnable) + { +#ifndef __SERIES60_30__ + if (AknIconConfig::EnableAknIconSrvCache(aEnable) == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("State changed")); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Unknown error occured")); + } + #else + aEnable = aEnable; + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Not supported in S60 3.0")); + #endif + + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SimulateLeaveL() + { + TInt leaveCode(-6); + + CAknNumberQueryDialog* numberQuery = CAknNumberQueryDialog::NewL(leaveCode); + numberQuery->SetPromptL(_L("Leave code")); + + if (numberQuery->ExecuteLD(R_GENERAL_NUMERIC_QUERY)) + { + User::Leave(leaveCode); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SimulatePanicL() + { + TInt panicCode(555); + TBuf<128> panicCategory; + panicCategory.Copy(_L("Test Category")); + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(panicCategory); + textQuery->SetPromptL(_L("Panic category")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + CAknNumberQueryDialog* numberQuery = CAknNumberQueryDialog::NewL(panicCode); + numberQuery->SetPromptL(_L("Panic code")); + + if (numberQuery->ExecuteLD(R_GENERAL_NUMERIC_QUERY)) + { + User::Panic(panicCategory, panicCode); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SimulateExceptionL() + { + TInt exceptionCode(0); + + CAknNumberQueryDialog* numberQuery = CAknNumberQueryDialog::NewL(exceptionCode); + numberQuery->SetPromptL(_L("Exception code")); + + if (numberQuery->ExecuteLD(R_GENERAL_NUMERIC_QUERY)) + { + User::RaiseException((TExcType)exceptionCode); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetDebugMaskL() + { + // get current debug mask + TUint32 dbgMask = UserSvr::DebugMask(); + + // convert the value in hex format + TBuf<64> hexBuf; + hexBuf.Copy(_L("0x")); + hexBuf.AppendNum(dbgMask, EHex); + + // do the query + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(hexBuf); + textQuery->SetPromptL(_L("Kernel debug mask in hex format")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + // check value + if (hexBuf.Length() > 2 && hexBuf[0]=='0' && hexBuf[1]=='x') + { + // remove 0x from the beginning + hexBuf.Copy(hexBuf.Right(hexBuf.Length()-2)); + + // convert the string back to decimal + TLex converter; + converter.Assign(hexBuf); + + if (converter.Val(dbgMask, EHex) == KErrNone) + { + User::SetDebugMask(dbgMask); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Changed")); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Cannot convert value")); + } + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not in hex format")); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::WriteAllAppsL() + { + _LIT(KAllAppsFileName, "AllApps.txt"); + TFileName allAppsPath = PathInfo::PhoneMemoryRootPath(); + allAppsPath.Append(KAllAppsFileName); + + RFile file; + if (file.Replace(iFs, allAppsPath, EFileWrite) == KErrNone) + { + CleanupClosePushL(file); + + CDesC8Array* appsArray = new(ELeave) CDesC8ArrayFlat(192); + CleanupStack::PushL(appsArray); + + TBuf8 fileEntry; + TBuf8 appFullPath; + _LIT8(KAppEntryFormat, "%S (0x%08X)%S"); + TApaAppInfo appInfo; + + iModel->LsSession().GetAllApps(); + + while (iModel->LsSession().GetNextApp(appInfo) == KErrNone) + { + appFullPath.Copy(appInfo.iFullName); + fileEntry.Format(KAppEntryFormat, &appFullPath, appInfo.iUid, &KFileNewLine); + appsArray->AppendL(fileEntry); + } + + appsArray->Sort(); + + for (TInt i=0; iCount(); i++) + { + file.Write(appsArray->MdcaPoint(i)); + } + + CleanupStack::PopAndDestroy(2); //appsArray, file + + _LIT(KMessage, "App list written to %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &allAppsPath); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote(); + note->SetTimeout(CAknNoteDialog::ENoTimeout); + note->ExecuteLD(noteMsg); + } + else + { + _LIT(KMessage, "Failed writing to %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &allAppsPath); + + CAknErrorNote* note = new(ELeave) CAknErrorNote(); + note->SetTimeout(CAknNoteDialog::ENoTimeout); + note->ExecuteLD(noteMsg); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::WriteAllFilesL() + { + _LIT(KAllFilesFileName, "AllFiles.txt"); + TFileName allFilesPath = PathInfo::PhoneMemoryRootPath(); + allFilesPath.Append(KAllFilesFileName); + + RFile file; + if (file.Replace(iFs, allFilesPath, EFileWrite) == KErrNone) + { + CleanupClosePushL(file); + iFindFileEntryList->Reset(); + + iModel->EikonEnv()->BusyMsgL(_L("** Generating **"), TGulAlignment(EHCenterVTop)); + + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = iDriveEntryList->At(i); + + TBuf<10> driveRoot; + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":\\")); + + // current dir + DoFindFiles(_L("*"), driveRoot); + + // recurse into sub directories + DoFindFilesRecursiveL(_L("*"), driveRoot); + } + + // write entries + TBuf8 writeBuf; + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = iFindFileEntryList->At(i); + + writeBuf.Copy(fileEntry.iPath); + writeBuf.Append(fileEntry.iEntry.iName); + writeBuf.Append(KFileNewLine); + + file.Write(writeBuf); + } + + iModel->EikonEnv()->BusyMsgCancel(); + + CleanupStack::PopAndDestroy(); //file + iFindFileEntryList->Reset(); + + _LIT(KMessage, "File list written to %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &allFilesPath); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote(); + note->SetTimeout(CAknNoteDialog::ENoTimeout); + note->ExecuteLD(noteMsg); + } + else + { + _LIT(KMessage, "Failed writing to %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &allFilesPath); + + CAknErrorNote* note = new(ELeave) CAknErrorNote(); + note->SetTimeout(CAknNoteDialog::ENoTimeout); + note->ExecuteLD(noteMsg); + } + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::DoFindFiles(const TDesC& aFileName, const TDesC& aPath) + { + TFindFile fileFinder(iFs); + CDir* dir; + TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir); + + while (err == KErrNone) + { + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + // ignore any directory entries + if (!entry.IsDir() && entry.iName.Length() && aPath.Length()) + { + TParse parsedName; + parsedName.Set(entry.iName, &fileFinder.File(), NULL); + + if (parsedName.Drive().Length() && aPath.Length() && parsedName.Drive()[0] == aPath[0]) + { + TFileEntry fileEntry; + fileEntry.iPath = parsedName.DriveAndPath(); + fileEntry.iEntry = entry; + fileEntry.iDirEntries = KErrNotFound; + fileEntry.iIconId = EFixedIconEmpty; + + TRAP(err, iFindFileEntryList->AppendL(fileEntry)); + } + } + } + + delete dir; + dir = NULL; + err = fileFinder.FindWild(dir); + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserFileUtils::DoFindFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath) + { + TInt err(KErrNone); + CDirScan* scan = CDirScan::NewLC(iFs); + scan->SetScanDataL(aPath, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst); + CDir* dir = NULL; + + for(;;) + { + TRAP(err, scan->NextL(dir)); + if (!dir || (err != KErrNone)) + break; + + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + + if (entry.IsDir()) + { + TFileName path(scan->FullPath()); + + if (path.Length()) + { + path.Append(entry.iName); + path.Append(_L("\\")); + DoFindFiles(aFileName, path); + } + } + } + delete(dir); + } + + CleanupStack::PopAndDestroy(scan); + return err; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ListOpenFilesL() + { + iFileEntryList->Reset(); + + CFileList* dir = NULL; + TOpenFileScan fileScan(iFs); + fileScan.NextL(dir); + + while (dir) + { + for (TInt i=0; iCount(); i++) + { + TEntry entry = (*dir)[i]; + TFileName fullPath; + + // TOpenFileScan does not return drive letters for the entries, so try to guess it + if (entry.iName.Length() > 2 && entry.iName[1] != ':') + { + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = iDriveEntryList->At(i); + + TFileName guessPath; + guessPath.Append(driveEntry.iLetter); + guessPath.Append(_L(":")); + guessPath.Append(entry.iName); + + // check if the file exists + if (BaflUtils::FileExists(iFs, guessPath)) + { + // if it's on read only drive, then take it or check if it's really in use + TBool readOnlyDrive(ETrue); + BaflUtils::DiskIsReadOnly(iFs, guessPath, readOnlyDrive); + + if (readOnlyDrive || iFs.SetEntry(guessPath, entry.iModified, NULL, NULL) == KErrInUse) + { + fullPath = guessPath; + break; + } + } + } + } + else + { + fullPath = entry.iName; + } + + TParse nameParser; + if (fullPath.Length() && nameParser.SetNoWild(fullPath, NULL, NULL) == KErrNone) + { + entry.iName = nameParser.NameAndExt(); + + TFileEntry fileEntry; + fileEntry.iPath = nameParser.DriveAndPath(); + fileEntry.iEntry = entry; + fileEntry.iDirEntries = KErrNotFound; + fileEntry.iIconId = EFixedIconEmpty; + + iFileEntryList->AppendL(fileEntry); + } + } + + delete dir; + dir = NULL; + fileScan.NextL(dir); + } + + TInt operations = iFileEntryList->Count(); + + iListingMode = EOpenFiles; + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex(0); + RefreshViewL(); + + _LIT(KMessage, "%d open files found"); + TFileName noteMsg; + noteMsg.Format(KMessage, operations); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ListMessageAttachmentsL(TInt aType) + { + iFileEntryList->Reset(); + + CMsvSession* session = CMsvSession::OpenSyncL(*this); + CleanupStack::PushL(session); + + CMsvEntry* context = NULL; + + if (aType == EFileBrowserCmdToolsMsgAttachmentsInbox) + context = session->GetEntryL(KMsvGlobalInBoxIndexEntryId); + else if (aType == EFileBrowserCmdToolsMsgAttachmentsDrafts) + context = session->GetEntryL(KMsvDraftEntryId); + else if (aType == EFileBrowserCmdToolsMsgAttachmentsSentItems) + context = session->GetEntryL(KMsvSentEntryId); + else if (aType == EFileBrowserCmdToolsMsgAttachmentsOutbox) + context = session->GetEntryL(KMsvGlobalOutBoxIndexEntryId); + else + User::Panic(_L("MsgAtt.Mode"), 100); + + CleanupStack::PushL(context); + + CDesCArray* attPaths = new(ELeave) CDesCArrayFlat(128); + CleanupStack::PushL(attPaths); + + // read attachment paths + ReadAttachmentPathsRecursiveL(session, context, attPaths); + + // create file entries of the paths + for (TInt i=0; iMdcaCount(); i++) + { + TFileEntry fileEntry; + TEntry entry; + TParse nameParser; + + if (attPaths->MdcaPoint(i).Length() && + nameParser.SetNoWild(attPaths->MdcaPoint(i), NULL, NULL) == KErrNone && + iFs.Entry(attPaths->MdcaPoint(i), entry) == KErrNone) + { + TFileEntry fileEntry; + fileEntry.iPath = nameParser.DriveAndPath(); + fileEntry.iEntry = entry; + fileEntry.iDirEntries = KErrNotFound; + fileEntry.iIconId = EFixedIconEmpty; + + iFileEntryList->AppendL(fileEntry); + } + } + + CleanupStack::PopAndDestroy(3); //session, context, attPaths + + TInt operations = iFileEntryList->Count(); + + if (aType == EFileBrowserCmdToolsMsgAttachmentsInbox) + iListingMode = EMsgAttachmentsInbox; + else if (aType == EFileBrowserCmdToolsMsgAttachmentsDrafts) + iListingMode = EMsgAttachmentsDrafts; + else if (aType == EFileBrowserCmdToolsMsgAttachmentsSentItems) + iListingMode = EMsgAttachmentsSentItems; + else if (aType == EFileBrowserCmdToolsMsgAttachmentsOutbox) + iListingMode = EMsgAttachmentsOutbox; + + iModel->FileListContainer()->ListBox()->SetCurrentItemIndex(0); + RefreshViewL(); + + _LIT(KMessage, "%d files found"); + TFileName noteMsg; + noteMsg.Format(KMessage, operations); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(noteMsg); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ReadAttachmentPathsRecursiveL(CMsvSession* aSession, CMsvEntry* aContext, CDesCArray* aAttPaths) + { + CMsvEntrySelection* entrySelection = aContext->ChildrenL(); + CleanupStack::PushL(entrySelection); + + for (TInt i=0; iCount(); i++) + { + CMsvEntry* entry = aSession->GetEntryL((*entrySelection)[i]); + CleanupStack::PushL(entry); + + CMsvStore* store = NULL; + TRAPD(err, store = entry->ReadStoreL()); + + if (err == KErrNone) + { + CleanupStack::PushL(store); + + for (TInt j=0; jAttachmentManagerL().AttachmentCount(); j++) + { + CMsvAttachment* attachment = store->AttachmentManagerL().GetAttachmentInfoL(j); + CleanupStack::PushL(attachment); + + aAttPaths->AppendL(attachment->FilePath()); + + CleanupStack::PopAndDestroy(); //attachment + } + CleanupStack::PopAndDestroy(); // store + } + + // recurse into children + if (entry->Count() > 0) + { + ReadAttachmentPathsRecursiveL(aSession, entry, aAttPaths); + } + + CleanupStack::PopAndDestroy(); // entry + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::WriteMsgStoreWalkL() + { + _LIT(KAllAppsFileName, "MsgStoreWalk.txt"); + TFileName allAppsPath = PathInfo::PhoneMemoryRootPath(); + allAppsPath.Append(KAllAppsFileName); + + if (iMsgStoreWalkFile.Replace(iFs, allAppsPath, EFileWrite) == KErrNone) + { + CMsvSession* session = CMsvSession::OpenSyncL(*this); + CleanupStack::PushL(session); + + CMsvEntry* context = session->GetEntryL(KMsvRootIndexEntryId); + CleanupStack::PushL(context); + + iMsgStoreWalkFile.Write(_L8("id service_id related_id type mtm date size error biotype mtmdata1 mtmdata2 mtmdata3 description details\r\n\r\n")); + + // write details about the root entry + DoWriteMessageEntryInfoL(context, iMsgStoreWalkFile, 0); + + // get and write info recursively + TInt level(1); + WriteMessageEntryInfoRecursiveL(session, context, iMsgStoreWalkFile, level); + + CleanupStack::PopAndDestroy(2); //session, context + + iMsgStoreWalkFile.Flush(); + iMsgStoreWalkFile.Close(); + + _LIT(KMessage, "Msg. store walk written to %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &allAppsPath); + + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote(); + note->SetTimeout(CAknNoteDialog::ENoTimeout); + note->ExecuteLD(noteMsg); + } + else + { + _LIT(KMessage, "Failed writing to %S"); + TFileName noteMsg; + noteMsg.Format(KMessage, &allAppsPath); + + CAknErrorNote* note = new(ELeave) CAknErrorNote(); + note->SetTimeout(CAknNoteDialog::ENoTimeout); + note->ExecuteLD(noteMsg); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::WriteMessageEntryInfoRecursiveL(CMsvSession* aSession, CMsvEntry* aContext, RFile& aFile, TInt& aLevel) + { + CMsvEntrySelection* entrySelection = aContext->ChildrenL(); + CleanupStack::PushL(entrySelection); + + for (TInt i=0; iCount(); i++) + { + CMsvEntry* entry = aSession->GetEntryL((*entrySelection)[i]); + CleanupStack::PushL(entry); + + DoWriteMessageEntryInfoL(entry, aFile, aLevel); + + // recurse into children + if (entry->Count() > 0) + { + aLevel++; + WriteMessageEntryInfoRecursiveL(aSession, entry, aFile, aLevel); + aLevel--; + } + + CleanupStack::PopAndDestroy(); // entry + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DoWriteMessageEntryInfoL(CMsvEntry* aContext, RFile& aFile, TInt aLevel) + { + TMsvEntry messageEntry = aContext->Entry(); + + for (TInt j=0; j desc; + desc.Copy(messageEntry.iDescription); + + TBuf8<256> details; + details.Copy(messageEntry.iDetails); + + _LIT8(KLine, "-> %d %d %d %d %d %Ld %d %d %d %d %d %d %S %S\r\n"); + TBuf8<1024> buf; + buf.Format(KLine, messageEntry.Id(), messageEntry.iServiceId, messageEntry.iRelatedId, messageEntry.iType.iUid, + messageEntry.iMtm.iUid, messageEntry.iDate.Int64(), messageEntry.iSize, messageEntry.iError, messageEntry.iBioType, + messageEntry.iMtmData1, messageEntry.iMtmData2, messageEntry.iMtmData3, &desc, &details); + + aFile.Write(buf); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::FileEditorL(TInt aType) + { + // just get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + + // only valid for files + if (!fileEntry.iEntry.IsDir()) + { + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + iModel->FileListContainer()->SetNaviPaneTextL(fileEntry.iEntry.iName); + + TInt editorMode(0); + + if (aType == EFileBrowserCmdFileViewText) + editorMode = EFileEditorViewAsText; + else if (aType == EFileBrowserCmdFileViewHex) + editorMode = EFileEditorViewAsHex; + else if (aType == EFileBrowserCmdFileEditText) + editorMode = EFileEditorEditAsText; + else if (aType == EFileBrowserCmdFileEditHex) + editorMode = EFileEditorEditAsHex; + else + User::Panic(_L("Inv.Ed.Mode"), 843); + + // launch dialog + CFileBrowserFileEditorDlg* dlg = CFileBrowserFileEditorDlg::NewL(fullPath, editorMode); + dlg->RunDlgLD(); + + iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + + if (aType == EFileBrowserCmdFileEditText || aType == EFileBrowserCmdFileEditHex) + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFileUtils::DriveSnapShotPossible() + { + // check that E-drive is available + TBool EDriveIsOK(EFalse); + + for (TInt i=0; iCount(); i++) + { + TDriveEntry driveEntry = iDriveEntryList->At(i); + + if (driveEntry.iNumber == EDriveE) + { + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt & KMediaAttLocked || driveEntry.iVolumeInfo.iDrive.iDriveAtt & KDriveAbsent) + EDriveIsOK = EFalse; + else + EDriveIsOK = ETrue; + } + } + + if (!EDriveIsOK) + return EFalse; + + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + // drive snapshot not possible when E-drive is highlighted, since that's where we are copying + if (driveEntry.iNumber == EDriveE) + return EFalse; + else + return ETrue; + } + + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DriveSnapShotL() + { + if (iModel->Settings().iBypassPlatformSecurity) + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + TChar sourceDriveLetter = driveEntry.iLetter; + TChar targetDriveLetter = 'E'; // hardcoded drive letter, could be better if would be queried from the user + + // append to the command array + AppendToCommandArrayL(EFileBrowserFileOpCommandDriveSnapShot, + new(ELeave)CCommandParamsDriveSnapShot(sourceDriveLetter, targetDriveLetter) + ); + + // execute the operation + StartExecutingCommandsL(_L("Copying")); + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Enable \"bypass platform security\" from the settings first")); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetDrivePasswordL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TMediaPassword oldPassword; + TMediaPassword newPassword; + TFileName oldPassword16; + TFileName newPassword16; + + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + // query existing password if it already exists + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt & KMediaAttHasPassword) + { + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(oldPassword16); + textQuery->SetPromptL(_L("Existing password:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + ConvertCharsToPwd(oldPassword16, oldPassword); + } + else + { + return; + } + } + + // query new password + newPassword16.Copy(oldPassword16); + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(newPassword16); + textQuery->SetPromptL(_L("New password:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + ConvertCharsToPwd(newPassword16, newPassword); + + // set the password, does not actually lock the drive + TInt err = iFs.LockDrive(driveEntry.iNumber, oldPassword, newPassword, ETrue); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Password set")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::UnlockDriveL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + // check if the drive is locked + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt & KMediaAttLocked) + { + TMediaPassword oldPassword; + TFileName oldPassword16; + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(oldPassword16); + textQuery->SetPromptL(_L("Existing password:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + ConvertCharsToPwd(oldPassword16, oldPassword); + + // unlock the drive + TInt err = iFs.UnlockDrive(driveEntry.iNumber, oldPassword, ETrue) == KErrNone; + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Drive unlocked")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("This drive is not locked")); + } + + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ClearDrivePasswordL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + // check if the drive has a password + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt & KMediaAttHasPassword) + { + TMediaPassword oldPassword; + TFileName oldPassword16; + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(oldPassword16); + textQuery->SetPromptL(_L("Existing password:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + ConvertCharsToPwd(oldPassword16, oldPassword); + + // clear the password from the drive + TInt err = iFs.ClearPassword(driveEntry.iNumber, oldPassword); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Password cleared")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("This drive has no password")); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::EraseDrivePasswordL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + // check if the drive has a password + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt & KMediaAttHasPassword) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you sure? All data can be lost!"))) + { + // erase the password from the drive + TInt err(KErrNone); + err = iFs.ErasePassword(driveEntry.iNumber); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Password erased")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Cannot erase, you may have to format the drive first")); + } + + RefreshViewL(); + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("This drive has no password")); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::FormatDriveL(TBool aQuickFormat) + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + CAknQueryDialog* query = CAknQueryDialog::NewL(); + + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you sure? All data will be lost!"))) + { + TInt err(KErrNone); + TInt formatCount(0); + + TBuf<10> driveRoot; + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":")); + + TUint formatMode(0); + if (aQuickFormat) + formatMode = ESpecialFormat|EQuickFormat; + else + formatMode = ESpecialFormat|EFullFormat; + + // set as system application to prevent getting shut down events + iModel->EikonEnv()->SetSystem(ETrue); + + // first close any open applications + CBaBackupSessionWrapper* BSWrapper = CBaBackupSessionWrapper::NewL(); + CleanupStack::PushL(BSWrapper); + + TBackupOperationAttributes atts(MBackupObserver::EReleaseLockNoAccess, MBackupOperationObserver::EStart); + BSWrapper->NotifyBackupOperationL(atts); + + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + BSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, waiter->iStatus ); + waiter->StartAndWait(); + CleanupStack::PopAndDestroy(); //waiter + + // some delay to make sure all applications have been closed + User::After(1000000); + + // format the drive + RFormat format; + err = format.Open(iFs, driveRoot, formatMode, formatCount); + + // Forced format for locked card + if ( err == KErrLocked ) + { + // Erase password and try again + err = iFs.ErasePassword( driveEntry.iNumber ); + if ( !err ) + { + err = format.Open(iFs, driveRoot, formatMode, formatCount); + } + } + + if( err != KErrNone && err != KErrLocked ) + { + CAknQueryDialog* lockQuery = CAknQueryDialog::NewL(); + if ( lockQuery->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Memory card in use by other application. Proceed anyway?"))) + { + // If format could not be started, someone is still keeping + // files open on media. Let's try to dismount file system, then + // remount with own extension embedded and try again. + + TFullName fsName; + err = iFs.FileSystemName( fsName, driveEntry.iNumber ); + + if ( err == KErrNone && fsName.Length() > 0 ) + { + // Prevent SysAp shutting down applications + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsed ); + + TRequestStatus stat; + iFs.NotifyDismount( driveEntry.iNumber, stat, EFsDismountForceDismount ); + User::WaitForRequest( stat ); + + // Unfortunately, at the moment we have to wait until clients have received + // notification about card dismount. Otherwise at least causes problems with + // theme selected from card. In future clients should use new notify-API. + User::After( KForcedFormatTimeout ); + + // Let's set priority higher than normally. This is done to decrease the chance + // that someone reopens files on memory card after mandatory file system + // remounting hence preventing formatting again. + TThreadPriority priority( RThread().Priority() ); + RThread().SetPriority( EPriorityAbsoluteHigh ); + + // Mount file system back... + err = iFs.MountFileSystem( fsName, driveEntry.iNumber ); + err = format.Open(iFs, driveRoot, formatMode, formatCount); + RThread().SetPriority( priority ); + } + } + } + + + if (err == KErrNone) + { + // needs to be implemented with active objects + // CAknProgressDialog* dlg = new(ELeave) CAknProgressDialog(formatCount, 1, 1, NULL); + // dlg->SetTone(CAknNoteDialog::ENoTone); + // dlg->ExecuteLD(R_FORMAT_PROGRESS_NOTE); + + while (formatCount && err == KErrNone) + { + err = format.Next(formatCount); + } + } + + format.Close(); + + // restart closed applications + TBackupOperationAttributes atts2(MBackupObserver::ETakeLock, MBackupOperationObserver::EEnd); + BSWrapper->NotifyBackupOperationL(atts2); + BSWrapper->RestartAll(); + CleanupStack::PopAndDestroy(); //BSWrapper + + // system status not needed anymore + iModel->EikonEnv()->SetSystem(EFalse); + + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Format succeeded")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::EraseMBRL() + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + CAknQueryDialog* query = CAknQueryDialog::NewL(); + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you sure? Your media driver must support this!"))) + { + + CAknQueryDialog* query2 = CAknQueryDialog::NewL(); + if (query2->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you really sure you know what are you doing ?!?"))) + { + // warn if the selected drive is not detected as removable + TBool proceed(EFalse); + + if (driveEntry.iVolumeInfo.iDrive.iDriveAtt & KDriveAttRemovable) + { + proceed = ETrue; + } + else + { + CAknQueryDialog* query3 = CAknQueryDialog::NewL(); + if (query3->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Selected drive is not removable, really continue?"))) + proceed = ETrue; + else + proceed = EFalse; + } + + if (proceed) + { + TInt err(KErrNone); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Please wait, this may take 30 seconds")); + + // set as system application to prevent getting shut down events + iModel->EikonEnv()->SetSystem(ETrue); + + // first close any open applications + CBaBackupSessionWrapper* BSWrapper = CBaBackupSessionWrapper::NewL(); + CleanupStack::PushL(BSWrapper); + + TBackupOperationAttributes atts(MBackupObserver::EReleaseLockNoAccess, MBackupOperationObserver::EStart); + BSWrapper->NotifyBackupOperationL(atts); + + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + BSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, waiter->iStatus ); + waiter->StartAndWait(); + CleanupStack::PopAndDestroy(); //waiter + + // some delay to make sure all applications have been closed + User::After(1000000); + + + // do the erase MBR operation + err = iFileOps->EraseMBR(driveEntry.iNumber); + + + // restart closed applications + TBackupOperationAttributes atts2(MBackupObserver::ETakeLock, MBackupOperationObserver::EEnd); + BSWrapper->NotifyBackupOperationL(atts2); + BSWrapper->RestartAll(); + CleanupStack::PopAndDestroy(); //BSWrapper + + // system status not needed anymore + iModel->EikonEnv()->SetSystem(EFalse); + + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Erase MBR succeeded")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Enable \"bypass platform security\" from the settings first")); + } + #else + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Not supported in lite version")); + #endif + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::PartitionDriveL() + { + #ifndef FILEBROWSER_LITE + if (iModel->Settings().iBypassPlatformSecurity) + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + CAknQueryDialog* query = CAknQueryDialog::NewL(); + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you sure? Your media driver must support this!"))) + { + + CAknQueryDialog* query2 = CAknQueryDialog::NewL(); + if (query2->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you really sure you know what are you doing ?!?"))) + { + // warn if the selected drive is not detected as removable + TBool proceed(EFalse); + + if (driveEntry.iVolumeInfo.iDrive.iDriveAtt & KDriveAttRemovable) + { + proceed = ETrue; + } + else + { + CAknQueryDialog* query3 = CAknQueryDialog::NewL(); + if (query3->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Selected drive is not removable, really continue?"))) + proceed = ETrue; + else + proceed = EFalse; + } + + if (proceed) + { + // query if erase mbr + TBool eraseMBR(EFalse); + + CAknQueryDialog* query4 = CAknQueryDialog::NewL(); + if (query4->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Erase MBR first (normally needed)?"))) + { + eraseMBR = ETrue; + } + + + // query amount of partitions from user + TInt queryIndex(0); + CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex); + + if (listQueryDlg->ExecuteLD(R_PARTITION_AMOUNT_QUERY)) + { + TInt amountOfPartitions = queryIndex + 1; // selections are 1..4 + + TInt err(KErrNone); + + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Please wait, this may take 30 seconds")); + + // set as system application to prevent getting shut down events + iModel->EikonEnv()->SetSystem(ETrue); + + // first close any open applications + CBaBackupSessionWrapper* BSWrapper = CBaBackupSessionWrapper::NewL(); + CleanupStack::PushL(BSWrapper); + + TBackupOperationAttributes atts(MBackupObserver::EReleaseLockNoAccess, MBackupOperationObserver::EStart); + BSWrapper->NotifyBackupOperationL(atts); + + CAsyncWaiter* waiter = CAsyncWaiter::NewLC(); + BSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, waiter->iStatus ); + waiter->StartAndWait(); + CleanupStack::PopAndDestroy(); //waiter + + // some delay to make sure all applications have been closed + User::After(1000000); + + // do the erase operation + if (eraseMBR) + { + err = iFileOps->EraseMBR(driveEntry.iNumber); + + if (err != KErrNone) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Erase MBR failed")); + } + + User::After(500000); + } + + + // do the partition operation + err = iFileOps->PartitionDrive(driveEntry.iNumber, amountOfPartitions); + + + // restart closed applications + TBackupOperationAttributes atts2(MBackupObserver::ETakeLock, MBackupOperationObserver::EEnd); + BSWrapper->NotifyBackupOperationL(atts2); + BSWrapper->RestartAll(); + CleanupStack::PopAndDestroy(); //BSWrapper + + // system status not needed anymore + iModel->EikonEnv()->SetSystem(EFalse); + + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Partition succeeded")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + } + } + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Enable \"bypass platform security\" from the settings first")); + } + #else + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Not supported in lite version")); + #endif + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::CheckDiskL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + TBuf<10> driveRoot; + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":")); + + // check disk + TInt err = iFs.CheckDisk(driveRoot); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Integrity of the disk is ok")); + } + else if (err == KErrNotReady) + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(_L("Disk is empty")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Disk is corrupted")); + } + + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ScanDriveL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("This finds errors on disk and corrects them. Proceed?"))) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + TBuf<10> driveRoot; + driveRoot.Append(driveEntry.iLetter); + driveRoot.Append(_L(":")); + + // scan disk + TInt err = iFs.ScanDrive(driveRoot); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Run succesfully")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetDriveNameL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + TFileName driveName; + + // get existing drive name + iFs.GetDriveName(driveEntry.iNumber, driveName); + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(driveName); + textQuery->SetPromptL(_L("New name:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + // set drive name + TInt err = iFs.SetDriveName(driveEntry.iNumber, driveName); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Name changed")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SetDriveVolumeLabelL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + // get existing volume label + TFileName volumeLabel; + volumeLabel.Copy(driveEntry.iVolumeInfo.iName); + + CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL(volumeLabel); + textQuery->SetPromptL(_L("New volume label:")); + + if (textQuery->ExecuteLD(R_GENERAL_TEXT_QUERY)) + { + // set volume label + TInt err = iFs.SetVolumeLabel(volumeLabel, driveEntry.iNumber); + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Volume label changed")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::EjectDriveL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + TInt err(KErrNone); + + // get current filesystem name + TFileName fileSystemName; + err = iFs.FileSystemName(fileSystemName, driveEntry.iNumber); + + if (err == KErrNone) + { + // Prevent SysAp shutting down applications + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsed ); + + // dismount the file system + err = iFs.DismountFileSystem(fileSystemName, driveEntry.iNumber); + + if (err == KErrNone) + { + // remount the file system + err = iFs.MountFileSystem(fileSystemName, driveEntry.iNumber); + + if (err == KErrInUse) + { + // try to remount after a while if locked + User::After(1000000); + err = iFs.MountFileSystem(fileSystemName, driveEntry.iNumber); + } + } + } + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Ejected succesfully")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::DismountFileSystemL() + { + // get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iDriveEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + + if (query->ExecuteLD(R_GENERAL_CONFIRMATION_QUERY, _L("Are you sure you know what are you doing?"))) + { + TDriveEntry driveEntry = iDriveEntryList->At(currentItemIndex); + + TInt err(KErrNone); + + // get current filesystem name + TFileName fileSystemName; + err = iFs.FileSystemName(fileSystemName, driveEntry.iNumber); + + if (err == KErrNone) + { + // Prevent SysAp shutting down applications + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsed ); + + // dismount the file system + err = iFs.DismountFileSystem(fileSystemName, driveEntry.iNumber); + } + + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Dismounted succesfully")); + } + else if (err == KErrNotSupported) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD(_L("Not supported for this drive")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + + RefreshViewL(); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::ConvertCharsToPwd(TDesC& aWord, TDes8& aConverted) const + { + aConverted.FillZ(aConverted.MaxLength()); + aConverted.Zero(); + + if (aWord.Length()) + { + aConverted.Copy( (TUint8*)(&aWord[0]), aWord.Size() ); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::EditDataTypesL() + { + iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeNormal); + iModel->FileListContainer()->SetNaviPaneTextL(KNullDesC); + + CFileBrowserDataTypesDlg* dlg = CFileBrowserDataTypesDlg::NewL(); + dlg->RunQueryLD(); + + iModel->FileListContainer()->SetScreenLayoutL(iModel->Settings().iDisplayMode); + iModel->FileListContainer()->SetNaviPaneTextL(iCurrentPath); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::SecureBackupL(TInt aType) + { + TInt err(KErrNone); + TInt showStatus(EFalse); + + if (aType == EFileBrowserCmdToolsSecureBackupStartBackup || aType == EFileBrowserCmdToolsSecureBackupStartRestore) + { + TInt queryIndexState(0); + TInt queryIndexType(0); + + CAknListQueryDialog* listQueryDlgState = new(ELeave) CAknListQueryDialog(&queryIndexState); + if (listQueryDlgState->ExecuteLD(R_SECUREBACKUP_STATE_QUERY)) + { + + CAknListQueryDialog* listQueryDlgType = new(ELeave) CAknListQueryDialog(&queryIndexType); + if (listQueryDlgType->ExecuteLD(R_SECUREBACKUP_TYPE_QUERY)) + { + conn::TBURPartType partType = conn::EBURNormal; + conn::TBackupIncType backupIncType = conn::ENoBackup; + + if (aType == EFileBrowserCmdToolsSecureBackupStartBackup) + { + if (queryIndexState == ESecureBackupStateFull) + partType = conn::EBURBackupFull; + else if (queryIndexState == ESecureBackupStatePartial) + partType = conn::EBURBackupPartial; + } + else if (aType == EFileBrowserCmdToolsSecureBackupStartRestore) + { + if (queryIndexState == ESecureBackupStateFull) + partType = conn::EBURRestoreFull; + else if (queryIndexState == ESecureBackupStatePartial) + partType = conn::EBURRestorePartial; + } + + if (queryIndexType == ESecureBackupTypeBase) + backupIncType = conn::EBackupBase; + else if (queryIndexType == ESecureBackupTypeIncremental) + backupIncType = conn::EBackupIncrement; + + // start secure backup + err = iFileOps->ActivateSecureBackUp(partType, backupIncType); + showStatus = ETrue; + } + } + } + + else if (aType == EFileBrowserCmdToolsSecureBackupStop) + { + err = iFileOps->DeActivateSecureBackUp(); + showStatus = ETrue; + } + + else + User::Panic(_L("Sec.br.mode"), 101); + + + if (showStatus) + { + if (err == KErrNone) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote; + note->ExecuteLD(_L("Succeeded")); + } + else + { + CTextResolver* textResolver = CTextResolver::NewLC(*iModel->EikonEnv()); + + CAknErrorNote* note = new(ELeave) CAknErrorNote; + note->ExecuteLD( textResolver->ResolveErrorString(err, CTextResolver::ECtxNoCtxNoSeparator) ); + + CleanupStack::PopAndDestroy(); //textResolver + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFileUtils::OpenCommonFileActionQueryL() + { + // just get current item + TInt currentItemIndex = iModel->FileListContainer()->CurrentListBoxItemIndex(); + + if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) + { + TInt queryIndex(0); + + CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex); + + if (listQueryDlg->ExecuteLD(R_COMMON_FILE_ACTION_QUERY)) + { + if (queryIndex == ECommonFileActionViewAsTextHex) + { + TFileEntry fileEntry = iFileEntryList->At(currentItemIndex); + + TFileName fullPath = fileEntry.iPath; + fullPath.Append(fileEntry.iEntry.iName); + + TInt viewerType(EFileBrowserCmdFileViewHex); + + // check from mime type if it's text + TDataType dataType; + TUid appUid; + if (iModel->LsSession().AppForDocument(fullPath, appUid, dataType) == KErrNone) + { + TBuf<128> mimeTypeBuf; + mimeTypeBuf.Copy(dataType.Des8()); + if (mimeTypeBuf == KNullDesC) + mimeTypeBuf.Copy(_L("N/A")); + + if (mimeTypeBuf.CompareF(_L("text/plain")) == 0) + viewerType = EFileBrowserCmdFileViewText; + } + + FileEditorL(viewerType); + } + + else if (queryIndex == ECommonFileActionOpenWithApparc) + { + OpenWithApparcL(); + } + + else if (queryIndex == ECommonFileActionOpenWithDocHandlerEmbed) + { + OpenWithDocHandlerL(ETrue); + } + + else + User::Panic(_L("Unk.Com.Act"), 221); + + } + } + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBModel.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,376 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBModel.h" +#include "FBApp.h" +#include "FB.hrh" +#include "FBSettingViewDlg.h" +#include "FBFileUtils.h" +#include "FBFileListContainer.h" +#include "FBStd.h" +#include + +#include +#include +#include +#include +#include + +// hash key selection related includes +#ifndef __SERIES60_30__ + #include + #include + #include + #include +#endif + +const TInt KSettingsDrive = EDriveC; +_LIT(KSettingsFileName, "filebrowser_settings.ini"); + +// ===================================== MEMBER FUNCTIONS ===================================== + +CFileBrowserModel* CFileBrowserModel::NewL() + { + CFileBrowserModel* self = new(ELeave) CFileBrowserModel; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserModel::CFileBrowserModel() + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserModel::ConstructL() + { + iEnv = CEikonEnv::Static(); + User::LeaveIfError(iLs.Connect()); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserModel::~CFileBrowserModel() + { + if (iFileUtils) + delete iFileUtils; + + iLs.Close(); + } + +// --------------------------------------------------------------------------- + +void CFileBrowserModel::ActivateModelL() + { + TRAP_IGNORE( LoadSettingsL() ); + + iFileUtils = CFileBrowserFileUtils::NewL(this); + + // get hash key selection value + GetHashKeySelectionStatus(); + } + +// --------------------------------------------------------------------------- + +void CFileBrowserModel::DeActivateModelL() + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserModel::SetFileListContainer(CFileBrowserFileListContainer* aFileListContainer) + { + iFileListContainer = aFileListContainer; + } + +// --------------------------------------------------------------------------- + +void CFileBrowserModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue) + { + if (aDicFS->IsPresentL(aUid)) + { + RDictionaryReadStream in; + in.OpenLC(*aDicFS, aUid); + aValue = in.ReadInt16L(); + CleanupStack::PopAndDestroy(); // in + } + } + +// --------------------------------------------------------------------------- + +void CFileBrowserModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue) + { + if (aDicFS->IsPresentL(aUid)) + { + RDictionaryReadStream in; + in.OpenLC(*aDicFS, aUid); + TInt bufLength = in.ReadInt16L(); // get length of descriptor + in.ReadL(aValue, bufLength); // get the descriptor itself + CleanupStack::PopAndDestroy(); // in + } + } + +// --------------------------------------------------------------------------- + +void CFileBrowserModel::SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue) + { + RDictionaryWriteStream out; + out.AssignLC(*aDicFS, aUid); + out.WriteInt16L(aValue); + out.CommitL(); + CleanupStack::PopAndDestroy(1);// out + } + +// --------------------------------------------------------------------------- + +void CFileBrowserModel::SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue) + { + RDictionaryWriteStream out; + out.AssignLC(*aDicFS, aUid); + out.WriteInt16L(aValue.Length()); // write length of the descriptor + out.WriteL(aValue, aValue.Length()); // write the descriptor itself + out.CommitL(); + CleanupStack::PopAndDestroy(1);// out + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserModel::LoadSettingsL() + { + const TSize screenSize = iEnv->ScreenDevice()->SizeInPixels(); + + // set defaults + iSettings.iDisplayMode = EDisplayModeFullScreen; + iSettings.iFileViewMode = IsQHD(screenSize) ? EFileViewModeExtended : EFileViewModeSimple; + iSettings.iShowSubDirectoryInfo = EFalse; + iSettings.iShowAssociatedIcons = EFalse; + iSettings.iRememberLastPath = EFalse; + iSettings.iLastPath = KNullDesC; + iSettings.iRememberFolderSelection = ETrue; +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + if ( AknLayoutUtils::PenEnabled() ) + { + iSettings.iEnableToolbar = ETrue; + } + else + { + iSettings.iEnableToolbar = EFalse; + } +#else + iSettings.iEnableToolbar = EFalse; +#endif + + iSettings.iSupportNetworkDrives = EFalse; + iSettings.iBypassPlatformSecurity = EFalse; + iSettings.iRemoveFileLocks = ETrue; + iSettings.iIgnoreProtectionsAtts = ETrue; + iSettings.iRemoveROMWriteProrection = ETrue; + + // build specific defaults +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + iSettings.iSupportNetworkDrives = ETrue; +#endif + + + // make sure that the private path of this app in c-drive exists + iEnv->FsSession().CreatePrivatePath( KSettingsDrive ); // c:\\private\\102828d6\\ + + // handle settings always in the private directory + if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone) + { + // open or create a dictionary file store + CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(iEnv->FsSession(), KSettingsFileName, KUidFileBrowser); + + LoadDFSValueL(settingsStore, KFBSettingDisplayMode, iSettings.iDisplayMode); + LoadDFSValueL(settingsStore, KFBSettingFileViewMode, iSettings.iFileViewMode); + LoadDFSValueL(settingsStore, KFBSettingShowSubDirectoryInfo, iSettings.iShowSubDirectoryInfo); + LoadDFSValueL(settingsStore, KFBSettingShowAssociatedIcons, iSettings.iShowAssociatedIcons); + LoadDFSValueL(settingsStore, KFBSettingRememberLastPath, iSettings.iRememberLastPath); + LoadDFSValueL(settingsStore, KFBSettingLastPath, iSettings.iLastPath); + LoadDFSValueL(settingsStore, KFBSettingFolderSelection, iSettings.iRememberFolderSelection); + LoadDFSValueL(settingsStore, KFBSettingEnableToolbar, iSettings.iEnableToolbar); + + LoadDFSValueL(settingsStore, KFBSettingSupportNetworkDrives, iSettings.iSupportNetworkDrives); + LoadDFSValueL(settingsStore, KFBSettingBypassPlatformSecurity, iSettings.iBypassPlatformSecurity); + LoadDFSValueL(settingsStore, KFBSettingRemoveFileLocks, iSettings.iRemoveFileLocks); + LoadDFSValueL(settingsStore, KFBSettingIgnoreProtectionsAtts, iSettings.iIgnoreProtectionsAtts); + LoadDFSValueL(settingsStore, KFBSettingRemoveROMWriteProtection, iSettings.iRemoveROMWriteProrection); + + CleanupStack::PopAndDestroy(); // settingsStore + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserModel::SaveSettingsL(TBool aNotifyModules) + { + // handle settings always in c:\\private\\102828d6\\ + if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone) + { + // delete existing store to make sure that it is clean and not eg corrupted + if (BaflUtils::FileExists(iEnv->FsSession(), KSettingsFileName)) + { + iEnv->FsSession().Delete(KSettingsFileName); + } + + // create a dictionary file store + CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(iEnv->FsSession(), KSettingsFileName, KUidFileBrowser); + + SaveDFSValueL(settingsStore, KFBSettingDisplayMode, iSettings.iDisplayMode); + SaveDFSValueL(settingsStore, KFBSettingFileViewMode, iSettings.iFileViewMode); + SaveDFSValueL(settingsStore, KFBSettingShowSubDirectoryInfo, iSettings.iShowSubDirectoryInfo); + SaveDFSValueL(settingsStore, KFBSettingShowAssociatedIcons, iSettings.iShowAssociatedIcons); + SaveDFSValueL(settingsStore, KFBSettingRememberLastPath, iSettings.iRememberLastPath); + SaveDFSValueL(settingsStore, KFBSettingLastPath, iSettings.iLastPath); + SaveDFSValueL(settingsStore, KFBSettingFolderSelection, iSettings.iRememberFolderSelection); + SaveDFSValueL(settingsStore, KFBSettingEnableToolbar, iSettings.iEnableToolbar); + + SaveDFSValueL(settingsStore, KFBSettingSupportNetworkDrives, iSettings.iSupportNetworkDrives); + SaveDFSValueL(settingsStore, KFBSettingBypassPlatformSecurity, iSettings.iBypassPlatformSecurity); + SaveDFSValueL(settingsStore, KFBSettingRemoveFileLocks, iSettings.iRemoveFileLocks); + SaveDFSValueL(settingsStore, KFBSettingIgnoreProtectionsAtts, iSettings.iIgnoreProtectionsAtts); + SaveDFSValueL(settingsStore, KFBSettingRemoveROMWriteProtection, iSettings.iRemoveROMWriteProrection); + + settingsStore->CommitL(); + CleanupStack::PopAndDestroy(); // settingsStore + } + + // update changes to modules + if (aNotifyModules) + { + //iScreenCapture->HandleSettingsChangeL(); + iFileUtils->HandleSettingsChangeL(); + iFileListContainer->HandleSettingsChangeL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserModel::GetHashKeySelectionStatus() + { + TBool hashKeySelectionInUse(EFalse); + +#ifndef __SERIES60_30__ + + // get hash key selection value + TRAP_IGNORE( + CRepository* repository = CRepository::NewLC(KCRUidAknFep); + repository->Get(KAknFepHashKeySelection, hashKeySelectionInUse); + CleanupStack::PopAndDestroy(); + ); + + // even if hash key selection is in use, ignore the value in qwerty mode + if (hashKeySelectionInUse) + { + TBool qwertyMode(EFalse); + RProperty qwertyModeStatusProperty; + qwertyModeStatusProperty.Attach(KCRUidAvkon, KAknQwertyInputModeActive); + qwertyModeStatusProperty.Get(qwertyMode); + qwertyModeStatusProperty.Close(); + + if (qwertyMode) + hashKeySelectionInUse = EFalse; + } + +#endif + + iIsHashKeySelectionInUse = hashKeySelectionInUse; + } + +// -------------------------------------------------------------------------------------------- + +TInt CFileBrowserModel::LaunchSettingsDialogL() + { + // set to normal mode + iFileListContainer->SetScreenLayoutL(EDisplayModeNormal); + iFileListContainer->DeleteNaviPane(); + iFileListContainer->HideToolbar(); + + // launch the dialog and save settings + CFileBrowserSettingViewDlg* dlg = CFileBrowserSettingViewDlg::NewL(iSettings); + TInt retValue = dlg->ExecuteLD(R_FILEBROWSER_SETTINGS_DIALOG); + FileListContainer()->CreateEmptyNaviPaneLabelL(); + TRAP_IGNORE(SaveSettingsL()); + return retValue; + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CAsyncWaiter* CAsyncWaiter::NewL(TInt aPriority) + { + CAsyncWaiter* self = new(ELeave) CAsyncWaiter(aPriority); + return self; + } + +CAsyncWaiter* CAsyncWaiter::NewLC(TInt aPriority) + { + CAsyncWaiter* self = new(ELeave) CAsyncWaiter(aPriority); + CleanupStack::PushL(self); + return self; + } + +CAsyncWaiter::CAsyncWaiter(TInt aPriority) : CActive(aPriority) + { + CActiveScheduler::Add(this); + } + +CAsyncWaiter::~CAsyncWaiter() + { + Cancel(); + } + +void CAsyncWaiter::StartAndWait() + { + iStatus = KRequestPending; + SetActive(); + iWait.Start(); + } + +TInt CAsyncWaiter::Result() const + { + return iError; + } + +void CAsyncWaiter::RunL() + { + iError = iStatus.Int(); + CAknEnv::StopSchedulerWaitWithBusyMessage( iWait ); + } + +void CAsyncWaiter::DoCancel() + { + iError = KErrCancel; + if( iStatus == KRequestPending ) + { + TRequestStatus* s=&iStatus; + User::RequestComplete( s, KErrCancel ); + } + + CAknEnv::StopSchedulerWaitWithBusyMessage( iWait ); + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBSettingViewDlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBSettingViewDlg.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,463 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBSettingViewDlg.h" +#include "FBModel.h" +#include "FB.hrh" +#include "FBStd.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// ===================================== MEMBER FUNCTIONS ===================================== + +CFileBrowserSettingViewDlg* CFileBrowserSettingViewDlg::NewL(TFileBrowserSettings& aSettings) + { + CFileBrowserSettingViewDlg* self = new(ELeave) CFileBrowserSettingViewDlg(aSettings); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserSettingViewDlg::~CFileBrowserSettingViewDlg() + { + // restore default navi pane + if (iNaviContainer) + iNaviContainer->Pop(); + + if (iSettingItemArray) + { + iSettingItemArray->ResetAndDestroy(); + delete iSettingItemArray; + } + + if (iDecoratedTabGroup) + delete iDecoratedTabGroup; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserSettingViewDlg::CFileBrowserSettingViewDlg(TFileBrowserSettings& aSettings) : iSettings(aSettings) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::ConstructL() + { + // construct a menu bar + CAknDialog::ConstructL(R_FILEBROWSER_SETTINGS_MENUBAR); + + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + // set empty navi pane label + iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iNaviContainer->PushDefaultL(); + + // set title text + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("Settings") ); + + // create a tab group + iDecoratedTabGroup = iNaviContainer->CreateTabGroupL(this); + iTabGroup = static_cast(iDecoratedTabGroup->DecoratedControl()); + iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoLongTabs); + + // add tabs + iTabGroup->AddTabL(ETabGeneral, _L("General")); + iTabGroup->AddTabL(ETabFileOps, _L("Operations")); + iTabGroup->SetActiveTabByIndex(ETabGeneral); + + iNaviContainer->PushL( *iDecoratedTabGroup ); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + ShowSettingPageL(EFalse); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::TabChangedL(TInt /*aIndex*/) + { + iListBox->SetCurrentItemIndex(0); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::ProcessCommandL(TInt aCommandId) + { + CAknDialog::ProcessCommandL(aCommandId); + + switch (aCommandId) + { + case EFileBrowserCmdSettingsChange: + ShowSettingPageL(ETrue); + break; + case EFileBrowserCmdSettingsExit: + TryExitL(EAknCmdExit); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CFileBrowserSettingViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if (iTabGroup == NULL) + { + return EKeyWasNotConsumed; + } + + TInt active = iTabGroup->ActiveTabIndex(); + TInt count = iTabGroup->TabCount(); + + switch ( aKeyEvent.iCode ) + { + case EKeyLeftArrow: + if (active > 0) + { + active--; + iTabGroup->SetActiveTabByIndex(active); + TabChangedL(active); + } + break; + + case EKeyRightArrow: + if((active + 1) < count) + { + active++; + iTabGroup->SetActiveTabByIndex(active); + TabChangedL(active); + } + break; + } + + return CAknDialog::OfferKeyEventL(aKeyEvent, aType); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::PreLayoutDynInitL() + { + iListBox = static_cast( Control(EFileBrowserSettingItemList) ); + iListBox->SetMopParent(this); + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + iListBox->SetListBoxObserver(this); + + iSettingItemArray = new(ELeave) CAknSettingItemArray(16, EFalse, 0); + + CTextListBoxModel* model = iListBox->Model(); + model->SetItemTextArray(iSettingItemArray); + model->SetOwnershipType(ELbmDoesNotOwnItemArray); + + UpdateListBoxL(); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserSettingViewDlg::OkToExitL(TInt aButtonId) + { + return CAknDialog::OkToExitL(aButtonId); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::ShowSettingPageL(TInt aCalledFromMenu) + { + TInt listIndex = iListBox->CurrentItemIndex(); + TInt realIndex = iSettingItemArray->ItemIndexFromVisibleIndex(listIndex); + CAknSettingItem* item = iSettingItemArray->At(realIndex); + item->EditItemL(aCalledFromMenu); + item->StoreL(); + SetVisibilitiesOfSettingItemsL(); + DrawNow(); + + if (realIndex == ESettingListBypassPlatformSecuritySelection && iSettings.iBypassPlatformSecurity) + { + _LIT(KMessage, "Gives TCB rights to file operations, use at your own risk"); + CAknInformationNote* note = new(ELeave) CAknInformationNote; + note->ExecuteLD(KMessage); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::SetVisibilitiesOfSettingItemsL() + { + if (iSettingItemArray->Count() > 0) + { + switch (iTabGroup->ActiveTabIndex()) + { + case ETabGeneral: + { + ((*iSettingItemArray)[ESettingListDisplayModeSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListFileViewModeSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListShowSubdirectoryInfoSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListShowAssociatedIconsSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListRememberLastPathSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListRememberFolderSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListEnableToolbar])->SetHidden(EFalse); + + ((*iSettingItemArray)[ESettingListSupportNetworkDrivesSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListBypassPlatformSecuritySelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListRemoveFileLocksSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListIgnoreProtectionsAttsSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListRemoveROMWriteProtectionSelection])->SetHidden(ETrue); + } + break; + + case ETabFileOps: + { + ((*iSettingItemArray)[ESettingListDisplayModeSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListFileViewModeSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListShowSubdirectoryInfoSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListShowAssociatedIconsSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListRememberLastPathSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListRememberFolderSelection])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListEnableToolbar])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListSupportNetworkDrivesSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListBypassPlatformSecuritySelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListRemoveFileLocksSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListIgnoreProtectionsAttsSelection])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListRemoveROMWriteProtectionSelection])->SetHidden(EFalse); + } + break; + + default: + User::Panic(_L("TabIOOB"), 50); + break; + } + + #ifdef FILEBROWSER_LITE + ((*iSettingItemArray)[ESettingListBypassPlatformSecuritySelection])->SetHidden(ETrue); + #endif + + #if(defined __SERIES60_30__ || defined __SERIES60_31__ || defined __S60_32__) + ((*iSettingItemArray)[ESettingListEnableToolbar])->SetHidden(ETrue); + #else + if ( !AknLayoutUtils::PenEnabled() ) + { + ((*iSettingItemArray)[ESettingListEnableToolbar])->SetHidden(ETrue); + } + #endif + + iSettingItemArray->RecalculateVisibleIndicesL(); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::UpdateListBoxL() + { + iSettingItemArray->ResetAndDestroy(); + + // create items + TInt ordinal(0); + + AddSettingItemL(ESettingListDisplayModeSelection, + R_DISPLAYMODESELECTION_SETTING_TITLE, + R_DISPLAYMODESELECTION_SETTING_PAGE, + R_DISPLAYMODESELECTION_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListFileViewModeSelection, + R_FILEVIEWMODESELECTION_SETTING_TITLE, + R_FILEVIEWMODESELECTION_SETTING_PAGE, + R_FILEVIEWMODESELECTION_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListShowSubdirectoryInfoSelection, + R_SHOWSUBDIRECTORYINFOSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListShowAssociatedIconsSelection, + R_SHOWASSOCIATEDICONSSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListRememberLastPathSelection, + R_REMEMBERLASTPATHSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListRememberFolderSelection, + R_REMEMBERFOLDERSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListEnableToolbar, + R_ENABLETOOLBAR_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListSupportNetworkDrivesSelection, + R_SUPPORTNETWORKDRIVESSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListBypassPlatformSecuritySelection, + R_BYPASSPLATFORMSECURITYSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListRemoveFileLocksSelection, + R_REMOVEFILELOCKSSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListIgnoreProtectionsAttsSelection, + R_IGNOREPROTECTIONATTSSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListRemoveROMWriteProtectionSelection, + R_REMOVEROMWRITEPROTECTIONSELECTION_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserSettingViewDlg::AddSettingItemL(TInt aId, + TInt aTitleResource, + TInt aSettingPageResource, + TInt aAssociatedResource, + TInt aOrdinal) + { + // create a setting item + CAknSettingItem* settingItem = NULL; + + switch (aId) + { + case ESettingListDisplayModeSelection: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDisplayMode); + break; + + case ESettingListFileViewModeSelection: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iFileViewMode); + break; + + case ESettingListShowSubdirectoryInfoSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iShowSubDirectoryInfo); + break; + + case ESettingListShowAssociatedIconsSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iShowAssociatedIcons); + break; + + case ESettingListRememberLastPathSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iRememberLastPath); + break; + + case ESettingListRememberFolderSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iRememberFolderSelection); + break; + + case ESettingListEnableToolbar: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iEnableToolbar); + break; + + case ESettingListSupportNetworkDrivesSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iSupportNetworkDrives); + break; + + case ESettingListBypassPlatformSecuritySelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iBypassPlatformSecurity); + break; + + case ESettingListRemoveFileLocksSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iRemoveFileLocks); + break; + + case ESettingListIgnoreProtectionsAttsSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iIgnoreProtectionsAtts); + break; + + case ESettingListRemoveROMWriteProtectionSelection: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iRemoveROMWriteProrection); + break; + + + default: + User::Panic(_L("NotSetItem"), 50); + break; + } + + CleanupStack::PushL(settingItem); + + // get title text + HBufC* itemTitle = StringLoader::LoadLC(aTitleResource); + + // construct the setting item + settingItem->ConstructL(EFalse, aOrdinal, *itemTitle, NULL, aSettingPageResource, + EAknCtPopupSettingList, NULL, aAssociatedResource); + + // append the setting item to settingitem array + iSettingItemArray->InsertL(aOrdinal, settingItem); + + CleanupStack::PopAndDestroy(); //itemTitle + CleanupStack::Pop(); //settingItem + } + +// -------------------------------------------------------------------------------------------- + +// End of File + diff -r 000000000000 -r d6fe6244b863 filebrowser/src/FBToolbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/src/FBToolbar.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,369 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 "FBToolbar.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "FB.hrh" +#include "FBDocument.h" +#include "FBModel.h" +#include "FBFileUtils.h" +#include "FBFileListContainer.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CFileBrowserToolbar::NewL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +CFileBrowserToolbar* CFileBrowserToolbar::NewL(/* CAknView& aView*/ ) + { + CFileBrowserToolbar* self = CFileBrowserToolbar::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CFileBrowserToolbar::NewLC() +// Creates and leaves on failure. +// ----------------------------------------------------------------------------- +// +CFileBrowserToolbar* CFileBrowserToolbar::NewLC() + { + CFileBrowserToolbar* self = new ( ELeave )CFileBrowserToolbar(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CFileBrowserToolbar::~CFileBrowserToolbar() +// removes the toolbar items when it leaves Editor/viewer plugin. +// ----------------------------------------------------------------------------- +// +CFileBrowserToolbar::~CFileBrowserToolbar() + { + delete iInfoPopup; + if ( AknLayoutUtils::PenEnabled() ) + { + if ( iViewerToolbar ) + { + iViewerToolbar->SetToolbarVisibility( EFalse ); + TRAP_IGNORE( iViewerToolbar->DisableToolbarL(ETrue) ); + } + } + + if ( iViewerToolbar ) + { + iViewerToolbar->HideItem( EFileBrowserCmdFileBack, ETrue, EFalse ); + iViewerToolbar->HideItem( EFileBrowserCmdFileSearch, ETrue, EFalse ); + iViewerToolbar->HideItem( EFileBrowserCmdEditSelect, ETrue, EFalse ); + } + } +// ----------------------------------------------------------------------------- +// CFileBrowserToolbar::CFileBrowserToolbar() +// C++ construct function add items the toolbar. +// ----------------------------------------------------------------------------- +// +CFileBrowserToolbar::CFileBrowserToolbar() : + iFirstSelectionIndex( KErrNotFound ), + iLastSelectionIndex( KErrNotFound ) + { + } + +// ----------------------------------------------------------------------------- +// CFileBrowserToolbar::ConstructL() +// C++ construct function add items the toolbar. +// ----------------------------------------------------------------------------- +// +void CFileBrowserToolbar::ConstructL() + { + CAknAppUi* appUi = (CAknAppUi*)CEikonEnv::Static()->EikAppUi(); + iModel = static_cast(appUi->Document())->Model(); + + iViewerToolbar = appUi->CurrentFixedToolbar(); + iSelectbutton = static_cast( iViewerToolbar->ControlOrNull( EFileBrowserCmdEditSelect ) ); + + if ( iViewerToolbar ) + { + iShown = ETrue; + iViewerToolbar->SetObserver( this ); + iViewerToolbar->SetToolbarObserver( this ); + iViewerToolbar->SetWithSliding( ETrue ); + iViewerToolbar->SetCloseOnAllCommands( EFalse ); + iViewerToolbar->SetFocusing( EFalse ); + } + iInfoPopup = CAknInfoPopupNoteController::NewL(); + iInfoPopup->SetTimePopupInView(5000); + iInfoPopup->SetTimeDelayBeforeShow(500); + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::ResetState +// Updates the toolbar +// --------------------------------------------------------------------------- +// +void CFileBrowserToolbar::ResetState() + { + if ( AknLayoutUtils::PenEnabled() ) + { + iSelectbutton->SetCurrentState( 0, ETrue ); + iFirstSelectionIndex = KErrNotFound; + iLastSelectionIndex = KErrNotFound; + } + if ( iInfoPopup ) + { + iInfoPopup->HideInfoPopupNote(); + } + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::DynInitToolbarL +// Initialise before the display of the toolbar +// --------------------------------------------------------------------------- +// +void CFileBrowserToolbar::DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* /*aToolbar*/ ) + { + ResetState(); + iViewerToolbar->SetFocusing(EFalse); + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::ShowToolbar +// Shows the toolbar +// --------------------------------------------------------------------------- +// +void CFileBrowserToolbar::ShowToolbarL() + { + if(AknLayoutUtils::PenEnabled() ) + { + TRAP_IGNORE( iViewerToolbar->DisableToolbarL(EFalse) ); + iViewerToolbar->SetToolbarVisibility(ETrue); + } + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::ShowToolbar +// Hides the Toolbar +// --------------------------------------------------------------------------- +// +void CFileBrowserToolbar::HideToolbarL() + { + // Undim the toolbar if dimmed + if(AknLayoutUtils::PenEnabled() ) + { + TRAP_IGNORE( iViewerToolbar->DisableToolbarL(ETrue) ); + iViewerToolbar->SetToolbarVisibility(EFalse); + } + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::OfferToolbarEventL +// Handling toolbar key events +// --------------------------------------------------------------------------- +// +void CFileBrowserToolbar::OfferToolbarEventL( TInt aCommand ) + { + switch ( aCommand ) + { + case EFileBrowserCmdFileBack: + { + iModel->FileUtils()->MoveUpOneLevelL(); + break; + } + case EFileBrowserCmdFileSearch: + { + TBool emptyListBox = iModel->FileListContainer()->ListBoxNumberOfVisibleItems() == 0; + TBool searchFieldEnabled = iModel->FileListContainer()->IsSearchFieldEnabled(); + if ( !emptyListBox && !searchFieldEnabled ) + { + iModel->FileListContainer()->EnableSearchFieldL(); + } + else if ( searchFieldEnabled ) + { + iModel->FileListContainer()->DisableSearchFieldL(); + } + break; + } + case EFileBrowserCmdEditSelect: + { + TBool emptyListBox = iModel->FileListContainer()->ListBoxNumberOfVisibleItems() == 0; + TBool driveListActive = iModel->FileUtils()->IsDriveListViewActive(); + TBool allSelected = iModel->FileListContainer()->ListBox()->SelectionIndexes()->Count() == iModel->FileListContainer()->ListBox()->Model()->NumberOfItems(); + TBool noneSelected = iModel->FileListContainer()->ListBox()->SelectionIndexes()->Count() == 0; + + if ( iViewerToolbar->EventModifiers() == CAknToolbar::ELongPressEnded ) + { + // handle long tap event + iFirstSelectionIndex = KErrNotFound; + iLastSelectionIndex = KErrNotFound; + iSelectbutton->SetCurrentState( 0, ETrue ); + + if ( !( driveListActive || allSelected || emptyListBox ) ) + { + AknSelectionService::HandleMarkableListProcessCommandL( EAknMarkAll, iModel->FileListContainer()->ListBox() ); + } + else if ( !( driveListActive || noneSelected || emptyListBox ) ) + { + AknSelectionService::HandleMarkableListProcessCommandL( EAknUnmarkAll, iModel->FileListContainer()->ListBox() ); + } + } + else if ( iViewerToolbar->EventModifiers() != CAknToolbar::ELongPress ) + { + // handle single tap event + TBool currentSelected = iModel->FileListContainer()->ListBox()->View()->ItemIsSelected(iModel->FileListContainer()->ListBox()->View()->CurrentItemIndex()); + + if ( !( driveListActive || emptyListBox ) ) + { + if ( noneSelected && iFirstSelectionIndex == KErrNotFound ) + { + iLastSelectionIndex = KErrNotFound; + } + + if ( iFirstSelectionIndex == KErrNotFound ) + { + // first item selected + iFirstSelectionIndex = iModel->FileListContainer()->ListBox()->CurrentItemIndex(); + if ( currentSelected ) + { + AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdUnmark, iModel->FileListContainer()->ListBox() ); + } + else + { + AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdMark, iModel->FileListContainer()->ListBox() ); + } + // Toolbar button updates its state (icon) + iInfoPopup->SetTextL( _L("Select the last item.") ); + iInfoPopup->ShowInfoPopupNote(); + } + else + { + iInfoPopup->HideInfoPopupNote(); + iLastSelectionIndex = iModel->FileListContainer()->ListBox()->CurrentItemIndex(); + if ( iLastSelectionIndex == iFirstSelectionIndex ) + { + // the same item selected second time + iFirstSelectionIndex = KErrNotFound; + iLastSelectionIndex = KErrNotFound; + if ( currentSelected ) + { + AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdUnmark, iModel->FileListContainer()->ListBox() ); + } + else + { + AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdMark, iModel->FileListContainer()->ListBox() ); + } + // Toolbar button updates its state (icon) + } + else + { + // the last item selected, toggle the item selection between first and last + TInt skipFirstToggle(1); + TInt skipLastToggle(0); + TInt finalFocus = iLastSelectionIndex; + if ( iFirstSelectionIndex > iLastSelectionIndex ) + { + TInt tmp = iFirstSelectionIndex; + iFirstSelectionIndex = iLastSelectionIndex; + iLastSelectionIndex = tmp; + skipFirstToggle = 0; + skipLastToggle = 1; + } + for ( TInt i = iFirstSelectionIndex+skipFirstToggle; i <= iLastSelectionIndex-skipLastToggle ; i++ ) + { + iModel->FileListContainer()->ListBox()->SetCurrentItemIndexAndDraw( i ); + TBool itemSelected = iModel->FileListContainer()->ListBox()->View()->ItemIsSelected(iModel->FileListContainer()->ListBox()->View()->CurrentItemIndex()); + if ( itemSelected ) + { + TRAP_IGNORE( AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdUnmark, iModel->FileListContainer()->ListBox() ) ); + } + else + { + TRAP_IGNORE( AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdMark, iModel->FileListContainer()->ListBox() ) ); + } + } + iFirstSelectionIndex = KErrNotFound; + iLastSelectionIndex = KErrNotFound; + iModel->FileListContainer()->ListBox()->SetCurrentItemIndexAndDraw( finalFocus ); + // Toolbar button updates its state (icon) + } + } + } + else + { + iSelectbutton->SetCurrentState( 0, ETrue ); + } + } + break; + } + default: + { + break; + } + } + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::HandleControlEventL +// Handles toolbar event cannot contain any code +// --------------------------------------------------------------------------- +// +void CFileBrowserToolbar::HandleControlEventL( CCoeControl* /*aControl*/, + TCoeEvent /*aEventType*/ ) + { + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::IsShown +// Returns whether the toolbar is shown or not +// --------------------------------------------------------------------------- +// +TBool CFileBrowserToolbar::IsShown() + { + return iShown; + } + +// --------------------------------------------------------------------------- +// CFileBrowserToolbar::Rect +// +// --------------------------------------------------------------------------- +// +const TRect CFileBrowserToolbar::Rect() const + { + return iViewerToolbar->Rect(); + } + +// End of File + diff -r 000000000000 -r d6fe6244b863 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Tue Feb 02 00:17:27 2010 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: + + bld.inf Top-level build information for rndtools + +----------------------------------------------------------------------------- +*/ + + +#include "../creator/group/bld.inf" +#include "../filebrowser/group/bld.inf" +#include "../launcher/group/bld.inf" +#include "../loadgen/group/bld.inf" +#include "../perfmon/group/bld.inf" +#include "../screengrabber/group/bld.inf" +#include "../stifui/group/bld.inf" +#include "../memspyui/group/bld.inf" +#include "../htiui/group/bld.inf" diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/data/1020DEB6.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/data/1020DEB6.rss Tue Feb 02 00:17:27 2010 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies 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 startup control file to add HtiFramework.exe to startup list. +* +*/ + +#include + +RESOURCE STARTUP_ITEM_INFO hti_framework + { + executable_name = "!:\\sys\\bin\\HtiFramework.exe"; + recovery = EStartupItemExPolicyNone; + } + + +// End of file diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/data/HtiAdmin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/data/HtiAdmin.rss Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,317 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 for HtiAdmin +* +*/ + +NAME HTIA + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "HtiAdmin.hrh" + + +// RESOURCE DEFINITIONS + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_htiadmin_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +// --------------------------------------------------------- +// +// r_htiadmin_menubar +// Menubar for HtiAdmin example +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_htiadmin_menubar + { + titles = + { + MENU_TITLE {menu_pane = r_htiadmin_menu;} + }; + } + + +// --------------------------------------------------------- +// +// Options menu items +// +// +// --------------------------------------------------------- + +RESOURCE MENU_PANE r_htiadmin_submenu_logs + { + items = + { + MENU_ITEM {command = EHtiAdminCreateLogFolder; txt = "Create c:\\logs\\hti";}, + MENU_ITEM {command = EHtiAdminRemoveLogFolder; txt = "Remove c:\\logs\\hti";}, + MENU_ITEM {command = EHtiAdminClearLogs; txt = "Clear";} + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_priority + { + items = + { + MENU_ITEM {command = EHtiAdminPriorityBackground; flags = EEikMenuItemCheckBox; txt="Background"; }, + MENU_ITEM {command = EHtiAdminPriorityForeground; flags = EEikMenuItemCheckBox; txt="Foreground"; }, + MENU_ITEM {command = EHtiAdminPriorityHigh; flags = EEikMenuItemCheckBox; txt="High"; }, + MENU_ITEM {command = EHtiAdminPriorityAbsoluteHigh; flags = EEikMenuItemCheckBox; txt="AbsoluteHigh"; } + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_watchdog + { + items = + { + MENU_ITEM {command = EHtiAdminWatchDogEnable; flags = EEikMenuItemCheckBox; txt="Enable"; }, + MENU_ITEM {command = EHtiAdminWatchDogDisable; flags = EEikMenuItemCheckBox; txt="Disable"; } + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_console + { + items = + { + MENU_ITEM {command = EHtiAdminConsoleEnable; flags = EEikMenuItemCheckBox; txt="Enable"; }, + MENU_ITEM {command = EHtiAdminConsoleDisable; flags = EEikMenuItemCheckBox; txt="Disable"; } + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_error_dialogs + { + items = + { + MENU_ITEM {command = EHtiAdminErrorDialogsEnable; flags = EEikMenuItemCheckBox; txt="Enable"; }, + MENU_ITEM {command = EHtiAdminErrorDialogsDisable; flags = EEikMenuItemCheckBox; txt="Disable"; } + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_autostart + { + items = + { + MENU_ITEM {command = EHtiAdminAutoStartEnable; flags = EEikMenuItemCheckBox; txt="Enable"; }, + MENU_ITEM {command = EHtiAdminAutoStartDisable; flags = EEikMenuItemCheckBox; txt="Disable"; } + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_set_param + { + items = + { + MENU_ITEM {command = EHtiAdminHtiCfg; txt = "Hti.cfg";}, + MENU_ITEM {command = EHtiAdminHtiBtCommCfg; txt = "HtiBtComm.cfg";}, + MENU_ITEM {command = EHtiAdminHtiSerialCommCfg; txt = "HtiSerialComm.cfg";}, + MENU_ITEM {command = EHtiAdminHtiIPCommCfg; txt = "HtiIPComm.cfg";} + }; + } + +RESOURCE MENU_PANE r_htiadmin_submenu_options + { + items = + { + MENU_ITEM {command = EHtiAdminSubComms; txt = "Comms";}, + MENU_ITEM {command = EHtiAdminSubAutoStart; cascade = r_htiadmin_submenu_autostart; txt = "AutoStart";}, + MENU_ITEM {command = EHtiAdminSubLogs; cascade = r_htiadmin_submenu_logs; txt = "Logs";}, + MENU_ITEM {command = EHtiAdminSubPriority; cascade = r_htiadmin_submenu_priority; txt = "Priority";}, + MENU_ITEM {command = EHtiAdminSubWatchDog; cascade = r_htiadmin_submenu_watchdog; txt = "Watchdog";}, + MENU_ITEM {command = EHtiAdminSubConsole; cascade = r_htiadmin_submenu_console; txt = "Console";}, + MENU_ITEM {command = EHtiAdminSubErrorDialogs; cascade = r_htiadmin_submenu_error_dialogs; txt = "Error dialogs";}, + MENU_ITEM {command = EHtiAdminSubSetParam; cascade = r_htiadmin_submenu_set_param; txt = "Set parameter";} + }; + } + +// --------------------------------------------------------- +// +// r_htiadmin_menu +// Menu for "Options" +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_htiadmin_menu + { + items = + { + MENU_ITEM {command = EHtiAdminStart; txt = "Start";}, + MENU_ITEM {command = EHtiAdminStop; txt = "Stop";}, + MENU_ITEM {command = EHtiAdminSubOptions; cascade = r_htiadmin_submenu_options; txt = "Options";}, + MENU_ITEM {command = EHtiAdminAbout; txt = "About";}, + MENU_ITEM {command = EAknSoftkeyExit; txt = "Exit";} + }; + } + + +RESOURCE DIALOG r_numeric_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + default_input_mode = EAknEditorNumericInputMode; + }; + }; + } + }; + } + +RESOURCE DIALOG r_text_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + default_input_mode = EAknEditorTextInputMode; + }; + }; + } + }; + } + +RESOURCE AVKON_LIST_QUERY r_query_dialog +{ + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + }; + heading = "Select Option"; + }; + } + }; +} + +RESOURCE AVKON_LIST_QUERY r_select_iap_dialog +{ + flags = EGeneralQueryFlags; + softkeys = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + }; + heading = "Select IAP"; + }; + } + }; +} + +// --------------------------------------------------------- +// +// r_htiadmin_about_dialog +// About dialog +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_htiadmin_about_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About HTI Admin"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_htiadmin_about_text +// Text for the About dialog +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_htiadmin_about_text { buf="Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."; } + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/data/HtiAdmin_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/data/HtiAdmin_reg.rss Tue Feb 02 00:17:27 2010 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: App registration resource definitions for HtiAdmin +* +*/ + + +// INCLUDES +#include +#include + +// RESOURCE DEFINITIONS + +UID2 KUidAppRegistrationResourceFile +UID3 0x1020DEB5 // application UID + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "HtiAdmin"; + group_name = "RnD Tools"; + } + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/group/HtiAdmin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/group/HtiAdmin.mmp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,81 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 file for HtiAdmin +* +*/ + + +#include +#include + +TARGET HtiAdmin.exe +TARGETTYPE EXE + +UID 0x100039CE 0x1020DEB5 + +VENDORID 0x101FB657 + +CAPABILITY ALL -TCB + +EPOCSTACKSIZE 0x5000 + +TARGETPATH PROGRAMS_DIR + +LANG SC + +USERINCLUDE ../inc +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE HtiAdmin.cpp +SOURCE HtiAdminApplication.cpp +SOURCE HtiAdminAppView.cpp +SOURCE HtiAdminAppUi.cpp +SOURCE HtiAdminDocument.cpp + +SOURCEPATH ../data + +START RESOURCE HtiAdmin.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANG SC +END + +START RESOURCE HtiAdmin_reg.rss +HEADER +TARGETPATH /private/10003a3f/apps +END + +START RESOURCE 1020DEB6.rss +HEADER +TARGETPATH /private/101f875a/import +END + +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY euser.lib +LIBRARY gdi.lib +LIBRARY hticfg.lib +LIBRARY ws32.lib +LIBRARY flogger.lib +LIBRARY bafl.lib +LIBRARY commdb.lib + +SMPSAFE + +// End of file diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/group/bld.inf Tue Feb 02 00:17:27 2010 +0200 @@ -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 "Eclipse Public License v1.0" +* which accompanies 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 application to start/stop HtiFramework.exe +* +*/ + + +PRJ_MMPFILES + +HtiAdmin.mmp + + diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/inc/HtiAdmin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/inc/HtiAdmin.hrh Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,66 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Command ids +* +*/ + +#ifndef __HTIADMIN_HRH__ +#define __HTIADMIN_HRH__ + +/* HtiAdmin enumerate command codes */ +enum THtiAdminIds + { + EHtiAdminStart = 1, + EHtiAdminStop, + EHtiAdminAbout, + EHtiAdminSubOptions, + + EHtiAdminSubComms, + + EHtiAdminSubAutoStart, + EHtiAdminAutoStartEnable, + EHtiAdminAutoStartDisable, + + EHtiAdminSubLogs, + EHtiAdminCreateLogFolder, + EHtiAdminRemoveLogFolder, + EHtiAdminClearLogs, + + EHtiAdminSubPriority, + EHtiAdminPriorityBackground, + EHtiAdminPriorityForeground, + EHtiAdminPriorityHigh, + EHtiAdminPriorityAbsoluteHigh, + + EHtiAdminSubWatchDog, + EHtiAdminWatchDogEnable, + EHtiAdminWatchDogDisable, + + EHtiAdminSubConsole, + EHtiAdminConsoleEnable, + EHtiAdminConsoleDisable, + + EHtiAdminSubErrorDialogs, + EHtiAdminErrorDialogsEnable, + EHtiAdminErrorDialogsDisable, + + EHtiAdminSubSetParam, + EHtiAdminHtiCfg, + EHtiAdminHtiBtCommCfg, + EHtiAdminHtiSerialCommCfg, + EHtiAdminHtiIPCommCfg + }; + + +#endif // __HTIADMIN_HRH__ diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/inc/HtiAdmin.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/inc/HtiAdmin.pan Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,35 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panics definitions for HtiAdmin +* +*/ + + +#ifndef __HTIADMIN_PAN__ +#define __HTIADMIN_PAN__ + +/** HtiAdmin application panic codes */ +enum THtiAdminPanics + { + EHtiAdminBasicUi = 1 + // add further panics here + }; + +inline void Panic(THtiAdminPanics aReason) + { + _LIT(applicationName,"HtiAdmin"); + User::Panic(applicationName, aReason); + } + +#endif // __HTIADMIN_PAN__ diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/inc/HtiAdminAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/inc/HtiAdminAppUi.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,153 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AppUi class +* +*/ + + +#ifndef __HTIADMIN_APPUI_H__ +#define __HTIADMIN_APPUI_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CHtiAdminAppView; +class CHtiCfg; + +// CLASS DECLARATION + +/** +* An instance of class CHtiAdminAppUi is the UserInterface part of the AVKON +* application framework for the HtiAdmin application +*/ +class CHtiAdminAppUi : public CAknAppUi + { + public: + /** + * Perform the second phase construction of a CHtiAdminAppUi object. + * This needs to be public due to the way the framework constructs the AppUi + */ + void ConstructL(); + + /** + * Perform the first phase of two phase construction. + * This needs to be public due to the way the framework constructs the AppUi + */ + CHtiAdminAppUi(); + + + /** + * Destroy the object and release all memory objects. + */ + ~CHtiAdminAppUi(); + + /** + * Tries to find the HTIFramework.exe process and open a handle to it. + * @param aPrs on return contains an open handle to the HTIFramework.exe + * process if process found and opened successfully + * @return ETrue if process found and opened successfully, + * otherwise EFalse + */ + TBool OpenHtiProcess( RProcess& aPrs ); + + /** + * Updates the version text in the display. + */ + void UpdateVersion(); + + /** + * Updates the HTI Framework process status in the display. + */ + void UpdateStatusL(); + + /** + * Updates the HTI auto start status in the display. + */ + void UpdateAutoStartStatus(); + + /** + * Updates the selected communication in the display. + */ + void UpdateSelectedComm(); + + /** + * Kills the HtiWatchDog process if it is running. + */ + void KillHtiWatchDogL(); + + /** + * Stops the timer issuing the periodical HTI Framework process + * status checks. + */ + void KillTimer(); + + /** + * The method called by the periodic timer. + * @param aPtr pointer to this CHtiAdminAppUi instance + * @return zero if the callback function should not be called again, + * otherwise non-zero. Current implementation returns always ETrue. + */ + static TInt TimerCallBackL( TAny* aPtr ); + + public: // from CAknAppUi + /** + * Handle user menu selections + * @param aCommand the enumerated code for the option selected + */ + void HandleCommandL( TInt aCommand ); + + /** + * Updates the HTI Framework status information and starts the + * periodical status polling when application comes to foreground - + * stops the polling when going to background. + * @param aForeground ETrue if the application is in the foreground, + * otherwise EFalse + */ + void HandleForegroundEventL( TBool aForeground ); + + public: // from MEikMenuObserver + /** + * Used to initialize user menu content dynamically + * @param aResourceId the resource id of the menu pane being initialised + * @param aMenuPane the in-memory representation of the menu pane + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane ); + + private: + void ShowBTListQueryL(); + void ShowIPListQueryL(); + void ShowCommsListQueryL(); + void ShowCommsDBListQueryL(); + void HandleBtByAddress(); + void HandleBtByName(); + void HandleBtSearch(); + void HandleIPConnect(); + void HandleIPListen(); + + private: + + // The application view + CHtiAdminAppView* iAppView; + + // Timer triggering periodic checking of HTIFramework process status + CPeriodic* iPeriodic; + + // For reading and writing HTI configuration files + CHtiCfg* iHtiCfg; + }; + +#endif // __HTIADMIN_APPUI_H__ + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/inc/HtiAdminAppView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/inc/HtiAdminAppView.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,110 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: App view displays 2 labels. +* +*/ + + +#ifndef __HTIADMIN_APPVIEW_H__ +#define __HTIADMIN_APPVIEW_H__ + +// INCLUDES +#include + +// CONSTANTS +const static TInt KMaxDisplayText = 64; + +// CLASS DECLARATION +/** + An instance of the Application View object for the HtiAdmin + example application + */ +class CHtiAdminAppView : public CCoeControl + { +public: + +/** + Create a CHtiAdminAppView object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @return a pointer to the created instance of CHtiAdminAppView + */ + static CHtiAdminAppView* NewL(const TRect& aRect); + +/** + Create a CHtiAdminAppView object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @return a pointer to the created instance of CHtiAdminAppView + */ + static CHtiAdminAppView* NewLC(const TRect& aRect); + + +/** + Destroy the object and release all memory objects + */ + ~CHtiAdminAppView(); + + /** + Set text for the labels in the view. + */ + void SetCaption( const TDesC& aText ); + void SetStatus( const TDesC& aText ); + void SetVersionCaption( const TDesC& aText ); + void SetVersion( const TDesC& aText ); + void SetAutoStartCaption( const TDesC& aText ); + void SetAutoStartStatus( const TDesC& aText ); + void SetSelectedCommCaption( const TDesC& aText ); + void SetSelectedComm( const TDesC& aText ); + void SetCommDetails( const TDesC& aText ); + +public: // from CCoeControl +/** + Draw this CHtiAdminAppView to the screen + @param aRect the rectangle of this view that needs updating + */ + void Draw( const TRect& aRect ) const; + + +private: + +/** + Perform the second phase construction of a CHtiAdminAppView object + @param aRect the rectangle this view will be drawn to + */ + void ConstructL( const TRect& aRect ); + +/** + Perform the first phase of two phase construction + */ + CHtiAdminAppView(); + +private: + /** + text to show in the view + */ + HBufC* iHtiCaption; + HBufC* iHtiStatus; + HBufC* iHtiVersionCaption; + HBufC* iHtiVersion; + HBufC* iHtiAutoStartCaption; + HBufC* iHtiAutoStartStatus; + HBufC* iHtiSelectedCommCaption; + HBufC* iHtiSelectedComm; + HBufC* iHtiCommDetails; + }; + + +#endif // __HTIADMIN_APPVIEW_H__ + + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/inc/HtiAdminApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/inc/HtiAdminApplication.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 +* +*/ + + +#ifndef __HTIADMIN_APPLICATION_H__ +#define __HTIADMIN_APPLICATION_H__ + +// INCLUDES + +#include + +// CLASS DECLARATION +/** + An instance of CHtiAdminApplication is the application part of the AVKON + application framework for the HtiAdmin example application + */ +class CHtiAdminApplication : public CAknApplication + { +public: // from CAknApplication + +/** + Returns the application DLL UID value + @return the UID of this Application/Dll + */ + TUid AppDllUid() const; + +protected: // from CAknApplication +/** + Create a CApaDocument object and return a pointer to it + @return a pointer to the created document + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // __HTIADMIN_APPLICATION_H__ + + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/inc/HtiAdminDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/inc/HtiAdminDocument.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,87 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Document class +* +*/ + + +#ifndef __HTIADMIN_DOCUMENT_H__ +#define __HTIADMIN_DOCUMENT_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CHtiAdminAppUi; +class CEikApplication; + +// CLASS DECLARATION +/** + An instance of class CHtiAdminDocument is the Document part of the AVKON + application framework for the HtiAdmin example application + */ +class CHtiAdminDocument : public CAknDocument + { +public: + +/** + Construct a CHtiAdminDocument for the AVKON application aApp + using two phase construction, and return a pointer to the created object + + @param aApp application creating this document + @return a pointer to the created instance of CHtiAdminDocument + */ + static CHtiAdminDocument* NewL(CEikApplication& aApp); + +/** + Construct a CHtiAdminDocument for the AVKON application aApp + using two phase construction, and return a pointer to the created object + @param aApp application creating this document + + @return a pointer to the created instance of CHtiAdminDocument + */ + static CHtiAdminDocument* NewLC(CEikApplication& aApp); + +/** +Destroy the object and release all memory objects + */ + ~CHtiAdminDocument(); + +public: // from CAknDocument +/** + Create a CHtiAdminAppUi object and return a pointer to it + @return a pointer to the created instance of the AppUi created + */ + CEikAppUi* CreateAppUiL(); + +private: + +/** + Perform the second phase construction of a CHtiAdminDocument object + */ + void ConstructL(); + +/** + Perform the first phase of two phase construction + @param aApp application creating this document + */ + CHtiAdminDocument(CEikApplication& aApp); + + }; + + +#endif // __HTIADMIN_DOCUMENT_H__ + + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/src/HtiAdmin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/src/HtiAdmin.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 HtiAdmin main. +* +*/ + + +#include "HtiAdminApplication.h" +#include + + +LOCAL_C CApaApplication* NewApplication() + { + //HTI_LOG_TEXT("NewApplication"); + return new CHtiAdminApplication; + } + +GLDEF_C TInt E32Main() + { + //HTI_LOG_TEXT("E32Main"); + return EikStart::RunApplication(NewApplication); + } diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/src/HtiAdminAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/src/HtiAdminAppUi.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,1144 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AppUi implementation, all functions here +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include + +#include +#include // for KHTICommInterfaceUid +#include +#include + +#include "HtiAdmin.pan" +#include "HtiAdminAppUi.h" +#include "HtiAdminAppView.h" +#include "HtiAdmin.hrh" + + +#ifdef __ENABLE_LOGGING__ + +#include + +_LIT(KLogFolder, "hti"); +_LIT(KLogFile, "htiadmin.txt"); +#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);} +#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));} +#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));} + +#else // __ENABLE_LOGGING__ + +#define HTI_LOG_TEXT(a1) +#define HTI_LOG_FORMAT(a1,a2) +#define HTI_LOG_DES(a1) + +#endif // __ENABLE_LOGGING__ + +// CONSTANTS +_LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" ); +_LIT( KHtiFrameworkExe, "HtiFramework.exe" ); +_LIT( KHtiMatchPattern, "HtiFramework*" ); +_LIT( KHtiFrameworkCaption, "HTI status: " ); +_LIT( KHtiAutoStartCaption, "AutoStart: " ); +_LIT( KHtiVersionCaption, "Version: " ); +_LIT( KHtiSelectedCommCaption, "Communication: " ); +_LIT( KHtiAdminStartParameter, "admin" ); +_LIT( KHtiAdminVersionFormat, "%u.%u.%u (%uwk%02u)" ); +_LIT( KHtiAdminAboutVersionFormat, "Version %u.%u.%u - " ); +const static TInt KTerminateReason = 1; + + +const TInt32 KHTIImplUidSerial = {0x10210CCA}; +const TInt32 KHTIImplUidBluetooth = {0x200212CC}; +const TInt32 KHTIImplUidIPComm = {0x200212CE}; + +// configuration file constants +_LIT( KCfgFilePath, "\\"); +_LIT( KHtiCfg, "hti.cfg" ); +_LIT( KHtiBtCommCfg, "HTIBtComm.cfg" ); +_LIT( KHtiSerialCommCfg , "HTISerialComm.cfg" ); +_LIT( KHtiIPCommCfg, "HTIIPComm.cfg" ); +// hti.cfg +_LIT8( KCommPlugin, "CommPlugin" ); +_LIT8( KPriority, "Priority" ); +_LIT8( KShowConsole, "ShowConsole" ); +_LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" ); +_LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" ); +_LIT8( KShowErrorDialogs, "ShowErrorDialogs" ); +// HtiBtComm.cfg +_LIT8( KBtDeviceAddress, "BtDeviceAddress" ); +_LIT8( KBtDeviceName, "BtDeviceName" ); +// HtiSerialComm.cfg +_LIT8( KCommPortNumber, "CommPort" ); +// HTIIPComm.cfg +_LIT8( KLocalPort, "LocalPort" ); +_LIT8( KRemoteHost, "RemoteHost" ); +_LIT8( KRemotePort, "RemotePort" ); +_LIT8( KIAPName, "IAPName" ); + + +// ConstructL is called by the application framework +void CHtiAdminAppUi::ConstructL() + { + BaseConstructL( EAknEnableSkin ); + iAppView = CHtiAdminAppView::NewL( ClientRect() ); + AddToStackL( iAppView ); + + iAppView->SetCaption( KHtiFrameworkCaption ); + iAppView->SetVersionCaption( KHtiVersionCaption ); + iAppView->SetAutoStartCaption( KHtiAutoStartCaption ); + iAppView->SetSelectedCommCaption( KHtiSelectedCommCaption ); + UpdateVersion(); + UpdateStatusL(); + iHtiCfg = CHtiCfg::NewL(); + UpdateAutoStartStatus(); // uses iHtiCfg + UpdateSelectedComm(); // uses iHtiCfg + } + +CHtiAdminAppUi::CHtiAdminAppUi() + { + iHtiCfg = NULL; + } + +CHtiAdminAppUi::~CHtiAdminAppUi() + { + KillTimer(); + if ( iAppView ) + { + RemoveFromStack( iAppView ); + delete iAppView; + iAppView = NULL; + } + + if ( iHtiCfg ) + delete iHtiCfg; + } + +void CHtiAdminAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) + { + HTI_LOG_FORMAT( "DynInitMenuPaneL 0x%x", aResourceId ); + + if ( aResourceId == R_HTIADMIN_MENU ) + { + RProcess prs; + if ( OpenHtiProcess( prs ) ) + { + if ( prs.ExitType() == EExitPending ) + { + aMenuPane->SetItemDimmed( EHtiAdminStart, ETrue ); + aMenuPane->SetItemDimmed( EHtiAdminSubOptions, ETrue ); + prs.Close(); + return; + } + } + aMenuPane->SetItemDimmed( EHtiAdminStop, ETrue ); + prs.Close(); + } + + else if ( aResourceId == R_HTIADMIN_SUBMENU_OPTIONS ) + { +#if !defined(__ENABLE_LOGGING__) + aMenuPane->SetItemDimmed( EHtiAdminSubLogs, ETrue ); +#endif + } + else if ( aResourceId == R_HTIADMIN_SUBMENU_PRIORITY ) + { + TInt priority = 3; // default value + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TRAP( err, priority = iHtiCfg->GetParameterIntL( KPriority ) ); + } + + switch ( priority ) + { + case 1: + aMenuPane->SetItemButtonState( EHtiAdminPriorityBackground, EEikMenuItemSymbolOn ); + break; + case 2: + aMenuPane->SetItemButtonState( EHtiAdminPriorityForeground, EEikMenuItemSymbolOn ); + break; + case 4: + aMenuPane->SetItemButtonState( EHtiAdminPriorityAbsoluteHigh, EEikMenuItemSymbolOn ); + break; + default: + aMenuPane->SetItemButtonState( EHtiAdminPriorityHigh, EEikMenuItemSymbolOn ); + break; + } + } + + else if ( aResourceId == R_HTIADMIN_SUBMENU_AUTOSTART ) + { +#ifdef __WINS__ + TInt value = 0; // default value for emulator +#else + TInt value = 1; // default value for hardware +#endif + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TRAP( err, value = iHtiCfg->GetParameterIntL( KEnableHtiAutoStart ) ); + } + + if ( value ) + aMenuPane->SetItemButtonState( EHtiAdminAutoStartEnable, EEikMenuItemSymbolOn ); + else + aMenuPane->SetItemButtonState( EHtiAdminAutoStartDisable, EEikMenuItemSymbolOn ); + } + + else if ( aResourceId == R_HTIADMIN_SUBMENU_WATCHDOG ) + { + TInt value = 0; // default value + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TRAP( err, value = iHtiCfg->GetParameterIntL( KEnableHtiWatchDog ) ); + } + + if ( value ) + aMenuPane->SetItemButtonState( EHtiAdminWatchDogEnable, EEikMenuItemSymbolOn ); + else + aMenuPane->SetItemButtonState( EHtiAdminWatchDogDisable, EEikMenuItemSymbolOn ); + } + + else if ( aResourceId == R_HTIADMIN_SUBMENU_CONSOLE ) + { + TInt value = 0; // default value + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TRAP( err, value = iHtiCfg->GetParameterIntL( KShowConsole ) ); + } + + if ( value ) + aMenuPane->SetItemButtonState( EHtiAdminConsoleEnable, EEikMenuItemSymbolOn ); + else + aMenuPane->SetItemButtonState( EHtiAdminConsoleDisable, EEikMenuItemSymbolOn ); + } + + else if ( aResourceId == R_HTIADMIN_SUBMENU_ERROR_DIALOGS ) + { + TInt value = 1; // default value + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TRAP( err, value = iHtiCfg->GetParameterIntL( KShowErrorDialogs ) ); + } + + if ( value ) + aMenuPane->SetItemButtonState( EHtiAdminErrorDialogsEnable, EEikMenuItemSymbolOn ); + else + aMenuPane->SetItemButtonState( EHtiAdminErrorDialogsDisable, EEikMenuItemSymbolOn ); + } + } + + +// Helper function to get data from a dialog +TInt ShowDialog(TInt aResourceId, const TDesC &aText, TDes8 &aValue) + { + TBuf data; + + CAknTextQueryDialog* dlg; + dlg = new (ELeave) CAknTextQueryDialog(data); + CleanupStack::PushL(dlg); + dlg->SetPromptL(aText); + dlg->SetMaxLength(KMaxParameterValueLength); + CleanupStack::Pop(); // dlg + + if ( dlg->ExecuteLD( aResourceId ) ) + { + aValue.Copy(data); + return KErrNone; + } + + return KErrCancel; + } + +void CHtiAdminAppUi::ShowBTListQueryL() + { + TInt selectedOption( KErrNotFound ); + + CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(20); + CleanupStack::PushL(array); + + array->AppendL(_L("By BT address")); + array->AppendL(_L("By BT Name")); + array->AppendL(_L("Search when starting")); + + CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption ); + dlg->PrepareLC(R_QUERY_DIALOG); + dlg->SetItemTextArray(array); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + dlg->RunLD(); + + CleanupStack::PopAndDestroy(array); + + if(selectedOption == 0) + { + HandleBtByAddress(); + } + else if(selectedOption == 1) + { + HandleBtByName(); + } + else if (selectedOption == 2) + { + HandleBtSearch(); + } + } + +void CHtiAdminAppUi::ShowIPListQueryL() + { + TInt selectedOption( KErrNotFound ); + + CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(10); + CleanupStack::PushL(array); + + array->AppendL(_L("Listen")); + array->AppendL(_L("Connect")); + + CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption ); + dlg->PrepareLC(R_QUERY_DIALOG); + dlg->SetItemTextArray(array); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + dlg->RunLD(); + + CleanupStack::PopAndDestroy(array); + + if(selectedOption == 0) + { + HandleIPListen(); + } + else if(selectedOption == 1) + { + HandleIPConnect(); + } + } + +void CleanupRArray( TAny* object ) + { + ( ( RImplInfoPtrArray* ) object )->ResetAndDestroy(); + } + +void CHtiAdminAppUi::ShowCommsListQueryL() + { + TInt selectedOption( KErrNotFound ); + + const TInt pluginNameArrayGranularity (15); + CDesCArrayFlat* pluginNameArray = new (ELeave) CDesCArrayFlat(pluginNameArrayGranularity); + CleanupStack::PushL(pluginNameArray); + + RImplInfoPtrArray implInfoArray; + CleanupStack::PushL( TCleanupItem( CleanupRArray, &implInfoArray ) ); + + REComSession::ListImplementationsL( KHTICommInterfaceUid, implInfoArray ); + + for ( TInt i = 0; i < implInfoArray.Count(); ++i ) + { + pluginNameArray->AppendL(implInfoArray[i]->DisplayName()); + } + + CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption ); + + dlg->PrepareLC(R_QUERY_DIALOG); + dlg->SetHeaderTextL(_L("Select communication")); + dlg->SetItemTextArray(pluginNameArray); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + + if(dlg->RunLD()) + { + TInt32 uid = implInfoArray[selectedOption]->ImplementationUid().iUid; + switch(uid) + { + case KHTIImplUidSerial: + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, _L8( "SERIAL" ) ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + + TBuf8 portNum; + if ( !ShowDialog( R_NUMERIC_QUERY, _L("Com port number:"), portNum ) ) + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) ); + iHtiCfg->SetParameterL( KCommPortNumber, portNum ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiSerialCommCfg ); + } + UpdateSelectedComm(); + } + break; + + case KHTIImplUidBluetooth: + { + ShowBTListQueryL(); + } + break; + + case KHTIImplUidIPComm: + { + ShowIPListQueryL(); + } + break; + default: + { + //Just save the conf info for other plugins + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, implInfoArray[selectedOption]->DataType() ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + UpdateSelectedComm(); + } + } + } + CleanupStack::PopAndDestroy(2, pluginNameArray); + } + +void CHtiAdminAppUi::HandleBtByAddress() + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) ); + iHtiCfg->RemoveParameterL( KBtDeviceName ); + iHtiCfg->RemoveParameterL( KBtDeviceAddress ); + + TBuf8 address; + if ( !ShowDialog( R_TEXT_QUERY, _L("BT address:"), address) ) + { + iHtiCfg->SetParameterL( KBtDeviceAddress, address); + } + + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg); + UpdateSelectedComm(); + } + +void CHtiAdminAppUi::HandleBtByName() + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) ); + iHtiCfg->RemoveParameterL( KBtDeviceName ); + iHtiCfg->RemoveParameterL( KBtDeviceAddress ); + + TBuf8 name; + if ( !ShowDialog( R_TEXT_QUERY, _L( "BT name:" ), name ) ) + { + iHtiCfg->SetParameterL( KBtDeviceName, name ); + } + + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg ); + UpdateSelectedComm(); + } + +void CHtiAdminAppUi::HandleBtSearch() + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) ); + iHtiCfg->RemoveParameterL( KBtDeviceName ); + iHtiCfg->RemoveParameterL( KBtDeviceAddress ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg ); + UpdateSelectedComm(); + } + +void CHtiAdminAppUi::HandleIPListen() + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, _L8("IPCOMM")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) ); + iHtiCfg->RemoveParameterL( KRemotePort ); + iHtiCfg->RemoveParameterL( KRemoteHost ); + + TBuf8 localPort; + if ( !ShowDialog( R_TEXT_QUERY, _L( "Local port:" ), localPort ) ) + { + iHtiCfg->SetParameterL( KLocalPort, localPort ); + ShowCommsDBListQueryL(); + } + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg ); + UpdateSelectedComm(); + } + +void CHtiAdminAppUi::HandleIPConnect() + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KCommPlugin, _L8( "IPCOMM" ) ); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) ); + iHtiCfg->RemoveParameterL( KLocalPort ); + TBuf8 remoteHost; + TBuf8 remotePort; + if ( !ShowDialog( R_TEXT_QUERY, _L("Remote host:"), remoteHost ) ) + { + iHtiCfg->SetParameterL( KRemoteHost, remoteHost ); + if ( !ShowDialog( R_TEXT_QUERY, _L( "Remote port:" ), remotePort ) ) + { + iHtiCfg->SetParameterL( KRemotePort, remotePort ); + ShowCommsDBListQueryL(); + } + } + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg ); + UpdateSelectedComm(); + } + + +// handle any menu commands +void CHtiAdminAppUi::HandleCommandL(TInt aCommand) + { + TFileName cfgFile; + + switch ( aCommand ) + { + case EEikCmdExit: + case EAknSoftkeyExit: + Exit(); + break; + + case EHtiAdminStart: + { + HTI_LOG_TEXT( "Start" ); + RProcess prs; + TInt err; + TBool isRunning = EFalse; + if ( OpenHtiProcess( prs ) ) + { + if ( prs.ExitType() == EExitPending ) + { + isRunning = ETrue; + _LIT(KText, "Already running"); + iAppView->SetStatus( KText ); + } + prs.Close(); + } + + if ( !isRunning ) + { + HTI_LOG_TEXT( "create process" ); + err = prs.Create( KHtiFrameworkExe, KHtiAdminStartParameter ); + if ( err == KErrNone ) + { + prs.Resume(); + prs.Close(); + UpdateStatusL(); + HTI_LOG_TEXT("create done"); + } + else + { + TBuf<64> msg; + msg.Format( _L("Error in starting: %d"), err ); + iAppView->SetStatus( msg ); + HTI_LOG_TEXT("create error"); + } + } + } + break; + + case EHtiAdminStop: + { + HTI_LOG_TEXT("Stop"); + + // kill the watchdog to prevent it from restarting HTI again + KillHtiWatchDogL(); + + RProcess prs; + if ( OpenHtiProcess( prs ) ) + { + if ( prs.ExitType() == EExitPending ) + { + HTI_LOG_TEXT("try to kill"); + prs.Kill( KTerminateReason ); + UpdateStatusL(); + } + else + { + _LIT(KText, "Already stopped"); + iAppView->SetStatus( KText ); + } + prs.Close(); + } + } + break; + + case EHtiAdminAbout: + { + HTI_LOG_TEXT("About"); + TDateSuffix suffix( KHtiVersionDay - 1 ); + TMonthName month( ( TMonth ) ( KHtiVersionMonth - 1 ) ); + TBuf<64> msgPart1; + msgPart1.Format( KHtiAdminAboutVersionFormat, + KHtiVersionMajor, KHtiVersionMinor, KHtiVersionBuild ); + msgPart1.AppendNum( KHtiVersionDay ); + msgPart1.Append( suffix ); + msgPart1.Append( ' ' ); + msgPart1.Append( month ); + msgPart1.Append( ' ' ); + msgPart1.AppendNum( KHtiVersionYear ); + msgPart1.Append( '.' ); + msgPart1.Append( ' ' ); + HBufC* msgPart2 = iEikonEnv->AllocReadResourceLC( R_HTIADMIN_ABOUT_TEXT ); + HBufC* fullMsg = HBufC::NewLC( msgPart1.Length() + msgPart2->Length() ); + fullMsg->Des().Append( msgPart1 ); + fullMsg->Des().Append( *msgPart2 ); + CAknMessageQueryDialog* dialog = new ( ELeave ) CAknMessageQueryDialog; + dialog->PrepareLC( R_HTIADMIN_ABOUT_DIALOG ); + dialog->SetMessageTextL( *fullMsg ); + dialog->RunLD(); + CleanupStack::PopAndDestroy( 2 ); // fullMsg, msgPart2 + } + break; + + case EHtiAdminSubOptions: + break; + + case EHtiAdminSubLogs: + break; + + case EHtiAdminCreateLogFolder: +#ifdef __ENABLE_LOGGING__ + { + TInt err = KErrNone; + RFs fs; + err = fs.Connect(); + if ( err == KErrNone ) + { + err = fs.MkDirAll(_L("c:\\logs\\hti\\")); + } + fs.Close(); + } +#endif + break; + + case EHtiAdminRemoveLogFolder: +#ifdef __ENABLE_LOGGING__ + { + TInt err = KErrNone; + RFs fs; + err = fs.Connect(); + if ( err == KErrNone ) + { + CFileMan *fileman = CFileMan::NewL( fs ); + fileman->RmDir( _L( "c:\\logs\\hti\\" ) ); + delete fileman; + } + fs.Close(); + } +#endif + break; + + case EHtiAdminClearLogs: +#ifdef __ENABLE_LOGGING__ + { + TInt err = KErrNone; + RFs fs; + err = fs.Connect(); + if ( err == KErrNone ) + { + CFileMan *fileman = CFileMan::NewL( fs ); + fileman->Delete( _L( "c:\\logs\\hti\\*" ) ); + fileman->Delete( _L( "c:\\HTI_*.log" ) ); + delete fileman; + } + fs.Close(); + } +#endif + break; + + case EHtiAdminSubComms: + { + ShowCommsListQueryL(); + } + break; + + case EHtiAdminSubPriority: + break; + + case EHtiAdminPriorityBackground: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KPriority, _L8("1")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminPriorityForeground: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KPriority, _L8("2")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminPriorityHigh: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KPriority, _L8("3")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminPriorityAbsoluteHigh: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KPriority, _L8("4")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminSubAutoStart: + break; + + case EHtiAdminAutoStartEnable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("1")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + UpdateAutoStartStatus(); + break; + + case EHtiAdminAutoStartDisable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("0")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + UpdateAutoStartStatus(); + break; + + case EHtiAdminSubWatchDog: + break; + + case EHtiAdminWatchDogEnable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("1")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminWatchDogDisable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("0")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminSubConsole: + break; + + case EHtiAdminConsoleEnable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KShowConsole, _L8("1")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminConsoleDisable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KShowConsole, _L8("0")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminErrorDialogsEnable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("1")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminErrorDialogsDisable: + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("0")); + iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg ); + break; + + case EHtiAdminSubSetParam: + break; + + case EHtiAdminHtiCfg: + cfgFile = KHtiCfg; + + case EHtiAdminHtiBtCommCfg: + if ( !cfgFile.Length() ) + cfgFile = KHtiBtCommCfg; + + case EHtiAdminHtiIPCommCfg: + if ( !cfgFile.Length() ) + cfgFile = KHtiIPCommCfg; + + case EHtiAdminHtiSerialCommCfg: + { + if ( !cfgFile.Length() ) + cfgFile = KHtiSerialCommCfg; + + TBuf8 parameterName; + if ( !ShowDialog( R_TEXT_QUERY, _L("Parameter name:"), parameterName) ) + { + TBuf8 parameterValue; + if ( !ShowDialog( R_TEXT_QUERY, _L("Parameter value:"), parameterValue ) ) + { + TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, cfgFile ) ); + iHtiCfg->SetParameterL( parameterName, parameterValue ); + iHtiCfg->SaveCfgL( KCfgFilePath, cfgFile); + } + } + } + break; + + default: + { + CAknErrorNote* dialog = new(ELeave)CAknErrorNote(ETrue); + dialog->ExecuteLD(_L("Unknown Command Recieved")); + } + break; + } + } + +void CHtiAdminAppUi::HandleForegroundEventL( TBool aForeground ) + { + CAknAppUi::HandleForegroundEventL( aForeground ); + + if ( aForeground ) + { + UpdateStatusL(); + UpdateAutoStartStatus(); + } + else + { + KillTimer(); + } + } + +TBool CHtiAdminAppUi::OpenHtiProcess( RProcess& aPrs ) + { + HTI_LOG_TEXT( "OpenHtiProcess" ); + + TFullName processName; + TInt err; + + TFindProcess finder( KHtiMatchPattern ); + err = finder.Next( processName ); + if ( err == KErrNone ) + { + HTI_LOG_TEXT( "try to open..." ); + err = aPrs.Open( finder ); + HTI_LOG_TEXT( "opened" ); + + if ( err == KErrNone ) + { + HTI_LOG_TEXT( "OpenHtiProcess OK" ); + return ETrue; + } + else + { + HTI_LOG_TEXT( "Failed to open process" ); + TBuf<64> msg; + msg.Format( _L( "Error: %d" ), err ); + iAppView->SetStatus( msg ); + } + } + else if ( err == KErrNotFound ) + { + HTI_LOG_TEXT( "Not found" ); + _LIT( KNotFound, "Stopped" ); + iAppView->SetStatus( KNotFound ); + } + else + { + TBuf<64> msg; + msg.Format( _L( "Error: %d" ), err ); + iAppView->SetStatus( msg ); + } + + HTI_LOG_TEXT( "OpenHtiProcess NOK" ); + + return EFalse; + } + + +void CHtiAdminAppUi::UpdateVersion() + { + HTI_LOG_TEXT( "UpdateVersion" ); + TBuf<128> tmp; + tmp.Format( KHtiAdminVersionFormat, KHtiVersionMajor, KHtiVersionMinor, + KHtiVersionBuild, KHtiVersionYear, KHtiVersionWeek ); + iAppView->SetVersion( tmp ); + } + + +void CHtiAdminAppUi::UpdateStatusL() + { + HTI_LOG_TEXT( "UpdateStatusL" ); + RProcess prs; + if ( OpenHtiProcess( prs ) ) + { + HTI_LOG_TEXT( "Update display" ); + TExitType exT = prs.ExitType(); + + switch ( exT ) + { + case EExitPending: + { + _LIT( KTxt, "Running" ); + iAppView->SetStatus( KTxt ); + + // start timer to watch the status + if ( !iPeriodic ) + { + iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); + iPeriodic->Start( 5 * 1000 * 1000, + 5 * 1000 * 1000, + TCallBack( TimerCallBackL, this ) ); + } + } + break; + + case EExitKill: + case EExitTerminate: + { + _LIT( KTxt, "Stopped" ); + iAppView->SetStatus( KTxt ); + KillTimer(); + } + break; + + case EExitPanic: + { + _LIT( KTxt, "Panic" ); + iAppView->SetStatus( KTxt ); + KillTimer(); + } + break; + }; + prs.Close(); + } + else + { + KillTimer(); + } + } + +void CHtiAdminAppUi::UpdateAutoStartStatus() + { + HTI_LOG_TEXT( "UpdateAutoStartStatus" ); + TInt value = KErrNotFound; + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiAutoStart) ); + } + + if ( value == KErrNotFound ) + { + // Use default values if not found from config. +#ifdef __WINS__ + value = 0; +#else + value = 1; +#endif + } + + if ( value == 0 ) + { + _LIT( KTxt, "Disabled" ); + iAppView->SetAutoStartStatus( KTxt ); + } + else if ( value == 1 ) + { + _LIT( KTxt, "Enabled" ); + iAppView->SetAutoStartStatus( KTxt ); + } + else + { + _LIT( KTxt, "Unknown" ); + iAppView->SetAutoStartStatus( KTxt ); + } + } + +void CHtiAdminAppUi::UpdateSelectedComm() + { + HTI_LOG_TEXT( "UpdateSelectedComm" ); + TBuf<64> commPlugin; + TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) ); + if ( !err ) + { + TBuf8 commValue; + TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) ); + if ( err == KErrNone ) + { + commPlugin.Copy( commValue ); + } + } + // Use default if not found from config + if ( commPlugin.Length() == 0 ) + { + commPlugin.Copy(KCommDefaultImplementation ); + } + iAppView->SetSelectedComm( commPlugin ); + + if ( commPlugin.Compare( _L( "SERIAL" ) ) == 0 ) + { + TInt portNum = 0; + TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) ); + if ( err == KErrNone ) + { + TRAP( err, portNum = iHtiCfg->GetParameterIntL( KCommPortNumber ) ); + } + TBuf<16> portBuf; + portBuf.Copy( _L( "Port: " ) ); + portBuf.AppendNum( portNum ); + iAppView->SetCommDetails( portBuf ); + } + + else if ( commPlugin.Compare( _L( "BTSERIAL" ) ) == 0 ) + { + TBuf<64> hostBuf; + TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) ); + if ( err == KErrNone ) + { + TBuf8 hostValue; + TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceAddress ) ); + if ( err != KErrNone ) + { + TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceName ) ); + } + if ( err == KErrNone ) + { + hostBuf.Copy( hostValue ); + } + } + if ( hostBuf.Length() > 0 ) + { + hostBuf.Insert( 0, _L( "Host: " ) ); + } + iAppView->SetCommDetails( hostBuf ); + } + + else if ( commPlugin.Compare( _L( "IPCOMM" ) ) == 0 ) + { + TBuf<128> hostBuf; + TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) ); + if ( err == KErrNone ) + { + TInt localPort = 0; + TRAP( err, localPort = iHtiCfg->GetParameterIntL( KLocalPort ) ); + if ( err == KErrNone && localPort > 0 ) + { + hostBuf.Copy( _L( "Listen: " ) ); + hostBuf.AppendNum( localPort ); + } + else + { + TBuf8 remoteHost; + TInt remotePort = 0; + TRAP( err, remoteHost = iHtiCfg->GetParameterL( KRemoteHost ) ); + if ( err == KErrNone ) + { + TRAP( err, remotePort = iHtiCfg->GetParameterIntL( + KRemotePort ) ); + } + if ( err == KErrNone ) + { + hostBuf.Copy( remoteHost ); + hostBuf.Insert( 0, _L("Connect: " ) ); + hostBuf.Append( ':' ); + hostBuf.AppendNum( remotePort ); + } + else + { + hostBuf.Copy( _L( "Invalid config!" ) ); + } + } + } + iAppView->SetCommDetails( hostBuf ); + } + + else + { + iAppView->SetCommDetails( KNullDesC ); + } + } + +void CHtiAdminAppUi::KillHtiWatchDogL() + { + TFullName processName; + TFindProcess finder( KHtiWatchDogMatchPattern ); + TInt err = finder.Next( processName ); + if ( err == KErrNone ) + { + HTI_LOG_TEXT( "HTI watchdog process found. Trying to open and kill it..." ); + RProcess prs; + User::LeaveIfError( prs.Open( finder ) ); + prs.Kill( KTerminateReason ); + prs.Close(); + HTI_LOG_TEXT( "HTI watchdog killed" ); + } + } + +void CHtiAdminAppUi::KillTimer() + { + if ( iPeriodic ) + { + iPeriodic->Cancel(); + delete iPeriodic; + iPeriodic = NULL; + } + } + +TInt CHtiAdminAppUi::TimerCallBackL( TAny* aPtr ) + { + ( (CHtiAdminAppUi*)aPtr )->UpdateStatusL(); + return ETrue; + } + +void CHtiAdminAppUi::ShowCommsDBListQueryL() + { + TInt selectedOption( KErrNotFound ); + TBuf name; + + CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(16); + CleanupStack::PushL(array); + + // Get IAP names from the database + CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);; + CleanupStack::PushL(db); + db->ShowHiddenRecords(); + CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP)); + TInt res = view->GotoFirstRecord(); + + while(res == KErrNone) + { + view->ReadTextL(TPtrC(COMMDB_NAME), name); + array->InsertL(0, name); + res = view->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(view); //view + CleanupStack::PopAndDestroy(db); //db + + // Show IAP selection dialog + CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&selectedOption); + dlg->PrepareLC(R_SELECT_IAP_DIALOG); + dlg->SetItemTextArray(array); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + dlg->RunLD(); + + if(selectedOption != KErrNotFound) + { + // Write selected IAP name to config file + name = array->MdcaPoint(selectedOption); + TBuf8 iapName; + iapName.Copy(name); + iHtiCfg->SetParameterL(KIAPName, iapName); + } + CleanupStack::PopAndDestroy(array); + } +// End of file diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/src/HtiAdminAppView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/src/HtiAdminAppView.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,184 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AppView implementation, only displays two labels changed +* from CHtiAdminAppUi class +* +*/ + + +#include +#include +#include + +#include "HtiAdminAppView.h" +#include "HtiAdminApplication.h" //logging + +// Standard construction sequence +CHtiAdminAppView* CHtiAdminAppView::NewL(const TRect& aRect) + { + CHtiAdminAppView* self = CHtiAdminAppView::NewLC(aRect); + CleanupStack::Pop(self); + return self; + } + +CHtiAdminAppView* CHtiAdminAppView::NewLC(const TRect& aRect) + { + CHtiAdminAppView* self = new (ELeave) CHtiAdminAppView; + CleanupStack::PushL(self); + self->ConstructL(aRect); + return self; + } + +CHtiAdminAppView::CHtiAdminAppView() + { + // no implementation required + } + +CHtiAdminAppView::~CHtiAdminAppView() + { + delete iHtiCaption; + delete iHtiStatus; + delete iHtiVersionCaption; + delete iHtiVersion; + delete iHtiAutoStartCaption; + delete iHtiAutoStartStatus; + delete iHtiSelectedCommCaption; + delete iHtiSelectedComm; + delete iHtiCommDetails; + } + +void CHtiAdminAppView::ConstructL(const TRect& aRect) + { + //HTI_LOG_TEXT("CHtiAdminAppView::ConstructL"); + + iHtiCaption = HBufC::NewL( KMaxDisplayText ); + iHtiStatus = HBufC::NewL( KMaxDisplayText ); + iHtiVersionCaption = HBufC::NewL( KMaxDisplayText ); + iHtiVersion = HBufC::NewL( KMaxDisplayText ); + iHtiAutoStartCaption = HBufC::NewL( KMaxDisplayText ); + iHtiAutoStartStatus = HBufC::NewL( KMaxDisplayText ); + iHtiSelectedCommCaption = HBufC::NewL( KMaxDisplayText ); + iHtiSelectedComm = HBufC::NewL( KMaxDisplayText ); + iHtiCommDetails = HBufC::NewL( KMaxDisplayText ); + + // Create a window for this application view + CreateWindowL(); + + // Set the windows size + SetRect(aRect); + + // Activate the window, which makes it ready to be drawn + ActivateL(); + } + +// Draw this application's view to the screen +void CHtiAdminAppView::Draw(const TRect& /*aRect*/) const + { + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + + // Gets the control's extent + TRect rect = Rect(); + + // Clears the screen + gc.Clear(rect); + + //draw text + const CFont* f = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); + gc.UseFont( f ); + + TInt leftMargin = f->MaxNormalCharWidthInPixels() / 4; + + TPoint dP( leftMargin, f->FontLineGap() ); + gc.DrawText( *iHtiCaption, dP ); + dP.iX += f->TextWidthInPixels( *iHtiCaption ); + gc.DrawText( *iHtiStatus, dP ); + + dP.iX = leftMargin; + dP.iY += f->FontLineGap() * 1.5; + gc.DrawText( *iHtiVersionCaption, dP ); + dP.iX += f->TextWidthInPixels( *iHtiVersionCaption ); + gc.DrawText( *iHtiVersion, dP ); + + dP.iX = leftMargin; + dP.iY += f->FontLineGap() * 1.5; + gc.DrawText( *iHtiAutoStartCaption, dP ); + dP.iX += f->TextWidthInPixels( *iHtiAutoStartCaption ); + gc.DrawText( *iHtiAutoStartStatus, dP ); + + dP.iX = leftMargin; + dP.iY += f->FontLineGap() * 1.5; + gc.DrawText( *iHtiSelectedCommCaption, dP ); + dP.iX += f->TextWidthInPixels( *iHtiSelectedCommCaption ); + gc.DrawText( *iHtiSelectedComm, dP ); + dP.iX = leftMargin; + dP.iY += f->FontLineGap(); + gc.DrawText( *iHtiCommDetails, dP ); + } + +void CHtiAdminAppView::SetCaption( const TDesC& aText ) + { + iHtiCaption->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetStatus( const TDesC& aText ) + { + iHtiStatus->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetVersionCaption( const TDesC& aText ) + { + iHtiVersionCaption->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetVersion( const TDesC& aText ) + { + iHtiVersion->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetAutoStartCaption( const TDesC& aText ) + { + iHtiAutoStartCaption->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetAutoStartStatus( const TDesC& aText ) + { + iHtiAutoStartStatus->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetSelectedCommCaption( const TDesC& aText ) + { + iHtiSelectedCommCaption->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetSelectedComm( const TDesC& aText ) + { + iHtiSelectedComm->Des().Copy( aText ); + DrawDeferred(); + } + +void CHtiAdminAppView::SetCommDetails( const TDesC& aText ) + { + iHtiCommDetails->Des().Copy( aText ); + DrawDeferred(); + } + +// End of file diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/src/HtiAdminApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/src/HtiAdminApplication.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,38 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 implemetation +* +*/ + + +#include "HtiAdminDocument.h" +#include "HtiAdminApplication.h" + +// UID for the application, this should correspond to the uid defined in the mmp file +static const TUid KUidHtiAdminApp = {0x1020DEB5}; + +CApaDocument* CHtiAdminApplication::CreateDocumentL() + { + //HTI_LOG_TEXT("CreateDocumentL"); + // Create an HtiAdmin document, and return a pointer to it + CApaDocument* document = CHtiAdminDocument::NewL(*this); + return document; + } + +TUid CHtiAdminApplication::AppDllUid() const + { + // Return the UID for the HtiAdmin application + return KUidHtiAdminApp; + } + diff -r 000000000000 -r d6fe6244b863 htiui/HtiAdmin/src/HtiAdminDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiAdmin/src/HtiAdminDocument.cpp Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,60 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AppDoc implemetation +* +*/ + + +#include "HtiAdminAppUi.h" +#include "HtiAdminDocument.h" + +// Standard Symbian OS construction sequence +CHtiAdminDocument* CHtiAdminDocument::NewL(CEikApplication& aApp) + { + CHtiAdminDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; + } + +CHtiAdminDocument* CHtiAdminDocument::NewLC(CEikApplication& aApp) + { + CHtiAdminDocument* self = new (ELeave) CHtiAdminDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CHtiAdminDocument::ConstructL() + { + // no implementation required + } + +CHtiAdminDocument::CHtiAdminDocument(CEikApplication& aApp) : CAknDocument(aApp) + { + // no implementation required + } + +CHtiAdminDocument::~CHtiAdminDocument() + { + // no implementation required + } + +CEikAppUi* CHtiAdminDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it, + // the framework takes ownership of this object + CEikAppUi* appUi = new (ELeave) CHtiAdminAppUi; + return appUi; + } + diff -r 000000000000 -r d6fe6244b863 htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommInterfaceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommInterfaceu.def Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,13 @@ +EXPORTS + ??0RHtiBtCommInterface@@QAE@XZ @ 1 NONAME ; RHtiBtCommInterface::RHtiBtCommInterface(void) + ?CancelReceive@RHtiBtCommInterface@@QAEXXZ @ 2 NONAME ; void RHtiBtCommInterface::CancelReceive(void) + ?CancelSend@RHtiBtCommInterface@@QAEXXZ @ 3 NONAME ; void RHtiBtCommInterface::CancelSend(void) + ?Close@RHtiBtCommInterface@@QAEXXZ @ 4 NONAME ; void RHtiBtCommInterface::Close(void) + ?Connect@RHtiBtCommInterface@@QAEHAAVTDesC8@@H@Z @ 5 NONAME ; int RHtiBtCommInterface::Connect(class TDesC8 &, int) + ?GetPortNumber@RHtiBtCommInterface@@QBEHXZ @ 6 NONAME ; int RHtiBtCommInterface::GetPortNumber(void) const + ?GetReceiveBufferSize@RHtiBtCommInterface@@QBEHXZ @ 7 NONAME ; int RHtiBtCommInterface::GetReceiveBufferSize(void) const + ?GetSendBufferSize@RHtiBtCommInterface@@QBEHXZ @ 8 NONAME ; int RHtiBtCommInterface::GetSendBufferSize(void) const + ?Receive@RHtiBtCommInterface@@QAEXAAVTDes8@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RHtiBtCommInterface::Receive(class TDes8 &, class TRequestStatus &) + ?Send@RHtiBtCommInterface@@QAEXABVTDesC8@@AAVTRequestStatus@@@Z @ 10 NONAME ; void RHtiBtCommInterface::Send(class TDesC8 const &, class TRequestStatus &) + ?Version@RHtiBtCommInterface@@QBE?AVTVersion@@XZ @ 11 NONAME ; class TVersion RHtiBtCommInterface::Version(void) const + diff -r 000000000000 -r d6fe6244b863 htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommServeru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommServeru.def Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?StartThread@@YAHXZ @ 1 NONAME ; int StartThread(void) + diff -r 000000000000 -r d6fe6244b863 htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtSerialComHelperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtSerialComHelperu.def Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,16 @@ +EXPORTS + ??1CBtSerialClient@@UAE@XZ @ 1 NONAME ; CBtSerialClient::~CBtSerialClient(void) + ?ConnectL@CBtSerialClient@@QAEXABVTDesC16@@H@Z @ 2 NONAME ; void CBtSerialClient::ConnectL(class TDesC16 const &, int) + ?ConnectL@CBtSerialClient@@QAEXVTBTDevAddr@@H@Z @ 3 NONAME ; void CBtSerialClient::ConnectL(class TBTDevAddr, int) + ?ConnectL@CBtSerialClient@@QAEXXZ @ 4 NONAME ; void CBtSerialClient::ConnectL(void) + ?Connected@CBtSerialClient@@QAEHXZ @ 5 NONAME ; int CBtSerialClient::Connected(void) + ?Connecting@CBtSerialClient@@QAEHXZ @ 6 NONAME ; int CBtSerialClient::Connecting(void) + ?Disconnect@CBtSerialClient@@QAEXXZ @ 7 NONAME ; void CBtSerialClient::Disconnect(void) + ?FreeSpaceInSendBuffer@CBtSerialClient@@QAEHXZ @ 8 NONAME ; int CBtSerialClient::FreeSpaceInSendBuffer(void) + ?NewL@CBtSerialClient@@SAPAV1@AAVMBtSerialClientObserver@@@Z @ 9 NONAME ; class CBtSerialClient * CBtSerialClient::NewL(class MBtSerialClientObserver &) + ?ReadAsyncL@CBtSerialClient@@QAEXXZ @ 10 NONAME ; void CBtSerialClient::ReadAsyncL(void) + ?SendBufferMaxSize@CBtSerialClient@@QAEHXZ @ 11 NONAME ; int CBtSerialClient::SendBufferMaxSize(void) + ?SendL@CBtSerialClient@@QAEXABVTDesC8@@@Z @ 12 NONAME ; void CBtSerialClient::SendL(class TDesC8 const &) + ?ServerAddressL@CBtSerialClient@@QAE?AVTBTDevAddr@@XZ @ 13 NONAME ; class TBTDevAddr CBtSerialClient::ServerAddressL(void) + ?ServicePort@CBtSerialClient@@QAEHXZ @ 14 NONAME ; int CBtSerialClient::ServicePort(void) + diff -r 000000000000 -r d6fe6244b863 htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialClient.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,255 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bluetooth serial client. +* +*/ + + +#ifndef __BTSERIALCLIENT_H__ +#define __BTSERIALCLIENT_H__ + +// INCLUDES +#include +#include +#include +#include +#include + +#include "SocketObserver.h" + +// FORWARD DECLARATIONS +class CMessageServiceSearcher; +class CSocketsReader; +class CSocketsWriter; + + +class MBtSerialClientObserver + { +public: + virtual void ConnectedToServer(TInt aError) = 0; + virtual void DisconnectedFromServer() = 0; + virtual void DataFromServer(const TDesC8& aData) = 0; + virtual void AllBufferedDataSent() = 0; + }; + +/** +* CBtSerialClient +* Connects and sends messages to a remote machine using bluetooth +*/ +class CBtSerialClient : public CActive, public MSocketObserver + { + public: // Constructors and destructor + + /** + * NewL() + * Construct a CBtSerialClient + * @param aObserver the observer for this BT serial client + * @return a pointer to the created instance of CBtSerialClient + */ + IMPORT_C static CBtSerialClient* NewL( MBtSerialClientObserver& aObserver ); + + /** + * ~CBtSerialClient() + * Destroy the object and release all memory objects. + * Close any open sockets. + */ + IMPORT_C virtual ~CBtSerialClient(); + + public: // New functions + + /** + * ConnectL() + * Connect to remote device. Query user for a device. + */ + IMPORT_C void ConnectL(); + + /** + * ConnectL() + * Connect to remote device. + */ + IMPORT_C void ConnectL(const TBTDevAddr aBTServerDevice, const TInt aPort ); + + /** + * ConnectL() + * Connect to remote device by device name. + */ + IMPORT_C void ConnectL( const TDesC& aBTServerDeviceName, const TInt aPort ); + + /** + * DisconnectL() + * Disconnect from remote machine + */ + IMPORT_C void Disconnect(); + + /** + * IsConnecting() + * @return ETrue if the client is establishing a + * connection to the server. + */ + IMPORT_C TBool Connecting(); + + /** + * Connected() + * @return ETrue if the client is fully connected to the server. + */ + IMPORT_C TBool Connected(); + + /** + * ServerAddressL() + * @return address of connected server. Leaves with KErrNotReady, if + * not connected. + */ + TBTDevAddr ServerAddressL(); + + /** + * Add data to outgoing buffer and start sending it to client. + * + * Leaves with KErrOverflow, if the outgoing buffer cannot + * be added all of the aData. + * Leaves with KErrNotReady, if client is not connected. + * When all data in internal buffer has been sent, observer + * is notified (AllBufferedDataSent) + */ + IMPORT_C void SendL(const TDesC8& aData); + + /** + * Issue read operation. Will complete asyncronously. + * + * Leaves with KErrNotReady, if client is not connected. + * Notifies observer, when some data has been read. Caller + * is responsible for calling this method again to receive + * more data. + */ + IMPORT_C void ReadAsyncL(); + + /** + * Query free size of outgoing buffer. + */ + IMPORT_C TInt FreeSpaceInSendBuffer(); + + /** + * Query max size of outgoing buffer. + */ + IMPORT_C TInt SendBufferMaxSize(); + + /** + * Query the port of the service we are connected with + * @return Port number or KErrDisconnected if not connected to a service + */ + IMPORT_C TInt ServicePort(); + + protected: // from CActive + + /** + * DoCancel() + * Cancel any outstanding requests + */ + void DoCancel(); + + /** + * RunL() + * Respond to an event + */ + void RunL(); + + protected: // from MSocketObserver + + void ReportError( TErrorType aErrorType, TInt aErrorCode ); + void NewData( const TDesC8& aData ); + void AllBufferedDataSent(); + + private: + + /** + * ConnectToServerL + * Connects to the service + */ + void ConnectToServerL(); + + /** + * DisconnectFromServer() + * Disconnects from the service + */ + void DisconnectFromServer(); + + /** + * CBtSerialClient() + * Constructs this object + */ + CBtSerialClient( MBtSerialClientObserver& aObserver ); + + /** + * ConstructL() + * Performs second phase construction of this object + */ + void ConstructL(); + + private: // data + + /** + * TState + * The state of the active object, determines behaviour within + * the RunL method. + * EWaitingToGetDevice waiting for the user to select a device + * EGettingDevice searching for a device + * EGettingService searching for a service + * EGettingConnection connecting to a service on a remote machine + * EConnected connected to a service on a remote machine + */ + enum TState + { + EWaitingToGetDevice, // phase 1 of Connect + EGettingDevice, // phase 2 of Connect + EGettingService, // phase 3 of Connect + EGettingConnection, // phase 4 of Connect + EConnected, // sending and receiving data + EDisconnecting + }; + + MBtSerialClientObserver& iObserver; + + /** iState the current state of the client */ + TState iState; + + /** + * iServiceSearcher searches for service this + * client can connect to. + * Owned by CBtSerialClient + */ + CMessageServiceSearcher* iServiceSearcher; + + /** + * iCurrentServiceIndex the index number of the service we are + * currently connecting/connected to + */ + TInt iCurrentServiceIndex; + + /** iSocketServer a connection to the socket server */ + RSocketServ iSocketServer; + + /** iSocket a socket to connect with */ + RSocket iSocket; + + /** iServiceClass the service class UUID to search for */ + TUUID iServiceClass; + + TBTDevAddr iBTServerDevice; + + CSocketsReader* iSocketReader; + CSocketsWriter* iSocketWriter; + }; + +#endif // __BTSERIALCLIENT_H__ + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialEngine.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialEngine.pan Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,60 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Bluetooth serial engine panic codes. +* +*/ + + +#ifndef __BTSERIALENGINE_PAN__ +#define __BTSERIALENGINE_PAN__ + +#include +#include + +/** Panic Categories */ +_LIT( KPanicSerialEngine, "BTSerialEngine" ); // All engine classes +_LIT( KPanicBTServiceAdvertiser, "BTServiceAdvertiser" ); // only service advertiser + + +enum TBTSerialEnginePanics + { + EBTPointToPointReceiverInvalidState = 1, + EBTPointToPointSenderExists = 2, + EBTPointToPointReceiverExists = 3, + EBTPointToPointSenderInvalidState = 4, + EBTPointToPointNoSender = 5, + EBTPointToPointAddMessage = 6, + EBTPointToPointNextRecordRequestComplete = 7, + EBTPointToPointAttributeRequestResult = 8, + EBTPointToPointAttributeRequestComplete = 9, + EBTPointToPointProtocolRead = 10, + EBTPointToPointAttributeRequest = 11, + EBTPointToPointSdpRecordDelete = 12, + EBTPointToPointServerStop = 13, + EBTPointToPointInvalidLogicState = 14, + EBTPointToPointUnableToDisconnect = 15, + + EBTSerialEngineReadSocketBadState = 16, + EBTSerialEngineWriteSocketBadState = 17 + }; + +inline void Panic( TBTSerialEnginePanics aReason ) + { + User::Panic( KPanicSerialEngine, aReason ); + } + + +#endif // __BTSERIALENGINE_PAN__ + +// End of File diff -r 000000000000 -r d6fe6244b863 htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/HtiBtEngineLogging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/HtiBtEngineLogging.h Tue Feb 02 00:17:27 2010 +0200 @@ -0,0 +1,92 @@ +/* +* 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 "Eclipse Public License v1.0" +* which accompanies 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 for Bluetooth engine. +* +*/ + + +#ifndef __HTIBTENGINELOGGING_H__ +#define __HTIBTENGINELOGGING_H__ + +// INCLUDES +#include + +/******************************************************/ +/** LOG SETUP **/ +/******************************************************/ +_LIT(KLogFolder, "Hti"); +_LIT(KLogFile, "BtSerialEngine.log"); + +#ifdef __ENABLE_LOGGING__ +// Comment out the levels which are marked supported in the build +// (and which are used runtime). +// +#define LOG_LEVEL_ERROR_SUPPORTED +#define LOG_LEVEL_WARN_SUPPORTED +#define LOG_LEVEL_INFO_SUPPORTED +//#define LOG_LEVEL_DEBUG_SUPPORTED +#endif + +/******************************************************/ +/** MACRO DEFINITIONS **/ +/******************************************************/ + +// Macros: Example: Result: +// LOGFMT_E(formatstring, parameter) LOGFMT_E("Leave in RunL: %d", -6)